@open-pencil/scene-graph 0.17.0-beta.5 → 0.17.0-beta.7

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.
Files changed (151) hide show
  1. package/dist/comments/schema.d.ts.map +1 -1
  2. package/dist/comments/schema.js +1 -0
  3. package/dist/comments/schema.js.map +1 -1
  4. package/dist/comments/threads.d.ts +2 -0
  5. package/dist/comments/threads.d.ts.map +1 -1
  6. package/dist/comments/threads.js +11 -5
  7. package/dist/comments/threads.js.map +1 -1
  8. package/dist/components/properties.d.ts.map +1 -1
  9. package/dist/components/properties.js +1 -1
  10. package/dist/components/properties.js.map +1 -1
  11. package/dist/constants.d.ts +12 -2
  12. package/dist/constants.d.ts.map +1 -1
  13. package/dist/constants.js +42 -1
  14. package/dist/constants.js.map +1 -1
  15. package/dist/copy.d.ts.map +1 -1
  16. package/dist/copy.js +3 -0
  17. package/dist/copy.js.map +1 -1
  18. package/dist/css/grid.d.ts.map +1 -1
  19. package/dist/css/grid.js +27 -3
  20. package/dist/css/grid.js.map +1 -1
  21. package/dist/css/index.d.ts +3 -3
  22. package/dist/css/index.js +3 -3
  23. package/dist/css/layout.d.ts +13 -1
  24. package/dist/css/layout.d.ts.map +1 -1
  25. package/dist/css/layout.js +26 -1
  26. package/dist/css/layout.js.map +1 -1
  27. package/dist/css/values.d.ts +18 -1
  28. package/dist/css/values.d.ts.map +1 -1
  29. package/dist/css/values.js +39 -1
  30. package/dist/css/values.js.map +1 -1
  31. package/dist/geometry.d.ts +6 -6
  32. package/dist/geometry.d.ts.map +1 -1
  33. package/dist/geometry.js +4 -20
  34. package/dist/geometry.js.map +1 -1
  35. package/dist/graph.d.ts +5 -2
  36. package/dist/graph.d.ts.map +1 -1
  37. package/dist/graph.js +16 -6
  38. package/dist/graph.js.map +1 -1
  39. package/dist/icons/glyph.d.ts.map +1 -1
  40. package/dist/icons/glyph.js +1 -1
  41. package/dist/icons/glyph.js.map +1 -1
  42. package/dist/ids.js +1 -1
  43. package/dist/ids.js.map +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/instances/index.d.ts +6 -1
  46. package/dist/instances/index.d.ts.map +1 -1
  47. package/dist/instances/index.js +20 -8
  48. package/dist/instances/index.js.map +1 -1
  49. package/dist/instances/swap.js +1 -1
  50. package/dist/instances/swap.js.map +1 -1
  51. package/dist/instances/sync.js +25 -1
  52. package/dist/instances/sync.js.map +1 -1
  53. package/dist/layout/index.d.ts +2 -1
  54. package/dist/layout/index.js +2 -1
  55. package/dist/layout/strokes.d.ts +10 -0
  56. package/dist/layout/strokes.d.ts.map +1 -0
  57. package/dist/layout/strokes.js +30 -0
  58. package/dist/layout/strokes.js.map +1 -0
  59. package/dist/node-defaults.d.ts.map +1 -1
  60. package/dist/node-defaults.js +49 -37
  61. package/dist/node-defaults.js.map +1 -1
  62. package/dist/outline/flatten.d.ts.map +1 -1
  63. package/dist/outline/flatten.js +2 -2
  64. package/dist/outline/flatten.js.map +1 -1
  65. package/dist/parse-path.d.ts +4 -1
  66. package/dist/parse-path.d.ts.map +1 -1
  67. package/dist/parse-path.js +15 -1
  68. package/dist/parse-path.js.map +1 -1
  69. package/dist/paths/index.d.ts +2 -2
  70. package/dist/paths/index.js +2 -2
  71. package/dist/paths/network.d.ts +26 -6
  72. package/dist/paths/network.d.ts.map +1 -1
  73. package/dist/paths/network.js +79 -13
  74. package/dist/paths/network.js.map +1 -1
  75. package/dist/paths/smooth-corners.d.ts.map +1 -1
  76. package/dist/paths/smooth-corners.js +1 -1
  77. package/dist/paths/smooth-corners.js.map +1 -1
  78. package/dist/primitives/index.d.ts +1 -7
  79. package/dist/primitives/index.d.ts.map +1 -1
  80. package/dist/shaders/model.d.ts.map +1 -1
  81. package/dist/shaders/model.js +1 -1
  82. package/dist/shaders/model.js.map +1 -1
  83. package/dist/shared-styles.d.ts.map +1 -1
  84. package/dist/shared-styles.js +2 -9
  85. package/dist/shared-styles.js.map +1 -1
  86. package/dist/strokes.d.ts +39 -0
  87. package/dist/strokes.d.ts.map +1 -0
  88. package/dist/strokes.js +104 -0
  89. package/dist/strokes.js.map +1 -0
  90. package/dist/text/index.d.ts +2 -1
  91. package/dist/text/index.js +2 -1
  92. package/dist/text/runs.d.ts +29 -0
  93. package/dist/text/runs.d.ts.map +1 -0
  94. package/dist/text/runs.js +72 -0
  95. package/dist/text/runs.js.map +1 -0
  96. package/dist/transfer/dependencies.d.ts.map +1 -1
  97. package/dist/transfer/dependencies.js +1 -1
  98. package/dist/transfer/dependencies.js.map +1 -1
  99. package/dist/types.d.ts +47 -2
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/types.js.map +1 -1
  102. package/dist/variables/resolution.d.ts.map +1 -1
  103. package/dist/variables/resolution.js +1 -1
  104. package/dist/variables/resolution.js.map +1 -1
  105. package/dist/vector-network.d.ts.map +1 -1
  106. package/dist/vector-network.js +2 -4
  107. package/dist/vector-network.js.map +1 -1
  108. package/package.json +10 -13
  109. package/src/comments/schema.ts +1 -0
  110. package/src/comments/threads.ts +13 -5
  111. package/src/components/properties.ts +2 -1
  112. package/src/constants.ts +25 -1
  113. package/src/copy.ts +3 -0
  114. package/src/css/grid.ts +31 -3
  115. package/src/css/index.ts +13 -2
  116. package/src/css/layout.ts +36 -0
  117. package/src/css/values.ts +49 -0
  118. package/src/geometry.ts +9 -27
  119. package/src/graph.ts +13 -6
  120. package/src/icons/glyph.ts +2 -1
  121. package/src/ids.ts +1 -1
  122. package/src/instances/index.ts +24 -9
  123. package/src/instances/swap.ts +2 -1
  124. package/src/instances/sync.ts +41 -0
  125. package/src/layout/index.ts +1 -0
  126. package/src/layout/strokes.ts +23 -0
  127. package/src/node-defaults.ts +48 -33
  128. package/src/outline/flatten.ts +2 -1
  129. package/src/parse-path.ts +14 -0
  130. package/src/paths/network.ts +90 -13
  131. package/src/paths/smooth-corners.ts +2 -1
  132. package/src/primitives/index.ts +0 -5
  133. package/src/shaders/model.ts +2 -1
  134. package/src/shared-styles.ts +3 -4
  135. package/src/strokes.ts +121 -0
  136. package/src/text/index.ts +1 -0
  137. package/src/text/runs.ts +80 -0
  138. package/src/transfer/dependencies.ts +2 -1
  139. package/src/types.ts +50 -0
  140. package/src/variables/resolution.ts +2 -1
  141. package/src/vector-network.ts +2 -4
  142. package/dist/arrays.d.ts +0 -17
  143. package/dist/arrays.d.ts.map +0 -1
  144. package/dist/arrays.js +0 -38
  145. package/dist/arrays.js.map +0 -1
  146. package/dist/random.d.ts +0 -7
  147. package/dist/random.d.ts.map +0 -1
  148. package/dist/random.js +0 -25
  149. package/dist/random.js.map +0 -1
  150. package/src/arrays.ts +0 -37
  151. package/src/random.ts +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":[],"sources":["../../src/shaders/model.ts"],"sourcesContent":["import { sha1 } from '@noble/hashes/legacy.js'\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js'\n\nimport { TRANSPARENT } from '../constants'\nimport { imagePaintHashes } from '../images'\nimport { readAllPluginData, withAllPluginData } from '../plugin-data/field'\nimport { OPEN_PENCIL_PLUGIN_DATA } from '../plugin-data/fields'\nimport { randomHex } from '../random'\nimport type { Fill, SceneNode } from '../types'\nimport type { ShaderPaint, ShaderPreset } from './schema'\n\n/** What shader paints read of a node. */\ntype ShaderNode = Pick<SceneNode, 'fills' | 'strokes' | 'pluginData'>\n\n/** Every shader a node's fills and strokes draw, whether or not a paint still shows it. */\nexport function readShaderPaints(node: Pick<SceneNode, 'pluginData'>): ShaderPaint[] {\n return readAllPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.shader)\n}\n\n/**\n * The shader a fill or stroke of `node` draws: an image paint whose image is a shader's frame.\n * Null for any other paint, including one whose image was replaced, which then draws as the\n * image it holds.\n */\nexport function shaderOfPaint(\n node: Pick<SceneNode, 'pluginData'>,\n paint: Fill\n): ShaderPaint | null {\n if (paint.type !== 'IMAGE' || !paint.imageHash) return null\n return readShaderPaints(node).find((shader) => shader.image === paint.imageHash) ?? null\n}\n\n/** Whether any paint of `node` draws a shader. */\nexport function hasShaderPaint(node: ShaderNode): boolean {\n return [...node.fills, ...node.strokes].some((paint) => shaderOfPaint(node, paint) !== null)\n}\n\n/**\n * The node's plugin data with `shaders` set by their image, keeping only shaders a fill or\n * stroke of `paints` still shows, so removing or replacing a paint leaves no entry behind.\n */\nexport function withShaderPaints(\n node: Pick<SceneNode, 'pluginData'>,\n paints: readonly Fill[],\n shaders: readonly ShaderPaint[] = []\n): SceneNode['pluginData'] {\n const shown = new Set(imagePaintHashes(paints))\n const byImage = new Map(readShaderPaints(node).map((shader) => [shader.image, shader]))\n for (const shader of shaders) byImage.set(shader.image, shader)\n return withAllPluginData(\n node.pluginData,\n OPEN_PENCIL_PLUGIN_DATA.shader,\n [...byImage.values()].filter((shader) => shown.has(shader.image))\n )\n}\n\n/**\n * A new paint that draws `preset`, and the shader entry it shows. Its image names a frame not yet\n * rendered, unique to this paint, so no other paint's entry claims it until the frame is drawn.\n */\nexport function createShaderPaint(preset: ShaderPreset): {\n paint: Fill\n shader: ShaderPaint\n} {\n const image = randomHex(20)\n return {\n paint: {\n type: 'IMAGE',\n color: TRANSPARENT,\n opacity: 1,\n visible: true,\n imageHash: image,\n imageScaleMode: 'FILL'\n },\n shader: { image, preset: structuredClone(preset) }\n }\n}\n\n/** A short key that tells one preset from another, which a rendered frame records. */\nexport function shaderPresetKey(preset: ShaderPreset): string {\n return bytesToHex(sha1(utf8ToBytes(JSON.stringify(preset))))\n}\n\n/**\n * Whether a shader's frame was rendered for its preset at the size `node` has now, so undoing a\n * preset change after reopening the document does not keep a frame of the newer preset.\n */\nexport function isShaderFrameCurrent(\n shader: ShaderPaint,\n size: { width: number; height: number }\n): boolean {\n const { frame } = shader\n return (\n frame !== undefined &&\n frame.preset === shaderPresetKey(shader.preset) &&\n Math.round(frame.width) === Math.round(size.width) &&\n Math.round(frame.height) === Math.round(size.height)\n )\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,iBAAiB,MAAoD;CAC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9C,KAAK,MAAM,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,KAAK,KACjD,KAAK,MAAM,MAAM,MAAM,MAAM,KAAK,MAAM,KAAK,MAAM;AAEvD"}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/shaders/model.ts"],"sourcesContent":["import { sha1 } from '@noble/hashes/legacy.js'\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js'\n\nimport { randomHex } from '@open-pencil/std/random'\n\nimport { TRANSPARENT } from '../constants'\nimport { imagePaintHashes } from '../images'\nimport { readAllPluginData, withAllPluginData } from '../plugin-data/field'\nimport { OPEN_PENCIL_PLUGIN_DATA } from '../plugin-data/fields'\nimport type { Fill, SceneNode } from '../types'\nimport type { ShaderPaint, ShaderPreset } from './schema'\n\n/** What shader paints read of a node. */\ntype ShaderNode = Pick<SceneNode, 'fills' | 'strokes' | 'pluginData'>\n\n/** Every shader a node's fills and strokes draw, whether or not a paint still shows it. */\nexport function readShaderPaints(node: Pick<SceneNode, 'pluginData'>): ShaderPaint[] {\n return readAllPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.shader)\n}\n\n/**\n * The shader a fill or stroke of `node` draws: an image paint whose image is a shader's frame.\n * Null for any other paint, including one whose image was replaced, which then draws as the\n * image it holds.\n */\nexport function shaderOfPaint(\n node: Pick<SceneNode, 'pluginData'>,\n paint: Fill\n): ShaderPaint | null {\n if (paint.type !== 'IMAGE' || !paint.imageHash) return null\n return readShaderPaints(node).find((shader) => shader.image === paint.imageHash) ?? null\n}\n\n/** Whether any paint of `node` draws a shader. */\nexport function hasShaderPaint(node: ShaderNode): boolean {\n return [...node.fills, ...node.strokes].some((paint) => shaderOfPaint(node, paint) !== null)\n}\n\n/**\n * The node's plugin data with `shaders` set by their image, keeping only shaders a fill or\n * stroke of `paints` still shows, so removing or replacing a paint leaves no entry behind.\n */\nexport function withShaderPaints(\n node: Pick<SceneNode, 'pluginData'>,\n paints: readonly Fill[],\n shaders: readonly ShaderPaint[] = []\n): SceneNode['pluginData'] {\n const shown = new Set(imagePaintHashes(paints))\n const byImage = new Map(readShaderPaints(node).map((shader) => [shader.image, shader]))\n for (const shader of shaders) byImage.set(shader.image, shader)\n return withAllPluginData(\n node.pluginData,\n OPEN_PENCIL_PLUGIN_DATA.shader,\n [...byImage.values()].filter((shader) => shown.has(shader.image))\n )\n}\n\n/**\n * A new paint that draws `preset`, and the shader entry it shows. Its image names a frame not yet\n * rendered, unique to this paint, so no other paint's entry claims it until the frame is drawn.\n */\nexport function createShaderPaint(preset: ShaderPreset): {\n paint: Fill\n shader: ShaderPaint\n} {\n const image = randomHex(20)\n return {\n paint: {\n type: 'IMAGE',\n color: TRANSPARENT,\n opacity: 1,\n visible: true,\n imageHash: image,\n imageScaleMode: 'FILL'\n },\n shader: { image, preset: structuredClone(preset) }\n }\n}\n\n/** A short key that tells one preset from another, which a rendered frame records. */\nexport function shaderPresetKey(preset: ShaderPreset): string {\n return bytesToHex(sha1(utf8ToBytes(JSON.stringify(preset))))\n}\n\n/**\n * Whether a shader's frame was rendered for its preset at the size `node` has now, so undoing a\n * preset change after reopening the document does not keep a frame of the newer preset.\n */\nexport function isShaderFrameCurrent(\n shader: ShaderPaint,\n size: { width: number; height: number }\n): boolean {\n const { frame } = shader\n return (\n frame !== undefined &&\n frame.preset === shaderPresetKey(shader.preset) &&\n Math.round(frame.width) === Math.round(size.width) &&\n Math.round(frame.height) === Math.round(size.height)\n )\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgB,iBAAiB,MAAoD;CACnF,OAAO,kBAAkB,KAAK,YAAY,wBAAwB,MAAM;AAC1E;;;;;;AAOA,SAAgB,cACd,MACA,OACoB;CACpB,IAAI,MAAM,SAAS,WAAW,CAAC,MAAM,WAAW,OAAO;CACvD,OAAO,iBAAiB,IAAI,CAAC,CAAC,MAAM,WAAW,OAAO,UAAU,MAAM,SAAS,KAAK;AACtF;;AAGA,SAAgB,eAAe,MAA2B;CACxD,OAAO,CAAC,GAAG,K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;;;;;iBAUG,eACd,MAAM,KAAK,yBACX,OAAO;iBAMO,kBAAkB,MAAM,0BAA0B,gBAAgB;iBAIlE,uBAAuB,MAAM,kBAAkB;;iBAK/C,kBAAkB,OAAO,aAAa,YAAY;iBAOlD,gBAAgB,OAAO,YAAY,MAAM,kBAAkB;iBA0B3D,uBACd,MAAM,WACN,SAAS,QAAQ,aAChB,QAAQ;;iBAmBK,gBACd,OAAO,YACP,YACA,MAAM,kBACL;;iBASa;;iBAOA,eAAe,OAAO,aAAa;;;;;iBAmCnC,iBACd,MAAM,iBACN,QAAQ,WACR,iBACA,OAAO,mBACN,QAAQ;;iBAYK,uBAAuB,MAAM,kBAAkB,QAAQ"}
