From e4a45908b5aed9b4000cee078ed224c06cf33bca Mon Sep 17 00:00:00 2001 From: Arindam Bose Date: Mon, 9 Dec 2019 14:33:42 -0800 Subject: [PATCH 1/3] Remove `stringContainsRTLText` dependency from within style-spec. (#9088) (cherry picked from commit 2e53e7c5ef8654f4ab7162c25103abece00919dc) --- src/data/bucket/symbol_bucket.js | 13 +++++++++++-- src/style-spec/expression/types/formatted.js | 11 ----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/data/bucket/symbol_bucket.js b/src/data/bucket/symbol_bucket.js index 2369e6029c5..1a64a3706b3 100644 --- a/src/data/bucket/symbol_bucket.js +++ b/src/data/bucket/symbol_bucket.js @@ -25,7 +25,7 @@ import {ProgramConfigurationSet} from '../program_configuration'; import {TriangleIndexArray, LineIndexArray} from '../index_array_type'; import transformText from '../../symbol/transform_text'; import mergeLines from '../../symbol/mergelines'; -import {allowsVerticalWritingMode} from '../../util/script_detection'; +import {allowsVerticalWritingMode, stringContainsRTLText} from '../../util/script_detection'; import {WritingMode} from '../../symbol/shaping'; import loadGeometry from '../load_geometry'; import mvt from '@mapbox/vector-tile'; @@ -131,6 +131,15 @@ function addDynamicAttributes(dynamicLayoutVertexArray: StructArray, p: Point, a dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle); } +function containsRTLText(formattedText: Formatted): boolean { + for (const section of formattedText.sections) { + if (stringContainsRTLText(section.text)) { + return true; + } + } + return false; +} + export class SymbolBuffers { layoutVertexArray: SymbolLayoutArray; layoutVertexBuffer: VertexBuffer; @@ -423,7 +432,7 @@ class SymbolBucket implements Bucket { // conversion here. const resolvedTokens = layer.getValueAndResolveTokens('text-field', feature, availableImages); const formattedText = Formatted.factory(resolvedTokens); - if (formattedText.containsRTLText()) { + if (containsRTLText(formattedText)) { this.hasRTLText = true; } if ( diff --git a/src/style-spec/expression/types/formatted.js b/src/style-spec/expression/types/formatted.js index 726242ea30f..378a0a2bd5d 100644 --- a/src/style-spec/expression/types/formatted.js +++ b/src/style-spec/expression/types/formatted.js @@ -1,6 +1,4 @@ // @flow - -import {stringContainsRTLText} from "../../../util/script_detection"; import type Color from '../../util/color'; import type ResolvedImage from '../types/resolved_image'; @@ -50,15 +48,6 @@ export default class Formatted { return this.sections.map(section => section.text).join(''); } - containsRTLText(): boolean { - for (const section of this.sections) { - if (stringContainsRTLText(section.text)) { - return true; - } - } - return false; - } - serialize(): Array { const serialized: Array = ["format"]; for (const section of this.sections) { From c69a420915e5638082961be5078d63c4cdf86b47 Mon Sep 17 00:00:00 2001 From: Arindam Bose Date: Mon, 9 Dec 2019 14:51:07 -0800 Subject: [PATCH 2/3] Bump version of style-spec package to 13.10.1 --- src/style-spec/CHANGELOG.md | 5 +++++ src/style-spec/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/style-spec/CHANGELOG.md b/src/style-spec/CHANGELOG.md index 2bb7d464b32..dfc3b96574e 100644 --- a/src/style-spec/CHANGELOG.md +++ b/src/style-spec/CHANGELOG.md @@ -1,3 +1,8 @@ +## 13.10.1 + +### 🐛 Bug fixes +* Fix import of `script_detection` module, which was external to style-spec package and a part of gl-js. + ## 13.10.0 ### ✨ Features and improvements diff --git a/src/style-spec/package.json b/src/style-spec/package.json index 844cf4748b3..7c15772e95d 100644 --- a/src/style-spec/package.json +++ b/src/style-spec/package.json @@ -1,7 +1,7 @@ { "name": "@mapbox/mapbox-gl-style-spec", "description": "a specification for mapbox gl styles", - "version": "13.10.0", + "version": "13.10.1", "author": "Mapbox", "keywords": [ "mapbox", From 30f54757fb41d6ec8ebd8cc22bcea9010c3f1d43 Mon Sep 17 00:00:00 2001 From: Arindam Bose Date: Mon, 9 Dec 2019 15:20:06 -0800 Subject: [PATCH 3/3] Update CHANGELOG text --- src/style-spec/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/style-spec/CHANGELOG.md b/src/style-spec/CHANGELOG.md index dfc3b96574e..b70a30c45c1 100644 --- a/src/style-spec/CHANGELOG.md +++ b/src/style-spec/CHANGELOG.md @@ -1,7 +1,7 @@ ## 13.10.1 ### 🐛 Bug fixes -* Fix import of `script_detection` module, which was external to style-spec package and a part of gl-js. +* Fix an incorrect import of the `script_detection` module which breaks projects that rely on importing submodules directly. ## 13.10.0