@pairdraw/core 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/outline-stroke.d.ts.map +1 -1
- package/dist/canvas/outline-stroke.js.map +1 -1
- package/dist/canvas/overlays/prototype.d.ts +2 -5
- package/dist/canvas/overlays/prototype.d.ts.map +1 -1
- package/dist/canvas/overlays/prototype.js +3 -19
- package/dist/canvas/overlays/prototype.js.map +1 -1
- package/dist/canvas/renderer/fonts.js +2 -1
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer.d.ts +4 -0
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +4 -0
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +61 -37
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts +4 -3
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +8 -7
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.js +2 -2
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/placed.js +2 -2
- package/dist/canvas/text/placed.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -0
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/create.d.ts +1 -1
- package/dist/figma-api/index.d.ts +43 -8
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +48 -6
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/serialization.js +10 -0
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/geometry/connectors.js +2 -14
- package/dist/geometry/connectors.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/scene.d.ts +3 -1
- package/dist/geometry/scene.d.ts.map +1 -1
- package/dist/geometry/scene.js +16 -1
- package/dist/geometry/scene.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -1
- package/dist/geometry/types.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +10 -0
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +32 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/shapes.d.ts +10 -5
- package/dist/io/formats/drawio/shapes.d.ts.map +1 -1
- package/dist/io/formats/drawio/shapes.js +10 -6
- package/dist/io/formats/drawio/shapes.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +11 -0
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -0
- package/dist/io/formats/drawio/warnings.js +23 -0
- package/dist/io/formats/drawio/warnings.js.map +1 -0
- package/dist/io/formats/pdf/dom.d.ts +10 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +31 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +3 -2
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +2 -2
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +2 -2
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +3 -1
- package/dist/io/formats.js.map +1 -1
- package/dist/io/registry.d.ts +2 -0
- package/dist/io/registry.d.ts.map +1 -1
- package/dist/io/registry.js +5 -0
- package/dist/io/registry.js.map +1 -1
- package/dist/io/types.d.ts +2 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +1 -0
- package/dist/library/snapshot.js.map +1 -1
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +11 -2
- package/dist/lint/linter.js.map +1 -1
- package/dist/rpc/variables-command.d.ts.map +1 -1
- package/dist/rpc/variables-command.js +4 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +6 -3
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/fallbacks.d.ts +8 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +73 -7
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/manager.d.ts +14 -6
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +40 -14
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +2 -2
- package/dist/text/outlines.js +1 -1
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/path/caret.d.ts +2 -4
- package/dist/text/path/caret.d.ts.map +1 -1
- package/dist/text/path/caret.js.map +1 -1
- package/dist/text/prepare.d.ts +5 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +19 -2
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/web-font/assets.d.ts.map +1 -1
- package/dist/text/web-font/assets.js +13 -21
- package/dist/text/web-font/assets.js.map +1 -1
- package/dist/text/web-font/resolver.d.ts.map +1 -1
- package/dist/text/web-font/resolver.js +4 -1
- package/dist/text/web-font/resolver.js.map +1 -1
- package/dist/tools/create/components.d.ts +2 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +27 -1
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +11 -5
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +9 -6
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/create.d.ts +2 -2
- package/dist/tools/create.js +2 -2
- package/dist/tools/modify/effects.d.ts.map +1 -1
- package/dist/tools/modify/effects.js +5 -3
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +9 -6
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +7 -5
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +28 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +16 -4
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +2 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +24 -5
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +80 -6
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +4 -3
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -2
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/export.d.ts.map +1 -1
- package/dist/tools/vector/export.js +5 -2
- package/dist/tools/vector/export.js.map +1 -1
- package/package.json +9 -9
- package/src/canvas/outline-stroke.ts +2 -6
- package/src/canvas/overlays/prototype.ts +5 -27
- package/src/canvas/renderer/fonts.ts +2 -1
- package/src/canvas/renderer.ts +4 -0
- package/src/canvas/scene.ts +92 -63
- package/src/canvas/text/font-families.ts +8 -7
- package/src/canvas/text/index.ts +3 -1
- package/src/canvas/text/paragraph/index.ts +2 -2
- package/src/canvas/text/placed.ts +2 -2
- package/src/canvas/text/renderer.ts +2 -0
- package/src/figma-api/index.ts +90 -9
- package/src/figma-api/serialization.ts +14 -0
- package/src/geometry/connectors.ts +2 -12
- package/src/geometry/index.ts +1 -1
- package/src/geometry/scene.ts +19 -0
- package/src/geometry/types.ts +8 -0
- package/src/io/formats/drawio/export.ts +11 -0
- package/src/io/formats/drawio/index.ts +36 -1
- package/src/io/formats/drawio/shapes.ts +13 -9
- package/src/io/formats/drawio/warnings.ts +27 -0
- package/src/io/formats/pdf/dom.ts +29 -0
- package/src/io/formats/pdf/export.ts +3 -2
- package/src/io/formats/raster/headless.ts +10 -3
- package/src/io/formats/raster/render.ts +4 -2
- package/src/io/formats.ts +3 -1
- package/src/io/registry.ts +12 -0
- package/src/io/types.ts +2 -0
- package/src/library/snapshot.ts +1 -0
- package/src/lint/linter.ts +12 -2
- package/src/rpc/variables-command.ts +6 -5
- package/src/text/coverage.ts +17 -2
- package/src/text/fallbacks.ts +81 -7
- package/src/text/font/manager.ts +50 -17
- package/src/text/outlines.ts +1 -1
- package/src/text/path/caret.ts +3 -4
- package/src/text/prepare.ts +34 -2
- package/src/text/web-font/assets.ts +11 -15
- package/src/text/web-font/resolver.ts +7 -1
- package/src/tools/create/components.ts +33 -0
- package/src/tools/create/icons.ts +13 -5
- package/src/tools/create/vector.ts +16 -6
- package/src/tools/create.ts +1 -0
- package/src/tools/modify/effects.ts +11 -4
- package/src/tools/modify/matching.ts +10 -6
- package/src/tools/modify/paint.ts +13 -5
- package/src/tools/modify/text.ts +53 -20
- package/src/tools/read/libraries.ts +21 -4
- package/src/tools/read/pages.ts +1 -0
- package/src/tools/registry/extended.ts +2 -0
- package/src/tools/schema.ts +109 -5
- package/src/tools/structure/batch.ts +10 -5
- package/src/tools/variables/values.ts +6 -3
- package/src/tools/vector/export.ts +5 -1
|
@@ -44,6 +44,11 @@ function style(names: string[], values: Record<string, string | undefined>): Dra
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** A layer's name, which draw.io has no field of its own for, so it travels in the style. */
|
|
48
|
+
function nameValues(node: SceneNode): Record<string, string> {
|
|
49
|
+
return { pairdrawName: encodeURIComponent(node.name) }
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
/** A layer's first visible solid fill, or the first stop of a gradient, as draw.io's colour. */
|
|
48
53
|
function fillColor(node: SceneNode): string {
|
|
49
54
|
const fill = node.fills.find((paint) => paint.visible)
|
|
@@ -296,6 +301,7 @@ class PageWriter {
|
|
|
296
301
|
style: style(['text'], {
|
|
297
302
|
html: '1',
|
|
298
303
|
whiteSpace: 'wrap',
|
|
304
|
+
...nameValues(node),
|
|
299
305
|
...placedValues(placement),
|
|
300
306
|
...fontValues(node)
|
|
301
307
|
}),
|
|
@@ -349,6 +355,7 @@ class PageWriter {
|
|
|
349
355
|
style: style([], {
|
|
350
356
|
container: '1',
|
|
351
357
|
html: '1',
|
|
358
|
+
...nameValues(node),
|
|
352
359
|
...paintValues(node),
|
|
353
360
|
...placedValues(placement)
|
|
354
361
|
}),
|
|
@@ -361,7 +368,10 @@ class PageWriter {
|
|
|
361
368
|
kind: 'vertex',
|
|
362
369
|
value: '',
|
|
363
370
|
style: style(node.type === 'ELLIPSE' ? ['ellipse'] : [], {
|
|
371
|
+
...(node.type === 'RECTANGLE' ? { pairdrawType: 'RECTANGLE' } : {}),
|
|
364
372
|
rounded: node.cornerRadius > 0 ? '1' : undefined,
|
|
373
|
+
pairdrawCornerRadius: node.cornerRadius > 0 ? String(node.cornerRadius) : undefined,
|
|
374
|
+
...nameValues(node),
|
|
365
375
|
...placedValues(placement),
|
|
366
376
|
...paintValues(node)
|
|
367
377
|
}),
|
|
@@ -378,6 +388,7 @@ class PageWriter {
|
|
|
378
388
|
const label = shapeWithTextLabel(this.graph, node)
|
|
379
389
|
const values: Record<string, string | undefined> = {
|
|
380
390
|
...drawioShapeValues(node.shapeWithTextType),
|
|
391
|
+
...nameValues(node),
|
|
381
392
|
whiteSpace: 'wrap',
|
|
382
393
|
html: '1',
|
|
383
394
|
...paintValues(node),
|
|
@@ -33,6 +33,25 @@ function nameOf(text: string, fallback: string): string {
|
|
|
33
33
|
return text.split('\n')[0]?.trim() || fallback
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The name Pairdraw wrote into a cell's style. draw.io has no field of its own for a layer whose
|
|
38
|
+
* cell draws no text, and a text cell's label is its content, so the name travels beside them.
|
|
39
|
+
*/
|
|
40
|
+
function writtenName(style: DrawIOStyle): string | undefined {
|
|
41
|
+
const value = style.values.pairdrawName
|
|
42
|
+
if (value === undefined) return undefined
|
|
43
|
+
try {
|
|
44
|
+
return decodeURIComponent(value)
|
|
45
|
+
} catch {
|
|
46
|
+
return undefined
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A layer's name: the one Pairdraw wrote, else the first line of its label. */
|
|
51
|
+
function layerName(style: DrawIOStyle, text: string, fallback: string): string {
|
|
52
|
+
return writtenName(style) ?? nameOf(text, fallback)
|
|
53
|
+
}
|
|
54
|
+
|
|
36
55
|
/** Builds one draw.io page's cells into `pageId`, in draw.io's drawing order. */
|
|
37
56
|
class PageBuilder {
|
|
38
57
|
/** The layer each draw.io cell or layer became. */
|
|
@@ -113,13 +132,29 @@ class PageBuilder {
|
|
|
113
132
|
return graph.createNode('TEXT', parentId, {
|
|
114
133
|
...box,
|
|
115
134
|
...placementOf(cell.style),
|
|
116
|
-
name:
|
|
135
|
+
name: layerName(cell.style, label.text, 'Text'),
|
|
117
136
|
...labelFields(cell.style, label.format),
|
|
118
137
|
text: label.text,
|
|
119
138
|
styleRuns: label.runs,
|
|
120
139
|
textAutoResize: 'NONE'
|
|
121
140
|
})
|
|
122
141
|
}
|
|
142
|
+
if (kind.type === 'FRAME') {
|
|
143
|
+
return graph.createNode('FRAME', parentId, {
|
|
144
|
+
...box,
|
|
145
|
+
...shapePaint(cell.style),
|
|
146
|
+
name: layerName(cell.style, label.text, 'Frame')
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
if (kind.type === 'RECTANGLE') {
|
|
150
|
+
const radius = Number.parseFloat(cell.style.values.pairdrawCornerRadius ?? '')
|
|
151
|
+
return graph.createNode('RECTANGLE', parentId, {
|
|
152
|
+
...box,
|
|
153
|
+
...shapePaint(cell.style),
|
|
154
|
+
...(radius > 0 ? { cornerRadius: radius } : {}),
|
|
155
|
+
name: layerName(cell.style, label.text, 'Rectangle')
|
|
156
|
+
})
|
|
157
|
+
}
|
|
123
158
|
if (kind.type === 'SECTION') {
|
|
124
159
|
return graph.createNode('SECTION', parentId, {
|
|
125
160
|
...box,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { DrawIOStyle } from '@pairdraw/drawio'
|
|
2
2
|
import type { ShapeWithTextType } from '@pairdraw/scene-graph/shape-with-text'
|
|
3
3
|
|
|
4
|
-
/** What a draw.io vertex becomes: a
|
|
4
|
+
/** What a draw.io vertex becomes: a shape, text, a frame or section around its cells, or a group. */
|
|
5
5
|
export type VertexKind =
|
|
6
6
|
/** A FigJam shape, turned clockwise by `rotation` degrees about its centre. */
|
|
7
7
|
| { type: 'SHAPE_WITH_TEXT'; shape: ShapeWithTextType; rotation: number; stencil: boolean }
|
|
8
8
|
| { type: 'TEXT' }
|
|
9
|
+
| { type: 'FRAME' }
|
|
9
10
|
| { type: 'SECTION' }
|
|
11
|
+
| { type: 'RECTANGLE' }
|
|
10
12
|
| { type: 'GROUP' }
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -82,18 +84,20 @@ const DIRECTION_TURN = new Map([
|
|
|
82
84
|
])
|
|
83
85
|
|
|
84
86
|
/**
|
|
85
|
-
* What a vertex becomes. Text stays text; a swimlane
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
87
|
+
* What a vertex becomes. Text stays text; a swimlane becomes a section holding its cells, and
|
|
88
|
+
* any other vertex its style makes a container becomes a frame, as Pairdraw writes one; a group
|
|
89
|
+
* stays a group. A style Pairdraw wrote says when it drew a rectangle, which draw.io has no
|
|
90
|
+
* style of its own for. A shape draw.io turns by `direction` keeps its turn. Any other shape, a
|
|
91
|
+
* stencil FigJam has no shape for among them, becomes a shape named after the stencil.
|
|
89
92
|
*/
|
|
90
93
|
export function vertexKind(style: DrawIOStyle, hasChildren: boolean): VertexKind {
|
|
91
94
|
const name = shapeName(style)
|
|
92
95
|
if (name === 'text') return { type: 'TEXT' }
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
if (
|
|
96
|
+
if (style.values.pairdrawType === 'RECTANGLE') return { type: 'RECTANGLE' }
|
|
97
|
+
if (name === 'swimlane') return { type: 'SECTION' }
|
|
98
|
+
if (name === 'group') return { type: 'GROUP' }
|
|
99
|
+
if (style.values.container === '1') return { type: 'FRAME' }
|
|
100
|
+
if (hasChildren && !SHAPES.has(name)) return { type: 'GROUP' }
|
|
97
101
|
let shape = SHAPES.get(name) ?? 'SQUARE'
|
|
98
102
|
const direction = style.values.direction ?? 'east'
|
|
99
103
|
let rotation = 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
/** `3 variables`, with the noun matching the count. */
|
|
4
|
+
function counted(count: number, one: string, many: string): string {
|
|
5
|
+
return `${count} ${count === 1 ? one : many}`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What a draw.io file cannot hold. draw.io has no variable model and no style that reads one, so
|
|
10
|
+
* a document that paints with variables arrives in draw.io as plain colours and comes back
|
|
11
|
+
* unbound. The writer names that loss instead of writing a file that looks complete.
|
|
12
|
+
*/
|
|
13
|
+
export function drawioDroppedWarnings(graph: SceneGraph): string[] {
|
|
14
|
+
const variables = graph.variables.size
|
|
15
|
+
if (variables === 0) return []
|
|
16
|
+
const names = [...graph.variableCollections.values()].map((collection) => collection.name)
|
|
17
|
+
const dropped = `draw.io has no variables: ${counted(variables, 'variable', 'variables')} in ${counted(names.length, 'collection', 'collections')} (${names.join(', ')}) not written`
|
|
18
|
+
const bound = [...graph.nodes.values()].filter(
|
|
19
|
+
(node) => Object.keys(node.boundVariables).length > 0
|
|
20
|
+
).length
|
|
21
|
+
if (bound === 0) return [dropped]
|
|
22
|
+
const users =
|
|
23
|
+
bound === 1
|
|
24
|
+
? '1 layer that uses one lost the binding'
|
|
25
|
+
: `${counted(bound, 'layer', 'layers')} that use them lost the binding`
|
|
26
|
+
return [`${dropped}, and ${users}`]
|
|
27
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as HappyDOM from 'happy-dom'
|
|
2
|
+
import type { svg2pdf } from 'svg2pdf.js'
|
|
2
3
|
|
|
3
4
|
import { IS_BROWSER } from '#core/constants'
|
|
4
5
|
|
|
@@ -99,3 +100,31 @@ async function withHappyDOM<T>(draw: (parse: SVGPageParser) => Promise<T>): Prom
|
|
|
99
100
|
await dom.happyDOM.close()
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Loads `svg2pdf.js`. Its package publishes a UMD build only, whose factory reads jsPDF from the
|
|
106
|
+
* global `jspdf` and, with no CommonJS `exports`, writes the function to the global `svg2pdf`; a
|
|
107
|
+
* bundler supplies both, a bare Node install supplies neither, and the module then fails on load.
|
|
108
|
+
* The two globals exist only while the import evaluates, and the function the module made keeps
|
|
109
|
+
* the jsPDF it read, so the rest of the export needs nothing from them.
|
|
110
|
+
*/
|
|
111
|
+
export async function loadSVG2PDF(jsPDF: unknown): Promise<typeof svg2pdf> {
|
|
112
|
+
const scope = globalThis as { jspdf?: unknown; svg2pdf?: { svg2pdf?: typeof svg2pdf } }
|
|
113
|
+
const previousJSPDF = Object.getOwnPropertyDescriptor(globalThis, 'jspdf')
|
|
114
|
+
const previousSVG2PDF = Object.getOwnPropertyDescriptor(globalThis, 'svg2pdf')
|
|
115
|
+
const set = (name: string, value: unknown): void => {
|
|
116
|
+
Object.defineProperty(globalThis, name, { value, configurable: true, writable: true })
|
|
117
|
+
}
|
|
118
|
+
set('jspdf', { jsPDF })
|
|
119
|
+
try {
|
|
120
|
+
const module = (await import('svg2pdf.js')) as { svg2pdf?: typeof svg2pdf }
|
|
121
|
+
const draw = module.svg2pdf ?? scope.svg2pdf?.svg2pdf
|
|
122
|
+
if (!draw) throw new Error('svg2pdf.js exported no svg2pdf function')
|
|
123
|
+
return draw
|
|
124
|
+
} finally {
|
|
125
|
+
if (previousJSPDF) Object.defineProperty(globalThis, 'jspdf', previousJSPDF)
|
|
126
|
+
else delete scope.jspdf
|
|
127
|
+
if (previousSVG2PDF) Object.defineProperty(globalThis, 'svg2pdf', previousSVG2PDF)
|
|
128
|
+
else delete scope.svg2pdf
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
|
3
3
|
import { computeContentBounds } from '#core/io/formats/raster'
|
|
4
4
|
import { renderNodesToSVG, type SVGExportOptions, type SVGTextLayout } from '#core/io/formats/svg'
|
|
5
5
|
|
|
6
|
-
import { withPDFDOM, type SVGPageParser } from './dom'
|
|
6
|
+
import { loadSVG2PDF, withPDFDOM, type SVGPageParser } from './dom'
|
|
7
7
|
import {
|
|
8
8
|
cutFontInstances,
|
|
9
9
|
embeddedFontAlias,
|
|
@@ -97,7 +97,8 @@ async function renderPages(
|
|
|
97
97
|
if (prepared.length === 0) return null
|
|
98
98
|
const first = prepared[0]
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const { jsPDF } = await import('jspdf')
|
|
101
|
+
const svg2pdf = await loadSVG2PDF(jsPDF)
|
|
101
102
|
|
|
102
103
|
const doc = new jsPDF({
|
|
103
104
|
orientation: orientationOf(first),
|
|
@@ -4,7 +4,12 @@ import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
|
4
4
|
|
|
5
5
|
import { SkiaRenderer } from '#core/canvas'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
renderNodesToImage,
|
|
9
|
+
renderThumbnail,
|
|
10
|
+
type ExportFormat,
|
|
11
|
+
type RasterExportFormat
|
|
12
|
+
} from './render'
|
|
8
13
|
|
|
9
14
|
let cachedCk: CanvasKit | null = null
|
|
10
15
|
let cachedRenderer: SkiaRenderer | null = null
|
|
@@ -59,10 +64,12 @@ export async function headlessRenderThumbnail(
|
|
|
59
64
|
graph: SceneGraph,
|
|
60
65
|
pageId: string,
|
|
61
66
|
width: number,
|
|
62
|
-
height: number
|
|
67
|
+
height: number,
|
|
68
|
+
format: RasterExportFormat = 'PNG',
|
|
69
|
+
quality = 100
|
|
63
70
|
): Promise<Uint8Array | null> {
|
|
64
71
|
const { ck, renderer } = await getRenderer()
|
|
65
72
|
renderer.invalidateAllPictures()
|
|
66
73
|
await renderer.prepareForExport(graph, pageId, graph.getNode(pageId)?.childIds ?? [])
|
|
67
|
-
return renderThumbnail(ck, renderer, graph, pageId, width, height)
|
|
74
|
+
return renderThumbnail(ck, renderer, graph, pageId, width, height, format, quality)
|
|
68
75
|
}
|
|
@@ -366,7 +366,9 @@ export function renderThumbnail(
|
|
|
366
366
|
graph: SceneGraph,
|
|
367
367
|
pageId: string,
|
|
368
368
|
width: number,
|
|
369
|
-
height: number
|
|
369
|
+
height: number,
|
|
370
|
+
format: RasterExportFormat = 'PNG',
|
|
371
|
+
quality = 100
|
|
370
372
|
): Uint8Array<ArrayBuffer> | null {
|
|
371
373
|
const frame = thumbnailFrame(graph, pageId, width, height)
|
|
372
374
|
if (!frame) return null
|
|
@@ -374,7 +376,7 @@ export function renderThumbnail(
|
|
|
374
376
|
// The page's own background, which the editor's page colour matches only while it is open.
|
|
375
377
|
const background = getPageColor(graph.getNode(pageId))
|
|
376
378
|
|
|
377
|
-
return renderToSurface(ck, renderer, graph, pageId, pixelW, pixelH,
|
|
379
|
+
return renderToSurface(ck, renderer, graph, pageId, pixelW, pixelH, format, quality, (canvas) => {
|
|
378
380
|
canvas.clear(ck.Color4f(background.r, background.g, background.b, 1))
|
|
379
381
|
canvas.translate(-bounds.minX * scale, -bounds.minY * scale)
|
|
380
382
|
canvas.scale(scale, scale)
|
package/src/io/formats.ts
CHANGED
|
@@ -314,12 +314,14 @@ export const mermaidFormat: IOFormatAdapter<'mermaid'> = {
|
|
|
314
314
|
async function writeDrawIO(graph: SceneGraph, target: DrawIOExportTarget): Promise<ExportResult> {
|
|
315
315
|
const { writeDrawIOFile } = await import('@pairdraw/drawio')
|
|
316
316
|
const { sceneGraphToDrawIO } = await import('./formats/drawio')
|
|
317
|
+
const { drawioDroppedWarnings } = await import('./formats/drawio/warnings')
|
|
317
318
|
return {
|
|
318
319
|
format: 'drawio',
|
|
319
320
|
mimeType: 'application/vnd.jgraph.mxfile',
|
|
320
321
|
extension: 'drawio',
|
|
321
322
|
data: writeDrawIOFile(sceneGraphToDrawIO(graph, target)),
|
|
322
|
-
encoding: 'utf8'
|
|
323
|
+
encoding: 'utf8',
|
|
324
|
+
warnings: drawioDroppedWarnings(graph)
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
327
|
|
package/src/io/registry.ts
CHANGED
|
@@ -38,6 +38,18 @@ export class IORegistry {
|
|
|
38
38
|
})
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/** The writable format a file name asks for, so a save keeps the document's own format. */
|
|
42
|
+
findWriter(fileName: string): IOFormatAdapter | null {
|
|
43
|
+
const lower = fileName.toLowerCase()
|
|
44
|
+
return (
|
|
45
|
+
this.adapters.find(
|
|
46
|
+
(adapter) =>
|
|
47
|
+
!!adapter.support.writeDocument &&
|
|
48
|
+
adapter.extensions.some((ext) => lower.endsWith(`.${ext}`))
|
|
49
|
+
) ?? null
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
41
53
|
findReader(fileName: string, mimeType?: string): IOFormatAdapter | null {
|
|
42
54
|
return (
|
|
43
55
|
this.adapters.find((adapter) => {
|
package/src/io/types.ts
CHANGED
|
@@ -133,6 +133,8 @@ export interface ExportResult {
|
|
|
133
133
|
encoding?: IOTextEncoding
|
|
134
134
|
/** Extra files the main file refers to, such as external images and fonts. */
|
|
135
135
|
assets?: ExportAsset[]
|
|
136
|
+
/** What the format could not hold, such as the variables draw.io has no model for. */
|
|
137
|
+
warnings?: string[]
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
export interface HTMLExportOptions {
|
package/src/library/snapshot.ts
CHANGED
package/src/lint/linter.ts
CHANGED
|
@@ -28,6 +28,15 @@ function effectiveTextStyles(node: SceneNode): { fontSize: number; fontWeight: n
|
|
|
28
28
|
return covered < node.text.length || runs.length === 0 ? [base, ...runs] : runs
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** A preset's rules, refusing a name no preset has so a typo cannot silently disable linting. */
|
|
32
|
+
function presetRules(id: string) {
|
|
33
|
+
if (!Object.hasOwn(presets, id)) {
|
|
34
|
+
const known = Object.keys(presets).sort().join(', ')
|
|
35
|
+
throw new Error(`Unknown lint preset "${id}". Known presets: ${known}`)
|
|
36
|
+
}
|
|
37
|
+
return presets[id].rules
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
export class Linter {
|
|
32
41
|
private rules = new Map<string, Rule>()
|
|
33
42
|
private ruleConfigs = new Map<string, { severity: Severity; options?: Record<string, unknown> }>()
|
|
@@ -46,16 +55,17 @@ export class Linter {
|
|
|
46
55
|
string,
|
|
47
56
|
Severity | { severity: Severity; options?: Record<string, unknown> }
|
|
48
57
|
> = {}
|
|
49
|
-
if (options.preset) baseConfig = { ...
|
|
58
|
+
if (options.preset) baseConfig = { ...presetRules(options.preset) }
|
|
50
59
|
if (options.config?.extends) {
|
|
51
60
|
const ids = Array.isArray(options.config.extends)
|
|
52
61
|
? options.config.extends
|
|
53
62
|
: [options.config.extends]
|
|
54
|
-
for (const id of ids) baseConfig = { ...baseConfig, ...
|
|
63
|
+
for (const id of ids) baseConfig = { ...baseConfig, ...presetRules(id) }
|
|
55
64
|
}
|
|
56
65
|
if (options.config?.rules) baseConfig = { ...baseConfig, ...options.config.rules }
|
|
57
66
|
const rulesToLoad = options.rules ?? Object.keys(baseConfig)
|
|
58
67
|
for (const ruleId of rulesToLoad) {
|
|
68
|
+
if (!Object.hasOwn(allRules, ruleId)) throw new Error(`Unknown lint rule "${ruleId}"`)
|
|
59
69
|
const rule = allRules[ruleId]
|
|
60
70
|
const config = baseConfig[ruleId]
|
|
61
71
|
if (config === 'off') continue
|
|
@@ -61,11 +61,7 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
61
61
|
const typeFilter = args.type?.toUpperCase()
|
|
62
62
|
const collFilter = args.collection?.toLowerCase()
|
|
63
63
|
|
|
64
|
-
const result: VariablesResult = {
|
|
65
|
-
collections: [],
|
|
66
|
-
totalVariables: graph.variables.size,
|
|
67
|
-
totalCollections: graph.variableCollections.size
|
|
68
|
-
}
|
|
64
|
+
const result: VariablesResult = { collections: [], totalVariables: 0, totalCollections: 0 }
|
|
69
65
|
|
|
70
66
|
for (const coll of graph.variableCollections.values()) {
|
|
71
67
|
if (collFilter && !coll.name.toLowerCase().includes(collFilter)) continue
|
|
@@ -89,6 +85,11 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
89
85
|
})
|
|
90
86
|
}
|
|
91
87
|
|
|
88
|
+
result.totalVariables = result.collections.reduce(
|
|
89
|
+
(count, collection) => count + collection.variables.length,
|
|
90
|
+
0
|
|
91
|
+
)
|
|
92
|
+
result.totalCollections = result.collections.length
|
|
92
93
|
return result
|
|
93
94
|
}
|
|
94
95
|
}
|
package/src/text/coverage.ts
CHANGED
|
@@ -4,10 +4,14 @@ import { DEFAULT_FONT_FAMILY } from '#core/constants'
|
|
|
4
4
|
import {
|
|
5
5
|
ARABIC_CHARACTER,
|
|
6
6
|
cjkFallbackScriptForLanguage,
|
|
7
|
+
DEVANAGARI_CHARACTER,
|
|
7
8
|
fontFallbackScriptForCharacter,
|
|
8
9
|
HAN_CHARACTER,
|
|
9
10
|
HANGUL_CHARACTER,
|
|
11
|
+
HEBREW_CHARACTER,
|
|
10
12
|
KANA_CHARACTER,
|
|
13
|
+
LETTER_FALLBACK_SCRIPTS,
|
|
14
|
+
THAI_CHARACTER,
|
|
11
15
|
TRADITIONAL_HAN_CHARACTER,
|
|
12
16
|
type FontFallbackScript
|
|
13
17
|
} from '#core/text/fallbacks'
|
|
@@ -20,6 +24,12 @@ function scriptCharRegex(script: FontFallbackScript): RegExp {
|
|
|
20
24
|
switch (script) {
|
|
21
25
|
case 'arabic':
|
|
22
26
|
return ARABIC_CHARACTER
|
|
27
|
+
case 'hebrew':
|
|
28
|
+
return HEBREW_CHARACTER
|
|
29
|
+
case 'thai':
|
|
30
|
+
return THAI_CHARACTER
|
|
31
|
+
case 'devanagari':
|
|
32
|
+
return DEVANAGARI_CHARACTER
|
|
23
33
|
case 'cjk-jp':
|
|
24
34
|
return KANA_CHARACTER
|
|
25
35
|
case 'cjk-kr':
|
|
@@ -32,7 +42,10 @@ function scriptCharRegex(script: FontFallbackScript): RegExp {
|
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
export function textHasFallbackScript(text: string): boolean {
|
|
35
|
-
return
|
|
45
|
+
return (
|
|
46
|
+
LETTER_FALLBACK_SCRIPTS.some((script) => scriptCharRegex(script).test(text)) ||
|
|
47
|
+
CJK_CHAR_RE.test(text)
|
|
48
|
+
)
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
function styleForCharacter(
|
|
@@ -87,7 +100,9 @@ export function textFallbackScriptsWithoutCoverage(node: SceneNode): FontFallbac
|
|
|
87
100
|
|
|
88
101
|
export function textNeededFallbackScripts(node: SceneNode): FontFallbackScript[] {
|
|
89
102
|
const scripts = new Set<FontFallbackScript>()
|
|
90
|
-
|
|
103
|
+
for (const script of LETTER_FALLBACK_SCRIPTS) {
|
|
104
|
+
if (textNeedsFallbackScript(node, script)) scripts.add(script)
|
|
105
|
+
}
|
|
91
106
|
|
|
92
107
|
let missingIdeograph = false
|
|
93
108
|
let missingTraditionalIdeograph = false
|
package/src/text/fallbacks.ts
CHANGED
|
@@ -5,10 +5,32 @@ import {
|
|
|
5
5
|
CJK_GOOGLE_FONTS
|
|
6
6
|
} from '#core/constants'
|
|
7
7
|
|
|
8
|
-
export type FontFallbackScript =
|
|
8
|
+
export type FontFallbackScript =
|
|
9
|
+
| 'cjk'
|
|
10
|
+
| 'cjk-sc'
|
|
11
|
+
| 'cjk-tc'
|
|
12
|
+
| 'cjk-jp'
|
|
13
|
+
| 'cjk-kr'
|
|
14
|
+
| 'arabic'
|
|
15
|
+
| 'hebrew'
|
|
16
|
+
| 'thai'
|
|
17
|
+
| 'devanagari'
|
|
18
|
+
|
|
19
|
+
/** The fallbacks for scripts written in letters, which the renderer tries before the CJK ones. */
|
|
20
|
+
export const LETTER_FALLBACK_SCRIPTS = [
|
|
21
|
+
'arabic',
|
|
22
|
+
'hebrew',
|
|
23
|
+
'thai',
|
|
24
|
+
'devanagari'
|
|
25
|
+
] as const satisfies readonly FontFallbackScript[]
|
|
26
|
+
|
|
27
|
+
export type LetterFallbackScript = (typeof LETTER_FALLBACK_SCRIPTS)[number]
|
|
9
28
|
|
|
10
29
|
/** Characters of the writing systems that need a fallback font, by their Unicode script. */
|
|
11
30
|
export const ARABIC_CHARACTER = /\p{Script=Arabic}/u
|
|
31
|
+
export const HEBREW_CHARACTER = /\p{Script=Hebrew}/u
|
|
32
|
+
export const THAI_CHARACTER = /\p{Script=Thai}/u
|
|
33
|
+
export const DEVANAGARI_CHARACTER = /\p{Script=Devanagari}/u
|
|
12
34
|
export const HANGUL_CHARACTER = /\p{Script=Hangul}/u
|
|
13
35
|
export const KANA_CHARACTER = /[\p{Script=Hiragana}\p{Script=Katakana}]/u
|
|
14
36
|
export const HAN_CHARACTER = /\p{Script=Han}/u
|
|
@@ -23,6 +45,9 @@ export function fontFallbackScriptForCharacter(
|
|
|
23
45
|
language?: string | null
|
|
24
46
|
): FontFallbackScript | null {
|
|
25
47
|
if (ARABIC_CHARACTER.test(char)) return 'arabic'
|
|
48
|
+
if (HEBREW_CHARACTER.test(char)) return 'hebrew'
|
|
49
|
+
if (THAI_CHARACTER.test(char)) return 'thai'
|
|
50
|
+
if (DEVANAGARI_CHARACTER.test(char)) return 'devanagari'
|
|
26
51
|
if (HANGUL_CHARACTER.test(char)) return 'cjk-kr'
|
|
27
52
|
if (KANA_CHARACTER.test(char)) return 'cjk-jp'
|
|
28
53
|
const languageScript = cjkFallbackScriptForLanguage(language)
|
|
@@ -72,7 +97,7 @@ export function cjkLocalFallbackFamilies(userAgent?: string): string[] {
|
|
|
72
97
|
return [...CJK_FALLBACK_FAMILIES_LINUX]
|
|
73
98
|
}
|
|
74
99
|
|
|
75
|
-
function
|
|
100
|
+
function platformFamilies(
|
|
76
101
|
userAgent: string | undefined,
|
|
77
102
|
families: Record<'mac' | 'windows' | 'linux', string[]>
|
|
78
103
|
): string[] {
|
|
@@ -88,25 +113,25 @@ function cjkScriptLocalFallbackFamilies(
|
|
|
88
113
|
): string[] {
|
|
89
114
|
switch (script) {
|
|
90
115
|
case 'cjk-tc':
|
|
91
|
-
return
|
|
116
|
+
return platformFamilies(userAgent, {
|
|
92
117
|
mac: ['PingFang TC', 'Heiti TC', 'PingFang SC', 'Hiragino Sans'],
|
|
93
118
|
windows: ['Microsoft JhengHei', 'Microsoft YaHei', 'Microsoft YaHei UI', 'SimSun'],
|
|
94
119
|
linux: ['Noto Sans CJK TC', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
95
120
|
})
|
|
96
121
|
case 'cjk-jp':
|
|
97
|
-
return
|
|
122
|
+
return platformFamilies(userAgent, {
|
|
98
123
|
mac: ['Hiragino Sans', 'PingFang SC', 'PingFang TC'],
|
|
99
124
|
windows: ['Yu Gothic', 'Microsoft YaHei', 'Microsoft JhengHei'],
|
|
100
125
|
linux: ['Noto Sans CJK JP', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
101
126
|
})
|
|
102
127
|
case 'cjk-kr':
|
|
103
|
-
return
|
|
128
|
+
return platformFamilies(userAgent, {
|
|
104
129
|
mac: ['Apple SD Gothic Neo', 'PingFang SC', 'Hiragino Sans'],
|
|
105
130
|
windows: ['Malgun Gothic', 'Microsoft YaHei', 'Yu Gothic'],
|
|
106
131
|
linux: ['Noto Sans CJK KR', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
107
132
|
})
|
|
108
133
|
default:
|
|
109
|
-
return
|
|
134
|
+
return platformFamilies(userAgent, {
|
|
110
135
|
mac: ['PingFang SC', 'Heiti SC', 'PingFang TC', 'Hiragino Sans'],
|
|
111
136
|
windows: ['Microsoft YaHei', 'Microsoft YaHei UI', 'SimHei', 'SimSun'],
|
|
112
137
|
linux: ['Noto Sans CJK SC', 'WenQuanYi Micro Hei', 'Droid Sans Fallback']
|
|
@@ -114,6 +139,52 @@ function cjkScriptLocalFallbackFamilies(
|
|
|
114
139
|
}
|
|
115
140
|
}
|
|
116
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Installed fonts that draw Hebrew, Thai, and Devanagari on each system, then the Noto family
|
|
144
|
+
* Google Fonts serves for it, so text in these scripts draws without bundling their fonts.
|
|
145
|
+
*/
|
|
146
|
+
const LETTER_SCRIPT_FAMILIES: Record<
|
|
147
|
+
Exclude<LetterFallbackScript, 'arabic'>,
|
|
148
|
+
{ local: Record<'mac' | 'windows' | 'linux', string[]>; remote: string[] }
|
|
149
|
+
> = {
|
|
150
|
+
hebrew: {
|
|
151
|
+
local: {
|
|
152
|
+
mac: ['Arial Hebrew', 'Lucida Grande'],
|
|
153
|
+
windows: ['Segoe UI', 'Arial', 'David'],
|
|
154
|
+
linux: ['Noto Sans Hebrew', 'DejaVu Sans']
|
|
155
|
+
},
|
|
156
|
+
remote: ['Noto Sans Hebrew']
|
|
157
|
+
},
|
|
158
|
+
thai: {
|
|
159
|
+
local: {
|
|
160
|
+
mac: ['Thonburi', 'Sukhumvit Set', 'Ayuthaya'],
|
|
161
|
+
windows: ['Leelawadee UI', 'Tahoma'],
|
|
162
|
+
linux: ['Noto Sans Thai', 'Loma']
|
|
163
|
+
},
|
|
164
|
+
remote: ['Noto Sans Thai']
|
|
165
|
+
},
|
|
166
|
+
devanagari: {
|
|
167
|
+
local: {
|
|
168
|
+
mac: ['Kohinoor Devanagari', 'Devanagari Sangam MN', 'Devanagari MT'],
|
|
169
|
+
windows: ['Nirmala UI', 'Mangal'],
|
|
170
|
+
linux: ['Noto Sans Devanagari', 'Lohit Devanagari']
|
|
171
|
+
},
|
|
172
|
+
remote: ['Noto Sans Devanagari']
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function letterScriptEntry(
|
|
177
|
+
script: Exclude<LetterFallbackScript, 'arabic'>,
|
|
178
|
+
userAgent?: string
|
|
179
|
+
): FontFallbackManifestEntry {
|
|
180
|
+
const families = LETTER_SCRIPT_FAMILIES[script]
|
|
181
|
+
return {
|
|
182
|
+
script,
|
|
183
|
+
localFamilies: [...platformFamilies(userAgent, families.local)],
|
|
184
|
+
remoteFamilies: [...families.remote]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
117
188
|
const CJK_SCRIPT_REMOTE_FAMILIES: Record<
|
|
118
189
|
Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,
|
|
119
190
|
string[]
|
|
@@ -157,7 +228,10 @@ export function fontFallbackManifest(
|
|
|
157
228
|
script: 'arabic',
|
|
158
229
|
localFamilies: [...ARABIC_LOCAL_FALLBACK_FAMILIES],
|
|
159
230
|
remoteFamilies: [...ARABIC_REMOTE_FALLBACK_FAMILIES]
|
|
160
|
-
}
|
|
231
|
+
},
|
|
232
|
+
hebrew: letterScriptEntry('hebrew', userAgent),
|
|
233
|
+
thai: letterScriptEntry('thai', userAgent),
|
|
234
|
+
devanagari: letterScriptEntry('devanagari', userAgent)
|
|
161
235
|
}
|
|
162
236
|
}
|
|
163
237
|
|