1
+ {"version":3,"file":"shared-styles.d.ts","names":[],"sources":["../src/shared-styles.ts"],"mappings":";;;cAmBM;;;;;;;;cASO;;iBAGG,mBAAmB,MAAM;;cAiB5B;;cAwBA;;;;;;;;cASA;;;;;iBAUG,eACd,MAAM,KAAK,yBACX,OAAO;iBAMO,kBAAkB,MAAM,0BAA0B,gBAAgB;iBAIlE,uBAAuB,MAAM,kBAAkB;;iBAK/C,kBAAkB,OAAO,aAAa,YAAY;iBAOlD,gBAAgB,OAAO,YAAY,MAAM,kBAAkB;iBAuB3D,uBACd,MAAM,WACN,SAAS,QAAQ,aAChB,QAAQ;;iBAmBK,gBACd,OAAO,YACP,YACA,MAAM,kBACL;;iBASa;;iBAOA,eAAe,OAAO,aAAa;;;;;iBAmCnC,iBACd,MAAM,iBACN,QAAQ,WACR,iBACA,OAAO,mBACN,QAAQ;;iBAYK,uBAAuB,MAAM,kBAAkB,QAAQ"}
@@ -1,9 +1,10 @@
1
1
  import { BLACK } from "./constants.js";
2
2
  import { newStrokeGeometry } from "./node-defaults.js";
3
3
  import { copyEffects, copyFills, copyLayoutGrids } from "./copy.js";
4
- import { randomHex } from "./random.js";
4
+ import { STROKE_LINE_KEYS } from "./strokes.js";
5
5
  import { styleRunReferences } from "./text/references.js";
6
6
  import { compact, isEqual, omit, pick } from "es-toolkit";
7
+ import { randomHex } from "@open-pencil/std/random";
7
8
  //#region src/shared-styles.ts
8
9
  const STYLE_REF_KEYS = {
9
10
  fill: "fillStyleId",
@@ -99,14 +100,6 @@ function getSharedStyles(graph, kind) {
99
100
  }
100
101
  return styles.sort((left, right) => left.name.localeCompare(right.name));
101
102
  }
102
- /** What a stroke draws along beside its paint: the layer's, not its stroke style's. */
103
- const STROKE_LINE_KEYS = [
104
- "weight",
105
- "align",
106
- "cap",
107
- "join",
108
- "dashPattern"
109
- ];
110
103
  /**
111
104
  * Whether new strokes only change how their lines run, keeping every paint. A stroke style gives
112
105
  * paints only, so such a write keeps it; any other strokes write leaves it, as setting even the
@@ -1 +1 @@
1
- {"version":3,"file":"shared-styles.js","names":[],"sources":["../src/shared-styles.ts"],"sourcesContent":["import { compact, isEqual, omit, pick } from 'es-toolkit'\n\nimport { BLACK } from './constants'\nimport { copyEffects, copyFills, copyLayoutGrids } from './copy'\nimport type { SceneGraph } from './graph'\nimport { newStrokeGeometry } from './node-defaults'\nimport { randomHex } from './random'\nimport { styleRunReferences } from './text/references'\nimport type {\n CharacterStyleOverride,\n SceneNode,\n SharedStyle,\n SharedStyleKind,\n SharedStyleType,\n Stroke\n} from './types'\n\nconst STYLE_REF_KEYS = {\n fill: 'fillStyleId',\n stroke: 'strokeStyleId',\n text: 'textStyleId',\n effect: 'effectStyleId',\n grid: 'gridStyleId'\n} as const satisfies Record<SharedStyleKind, keyof SceneNode>\n\n/** The fields that link a layer to its shared styles. */\nexport const STYLE_LINK_FIELDS = Object.values(STYLE_REF_KEYS)\n\n/** The shared styles a layer uses: its own, its text ranges', and its vector regions'. */\nexport function referencedStyleIds(node: SceneNode): string[] {\n return compact([\n ...STYLE_LINK_FIELDS.map((field) => node[field]),\n ...styleRunReferences(node.styleRuns).styles,\n ...(node.vectorNetwork?.regions ?? []).map((region) => region.fillStyleId)\n ])\n}\n\nconst STYLE_TYPES = {\n fill: 'FILL',\n stroke: 'FILL',\n text: 'TEXT',\n effect: 'EFFECT',\n grid: 'GRID'\n} as const satisfies Record<SharedStyleKind, SharedStyleType>\n\n/** The fields a text style gives what uses it; changing one leaves the style. */\nexport const SHARED_TEXT_STYLE_FIELDS = [\n 'fontFamily',\n 'fontWeight',\n 'italic',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textDecoration',\n 'textCase',\n 'fontFeatures'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/**\n * The paragraph fields a text style also gives the whole text; a range takes only the character\n * ones. Changing one leaves the style, and a cleared style resets them (live-verified).\n */\nconst TEXT_STYLE_PARAGRAPH_FIELDS = [\n 'paragraphSpacing',\n 'paragraphIndent',\n 'listSpacing'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/** The fields each kind of shared style gives what uses it; changing one leaves the style. */\nexport const SHARED_STYLE_FIELDS = {\n fill: ['fills'],\n stroke: ['strokes'],\n text: [...SHARED_TEXT_STYLE_FIELDS, ...TEXT_STYLE_PARAGRAPH_FIELDS],\n effect: ['effects'],\n grid: ['layoutGrids']\n} as const satisfies Record<SharedStyleKind, readonly (keyof SceneNode)[]>\n\n/** The fields that pick a text's face, which its style name names. */\nexport const FACE_KEYS = [\n 'fontFamily',\n 'fontWeight',\n 'italic'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/**\n * The face name of characters with `style` over the text: their own, none where they set another\n * face without one (as ranges from HTML or `.pen` do), else the text's.\n */\nexport function rangeFontStyle(\n node: Pick<SceneNode, 'fontStyle'>,\n style: CharacterStyleOverride\n): string | null {\n if (style.fontStyle !== undefined) return style.fontStyle\n return FACE_KEYS.some((key) => style[key] !== undefined) ? null : node.fontStyle\n}\n\nexport function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind] {\n return STYLE_REF_KEYS[kind]\n}\n\nexport function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType {\n return STYLE_TYPES[kind]\n}\n\n/** The document's shared style layers, by the source ID layers link them by. */\nexport function sharedStyleLayers(graph: SceneGraph): Map<string, SceneNode> {\n const styles = new Map<string, SceneNode>()\n for (const node of graph.getAllNodes())\n if (node.sharedStyleType !== null && node.source.id) styles.set(node.source.id, node)\n return styles\n}\n\nexport function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[] {\n const type = sharedStyleTypeForKind(kind)\n const styles: SharedStyle[] = []\n for (const node of graph.getAllNodes()) {\n if (node.sharedStyleType !== type || !node.source.id) continue\n styles.push({ id: node.source.id, nodeId: node.id, name: node.name, type })\n }\n return styles.sort((left, right) => left.name.localeCompare(right.name))\n}\n\n/** What a stroke draws along beside its paint: the layer's, not its stroke style's. */\nconst STROKE_LINE_KEYS = ['weight', 'align', 'cap', 'join', 'dashPattern'] as const\n\n/**\n * Whether new strokes only change how their lines run, keeping every paint. A stroke style gives\n * paints only, so such a write keeps it; any other strokes write leaves it, as setting even the\n * same paints does in Figma (live-verified).\n */\nfunction restylesStrokeLines(current: readonly Stroke[], next: readonly Stroke[]): boolean {\n const paints = (strokes: readonly Stroke[]) =>\n strokes.map((stroke) => omit(stroke, STROKE_LINE_KEYS))\n const lines = (strokes: readonly Stroke[]) =>\n strokes.map((stroke) => STROKE_LINE_KEYS.map((key) => stroke[key]))\n return isEqual(paints(current), paints(next)) && !isEqual(lines(current), lines(next))\n}\n\nexport function styleDetachmentChanges(\n node: SceneNode,\n changes: Partial<SceneNode>\n): Partial<SceneNode> {\n const next = { ...changes }\n for (const [kind, fields] of Object.entries(SHARED_STYLE_FIELDS)) {\n const reference = STYLE_REF_KEYS[kind as SharedStyleKind]\n if (reference in changes || !node[reference]) continue\n if (!fields.some((field) => field in changes)) continue\n if (kind === 'stroke' && changes.strokes && restylesStrokeLines(node.strokes, changes.strokes))\n continue\n next[reference] = null\n }\n // A face named for another family, weight, or slant names none; the new one takes its own name.\n const changesFace = FACE_KEYS.some((key) => key in changes && changes[key] !== node[key])\n if (changesFace && !('fontStyle' in changes) && node.fontStyle) {\n next.fontStyle = null\n }\n return next\n}\n\n/** The node of the shared style with `id`, when the document holds one of `type`. */\nexport function findSharedStyle(\n graph: SceneGraph,\n id: string,\n type: SharedStyleType\n): SceneNode | undefined {\n if (!id) return undefined\n for (const node of graph.getAllNodes()) {\n if (node.sharedStyleType === type && node.source.id === id) return node\n }\n return undefined\n}\n\n/** A new local style's ID, in the shape Figma gives one: `S:` and a 40-digit hex key. */\nexport function newSharedStyleId(): string {\n return `S:${randomHex(20)},`\n}\n\nconst INTERNAL_CANVAS_NAME = 'Internal Only Canvas'\n\n/** The page that holds the document's styles out of view, as a `.fig` file keeps them; made once. */\nexport function internalCanvas(graph: SceneGraph): SceneNode {\n const existing = graph.getPages(true).find((page) => page.internalOnly)\n if (existing) return existing\n return graph.createNode('CANVAS', graph.rootId, {\n name: INTERNAL_CANVAS_NAME,\n width: 0,\n height: 0,\n internalOnly: true\n })\n}\n\n/**\n * A paint style's paints as a layer's strokes: every paint, each keeping the weight, alignment,\n * and line style of the stroke it replaces, or of the layer's first; no paints clear the strokes\n * (Figma desktop 126).\n */\nfunction strokesFromStyle(target: SceneNode, style: SceneNode): SceneNode['strokes'] {\n // Without strokes, the layer keeps the weight and alignment a new stroke takes.\n const fallback: Stroke = target.strokes[0] ?? {\n type: 'SOLID',\n color: BLACK,\n opacity: 1,\n visible: true,\n ...newStrokeGeometry(target)\n }\n return copyFills(style.fills).map((paint, index) => ({\n ...paint,\n ...pick(target.strokes[index] ?? fallback, STROKE_LINE_KEYS)\n }))\n}\n\n/**\n * What a layer takes from a shared style it starts using: the style's fields and the reference\n * that keeps it attached. Without the style's node, the reference alone.\n */\nexport function sharedStylePatch(\n kind: SharedStyleKind,\n target: SceneNode,\n styleId: string,\n style: SceneNode | null\n): Partial<SceneNode> {\n const patch: Partial<SceneNode> = { [STYLE_REF_KEYS[kind]]: styleId }\n if (!style) return patch\n if (kind === 'fill') patch.fills = copyFills(style.fills)\n else if (kind === 'stroke') patch.strokes = strokesFromStyle(target, style)\n else if (kind === 'effect') patch.effects = copyEffects(style.effects)\n else if (kind === 'grid') patch.layoutGrids = copyLayoutGrids(style.layoutGrids)\n else Object.assign(patch, structuredClone(pick(style, SHARED_STYLE_FIELDS.text)))\n return patch\n}\n\n/** A layer leaving a shared style: it keeps the style's values, without the reference. */\nexport function sharedStyleDetachPatch(kind: SharedStyleKind): Partial<SceneNode> {\n return { [STYLE_REF_KEYS[kind]]: null }\n}\n"],"mappings":";;;;;;;AAiBA,MAAM,iBAAiB;CACrB,MAAM;CACN,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,MAAM;AACR;;AAGA,MAAa,oBAAoB,OAAO,OAAO,cAAc;;AAG7D,SAAgB,mBAAmB,MAA2B;CAC5D,OAAO,QAAQ;EACb,GAAG,kBAAkB,KAAK,UAAU,KAAK,MAAM;EAC/C,GAAG,mBAAmB,KAAK,SAAS,CAAC,CAAC;EACtC,IAAI,KAAK,eAAe,WAAW,CAAC,EAAA,CAAG,KAAK,WAAW,OAAO,WAAW;CAC3E,CAAC;AACH;AAEA,MAAM,cAAc;CAClB,MAAM;CACN,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,MAAM;AACR;;AAGA,MAAa,2BAA2B;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAM,8BAA8B;CAClC;CACA;CACA;AACF;;AAGA,MAAa,sBAAsB;CACjC,MAAM,CAAC,OAAO;CACd,QAAQ,CAAC,SAAS;CAClB,MAAM,CAAC,GAAG,0BAA0B,GAAG,2BAA2B;CAClE,QAAQ,CAAC,SAAS;CAClB,MAAM,CAAC,aAAa;AACtB;;AAGA,MAAa,YAAY;CACvB;CACA;CACA;AACF;;;;;AAMA,SAAgB,eACd,MACA,OACe;CACf,IAAI,MAAM,cAAc,KAAA,GAAW,OAAO,MAAM;CAChD,OAAO,UAAU,MAAM,QAAQ,MAAM,SAAS,KAAA,CAAS,IAAI,OAAO,KAAK;AACzE;AAEA,SAAgB,kB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AAI,SAAS,QAAQ,MAAM,QAAQ,UAAU,MAAM,KAAK;MACnD,IAAI,SAAS,UAAU,MAAM,UAAU,iBAAiB,QAAQ,KAAK;MACrE,IAAI,SAAS,UAAU,MAAM,UAAU,YAAY,MAAM,OAAO;MAChE,IAAI,SAAS,QAAQ,MAAM,cAAc,gBAAgB,MAAM,WAAW;MAC1E,OAAO,OAAO,OAAO,gBAAgB,KAAK,OAAO,oBAAoB,IAAI,CAAC,CAAC;CAChF,OAAO;AACT;;AAGA,SAAgB,uBAAuB,MAA2C;CAChF,OAAO,GAAG,eAAe,QAAQ,KAAK;AACxC"}
1
+ {"version":3,"file":"shared-styles.js","names":[],"sources":["../src/shared-styles.ts"],"sourcesContent":["import { compact, isEqual, omit, pick } from 'es-toolkit'\n\nimport { randomHex } from '@open-pencil/std/random'\n\nimport { BLACK } from './constants'\nimport { copyEffects, copyFills, copyLayoutGrids } from './copy'\nimport type { SceneGraph } from './graph'\nimport { newStrokeGeometry } from './node-defaults'\nimport { STROKE_LINE_KEYS } from './strokes'\nimport { styleRunReferences } from './text/references'\nimport type {\n CharacterStyleOverride,\n SceneNode,\n SharedStyle,\n SharedStyleKind,\n SharedStyleType,\n Stroke\n} from './types'\n\nconst STYLE_REF_KEYS = {\n fill: 'fillStyleId',\n stroke: 'strokeStyleId',\n text: 'textStyleId',\n effect: 'effectStyleId',\n grid: 'gridStyleId'\n} as const satisfies Record<SharedStyleKind, keyof SceneNode>\n\n/** The fields that link a layer to its shared styles. */\nexport const STYLE_LINK_FIELDS = Object.values(STYLE_REF_KEYS)\n\n/** The shared styles a layer uses: its own, its text ranges', and its vector regions'. */\nexport function referencedStyleIds(node: SceneNode): string[] {\n return compact([\n ...STYLE_LINK_FIELDS.map((field) => node[field]),\n ...styleRunReferences(node.styleRuns).styles,\n ...(node.vectorNetwork?.regions ?? []).map((region) => region.fillStyleId)\n ])\n}\n\nconst STYLE_TYPES = {\n fill: 'FILL',\n stroke: 'FILL',\n text: 'TEXT',\n effect: 'EFFECT',\n grid: 'GRID'\n} as const satisfies Record<SharedStyleKind, SharedStyleType>\n\n/** The fields a text style gives what uses it; changing one leaves the style. */\nexport const SHARED_TEXT_STYLE_FIELDS = [\n 'fontFamily',\n 'fontWeight',\n 'italic',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textDecoration',\n 'textCase',\n 'fontFeatures'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/**\n * The paragraph fields a text style also gives the whole text; a range takes only the character\n * ones. Changing one leaves the style, and a cleared style resets them (live-verified).\n */\nconst TEXT_STYLE_PARAGRAPH_FIELDS = [\n 'paragraphSpacing',\n 'paragraphIndent',\n 'listSpacing'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/** The fields each kind of shared style gives what uses it; changing one leaves the style. */\nexport const SHARED_STYLE_FIELDS = {\n fill: ['fills'],\n stroke: ['strokes'],\n text: [...SHARED_TEXT_STYLE_FIELDS, ...TEXT_STYLE_PARAGRAPH_FIELDS],\n effect: ['effects'],\n grid: ['layoutGrids']\n} as const satisfies Record<SharedStyleKind, readonly (keyof SceneNode)[]>\n\n/** The fields that pick a text's face, which its style name names. */\nexport const FACE_KEYS = [\n 'fontFamily',\n 'fontWeight',\n 'italic'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/**\n * The face name of characters with `style` over the text: their own, none where they set another\n * face without one (as ranges from HTML or `.pen` do), else the text's.\n */\nexport function rangeFontStyle(\n node: Pick<SceneNode, 'fontStyle'>,\n style: CharacterStyleOverride\n): string | null {\n if (style.fontStyle !== undefined) return style.fontStyle\n return FACE_KEYS.some((key) => style[key] !== undefined) ? null : node.fontStyle\n}\n\nexport function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind] {\n return STYLE_REF_KEYS[kind]\n}\n\nexport function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType {\n return STYLE_TYPES[kind]\n}\n\n/** The document's shared style layers, by the source ID layers link them by. */\nexport function sharedStyleLayers(graph: SceneGraph): Map<string, SceneNode> {\n const styles = new Map<string, SceneNode>()\n for (const node of graph.getAllNodes())\n if (node.sharedStyleType !== null && node.source.id) styles.set(node.source.id, node)\n return styles\n}\n\nexport function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[] {\n const type = sharedStyleTypeForKind(kind)\n const styles: SharedStyle[] = []\n for (const node of graph.getAllNodes()) {\n if (node.sharedStyleType !== type || !node.source.id) continue\n styles.push({ id: node.source.id, nodeId: node.id, name: node.name, type })\n }\n return styles.sort((left, right) => left.name.localeCompare(right.name))\n}\n\n/**\n * Whether new strokes only change how their lines run, keeping every paint. A stroke style gives\n * paints only, so such a write keeps it; any other strokes write leaves it, as setting even the\n * same paints does in Figma (live-verified).\n */\nfunction restylesStrokeLines(current: readonly Stroke[], next: readonly Stroke[]): boolean {\n const paints = (strokes: readonly Stroke[]) =>\n strokes.map((stroke) => omit(stroke, STROKE_LINE_KEYS))\n const lines = (strokes: readonly Stroke[]) =>\n strokes.map((stroke) => STROKE_LINE_KEYS.map((key) => stroke[key]))\n return isEqual(paints(current), paints(next)) && !isEqual(lines(current), lines(next))\n}\n\nexport function styleDetachmentChanges(\n node: SceneNode,\n changes: Partial<SceneNode>\n): Partial<SceneNode> {\n const next = { ...changes }\n for (const [kind, fields] of Object.entries(SHARED_STYLE_FIELDS)) {\n const reference = STYLE_REF_KEYS[kind as SharedStyleKind]\n if (reference in changes || !node[reference]) continue\n if (!fields.some((field) => field in changes)) continue\n if (kind === 'stroke' && changes.strokes && restylesStrokeLines(node.strokes, changes.strokes))\n continue\n next[reference] = null\n }\n // A face named for another family, weight, or slant names none; the new one takes its own name.\n const changesFace = FACE_KEYS.some((key) => key in changes && changes[key] !== node[key])\n if (changesFace && !('fontStyle' in changes) && node.fontStyle) {\n next.fontStyle = null\n }\n return next\n}\n\n/** The node of the shared style with `id`, when the document holds one of `type`. */\nexport function findSharedStyle(\n graph: SceneGraph,\n id: string,\n type: SharedStyleType\n): SceneNode | undefined {\n if (!id) return undefined\n for (const node of graph.getAllNodes()) {\n if (node.sharedStyleType === type && node.source.id === id) return node\n }\n return undefined\n}\n\n/** A new local style's ID, in the shape Figma gives one: `S:` and a 40-digit hex key. */\nexport function newSharedStyleId(): string {\n return `S:${randomHex(20)},`\n}\n\nconst INTERNAL_CANVAS_NAME = 'Internal Only Canvas'\n\n/** The page that holds the document's styles out of view, as a `.fig` file keeps them; made once. */\nexport function internalCanvas(graph: SceneGraph): SceneNode {\n const existing = graph.getPages(true).find((page) => page.internalOnly)\n if (existing) return existing\n return graph.createNode('CANVAS', graph.rootId, {\n name: INTERNAL_CANVAS_NAME,\n width: 0,\n height: 0,\n internalOnly: true\n })\n}\n\n/**\n * A paint style's paints as a layer's strokes: every paint, each keeping the weight, alignment,\n * and line style of the stroke it replaces, or of the layer's first; no paints clear the strokes\n * (Figma desktop 126).\n */\nfunction strokesFromStyle(target: SceneNode, style: SceneNode): SceneNode['strokes'] {\n // Without strokes, the layer keeps the weight and alignment a new stroke takes.\n const fallback: Stroke = target.strokes[0] ?? {\n type: 'SOLID',\n color: BLACK,\n opacity: 1,\n visible: true,\n ...newStrokeGeometry(target)\n }\n return copyFills(style.fills).map((paint, index) => ({\n ...paint,\n ...pick(target.strokes[index] ?? fallback, STROKE_LINE_KEYS)\n }))\n}\n\n/**\n * What a layer takes from a shared style it starts using: the style's fields and the reference\n * that keeps it attached. Without the style's node, the reference alone.\n */\nexport function sharedStylePatch(\n kind: SharedStyleKind,\n target: SceneNode,\n styleId: string,\n style: SceneNode | null\n): Partial<SceneNode> {\n const patch: Partial<SceneNode> = { [STYLE_REF_KEYS[kind]]: styleId }\n if (!style) return patch\n if (kind === 'fill') patch.fills = copyFills(style.fills)\n else if (kind === 'stroke') patch.strokes = strokesFromStyle(target, style)\n else if (kind === 'effect') patch.effects = copyEffects(style.effects)\n else if (kind === 'grid') patch.layoutGrids = copyLayoutGrids(style.layoutGrids)\n else Object.assign(patch, structuredClone(pick(style, SHARED_STYLE_FIELDS.text)))\n return patch\n}\n\n/** A layer leaving a shared style: it keeps the style's values, without the reference. */\nexport function sharedStyleDetachPatch(kind: SharedStyleKind): Partial<SceneNode> {\n return { [STYLE_REF_KEYS[kind]]: null }\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,iBAAiB;CACrB,MAAM;CACN,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,MAAM;AACR;;AAGA,MAAa,oBAAoB,OAAO,OAAO,cAAc;;AAG7D,SAAgB,mBAAmB,MAA2B;CAC5D,OAAO,QAAQ;EACb,GAAG,kBAAkB,KAAK,UAAU,KAAK,MAAM;EAC/C,GAAG,mBAAmB,KAAK,SAAS,CAAC,CAAC;EACtC,IAAI,KAAK,eAAe,WAAW,CAAC,EAAA,CAAG,KAAK,WAAW,OAAO,WAAW;CAC3E,CAAC;AACH;AAEA,MAAM,cAAc;CAClB,MAAM;CACN,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,MAAM;AACR;;AAGA,MAAa,2BAA2B;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAM,8BAA8B;CAClC;CACA;CACA;AACF;;AAGA,MAAa,sBAAsB;CACjC,MAAM,CAAC,OAAO;CACd,QAAQ,CAAC,SAAS;CAClB,MAAM,CAAC,GAAG,0BAA0B,GAAG,2BAA2B;CAClE,QAAQ,CAAC,SAAS;CAClB,MAAM,CAAC,aAAa;AACtB;;AAGA,MAAa,YAAY;CACvB;CACA;CACA;AACF;;;;;AAMA,SAAgB,eACd,MACA,OACe;CACf,IAAI,MAAM,cAAc,KAAA,GAAW,OAAO,MAAM;CAChD,OAAO,UAAU,MAAM,QAAQ,MAAM,SAAS,KAAA,CAAS,IAAI,OAAO,KAAK;AACzE;AAEA,SAAgB,kBAAkB,MAAiE;CACjG,OAAO,eAAe;AACxB;AAEA,SAAgB,uBAAuB,MAAwC;CAC7E,OAAO,YAAY;AACrB;;AAGA,SAAgB,kBAAkB,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AAS,QAAQ,MAAM,cAAc,gBAAgB,MAAM,WAAW;MAC1E,OAAO,OAAO,OAAO,gBAAgB,KAAK,OAAO,oBAAoB,IAAI,CAAC,CAAC;CAChF,OAAO;AACT;;AAGA,SAAgB,uBAAuB,MAA2C;CAChF,OAAO,GAAG,eAAe,QAAQ,KAAK;AACxC"}
@@ -0,0 +1,39 @@
1
+ import { SceneNode, Stroke } from "./types.js";
2
+ //#region src/strokes.d.ts
3
+ /** What a stroke draws along beside its paint. */
4
+ declare const STROKE_LINE_KEYS: readonly ["weight", "align", "cap", "join", "dashPattern"];
5
+ type StrokeLineKey = (typeof STROKE_LINE_KEYS)[number];
6
+ /**
7
+ * The layer field that keeps each line value. Figma keeps one of each per layer; a layer here
8
+ * also keeps them on each stroke, which the renderer draws.
9
+ */
10
+ declare const STROKE_LINE_FIELDS: {
11
+ readonly weight: "strokeWeight";
12
+ readonly align: "strokeAlign";
13
+ readonly cap: "strokeCap";
14
+ readonly join: "strokeJoin";
15
+ readonly dashPattern: "dashPattern";
16
+ };
17
+ type StrokeLines = Partial<Pick<Stroke, StrokeLineKey>>;
18
+ /** The value a stroke draws with; a stroke without a dash draws solid. */
19
+ declare function strokeLine(stroke: Stroke, key: StrokeLineKey): Stroke[StrokeLineKey];
20
+ /** `strokes` with each line field `values` names, as a layer field set alone gives every stroke. */
21
+ declare function withStrokeLines(strokes: readonly Stroke[], values: StrokeLines): Stroke[];
22
+ /**
23
+ * What else `changes` sets so a layer's line fields and its strokes agree: new strokes set the
24
+ * layer's fields to the first stroke's, and a layer field set without strokes goes to every
25
+ * stroke. Strokes win when `changes` sets both, so restoring strokes restores what they draw.
26
+ * Only fields whose value changes are returned, so an instance overrides no more than an edit
27
+ * changed. A layer without strokes keeps its fields for the next stroke (`newStrokeGeometry`).
28
+ */
29
+ declare function strokeLineChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
30
+ /**
31
+ * Whether the strokes `changes` sets differ from `node`'s by more than the layer fields the same
32
+ * write sets: a paint, a stroke added or removed, or a stroke's line that no layer field records.
33
+ * Figma overrides a weight or dash set on an instance layer alone, so a component's later paint
34
+ * change still reaches the copy (live).
35
+ */
36
+ declare function changesMoreThanStrokeLines(node: SceneNode, changes: Partial<SceneNode>): boolean;
37
+ //#endregion
38
+ export { STROKE_LINE_FIELDS, STROKE_LINE_KEYS, StrokeLines, changesMoreThanStrokeLines, strokeLine, strokeLineChanges, withStrokeLines };
39
+ //# sourceMappingURL=strokes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strokes.d.ts","names":[],"sources":["../src/strokes.ts"],"mappings":";;;cAMa;KAQR,wBAAwB;;;;;cAMhB;;;;;;;KAQD,cAAc,QAAQ,KAAK,QAAQ;;iBAG/B,WAAW,QAAQ,QAAQ,KAAK,gBAAgB,OAAO;;iBAKvD,gBAAgB,kBAAkB,UAAU,QAAQ,cAAc;;;;;;;;iBAkBlE,kBACd,MAAM,WACN,SAAS,QAAQ,aAChB,QAAQ;;;;;;;iBA6CK,2BAA2B,MAAM,WAAW,SAAS,QAAQ"}
@@ -0,0 +1,104 @@
1
+ import { copyStroke } from "./copy.js";
2
+ import { isEqual } from "es-toolkit";
3
+ //#region src/strokes.ts
4
+ /** What a stroke draws along beside its paint. */
5
+ const STROKE_LINE_KEYS = [
6
+ "weight",
7
+ "align",
8
+ "cap",
9
+ "join",
10
+ "dashPattern"
11
+ ];
12
+ /**
13
+ * The layer field that keeps each line value. Figma keeps one of each per layer; a layer here
14
+ * also keeps them on each stroke, which the renderer draws.
15
+ */
16
+ const STROKE_LINE_FIELDS = {
17
+ weight: "strokeWeight",
18
+ align: "strokeAlign",
19
+ cap: "strokeCap",
20
+ join: "strokeJoin",
21
+ dashPattern: "dashPattern"
22
+ };
23
+ /** The value a stroke draws with; a stroke without a dash draws solid. */
24
+ function strokeLine(stroke, key) {
25
+ return key === "dashPattern" ? stroke.dashPattern ?? [] : stroke[key];
26
+ }
27
+ /** `strokes` with each line field `values` names, as a layer field set alone gives every stroke. */
28
+ function withStrokeLines(strokes, values) {
29
+ return strokes.map((stroke) => {
30
+ const next = copyStroke(stroke);
31
+ for (const key of STROKE_LINE_KEYS) {
32
+ const value = values[key];
33
+ if (value !== void 0) Reflect.set(next, key, structuredClone(value));
34
+ }
35
+ return next;
36
+ });
37
+ }
38
+ /**
39
+ * What else `changes` sets so a layer's line fields and its strokes agree: new strokes set the
40
+ * layer's fields to the first stroke's, and a layer field set without strokes goes to every
41
+ * stroke. Strokes win when `changes` sets both, so restoring strokes restores what they draw.
42
+ * Only fields whose value changes are returned, so an instance overrides no more than an edit
43
+ * changed. A layer without strokes keeps its fields for the next stroke (`newStrokeGeometry`).
44
+ */
45
+ function strokeLineChanges(node, changes) {
46
+ if (changes.strokes) {
47
+ const first = changes.strokes.at(0);
48
+ if (!first) return {};
49
+ const derived = {};
50
+ for (const key of STROKE_LINE_KEYS) {
51
+ const field = STROKE_LINE_FIELDS[key];
52
+ const current = field in changes ? changes[field] : node[field];
53
+ const value = strokeLine(first, key) ?? current;
54
+ if (!isEqual(current, value)) Reflect.set(derived, field, structuredClone(value));
55
+ }
56
+ const cap = derived.strokeCap ?? changes.strokeCap ?? node.strokeCap;
57
+ const join = derived.strokeJoin ?? changes.strokeJoin ?? node.strokeJoin;
58
+ if (changes.strokes.some((stroke) => stroke.cap === void 0 || stroke.join === void 0)) derived.strokes = changes.strokes.map((stroke) => ({
59
+ ...copyStroke(stroke),
60
+ cap: stroke.cap ?? cap,
61
+ join: stroke.join ?? join
62
+ }));
63
+ return derived;
64
+ }
65
+ if (node.strokes.length === 0) return {};
66
+ const values = {};
67
+ let set = false;
68
+ for (const key of STROKE_LINE_KEYS) {
69
+ const value = changes[STROKE_LINE_FIELDS[key]];
70
+ if (value === void 0) continue;
71
+ Reflect.set(values, key, value);
72
+ set = true;
73
+ }
74
+ if (!set) return {};
75
+ const strokes = withStrokeLines(node.strokes, values);
76
+ return isEqual(strokes, node.strokes) ? {} : { strokes };
77
+ }
78
+ /**
79
+ * Whether the strokes `changes` sets differ from `node`'s by more than the layer fields the same
80
+ * write sets: a paint, a stroke added or removed, or a stroke's line that no layer field records.
81
+ * Figma overrides a weight or dash set on an instance layer alone, so a component's later paint
82
+ * change still reaches the copy (live).
83
+ */
84
+ function changesMoreThanStrokeLines(node, changes) {
85
+ const next = changes.strokes;
86
+ if (!next) return false;
87
+ if (next.length !== node.strokes.length) return true;
88
+ const lines = {};
89
+ for (const key of STROKE_LINE_KEYS) {
90
+ const value = changes[STROKE_LINE_FIELDS[key]];
91
+ if (value !== void 0) Reflect.set(lines, key, value);
92
+ }
93
+ const drawn = (stroke) => ({
94
+ ...stroke,
95
+ cap: stroke.cap ?? node.strokeCap,
96
+ join: stroke.join ?? node.strokeJoin,
97
+ dashPattern: stroke.dashPattern ?? []
98
+ });
99
+ return !isEqual(withStrokeLines(node.strokes, lines).map(drawn), next.map(drawn));
100
+ }
101
+ //#endregion
102
+ export { STROKE_LINE_FIELDS, STROKE_LINE_KEYS, changesMoreThanStrokeLines, strokeLine, strokeLineChanges, withStrokeLines };
103
+
104
+ //# sourceMappingURL=strokes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strokes.js","names":[],"sources":["../src/strokes.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit'\n\nimport { copyStroke } from './copy'\nimport type { SceneNode, Stroke } from './types'\n\n/** What a stroke draws along beside its paint. */\nexport const STROKE_LINE_KEYS = [\n 'weight',\n 'align',\n 'cap',\n 'join',\n 'dashPattern'\n] as const satisfies readonly (keyof Stroke)[]\n\ntype StrokeLineKey = (typeof STROKE_LINE_KEYS)[number]\n\n/**\n * The layer field that keeps each line value. Figma keeps one of each per layer; a layer here\n * also keeps them on each stroke, which the renderer draws.\n */\nexport const STROKE_LINE_FIELDS = {\n weight: 'strokeWeight',\n align: 'strokeAlign',\n cap: 'strokeCap',\n join: 'strokeJoin',\n dashPattern: 'dashPattern'\n} as const satisfies Record<StrokeLineKey, keyof SceneNode>\n\nexport type StrokeLines = Partial<Pick<Stroke, StrokeLineKey>>\n\n/** The value a stroke draws with; a stroke without a dash draws solid. */\nexport function strokeLine(stroke: Stroke, key: StrokeLineKey): Stroke[StrokeLineKey] {\n return key === 'dashPattern' ? (stroke.dashPattern ?? []) : stroke[key]\n}\n\n/** `strokes` with each line field `values` names, as a layer field set alone gives every stroke. */\nexport function withStrokeLines(strokes: readonly Stroke[], values: StrokeLines): Stroke[] {\n return strokes.map((stroke) => {\n const next = copyStroke(stroke)\n for (const key of STROKE_LINE_KEYS) {\n const value = values[key]\n if (value !== undefined) Reflect.set(next, key, structuredClone(value))\n }\n return next\n })\n}\n\n/**\n * What else `changes` sets so a layer's line fields and its strokes agree: new strokes set the\n * layer's fields to the first stroke's, and a layer field set without strokes goes to every\n * stroke. Strokes win when `changes` sets both, so restoring strokes restores what they draw.\n * Only fields whose value changes are returned, so an instance overrides no more than an edit\n * changed. A layer without strokes keeps its fields for the next stroke (`newStrokeGeometry`).\n */\nexport function strokeLineChanges(\n node: SceneNode,\n changes: Partial<SceneNode>\n): Partial<SceneNode> {\n if (changes.strokes) {\n const first = changes.strokes.at(0)\n if (!first) return {}\n const derived: Partial<SceneNode> = {}\n for (const key of STROKE_LINE_KEYS) {\n const field = STROKE_LINE_FIELDS[key]\n const current = field in changes ? changes[field] : node[field]\n // A stroke without its own cap or join draws with the layer's.\n const value = strokeLine(first, key) ?? current\n if (!isEqual(current, value)) Reflect.set(derived, field, structuredClone(value))\n }\n // Strokes without their own cap or join take the layer's, so every stroke says what it draws.\n const cap = derived.strokeCap ?? changes.strokeCap ?? node.strokeCap\n const join = derived.strokeJoin ?? changes.strokeJoin ?? node.strokeJoin\n if (changes.strokes.some((stroke) => stroke.cap === undefined || stroke.join === undefined)) {\n derived.strokes = changes.strokes.map((stroke) => ({\n ...copyStroke(stroke),\n cap: stroke.cap ?? cap,\n join: stroke.join ?? join\n }))\n }\n return derived\n }\n if (node.strokes.length === 0) return {}\n const values: StrokeLines = {}\n let set = false\n for (const key of STROKE_LINE_KEYS) {\n const value = changes[STROKE_LINE_FIELDS[key]]\n if (value === undefined) continue\n Reflect.set(values, key, value)\n set = true\n }\n // Most writes, such as a move or a layout pass, set no line field.\n if (!set) return {}\n const strokes = withStrokeLines(node.strokes, values)\n return isEqual(strokes, node.strokes) ? {} : { strokes }\n}\n\n/**\n * Whether the strokes `changes` sets differ from `node`'s by more than the layer fields the same\n * write sets: a paint, a stroke added or removed, or a stroke's line that no layer field records.\n * Figma overrides a weight or dash set on an instance layer alone, so a component's later paint\n * change still reaches the copy (live).\n */\nexport function changesMoreThanStrokeLines(node: SceneNode, changes: Partial<SceneNode>): boolean {\n const next = changes.strokes\n if (!next) return false\n if (next.length !== node.strokes.length) return true\n const lines: StrokeLines = {}\n for (const key of STROKE_LINE_KEYS) {\n const value = changes[STROKE_LINE_FIELDS[key]]\n if (value !== undefined) Reflect.set(lines, key, value)\n }\n // Strokes written without a cap or join take the layer's, as `strokeLineChanges` gives them,\n // and a stroke without a dash draws as solid as one with an empty dash.\n const drawn = (stroke: Stroke): Stroke => ({\n ...stroke,\n cap: stroke.cap ?? node.strokeCap,\n join: stroke.join ?? node.strokeJoin,\n dashPattern: stroke.dashPattern ?? []\n })\n return !isEqual(withStrokeLines(node.strokes, lines).map(drawn), next.map(drawn))\n}\n"],"mappings":";;;;AAMA,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;AACF;;;;;AAQA,MAAa,qBAAqB;CAChC,QAAQ;CACR,OAAO;CACP,KAAK;CACL,MAAM;CACN,aAAa;AACf;;AAKA,SAAgB,WAAW,QAAgB,KAA2C;CACpF,OAAO,QAAQ,gBAAiB,OAAO,eAAe,CAAC,IAAK,OAAO;AACrE;;AAGA,SAAgB,gBAAgB,SAA4B,QAA+B;CACzF,OAAO,QAAQ,KAAK,WAAW;EAC7B,MAAM,OAAO,WAAW,MAAM;EAC9B,KAAK,MAAM,OAAO,kBAAkB;GAClC,MAAM,QAAQ,OAAO;GACrB,IAAI,UAAU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EAAE,QAAQ;AACzD;;;;;;;AAQA,SAAgB,2BAA2B,MAAiB,SAAsC;CAChG,MAAM,OAAO,QAAQ;CACrB,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,KAAK,WAAW,KAAK,QAAQ,QAAQ,OAAO;CAChD,MAAM,QAAqB,CAAC;CAC5B,KAAK,MAAM,OAAO,kBAAkB;EAClC,MAAM,QAAQ,QAAQ,mBAAmB;EACzC,IAAI,UAAU,KAAA,GAAW,QAAQ,IAAI,OAAO,KAAK,KAAK;CACxD;CAGA,MAAM,SAAS,YAA4B;EACzC,GAAG;EACH,KAAK,OAAO,OAAO,KAAK;EACxB,MAAM,OAAO,QAAQ,KAAK;EAC1B,aAAa,OAAO,eAAe,CAAC;CACtC;CACA,OAAO,CAAC,QAAQ,gBAAgB,KAAK,SAAS,KAAK,CAAC,CAAC,IAAI,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC;AAClF"}
@@ -5,4 +5,5 @@ import { StyleRunReferences, remapStyleRunReferences, styleRunReferences } from
5
5
  import { NO_LETTER_SPACING, estimatedLineStep, formatTextLength, lineHeightPixels, lineStepPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels } from "./lengths.js";
6
6
  import { TextLinesReach, textLinesReach, textVerticalOffset } from "./overflow.js";
7
7
  import { textLengthSchema } from "./schema.js";
8
- export { FigmaTextAutoResize, LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, StyleRunReferences, TEXT_PARAGRAPH_SPACING_FIELDS, TextLinesReach, TextListItem, TextParagraphRange, estimatedLineStep, figmaTextAutoResize, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, lineStepPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textAutoResizeFields, textLengthPixels, textLengthSchema, textLinesReach, textListItems, textParagraphRanges, textVerticalOffset, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
8
+ import { StyleRunPiece, appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt } from "./runs.js";
9
+ export { FigmaTextAutoResize, LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, StyleRunPiece, StyleRunReferences, TEXT_PARAGRAPH_SPACING_FIELDS, TextLinesReach, TextListItem, TextParagraphRange, appendStyleRun, characterOverrides, estimatedLineStep, figmaTextAutoResize, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, lineStepPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunAt, styleRunPieces, styleRunReferences, textAutoResizeFields, textLanguageAt, textLengthPixels, textLengthSchema, textLinesReach, textListItems, textParagraphRanges, textVerticalOffset, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
@@ -5,4 +5,5 @@ import { figmaTextAutoResize, textAutoResizeFields } from "./auto-resize.js";
5
5
  import { LIST_BULLET, formatListNumber, listNumberFormat, textListItems, topLevelNumberDigits } from "./lists.js";
6
6
  import { textLinesReach, textVerticalOffset } from "./overflow.js";
7
7
  import { textLengthSchema } from "./schema.js";
8
- export { LIST_BULLET, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, estimatedLineStep, figmaTextAutoResize, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, lineStepPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textAutoResizeFields, textLengthPixels, textLengthSchema, textLinesReach, textListItems, textParagraphRanges, textVerticalOffset, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
8
+ import { appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt } from "./runs.js";
9
+ export { LIST_BULLET, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, appendStyleRun, characterOverrides, estimatedLineStep, figmaTextAutoResize, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, lineStepPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunAt, styleRunPieces, styleRunReferences, textAutoResizeFields, textLanguageAt, textLengthPixels, textLengthSchema, textLinesReach, textListItems, textParagraphRanges, textVerticalOffset, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
@@ -0,0 +1,29 @@
1
+ import { CharacterStyleOverride, SceneNode, StyleRun } from "../types.js";
2
+ //#region src/text/runs.d.ts
3
+ /** The run that styles `text[index]`, if one does. */
4
+ declare function styleRunAt(runs: readonly StyleRun[], index: number): StyleRun | undefined;
5
+ /** The language `text[index]` is shaped in: its run's, or the text's own. */
6
+ declare function textLanguageAt(node: Pick<SceneNode, 'styleRuns' | 'textLanguage'>, index: number): string | null;
7
+ /**
8
+ * Adds `style` over `[start, start + length)` to runs built in text order, extending the last
9
+ * run instead when it ends at `start` with an equal style. An empty style or range adds nothing,
10
+ * since those characters keep the text's own style.
11
+ */
12
+ declare function appendStyleRun(runs: StyleRun[], start: number, length: number, style: CharacterStyleOverride): void;
13
+ /** A stretch of text in one style: a run's, or the text's own where `style` is null. */
14
+ interface StyleRunPiece {
15
+ start: number;
16
+ end: number;
17
+ style: CharacterStyleOverride | null;
18
+ }
19
+ /**
20
+ * The first `length` characters cut at their runs, in order and covering every character once:
21
+ * a run's part that an earlier run already covers, or that lies past the text, is left out.
22
+ * `boundary` moves each cut to where the text may be cut, such as out of a surrogate pair.
23
+ */
24
+ declare function styleRunPieces(runs: readonly StyleRun[], length: number, boundary?: (index: number) => number): StyleRunPiece[];
25
+ /** Each of the first `length` characters' overrides, merged from the runs over it in order. */
26
+ declare function characterOverrides(runs: readonly StyleRun[], length: number): CharacterStyleOverride[];
27
+ //#endregion
28
+ export { StyleRunPiece, appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt };
29
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","names":[],"sources":["../../src/text/runs.ts"],"mappings":";;;iBAKgB,WAAW,eAAe,YAAY,gBAAgB;;iBAKtD,eACd,MAAM,KAAK,0CACX;;;;;;iBAWc,eACd,MAAM,YACN,eACA,gBACA,OAAO;;UAUQ;EACf;EACA;EACA,OAAO;;;;;;;iBAQO,eACd,eAAe,YACf,gBACA,YAAW,2BACV;;iBAea,mBACd,eAAe,YACf,iBACC"}
@@ -0,0 +1,72 @@
1
+ import { isEqual } from "es-toolkit/predicate";
2
+ //#region src/text/runs.ts
3
+ /** The run that styles `text[index]`, if one does. */
4
+ function styleRunAt(runs, index) {
5
+ return runs.find((run) => index >= run.start && index < run.start + run.length);
6
+ }
7
+ /** The language `text[index]` is shaped in: its run's, or the text's own. */
8
+ function textLanguageAt(node, index) {
9
+ const language = styleRunAt(node.styleRuns, index)?.style.textLanguage;
10
+ return language !== void 0 ? language : node.textLanguage;
11
+ }
12
+ /**
13
+ * Adds `style` over `[start, start + length)` to runs built in text order, extending the last
14
+ * run instead when it ends at `start` with an equal style. An empty style or range adds nothing,
15
+ * since those characters keep the text's own style.
16
+ */
17
+ function appendStyleRun(runs, start, length, style) {
18
+ if (length <= 0 || Object.keys(style).length === 0) return;
19
+ const previous = runs.at(-1);
20
+ if (previous && previous.start + previous.length === start && isEqual(previous.style, style)) previous.length += length;
21
+ else runs.push({
22
+ start,
23
+ length,
24
+ style
25
+ });
26
+ }
27
+ /**
28
+ * The first `length` characters cut at their runs, in order and covering every character once:
29
+ * a run's part that an earlier run already covers, or that lies past the text, is left out.
30
+ * `boundary` moves each cut to where the text may be cut, such as out of a surrogate pair.
31
+ */
32
+ function styleRunPieces(runs, length, boundary = (index) => index) {
33
+ const pieces = [];
34
+ let at = 0;
35
+ for (const run of runs.toSorted((a, b) => a.start - b.start)) {
36
+ const start = Math.min(length, Math.max(at, boundary(run.start)));
37
+ const end = Math.min(length, boundary(run.start + run.length));
38
+ if (start > at) pieces.push({
39
+ start: at,
40
+ end: start,
41
+ style: null
42
+ });
43
+ if (end > start) pieces.push({
44
+ start,
45
+ end,
46
+ style: run.style
47
+ });
48
+ at = Math.max(start, end);
49
+ }
50
+ if (at < length) pieces.push({
51
+ start: at,
52
+ end: length,
53
+ style: null
54
+ });
55
+ return pieces;
56
+ }
57
+ /** Each of the first `length` characters' overrides, merged from the runs over it in order. */
58
+ function characterOverrides(runs, length) {
59
+ const styles = Array.from({ length }, () => ({}));
60
+ for (const run of runs) {
61
+ const end = Math.min(length, run.start + run.length);
62
+ for (let index = Math.max(0, run.start); index < end; index++) styles[index] = {
63
+ ...styles[index],
64
+ ...run.style
65
+ };
66
+ }
67
+ return styles;
68
+ }
69
+ //#endregion
70
+ export { appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt };
71
+
72
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","names":[],"sources":["../../src/text/runs.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit/predicate'\n\nimport type { CharacterStyleOverride, SceneNode, StyleRun } from '../types'\n\n/** The run that styles `text[index]`, if one does. */\nexport function styleRunAt(runs: readonly StyleRun[], index: number): StyleRun | undefined {\n return runs.find((run) => index >= run.start && index < run.start + run.length)\n}\n\n/** The language `text[index]` is shaped in: its run's, or the text's own. */\nexport function textLanguageAt(\n node: Pick<SceneNode, 'styleRuns' | 'textLanguage'>,\n index: number\n): string | null {\n const language = styleRunAt(node.styleRuns, index)?.style.textLanguage\n return language !== undefined ? language : node.textLanguage\n}\n\n/**\n * Adds `style` over `[start, start + length)` to runs built in text order, extending the last\n * run instead when it ends at `start` with an equal style. An empty style or range adds nothing,\n * since those characters keep the text's own style.\n */\nexport function appendStyleRun(\n runs: StyleRun[],\n start: number,\n length: number,\n style: CharacterStyleOverride\n): void {\n if (length <= 0 || Object.keys(style).length === 0) return\n const previous = runs.at(-1)\n if (previous && previous.start + previous.length === start && isEqual(previous.style, style))\n previous.length += length\n else runs.push({ start, length, style })\n}\n\n/** A stretch of text in one style: a run's, or the text's own where `style` is null. */\nexport interface StyleRunPiece {\n start: number\n end: number\n style: CharacterStyleOverride | null\n}\n\n/**\n * The first `length` characters cut at their runs, in order and covering every character once:\n * a run's part that an earlier run already covers, or that lies past the text, is left out.\n * `boundary` moves each cut to where the text may be cut, such as out of a surrogate pair.\n */\nexport function styleRunPieces(\n runs: readonly StyleRun[],\n length: number,\n boundary: (index: number) => number = (index) => index\n): StyleRunPiece[] {\n const pieces: StyleRunPiece[] = []\n let at = 0\n for (const run of runs.toSorted((a, b) => a.start - b.start)) {\n const start = Math.min(length, Math.max(at, boundary(run.start)))\n const end = Math.min(length, boundary(run.start + run.length))\n if (start > at) pieces.push({ start: at, end: start, style: null })\n if (end > start) pieces.push({ start, end, style: run.style })\n at = Math.max(start, end)\n }\n if (at < length) pieces.push({ start: at, end: length, style: null })\n return pieces\n}\n\n/** Each of the first `length` characters' overrides, merged from the runs over it in order. */\nexport function characterOverrides(\n runs: readonly StyleRun[],\n length: number\n): CharacterStyleOverride[] {\n const styles = Array.from({ length }, (): CharacterStyleOverride => ({}))\n for (const run of runs) {\n const end = Math.min(length, run.start + run.length)\n for (let index = Math.max(0, run.start); index < end; index++) {\n styles[index] = { ...styles[index], ...run.style }\n }\n }\n return styles\n}\n"],"mappings":";;;AAKA,SAAgB,WAAW,MAA2B,OAAqC;CACzF,OAAO,KAAK,MAAM,QAAQ,SAAS,IAAI,SAAS,QAAQ,IAAI,QAAQ,IAAI,MAAM;AAChF;;AAGA,SAAgB,eACd,MACA,OACe;CACf,MAAM,WAAW,WAAW,KAAK,WAAW,KAAK,CAAC,EAAE,MAAM;CAC1D,OAAO,aAAa,KAAA,IAAY,WAAW,KAAK;AAClD;;;;;;AAOA,SAAgB,eACd,MACA,OACA,QACA,OACM;CACN,IAAI,UAAU,KAAK,OAAO,KAAK,KAAK,CAAC,CAAC,WAAW,GAAG;CACpD,MAAM,WAAW,KAAK,GAAG,EAAE;CAC3B,IAAI,YAAY,SAAS,QAAQ,SAAS,WAAW,SAAS,QAAQ,SAAS,OAAO,KAAK,GACzF,SAAS,UAAU;MAChB,KAAK,KAAK;EAAE;EAAO;EAAQ;CAAM,CAAC;AACzC;;;;;;AAcA,SAAgB,eACd,MACA,QACA,YAAuC,UAAU,OAChC;CACjB,MAAM,SAA0B,CAAC;CACjC,IAAI,KAAK;CACT,KAAK,MAAM,OAAO,KAAK,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG;EAC5D,MAAM,QAAQ,KAAK,IAAI,QAAQ,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK,CAAC,CAAC;EAChE,MAAM,MAAM,KAAK,IAAI,QAAQ,SAAS,IAAI,QAAQ,IAAI,MAAM,CAAC;EAC7D,IAAI,QAAQ,IAAI,OAAO,KAAK;GAAE,OAAO;GAAI,KAAK;GAAO,OAAO;EAAK,CAAC;EAClE,IAAI,MAAM,OAAO,OAAO,KAAK;GAAE;GAAO;GAAK,OAAO,IAAI;EAAM,CAAC;EAC7D,KAAK,KAAK,IAAI,OAAO,GAAG;CAC1B;CACA,IAAI,KAAK,QAAQ,OAAO,KAAK;EAAE,OAAO;EAAI,KAAK;EAAQ,OAAO;CAAK,CAAC;CACpE,OAAO;AACT;;AAGA,SAAgB,mBACd,MACA,QAC0B;CAC1B,MAAM,SAAS,MAAM,KAAK,EAAE,OAAO,UAAkC,CAAC,EAAE;CACxE,KAAK,MAAM,OAAO,MAAM;EACtB,MAAM,MAAM,KAAK,IAAI,QAAQ,IAAI,QAAQ,IAAI,MAAM;EACnD,KAAK,IAAI,QAAQ,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,QAAQ,KAAK,SACpD,OAAO,SAAS;GAAE,GAAG,OAAO;GAAQ,GAAG,IAAI;EAAM;CAErD;CACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.d.ts","names":[],"sources":["../../src/transfer/dependencies.ts"],"mappings":";;;;UAWiB;;EAEf,WAAW;;;;;EAKX,aAAa;;EAEb,QAAQ;;EAER,QAAQ;;;iBAIM,iBAAiB,MAAM;;;;;iBAgBvB,iBAAiB,MAAM;;;;;;iBAkBvB,kBACd,OAAO,YACP,QAAQ,SAAS,aAChB;;;;;iBA8Ba,qBACd,OAAO,YACP,KAAK,mBACJ,KAAK"}
1
+ {"version":3,"file":"dependencies.d.ts","names":[],"sources":["../../src/transfer/dependencies.ts"],"mappings":";;;;UAYiB;;EAEf,WAAW;;;;;EAKX,aAAa;;EAEb,QAAQ;;EAER,QAAQ;;;iBAIM,iBAAiB,MAAM;;;;;iBAgBvB,iBAAiB,MAAM;;;;;;iBAkBvB,kBACd,OAAO,YACP,QAAQ,SAAS,aAChB;;;;;iBA8Ba,qBACd,OAAO,YACP,KAAK,mBACJ,KAAK"}
@@ -1,10 +1,10 @@
1
1
  import { overriddenBindingField } from "../instances/overrides.js";
2
- import { appendAll } from "../arrays.js";
3
2
  import { isUnsupportedVariableValue, variableValueReferences } from "../variables/value.js";
4
3
  import { styleRunReferences } from "../text/references.js";
5
4
  import { referencedStyleIds, sharedStyleLayers } from "../shared-styles.js";
6
5
  import { regionFills } from "../vector-network.js";
7
6
  import { imagePaintHashes } from "../images.js";
7
+ import { appendAll } from "@open-pencil/std/arrays";
8
8
  //#region src/transfer/dependencies.ts
9
9
  /** The variables a layer names: its own bindings, its characters', and its overrides'. */
10
10
  function layerVariableIds(node) {
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","names":[],"sources":["../../src/transfer/dependencies.ts"],"sourcesContent":["import { appendAll } from '../arrays'\nimport type { SceneGraph } from '../graph'\nimport { imagePaintHashes } from '../images'\nimport { overriddenBindingField } from '../instances/overrides'\nimport { referencedStyleIds, sharedStyleLayers } from '../shared-styles'\nimport { styleRunReferences } from '../text/references'\nimport type { SceneNode } from '../types'\nimport { isUnsupportedVariableValue, variableValueReferences } from '../variables/value'\nimport { regionFills } from '../vector-network'\n\n/** What layers need from their document to draw the same in another one. */\nexport interface LayerDependencies {\n /** The variables the layers and their styles bind, and every variable those alias. */\n variables: Set<string>\n /**\n * The collections of those variables, those the layers set a mode of, and those a kept\n * expression names a mode of.\n */\n collections: Set<string>\n /** The shared styles the layers use, as the style layers that define them. */\n styles: SceneNode[]\n /** The images the layers and their styles paint with. */\n images: Set<string>\n}\n\n/** The variables a layer names: its own bindings, its characters', and its overrides'. */\nexport function layerVariableIds(node: SceneNode): string[] {\n const { self, descendants } = node.instanceOverrides\n const overridden = [...self, ...[...descendants.values()].flatMap((fields) => [...fields])]\n return [\n ...Object.values(node.boundVariables),\n ...styleRunReferences(node.styleRuns).variables,\n ...overridden.flatMap(([field, value]) =>\n typeof value === 'string' && overriddenBindingField(field) !== null ? [value] : []\n )\n ]\n}\n\n/**\n * The images a layer paints with: its fills, strokes, vector regions, text decorations, and\n * characters.\n */\nexport function layerImageHashes(node: SceneNode): string[] {\n return imagePaintHashes([\n ...node.fills,\n ...node.strokes,\n ...regionFills(node.vectorNetwork),\n ...node.textDecorationFills,\n ...node.styleRuns.flatMap((run) => [\n ...(run.style.fills ?? []),\n ...(run.style.textDecorationFills ?? [])\n ])\n ])\n}\n\n/**\n * The variables, collections, styles, and images `layers` depend on, as a copy into another\n * document must carry them: a style brings what it binds and paints with in turn, and a variable\n * brings the variables it aliases.\n */\nexport function layerDependencies(\n graph: SceneGraph,\n layers: Iterable<SceneNode>\n): LayerDependencies {\n const collections = new Set<string>()\n const images = new Set<string>()\n const styles = new Map<string, SceneNode>()\n const pending: string[] = []\n let styleLayers: Map<string, SceneNode> | undefined\n const styleLayer = (id: string): SceneNode | undefined =>\n (styleLayers ??= sharedStyleLayers(graph)).get(id)\n const visit = (node: SceneNode): void => {\n for (const hash of layerImageHashes(node)) images.add(hash)\n appendAll(pending, layerVariableIds(node))\n for (const id of Object.keys(node.variableModes))\n if (graph.variableCollections.has(id)) collections.add(id)\n for (const id of referencedStyleIds(node)) {\n const style = styles.has(id) ? undefined : styleLayer(id)\n if (!style) continue\n styles.set(id, style)\n visit(style)\n }\n }\n for (const node of layers) visit(node)\n const resolved = variableDependencies(graph, pending)\n for (const id of resolved.collections) collections.add(id)\n return { variables: resolved.variables, collections, styles: [...styles.values()], images }\n}\n\n/**\n * These variables and every variable they alias, at any depth, with their collections and the\n * collections a kept expression names a mode of.\n */\nexport function variableDependencies(\n graph: SceneGraph,\n ids: Iterable<string>\n): Pick<LayerDependencies, 'variables' | 'collections'> {\n const pending = [...ids]\n const variables = new Set<string>()\n const collections = new Set<string>()\n let modeCollections: Map<string, string> | undefined\n const collectionOfMode = (modeId: string): string | undefined => {\n modeCollections ??= new Map(\n [...graph.variableCollections.values()].flatMap((collection) =>\n collection.modes.map((mode) => [mode.modeId, collection.id] as const)\n )\n )\n return modeCollections.get(modeId)\n }\n for (let id = pending.pop(); id !== undefined; id = pending.pop()) {\n if (variables.has(id)) continue\n const variable = graph.variables.get(id)\n if (!variable) continue\n variables.add(id)\n collections.add(variable.collectionId)\n for (const value of Object.values(variable.valuesByMode)) {\n appendAll(pending, variableValueReferences(value))\n // A kept expression can name a mode of a collection none of its aliases reach.\n if (!isUnsupportedVariableValue(value)) continue\n for (const modeId of value.modes) {\n const collection = collectionOfMode(modeId)\n if (collection) collections.add(collection)\n }\n }\n }\n return { variables, collections }\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,iBAAiB,MAA2B;CAC1D,MAAM,EAAE,MAAM,gBAAgB,KAAK;CACnC,MAAM,aAAa,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,MAAM,CAAC,CAAC;CAC1F,OAAO;EACL,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,mBAAmB,KAAK,SAAS,CAAC,CAAC;EACtC,GAAG,WAAW,SAAS,CAAC,OAAO,WAC7B,OAAO,UAAU,YAAY,uBAAuB,KAAK,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,CACnF;CACF;AACF;;;;;AAMA,SAAgB,iBAAiB,MAA2B;CAC1D,OAAO,iBAAiB;EACtB,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG,YAAY,KAAK,aAAa;EACjC,GAAG,KAAK;EACR,GAAG,KAAK,UAAU,SAAS,QAAQ,CACjC,GAAI,IAAI,MAAM,SAAS,CAAC,GACxB,GAAI,IAAI,MAAM,uBAAuB,CAAC,CACxC,CAAC;CACH,CAAC;AACH;;;;;;AAOA,SAAgB,kBACd,OACA,QACmB;CACnB,MAAM,8BAAc,IAAI,IAAY;CACpC,MAAM,yBAAS,IAAI,IAAY;CAC/B,MAAM,yBAAS,IAAI,IAAuB;CAC1C,MAAM,UAAoB,CAAC;CAC3B,IAAI;CACJ,MAAM,cAAc,QACjB,gBAAgB,kBAAkB,KAAK,EAAA,CAAG,IAAI,EAAE;CACnD,MAAM,SAAS,SAA0B;EACvC,KAAK,MAAM,QAAQ,iBAAiB,IAAI,GAAG,OAAO,IAAI,IAAI;EAC1D,UAAU,SAAS,iB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D,UAAU,SAAS,wBAAwB,KAAK,CAAC;GAEjD,IAAI,CAAC,2BAA2B,KAAK,GAAG;GACxC,KAAK,MAAM,UAAU,MAAM,OAAO;IAChC,MAAM,aAAa,iBAAiB,MAAM;IAC1C,IAAI,YAAY,YAAY,IAAI,UAAU;GAC5C;EACF;CACF;CACA,OAAO;EAAE;EAAW;CAAY;AAClC"}
1
+ {"version":3,"file":"dependencies.js","names":[],"sources":["../../src/transfer/dependencies.ts"],"sourcesContent":["import { appendAll } from '@open-pencil/std/arrays'\n\nimport type { SceneGraph } from '../graph'\nimport { imagePaintHashes } from '../images'\nimport { overriddenBindingField } from '../instances/overrides'\nimport { referencedStyleIds, sharedStyleLayers } from '../shared-styles'\nimport { styleRunReferences } from '../text/references'\nimport type { SceneNode } from '../types'\nimport { isUnsupportedVariableValue, variableValueReferences } from '../variables/value'\nimport { regionFills } from '../vector-network'\n\n/** What layers need from their document to draw the same in another one. */\nexport interface LayerDependencies {\n /** The variables the layers and their styles bind, and every variable those alias. */\n variables: Set<string>\n /**\n * The collections of those variables, those the layers set a mode of, and those a kept\n * expression names a mode of.\n */\n collections: Set<string>\n /** The shared styles the layers use, as the style layers that define them. */\n styles: SceneNode[]\n /** The images the layers and their styles paint with. */\n images: Set<string>\n}\n\n/** The variables a layer names: its own bindings, its characters', and its overrides'. */\nexport function layerVariableIds(node: SceneNode): string[] {\n const { self, descendants } = node.instanceOverrides\n const overridden = [...self, ...[...descendants.values()].flatMap((fields) => [...fields])]\n return [\n ...Object.values(node.boundVariables),\n ...styleRunReferences(node.styleRuns).variables,\n ...overridden.flatMap(([field, value]) =>\n typeof value === 'string' && overriddenBindingField(field) !== null ? [value] : []\n )\n ]\n}\n\n/**\n * The images a layer paints with: its fills, strokes, vector regions, text decorations, and\n * characters.\n */\nexport function layerImageHashes(node: SceneNode): string[] {\n return imagePaintHashes([\n ...node.fills,\n ...node.strokes,\n ...regionFills(node.vectorNetwork),\n ...node.textDecorationFills,\n ...node.styleRuns.flatMap((run) => [\n ...(run.style.fills ?? []),\n ...(run.style.textDecorationFills ?? [])\n ])\n ])\n}\n\n/**\n * The variables, collections, styles, and images `layers` depend on, as a copy into another\n * document must carry them: a style brings what it binds and paints with in turn, and a variable\n * brings the variables it aliases.\n */\nexport function layerDependencies(\n graph: SceneGraph,\n layers: Iterable<SceneNode>\n): LayerDependencies {\n const collections = new Set<string>()\n const images = new Set<string>()\n const styles = new Map<string, SceneNode>()\n const pending: string[] = []\n let styleLayers: Map<string, SceneNode> | undefined\n const styleLayer = (id: string): SceneNode | undefined =>\n (styleLayers ??= sharedStyleLayers(graph)).get(id)\n const visit = (node: SceneNode): void => {\n for (const hash of layerImageHashes(node)) images.add(hash)\n appendAll(pending, layerVariableIds(node))\n for (const id of Object.keys(node.variableModes))\n if (graph.variableCollections.has(id)) collections.add(id)\n for (const id of referencedStyleIds(node)) {\n const style = styles.has(id) ? undefined : styleLayer(id)\n if (!style) continue\n styles.set(id, style)\n visit(style)\n }\n }\n for (const node of layers) visit(node)\n const resolved = variableDependencies(graph, pending)\n for (const id of resolved.collections) collections.add(id)\n return { variables: resolved.variables, collections, styles: [...styles.values()], images }\n}\n\n/**\n * These variables and every variable they alias, at any depth, with their collections and the\n * collections a kept expression names a mode of.\n */\nexport function variableDependencies(\n graph: SceneGraph,\n ids: Iterable<string>\n): Pick<LayerDependencies, 'variables' | 'collections'> {\n const pending = [...ids]\n const variables = new Set<string>()\n const collections = new Set<string>()\n let modeCollections: Map<string, string> | undefined\n const collectionOfMode = (modeId: string): string | undefined => {\n modeCollections ??= new Map(\n [...graph.variableCollections.values()].flatMap((collection) =>\n collection.modes.map((mode) => [mode.modeId, collection.id] as const)\n )\n )\n return modeCollections.get(modeId)\n }\n for (let id = pending.pop(); id !== undefined; id = pending.pop()) {\n if (variables.has(id)) continue\n const variable = graph.variables.get(id)\n if (!variable) continue\n variables.add(id)\n collections.add(variable.collectionId)\n for (const value of Object.values(variable.valuesByMode)) {\n appendAll(pending, variableValueReferences(value))\n // A kept expression can name a mode of a collection none of its aliases reach.\n if (!isUnsupportedVariableValue(value)) continue\n for (const modeId of value.modes) {\n const collection = collectionOfMode(modeId)\n if (collection) collections.add(collection)\n }\n }\n }\n return { variables, collections }\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,iBAAiB,MAA2B;CAC1D,MAAM,EAAE,MAAM,gBAAgB,KAAK;CACnC,MAAM,aAAa,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,MAAM,CAAC,CAAC;CAC1F,OAAO;EACL,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,mBAAmB,KAAK,SAAS,CAAC,CAAC;EACtC,GAAG,WAAW,SAAS,CAAC,OAAO,WAC7B,OAAO,UAAU,YAAY,uBAAuB,KAAK,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,CACnF;CACF;AACF;;;;;AAMA,SAAgB,iBAAiB,MAA2B;CAC1D,OAAO,iBAAiB;EACtB,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG,YAAY,KAAK,aAAa;EACjC,GAAG,KAAK;EACR,GAAG,KAAK,UAAU,SAAS,QAAQ,CACjC,GAAI,IAAI,MAAM,SAAS,CAAC,GACxB,GAAI,IAAI,MAAM,uBAAuB,CAAC,CACxC,CAAC;CACH,CAAC;AACH;;;;;;AAOA,SAAgB,kBACd,OACA,QACmB;CACnB,MAAM,8BAAc,IAAI,IAAY;CACpC,MAAM,yBAAS,IAAI,IAAY;CAC/B,MAAM,yBAAS,IAAI,IAAuB;CAC1C,MAAM,UAAoB,CAAC;CAC3B,IAAI;CACJ,MAAM,cAAc,QACjB,gBAAgB,kBAAkB,KAAK,EAAA,CAAG,IAAI,EAAE;CACnD,MAAM,SAAS,SAA0B;EACvC,KAAK,MAAM,QAAQ,iBAAiB,IAAI,GAAG,OAAO,IAAI,IAAI;EAC1D,UAAU,SAAS,iBAAiB,IAAI,CAAC;EACz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,KAAK,CAAC;GAEjD,IAAI,CAAC,2BAA2B,KAAK,GAAG;GACxC,KAAK,MAAM,UAAU,MAAM,OAAO;IAChC,MAAM,aAAa,iBAAiB,MAAM;IAC1C,IAAI,YAAY,YAAY,IAAI,UAAU;GAC5C;EACF;CACF;CACA,OAAO;EAAE;EAAW;CAAY;AAClC"}
package/dist/types.d.ts CHANGED
@@ -108,6 +108,16 @@ interface GradientStop {
108
108
  position: number;
109
109
  }
110
110
  type GradientTransform = Matrix;
111
+ /** Figma's adjustments of an image paint, each from -1 to 1; 0 leaves the image as it is. */
112
+ interface ImageFilters {
113
+ exposure?: number;
114
+ contrast?: number;
115
+ saturation?: number;
116
+ temperature?: number;
117
+ tint?: number;
118
+ highlights?: number;
119
+ shadows?: number;
120
+ }
111
121
  interface Fill {
112
122
  type: FillType;
113
123
  color: Color;
@@ -125,6 +135,8 @@ interface Fill {
125
135
  imageTransform?: GradientTransform;
126
136
  /** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */
127
137
  imageRotation?: number;
138
+ /** An image's adjustments, kept and saved; the canvas does not draw them. */
139
+ filters?: ImageFilters;
128
140
  sourceNodeId?: string;
129
141
  scale?: number;
130
142
  spacing?: number;
@@ -194,8 +206,33 @@ interface ProgressiveBlur {
194
206
  startOffset: Vector;
195
207
  endOffset: Vector;
196
208
  }
209
+ /**
210
+ * A Noise effect's grain, in Figma's plugin terms: `MONOTONE` grains in the effect's colour,
211
+ * `DUOTONE` in it and `secondaryColor`, `MULTITONE` in many colours at `opacity`. `noiseSize` is a
212
+ * grain's size in px, which Figma keeps within 0 to 100, and `density` how much of the layer the
213
+ * grains cover, 0 to 1. `seed` picks the pattern; Figma's plugin API neither shows nor sets it.
214
+ */
215
+ interface NoiseEffectParams {
216
+ noiseType: NoiseType;
217
+ noiseSize: Vector;
218
+ density: number;
219
+ secondaryColor?: Color;
220
+ opacity?: number;
221
+ seed?: number;
222
+ }
223
+ /**
224
+ * A Texture effect's grain, which roughens the layer's edges: `noiseSize` is the grain's size in
225
+ * px, within 0 to 100 as Figma keeps it, and `clipToShape` keeps the roughened layer inside its
226
+ * own outline. The effect's `radius` is how far the grain moves the edges. `.fig` files name the
227
+ * effect `GRAIN`.
228
+ */
229
+ interface TextureEffectParams {
230
+ noiseSize: Vector;
231
+ clipToShape: boolean;
232
+ seed?: number;
233
+ }
197
234
  interface Effect {
198
- type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR' | 'GLASS';
235
+ type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR' | 'GLASS' | 'NOISE' | 'TEXTURE';
199
236
  color: Color;
200
237
  offset: Vector;
201
238
  radius: number;
@@ -207,6 +244,10 @@ interface Effect {
207
244
  glass?: GlassEffectParams;
208
245
  /** Set on a layer or background blur that is progressive, and only there. */
209
246
  progressive?: ProgressiveBlur;
247
+ /** Set on a `NOISE` effect, and only there. */
248
+ noise?: NoiseEffectParams;
249
+ /** Set on a `TEXTURE` effect, and only there. */
250
+ texture?: TextureEffectParams;
210
251
  }
211
252
  type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE';
212
253
  type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT';
@@ -473,6 +514,8 @@ interface CommentReply {
473
514
  author: string;
474
515
  /** The author's collaboration color when they wrote it, for their avatar. */
475
516
  authorColor?: Color;
517
+ /** The agent that wrote it, for `author` or as itself. */
518
+ agent?: string;
476
519
  /** Markdown: bold, italic, strikethrough, links and lists. */
477
520
  text: string;
478
521
  createdAt: string;
@@ -496,6 +539,8 @@ interface CommentThread {
496
539
  author: string;
497
540
  /** The author's collaboration color when they wrote it, for their avatar. */
498
541
  authorColor?: Color;
542
+ /** The agent that wrote it, for `author` or as itself. */
543
+ agent?: string;
499
544
  /** Markdown: bold, italic, strikethrough, links and lists. */
500
545
  text: string;
501
546
  createdAt: string;
@@ -908,5 +953,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
908
953
  declare const MODE_ATTRIBUTE_PATTERN: RegExp;
909
954
  declare function isModeAttributeName(name: string): boolean;
910
955
  //#endregion
911
- export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, DocumentRecordKind, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GlassEffectParams, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, ProgressiveBlur, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
956
+ export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, DocumentRecordKind, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GlassEffectParams, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseEffectParams, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, ProgressiveBlur, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TextureEffectParams, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
912
957
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;UAQiB;EACf,iBAAiB,MAAM;EACvB,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,wBAAwB,YAAY,SAAS,QAAQ;EACrD,iBAAiB,YAAY;EAC7B,oBAAoB,gBAAgB,4BAA4B;EAChE,mBACE,gBACA,kBACA,eACA;;KAIQ,0BAA0B;EACpC,UAAU,MAAM;EAChB,UAAU,YAAY,SAAS,QAAQ;EACvC,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,UAAU,YAAY;EACtB,aAAa,gBAAgB,4BAA4B;EACzD,YACE,gBACA,kBACA,eACA;;;KAKQ;;UAGK;;EAEf,SAAS,MAAM;;EAEf,UAAU,MAAM;;EAEhB,aAAa,MAAM;;;;;EAKnB,gBAAgB,MAAM,oBAAoB;;;;;EAK1C;EACA;;KAGU;;KAGA;UAEK;EACf,SAAS;EACT,cAAc;EACd,eAAe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,KAAK;;KAGK;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA,kBAAkB;;UAGH;EACf;EACA;EACA,cAAc;EACd,YAAY;;UAGG;EACf,aAAa;EACb;;EAEA,QAAQ;;EAER;;UAGe;EACf,UAAU;EACV,UAAU;EACV,SAAS;;UAGM;EACf,aAAa;EACb,cAAc;;KAGJ;KAqBA;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EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;;KAGU;;KAEA;;KAEA;KAEA;UAEK;EACf,QAAQ;EACR;;UAGe;EACf;EACA;EACA;EACA;;KAEU;KACA;KACA;KACA;UAEK;EACf;EACA;EACA;;;UAIe;EACf;EACA;;;KAIU;;;;;UAMK;EACf;EACA,QAAQ;;EAER;;EAEA,OAAO;;EAEP;;EAEA;EACA,eAAe;;EAEf;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;;;;;;UAQe;EACf,SAAS;EACT,gBAAgB;;EAEhB;EACA;;EAEA;;UAGe;;EAEf;EACA,cAAc;EACd;EACA;EACA;;EAEA;;;;;EAKA;;;;;;;EAOA;EACA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;;KAGU,sBAAsB,QAChC,oOAaE,qMAWA;UAGa;EACf;EACA;EACA;;UAGe;EACf,UAAU;EACV;EACA;;UAGe;EACf;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA,cAAc;;EAEd;EACA;EACA;;;UAIe;EACf;EACA;;EAEA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;EACA;;EAEA,cAAc;;EAEd;EACA;;EAEA;EACA;EACA;;EAEA;EACA,SAAS;;UAGM;EACf;EACA,MAAM;EACN;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA,QAAQ;;EAER,eAAe,QAAQ;EAEvB,OAAO;EACP,SAAS;EACT,SAAS;EACT,aAAa;EACb,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA,WAAW;EAEX;EACA;EACA;EACA;EACA;;;;;EAKA;EACA;EACA,eAAe;EACf;EACA,mBAAmB;EACnB,gBAAgB;EAChB,UAAU;EACV,gBAAgB;EAChB,qBAAqB;EACrB;EACA,qBAAqB;EACrB;EACA;EACA,aAAa;;EAEb,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