@pairdraw/scene-graph 0.18.0 → 0.19.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.
Files changed (181) hide show
  1. package/dist/components/index.d.ts +2 -2
  2. package/dist/components/index.js +2 -2
  3. package/dist/components/properties.d.ts +6 -1
  4. package/dist/components/properties.d.ts.map +1 -1
  5. package/dist/components/properties.js +14 -3
  6. package/dist/components/properties.js.map +1 -1
  7. package/dist/copy.d.ts.map +1 -1
  8. package/dist/copy.js +1 -0
  9. package/dist/copy.js.map +1 -1
  10. package/dist/css/gradient.d.ts +23 -0
  11. package/dist/css/gradient.d.ts.map +1 -0
  12. package/dist/css/gradient.js +404 -0
  13. package/dist/css/gradient.js.map +1 -0
  14. package/dist/css/index.d.ts +2 -1
  15. package/dist/css/index.js +2 -1
  16. package/dist/css/shadows.d.ts.map +1 -1
  17. package/dist/css/shadows.js +2 -13
  18. package/dist/css/shadows.js.map +1 -1
  19. package/dist/css/values.js +24 -1
  20. package/dist/css/values.js.map +1 -1
  21. package/dist/font-style.d.ts +2 -1
  22. package/dist/font-style.d.ts.map +1 -1
  23. package/dist/font-style.js +31 -6
  24. package/dist/font-style.js.map +1 -1
  25. package/dist/geometry.d.ts +10 -1
  26. package/dist/geometry.d.ts.map +1 -1
  27. package/dist/geometry.js +21 -6
  28. package/dist/geometry.js.map +1 -1
  29. package/dist/graph.d.ts +49 -3
  30. package/dist/graph.d.ts.map +1 -1
  31. package/dist/graph.js +179 -17
  32. package/dist/graph.js.map +1 -1
  33. package/dist/hit-test.d.ts +3 -1
  34. package/dist/hit-test.d.ts.map +1 -1
  35. package/dist/hit-test.js +38 -23
  36. package/dist/hit-test.js.map +1 -1
  37. package/dist/icons/index.d.ts +2 -2
  38. package/dist/icons/index.js +2 -2
  39. package/dist/icons/model.d.ts +8 -2
  40. package/dist/icons/model.d.ts.map +1 -1
  41. package/dist/icons/model.js +10 -1
  42. package/dist/icons/model.js.map +1 -1
  43. package/dist/index.d.ts +2 -2
  44. package/dist/instances/assignments.js +40 -6
  45. package/dist/instances/assignments.js.map +1 -1
  46. package/dist/instances/fields.d.ts +2 -2
  47. package/dist/instances/fields.d.ts.map +1 -1
  48. package/dist/instances/fields.js +18 -1
  49. package/dist/instances/fields.js.map +1 -1
  50. package/dist/instances/index.d.ts +38 -2
  51. package/dist/instances/index.d.ts.map +1 -1
  52. package/dist/instances/index.js +134 -15
  53. package/dist/instances/index.js.map +1 -1
  54. package/dist/instances/overrides.d.ts +10 -1
  55. package/dist/instances/overrides.d.ts.map +1 -1
  56. package/dist/instances/overrides.js +28 -2
  57. package/dist/instances/overrides.js.map +1 -1
  58. package/dist/instances/placement.js +1 -1
  59. package/dist/instances/placement.js.map +1 -1
  60. package/dist/instances/swap-overrides.js +94 -0
  61. package/dist/instances/swap-overrides.js.map +1 -0
  62. package/dist/instances/sync.js +90 -12
  63. package/dist/instances/sync.js.map +1 -1
  64. package/dist/layout/draw-order.d.ts +11 -0
  65. package/dist/layout/draw-order.d.ts.map +1 -0
  66. package/dist/layout/draw-order.js +14 -0
  67. package/dist/layout/draw-order.js.map +1 -0
  68. package/dist/layout/index.d.ts +2 -1
  69. package/dist/layout/index.js +2 -1
  70. package/dist/node-defaults.d.ts +11 -1
  71. package/dist/node-defaults.d.ts.map +1 -1
  72. package/dist/node-defaults.js +16 -1
  73. package/dist/node-defaults.js.map +1 -1
  74. package/dist/order-keys.d.ts +3 -1
  75. package/dist/order-keys.d.ts.map +1 -1
  76. package/dist/order-keys.js +6 -1
  77. package/dist/order-keys.js.map +1 -1
  78. package/dist/resize.d.ts +29 -9
  79. package/dist/resize.d.ts.map +1 -1
  80. package/dist/resize.js +95 -62
  81. package/dist/resize.js.map +1 -1
  82. package/dist/shared-styles.d.ts.map +1 -1
  83. package/dist/shared-styles.js +1 -8
  84. package/dist/shared-styles.js.map +1 -1
  85. package/dist/slots/authoring.d.ts +3 -2
  86. package/dist/slots/authoring.d.ts.map +1 -1
  87. package/dist/slots/authoring.js +5 -3
  88. package/dist/slots/authoring.js.map +1 -1
  89. package/dist/slots/content.d.ts.map +1 -1
  90. package/dist/slots/content.js +4 -1
  91. package/dist/slots/content.js.map +1 -1
  92. package/dist/source-metadata.d.ts +4 -2
  93. package/dist/source-metadata.d.ts.map +1 -1
  94. package/dist/source-metadata.js +10 -3
  95. package/dist/source-metadata.js.map +1 -1
  96. package/dist/strokes.d.ts +39 -0
  97. package/dist/strokes.d.ts.map +1 -0
  98. package/dist/strokes.js +104 -0
  99. package/dist/strokes.js.map +1 -0
  100. package/dist/text/direction.d.ts +6 -2
  101. package/dist/text/direction.d.ts.map +1 -1
  102. package/dist/text/direction.js +2 -1
  103. package/dist/text/direction.js.map +1 -1
  104. package/dist/text/index.d.ts +3 -3
  105. package/dist/text/index.js +3 -3
  106. package/dist/text/lengths.d.ts +6 -1
  107. package/dist/text/lengths.d.ts.map +1 -1
  108. package/dist/text/lengths.js +10 -1
  109. package/dist/text/lengths.js.map +1 -1
  110. package/dist/text/overflow.d.ts +22 -6
  111. package/dist/text/overflow.d.ts.map +1 -1
  112. package/dist/text/overflow.js +24 -6
  113. package/dist/text/overflow.js.map +1 -1
  114. package/dist/transfer/nodes.js +9 -5
  115. package/dist/transfer/nodes.js.map +1 -1
  116. package/dist/types.d.ts +18 -2
  117. package/dist/types.d.ts.map +1 -1
  118. package/dist/types.js.map +1 -1
  119. package/dist/undo.d.ts +36 -1
  120. package/dist/undo.d.ts.map +1 -1
  121. package/dist/undo.js +52 -2
  122. package/dist/undo.js.map +1 -1
  123. package/dist/variables/bindings.d.ts +14 -6
  124. package/dist/variables/bindings.d.ts.map +1 -1
  125. package/dist/variables/bindings.js +42 -67
  126. package/dist/variables/bindings.js.map +1 -1
  127. package/dist/variables/formula/signatures.js +1 -1
  128. package/dist/variables/index.d.ts +10 -4
  129. package/dist/variables/index.d.ts.map +1 -1
  130. package/dist/variables/index.js +58 -15
  131. package/dist/variables/index.js.map +1 -1
  132. package/dist/variables/paints.d.ts +101 -0
  133. package/dist/variables/paints.d.ts.map +1 -0
  134. package/dist/variables/paints.js +313 -0
  135. package/dist/variables/paints.js.map +1 -0
  136. package/dist/variables/resolution.d.ts +14 -1
  137. package/dist/variables/resolution.d.ts.map +1 -1
  138. package/dist/variables/resolution.js +44 -4
  139. package/dist/variables/resolution.js.map +1 -1
  140. package/dist/variables/subtree.js +17 -0
  141. package/dist/variables/subtree.js.map +1 -0
  142. package/package.json +6 -1
  143. package/src/components/properties.ts +17 -2
  144. package/src/copy.ts +1 -0
  145. package/src/css/gradient.ts +438 -0
  146. package/src/css/index.ts +1 -0
  147. package/src/css/shadows.ts +2 -18
  148. package/src/css/values.ts +27 -1
  149. package/src/font-style.ts +38 -4
  150. package/src/geometry.ts +25 -6
  151. package/src/graph.ts +207 -17
  152. package/src/hit-test.ts +67 -24
  153. package/src/icons/model.ts +11 -1
  154. package/src/instances/assignments.ts +65 -7
  155. package/src/instances/fields.ts +21 -0
  156. package/src/instances/index.ts +237 -14
  157. package/src/instances/overrides.ts +36 -1
  158. package/src/instances/placement.ts +5 -1
  159. package/src/instances/swap-overrides.ts +123 -0
  160. package/src/instances/sync.ts +139 -12
  161. package/src/layout/draw-order.ts +13 -0
  162. package/src/layout/index.ts +1 -0
  163. package/src/node-defaults.ts +21 -0
  164. package/src/order-keys.ts +6 -0
  165. package/src/resize.ts +133 -69
  166. package/src/shared-styles.ts +1 -3
  167. package/src/slots/authoring.ts +5 -3
  168. package/src/slots/content.ts +4 -1
  169. package/src/source-metadata.ts +18 -3
  170. package/src/strokes.ts +121 -0
  171. package/src/text/direction.ts +7 -5
  172. package/src/text/lengths.ts +10 -0
  173. package/src/text/overflow.ts +30 -7
  174. package/src/transfer/nodes.ts +7 -5
  175. package/src/types.ts +17 -0
  176. package/src/undo.ts +79 -2
  177. package/src/variables/bindings.ts +52 -74
  178. package/src/variables/index.ts +80 -14
  179. package/src/variables/paints.ts +413 -0
  180. package/src/variables/resolution.ts +56 -5
  181. package/src/variables/subtree.ts +15 -0
@@ -1,7 +1,7 @@
1
- import { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels } from "./lengths.js";
2
- import { textLinesOverflow } from "./overflow.js";
1
+ import { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, lineStepPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels } from "./lengths.js";
2
+ import { textLinesReach, textVerticalOffset } from "./overflow.js";
3
3
  import { MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, hasParagraphSpacing, hasTextList, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./paragraphs.js";
4
4
  import { LIST_BULLET, formatListNumber, listNumberFormat, textListItems, topLevelNumberDigits } from "./lists.js";
5
5
  import { remapStyleRunReferences, styleRunReferences } from "./references.js";
6
6
  import { textLengthSchema } from "./schema.js";
7
- export { LIST_BULLET, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textLengthPixels, textLengthSchema, textLinesOverflow, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
7
+ export { LIST_BULLET, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, lineStepPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textLengthPixels, textLengthSchema, textLinesReach, textListItems, textParagraphRanges, textVerticalOffset, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
@@ -6,6 +6,11 @@ declare const NO_LETTER_SPACING: TextLength;
6
6
  declare function textLengthPixels(length: TextLength, fontSize: number): number;
7
7
  /** A line height in pixels at `fontSize`, or null when it is automatic. */
8
8
  declare function lineHeightPixels(lineHeight: TextLength | null, fontSize: number): number | null;
9
+ /**
10
+ * How far apart a line height sets lines at `fontSize`, as Figma steps them: a height in pixels
11
+ * as it is, a percent one to whole pixels (Figma desktop 126); null when it is automatic.
12
+ */
13
+ declare function lineStepPixels(lineHeight: TextLength | null, fontSize: number): number | null;
9
14
  /** A length in pixels, as a bound number variable and most authored formats give one. */
10
15
  declare function pixelLength(value: number): TextLength;
11
16
  /** A length as a percent of the font size. */
@@ -15,5 +20,5 @@ declare function scaledTextLength(length: TextLength, factor: number): TextLengt
15
20
  /** `length` as people read it: `24px` or `150%`. */
16
21
  declare function formatTextLength(length: TextLength): string;
17
22
  //#endregion
18
- export { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels };
23
+ export { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, lineStepPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels };
19
24
  //# sourceMappingURL=lengths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lengths.d.ts","names":[],"sources":["../../src/text/lengths.ts"],"mappings":";;;cAGa,mBAAmB;;iBAGhB,iBAAiB,QAAQ,YAAY;;iBAKrC,iBAAiB,YAAY,mBAAmB;;iBAKhD,YAAY,gBAAgB;;iBAK5B,cAAc,gBAAgB;;iBAK9B,iBAAiB,QAAQ,YAAY,iBAAiB;;iBAKtD,iBAAiB,QAAQ"}
1
+ {"version":3,"file":"lengths.d.ts","names":[],"sources":["../../src/text/lengths.ts"],"mappings":";;;cAGa,mBAAmB;;iBAGhB,iBAAiB,QAAQ,YAAY;;iBAKrC,iBAAiB,YAAY,mBAAmB;;;;;iBAQhD,eAAe,YAAY,mBAAmB;;iBAO9C,YAAY,gBAAgB;;iBAK5B,cAAc,gBAAgB;;iBAK9B,iBAAiB,QAAQ,YAAY,iBAAiB;;iBAKtD,iBAAiB,QAAQ"}
@@ -12,6 +12,15 @@ function textLengthPixels(length, fontSize) {
12
12
  function lineHeightPixels(lineHeight, fontSize) {
13
13
  return lineHeight ? textLengthPixels(lineHeight, fontSize) : null;
14
14
  }
15
+ /**
16
+ * How far apart a line height sets lines at `fontSize`, as Figma steps them: a height in pixels
17
+ * as it is, a percent one to whole pixels (Figma desktop 126); null when it is automatic.
18
+ */
19
+ function lineStepPixels(lineHeight, fontSize) {
20
+ if (!lineHeight) return null;
21
+ const pixels = textLengthPixels(lineHeight, fontSize);
22
+ return lineHeight.unit === "PIXELS" ? pixels : Math.round(pixels);
23
+ }
15
24
  /** A length in pixels, as a bound number variable and most authored formats give one. */
16
25
  function pixelLength(value) {
17
26
  return {
@@ -35,6 +44,6 @@ function formatTextLength(length) {
35
44
  return length.unit === "PIXELS" ? `${length.value}px` : `${length.value}%`;
36
45
  }
37
46
  //#endregion
38
- export { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels };
47
+ export { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, lineStepPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels };
39
48
 
40
49
  //# sourceMappingURL=lengths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lengths.js","names":[],"sources":["../../src/text/lengths.ts"],"sourcesContent":["import type { TextLength } from '../types'\n\n/** No letter spacing, as a new text has it and as Figma writes it. */\nexport const NO_LETTER_SPACING: TextLength = { value: 0, unit: 'PERCENT' }\n\n/** `length` in pixels at `fontSize`. */\nexport function textLengthPixels(length: TextLength, fontSize: number): number {\n return length.unit === 'PIXELS' ? length.value : (length.value / 100) * fontSize\n}\n\n/** A line height in pixels at `fontSize`, or null when it is automatic. */\nexport function lineHeightPixels(lineHeight: TextLength | null, fontSize: number): number | null {\n return lineHeight ? textLengthPixels(lineHeight, fontSize) : null\n}\n\n/** A length in pixels, as a bound number variable and most authored formats give one. */\nexport function pixelLength(value: number): TextLength {\n return { value, unit: 'PIXELS' }\n}\n\n/** A length as a percent of the font size. */\nexport function percentLength(value: number): TextLength {\n return { value, unit: 'PERCENT' }\n}\n\n/** `length` scaled by `factor`: pixels scale, a percent already follows the font size. */\nexport function scaledTextLength(length: TextLength, factor: number): TextLength {\n return length.unit === 'PIXELS' ? pixelLength(length.value * factor) : length\n}\n\n/** `length` as people read it: `24px` or `150%`. */\nexport function formatTextLength(length: TextLength): string {\n return length.unit === 'PIXELS' ? `${length.value}px` : `${length.value}%`\n}\n"],"mappings":";;AAGA,MAAa,oBAAgC;CAAE,OAAO;CAAG,MAAM;AAAU;;AAGzE,SAAgB,iBAAiB,QAAoB,UAA0B;CAC7E,OAAO,OAAO,SAAS,WAAW,OAAO,QAAS,OAAO,QAAQ,MAAO;AAC1E;;AAGA,SAAgB,iBAAiB,YAA+B,UAAiC;CAC/F,OAAO,aAAa,iBAAiB,YAAY,QAAQ,IAAI;AAC/D;;AAGA,SAAgB,YAAY,OAA2B;CACrD,OAAO;EAAE;EAAO,MAAM;CAAS;AACjC;;AAGA,SAAgB,cAAc,OAA2B;CACvD,OAAO;EAAE;EAAO,MAAM;CAAU;AAClC;;AAGA,SAAgB,iBAAiB,QAAoB,QAA4B;CAC/E,OAAO,OAAO,SAAS,WAAW,YAAY,OAAO,QAAQ,MAAM,IAAI;AACzE;;AAGA,SAAgB,iBAAiB,QAA4B;CAC3D,OAAO,OAAO,SAAS,WAAW,GAAG,OAAO,MAAM,MAAM,GAAG,OAAO,MAAM;AAC1E"}
1
+ {"version":3,"file":"lengths.js","names":[],"sources":["../../src/text/lengths.ts"],"sourcesContent":["import type { TextLength } from '../types'\n\n/** No letter spacing, as a new text has it and as Figma writes it. */\nexport const NO_LETTER_SPACING: TextLength = { value: 0, unit: 'PERCENT' }\n\n/** `length` in pixels at `fontSize`. */\nexport function textLengthPixels(length: TextLength, fontSize: number): number {\n return length.unit === 'PIXELS' ? length.value : (length.value / 100) * fontSize\n}\n\n/** A line height in pixels at `fontSize`, or null when it is automatic. */\nexport function lineHeightPixels(lineHeight: TextLength | null, fontSize: number): number | null {\n return lineHeight ? textLengthPixels(lineHeight, fontSize) : null\n}\n\n/**\n * How far apart a line height sets lines at `fontSize`, as Figma steps them: a height in pixels\n * as it is, a percent one to whole pixels (Figma desktop 126); null when it is automatic.\n */\nexport function lineStepPixels(lineHeight: TextLength | null, fontSize: number): number | null {\n if (!lineHeight) return null\n const pixels = textLengthPixels(lineHeight, fontSize)\n return lineHeight.unit === 'PIXELS' ? pixels : Math.round(pixels)\n}\n\n/** A length in pixels, as a bound number variable and most authored formats give one. */\nexport function pixelLength(value: number): TextLength {\n return { value, unit: 'PIXELS' }\n}\n\n/** A length as a percent of the font size. */\nexport function percentLength(value: number): TextLength {\n return { value, unit: 'PERCENT' }\n}\n\n/** `length` scaled by `factor`: pixels scale, a percent already follows the font size. */\nexport function scaledTextLength(length: TextLength, factor: number): TextLength {\n return length.unit === 'PIXELS' ? pixelLength(length.value * factor) : length\n}\n\n/** `length` as people read it: `24px` or `150%`. */\nexport function formatTextLength(length: TextLength): string {\n return length.unit === 'PIXELS' ? `${length.value}px` : `${length.value}%`\n}\n"],"mappings":";;AAGA,MAAa,oBAAgC;CAAE,OAAO;CAAG,MAAM;AAAU;;AAGzE,SAAgB,iBAAiB,QAAoB,UAA0B;CAC7E,OAAO,OAAO,SAAS,WAAW,OAAO,QAAS,OAAO,QAAQ,MAAO;AAC1E;;AAGA,SAAgB,iBAAiB,YAA+B,UAAiC;CAC/F,OAAO,aAAa,iBAAiB,YAAY,QAAQ,IAAI;AAC/D;;;;;AAMA,SAAgB,eAAe,YAA+B,UAAiC;CAC7F,IAAI,CAAC,YAAY,OAAO;CACxB,MAAM,SAAS,iBAAiB,YAAY,QAAQ;CACpD,OAAO,WAAW,SAAS,WAAW,SAAS,KAAK,MAAM,MAAM;AAClE;;AAGA,SAAgB,YAAY,OAA2B;CACrD,OAAO;EAAE;EAAO,MAAM;CAAS;AACjC;;AAGA,SAAgB,cAAc,OAA2B;CACvD,OAAO;EAAE;EAAO,MAAM;CAAU;AAClC;;AAGA,SAAgB,iBAAiB,QAAoB,QAA4B;CAC/E,OAAO,OAAO,SAAS,WAAW,YAAY,OAAO,QAAQ,MAAM,IAAI;AACzE;;AAGA,SAAgB,iBAAiB,QAA4B;CAC3D,OAAO,OAAO,SAAS,WAAW,GAAG,OAAO,MAAM,MAAM,GAAG,OAAO,MAAM;AAC1E"}
@@ -1,11 +1,27 @@
1
- import { VisualBoundsNode } from "../geometry.js";
2
1
  //#region src/text/overflow.d.ts
3
- type TextBoundsNode = Pick<VisualBoundsNode, 'type' | 'height' | 'derivedTextHeight'>;
2
+ type TextBoxNode = {
3
+ height: number;
4
+ textAlignVertical?: string;
5
+ };
6
+ type TextBoundsNode = TextBoxNode & {
7
+ type?: string;
8
+ derivedTextHeight?: number | null;
9
+ };
10
+ type TextLinesReach = {
11
+ minY: number;
12
+ maxY: number;
13
+ };
4
14
  /**
5
- * How far a text's lines reach below its box: a fixed-size box does not clip them, as in Figma,
6
- * and the renderer starts them at its top.
15
+ * Where the top of laid-out lines `contentHeight` tall sits in a text's box, by its vertical
16
+ * alignment. Lines taller than the box overflow on the side away from the alignment, as Figma
17
+ * lays them out.
7
18
  */
8
- declare function textLinesOverflow(node: TextBoundsNode): number;
19
+ declare function textVerticalOffset(node: TextBoxNode, contentHeight: number): number;
20
+ /**
21
+ * The rows a text draws its lines over, in its own axes: its box, grown by the lines a fixed-size
22
+ * box lets run past it above or below, as in Figma.
23
+ */
24
+ declare function textLinesReach(node: TextBoundsNode): TextLinesReach;
9
25
  //#endregion
10
- export { textLinesOverflow };
26
+ export { TextLinesReach, textLinesReach, textVerticalOffset };
11
27
  //# sourceMappingURL=overflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overflow.d.ts","names":[],"sources":["../../src/text/overflow.ts"],"mappings":";;KAEK,iBAAiB,KAAK;;;;;iBAMX,kBAAkB,MAAM"}
1
+ {"version":3,"file":"overflow.d.ts","names":[],"sources":["../../src/text/overflow.ts"],"mappings":";KAAK;EAAgB;EAAgB;;KAChC,iBAAiB;EAAgB;EAAe;;KAEzC;EAAmB;EAAc;;;;;;;iBAO7B,mBAAmB,MAAM,aAAa;;;;;iBAetC,eAAe,MAAM,iBAAiB"}
@@ -1,13 +1,31 @@
1
1
  //#region src/text/overflow.ts
2
2
  /**
3
- * How far a text's lines reach below its box: a fixed-size box does not clip them, as in Figma,
4
- * and the renderer starts them at its top.
3
+ * Where the top of laid-out lines `contentHeight` tall sits in a text's box, by its vertical
4
+ * alignment. Lines taller than the box overflow on the side away from the alignment, as Figma
5
+ * lays them out.
5
6
  */
6
- function textLinesOverflow(node) {
7
- if (node.type !== "TEXT" || !node.derivedTextHeight) return 0;
8
- return Math.max(0, node.derivedTextHeight - node.height);
7
+ function textVerticalOffset(node, contentHeight) {
8
+ const available = node.height - contentHeight;
9
+ if (node.textAlignVertical === "CENTER") return available / 2;
10
+ if (node.textAlignVertical === "BOTTOM") return available;
11
+ return 0;
12
+ }
13
+ /**
14
+ * The rows a text draws its lines over, in its own axes: its box, grown by the lines a fixed-size
15
+ * box lets run past it above or below, as in Figma.
16
+ */
17
+ function textLinesReach(node) {
18
+ if (node.type !== "TEXT" || !node.derivedTextHeight) return {
19
+ minY: 0,
20
+ maxY: node.height
21
+ };
22
+ const linesTop = textVerticalOffset(node, node.derivedTextHeight);
23
+ return {
24
+ minY: Math.min(0, linesTop),
25
+ maxY: Math.max(node.height, linesTop + node.derivedTextHeight)
26
+ };
9
27
  }
10
28
  //#endregion
11
- export { textLinesOverflow };
29
+ export { textLinesReach, textVerticalOffset };
12
30
 
13
31
  //# sourceMappingURL=overflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"overflow.js","names":[],"sources":["../../src/text/overflow.ts"],"sourcesContent":["import type { VisualBoundsNode } from '../geometry'\n\ntype TextBoundsNode = Pick<VisualBoundsNode, 'type' | 'height' | 'derivedTextHeight'>\n\n/**\n * How far a text's lines reach below its box: a fixed-size box does not clip them, as in Figma,\n * and the renderer starts them at its top.\n */\nexport function textLinesOverflow(node: TextBoundsNode): number {\n if (node.type !== 'TEXT' || !node.derivedTextHeight) return 0\n return Math.max(0, node.derivedTextHeight - node.height)\n}\n"],"mappings":";;;;;AAQA,SAAgB,kBAAkB,MAA8B;CAC9D,IAAI,KAAK,SAAS,UAAU,CAAC,KAAK,mBAAmB,OAAO;CAC5D,OAAO,KAAK,IAAI,GAAG,KAAK,oBAAoB,KAAK,MAAM;AACzD"}
1
+ {"version":3,"file":"overflow.js","names":[],"sources":["../../src/text/overflow.ts"],"sourcesContent":["type TextBoxNode = { height: number; textAlignVertical?: string }\ntype TextBoundsNode = TextBoxNode & { type?: string; derivedTextHeight?: number | null }\n\nexport type TextLinesReach = { minY: number; maxY: number }\n\n/**\n * Where the top of laid-out lines `contentHeight` tall sits in a text's box, by its vertical\n * alignment. Lines taller than the box overflow on the side away from the alignment, as Figma\n * lays them out.\n */\nexport function textVerticalOffset(node: TextBoxNode, contentHeight: number): number {\n const available = node.height - contentHeight\n if (node.textAlignVertical === 'CENTER') {\n return available / 2\n }\n if (node.textAlignVertical === 'BOTTOM') {\n return available\n }\n return 0\n}\n\n/**\n * The rows a text draws its lines over, in its own axes: its box, grown by the lines a fixed-size\n * box lets run past it above or below, as in Figma.\n */\nexport function textLinesReach(node: TextBoundsNode): TextLinesReach {\n if (node.type !== 'TEXT' || !node.derivedTextHeight) {\n return { minY: 0, maxY: node.height }\n }\n const linesTop = textVerticalOffset(node, node.derivedTextHeight)\n return {\n minY: Math.min(0, linesTop),\n maxY: Math.max(node.height, linesTop + node.derivedTextHeight)\n }\n}\n"],"mappings":";;;;;;AAUA,SAAgB,mBAAmB,MAAmB,eAA+B;CACnF,MAAM,YAAY,KAAK,SAAS;CAChC,IAAI,KAAK,sBAAsB,UAC7B,OAAO,YAAY;CAErB,IAAI,KAAK,sBAAsB,UAC7B,OAAO;CAET,OAAO;AACT;;;;;AAMA,SAAgB,eAAe,MAAsC;CACnE,IAAI,KAAK,SAAS,UAAU,CAAC,KAAK,mBAChC,OAAO;EAAE,MAAM;EAAG,MAAM,KAAK;CAAO;CAEtC,MAAM,WAAW,mBAAmB,MAAM,KAAK,iBAAiB;CAChE,OAAO;EACL,MAAM,KAAK,IAAI,GAAG,QAAQ;EAC1B,MAAM,KAAK,IAAI,KAAK,QAAQ,WAAW,KAAK,iBAAiB;CAC/D;AACF"}
@@ -42,7 +42,8 @@ function prepareNodeTransfer(source, refs) {
42
42
  result.componentId = source.componentId ? node(source.componentId) : null;
43
43
  result.instanceOverrides = remapInstanceOverrideState(source.instanceOverrides, {
44
44
  node,
45
- variable
45
+ variable,
46
+ property: (id) => refs.properties.get(id)
46
47
  });
47
48
  result.boundVariables = Object.fromEntries(Object.entries(source.boundVariables).map(([field, id]) => [field, variable(id)]));
48
49
  result.variableModes = Object.fromEntries(Object.entries(source.variableModes).map(([collection, mode]) => [requireTransferReference(refs.collections, collection, "collection"), requireTransferReference(refs.modes, mode, "mode")]));
@@ -68,10 +69,13 @@ function prepareNodeTransfer(source, refs) {
68
69
  id: property(definition.id),
69
70
  defaultValue: propertyValue(definition.id, definition.defaultValue)
70
71
  }));
71
- result.componentPropertyReferences = source.componentPropertyReferences.map((reference) => ({
72
- ...reference,
73
- propertyId: property(reference.propertyId)
74
- }));
72
+ result.componentPropertyReferences = source.componentPropertyReferences.flatMap((reference) => {
73
+ const propertyId = refs.properties.get(reference.propertyId);
74
+ return propertyId ? [{
75
+ ...reference,
76
+ propertyId
77
+ }] : [];
78
+ });
75
79
  result.componentPropertyAssignments = values(source.componentPropertyAssignments);
76
80
  result.componentPropertyValues = { ...source.componentPropertyValues };
77
81
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.js","names":["required"],"sources":["../../src/transfer/nodes.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport {\n isLayerReferenceOverride,\n overriddenBindingField,\n remapInstanceOverrideState\n} from '../instances/overrides'\nimport { remapStyleRunReferences, styleRunReferences } from '../text/references'\nimport type { ComponentPropertyType, SceneNode } from '../types'\nimport { requireTransferReference as required } from './references'\nimport type { VariableTransferReferences } from './variables'\n\nexport function semanticTransferReferences(node: SceneNode): string[] {\n const runs = styleRunReferences(node.styleRuns)\n return [\n ...(node.componentId ? [node.componentId] : []),\n ...Object.values(node.boundVariables),\n ...runs.variables,\n ...runs.styles,\n ...[\n node.fillStyleId,\n node.strokeStyleId,\n node.textStyleId,\n node.effectStyleId,\n node.gridStyleId\n ].filter((id): id is string => !!id),\n ...node.fillGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...node.strokeGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...Object.entries(node.componentPropertyAssignments).flatMap(([id, value]) => [id, value]),\n ...node.componentPropertyReferences.map((reference) => reference.propertyId),\n ...node.componentPropertyDefinitions.flatMap((definition) => [\n definition.id,\n ...(definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? [definition.defaultValue]\n : [])\n ]),\n ...node.instanceOverrides.descendants.keys(),\n ...[\n ...node.instanceOverrides.self,\n ...[...node.instanceOverrides.descendants.values()].flatMap((fields) => [...fields])\n ].flatMap(([field, value]) =>\n typeof value === 'string' &&\n (isLayerReferenceOverride(field) || overriddenBindingField(field) !== null)\n ? [value]\n : []\n )\n ]\n}\n\nexport interface NodeTransferReferences extends VariableTransferReferences {\n nodes: ReadonlyMap<string, string>\n styles: ReadonlyMap<string, string>\n properties: ReadonlyMap<string, string>\n propertyTypes: ReadonlyMap<string, ComponentPropertyType>\n}\n\n/** Prepare runtime references without rewriting original format identities or ordinary text. */\nexport function prepareNodeTransfer(\n source: SceneNode,\n refs: NodeTransferReferences\n): Partial<SceneNode> {\n const node = (id: string) => required(refs.nodes, id, 'node')\n const variable = (id: string) => required(refs.variables, id, 'variable')\n const property = (id: string) => required(refs.properties, id, 'property')\n const style = (id: string) => required(refs.styles, id, 'style')\n const propertyValue = (id: string, value: string): string => {\n const type = refs.propertyTypes.get(id)\n if (!type) throw new Error(`Missing property transfer type: ${id}`)\n return type === 'INSTANCE_SWAP' && value ? node(value) : value\n }\n const values = (entries: Record<string, string>) =>\n Object.fromEntries(\n Object.entries(entries).map(([id, value]) => [property(id), propertyValue(id, value)])\n )\n const result = cloneNodeProps(source, null)\n result.componentId = source.componentId ? node(source.componentId) : null\n result.instanceOverrides = remapInstanceOverrideState(source.instanceOverrides, {\n node,\n variable\n })\n result.boundVariables = Object.fromEntries(\n Object.entries(source.boundVariables).map(([field, id]) => [field, variable(id)])\n )\n result.variableModes = Object.fromEntries(\n Object.entries(source.variableModes).map(([collection, mode]) => [\n required(refs.collections, collection, 'collection'),\n required(refs.modes, mode, 'mode')\n ])\n )\n for (const field of [\n 'fillStyleId',\n 'strokeStyleId',\n 'textStyleId',\n 'effectStyleId',\n 'gridStyleId'\n ] as const) {\n result[field] = source[field] ? style(source[field]) : null\n }\n if (result.styleRuns) {\n // A link to a layer the transfer leaves behind keeps naming it.\n result.styleRuns = remapStyleRunReferences(result.styleRuns, {\n variable,\n style,\n node: (id) => refs.nodes.get(id) ?? id\n })\n }\n // A connector keeps the layers it was attached to when they are left behind; the end becomes\n // free where nothing by that ID exists, as a pasted Figma connector does.\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = result[field]\n if (endpoint?.nodeId) endpoint.nodeId = refs.nodes.get(endpoint.nodeId) ?? endpoint.nodeId\n }\n for (const paths of [result.fillGeometry, result.strokeGeometry]) {\n for (const path of paths ?? []) if (path.fillStyleId) path.fillStyleId = style(path.fillStyleId)\n }\n result.componentPropertyDefinitions = source.componentPropertyDefinitions.map((definition) => ({\n ...structuredClone(definition),\n id: property(definition.id),\n defaultValue: propertyValue(definition.id, definition.defaultValue)\n }))\n result.componentPropertyReferences = source.componentPropertyReferences.map((reference) => ({\n ...reference,\n propertyId: property(reference.propertyId)\n }))\n result.componentPropertyAssignments = values(source.componentPropertyAssignments)\n // Variant values are keyed by display names, unlike definition-ID assignments.\n result.componentPropertyValues = { ...source.componentPropertyValues }\n return result\n}\n"],"mappings":";;;;;AAWA,SAAgB,2BAA2B,MAA2B;CACpE,MAAM,OAAO,mBAAmB,KAAK,SAAS;CAC9C,OAAO;EACL,GAAI,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC;EAC7C,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG;GACD,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC,CAAC,QAAQ,OAAqB,CAAC,CAAC,EAAE;EACnC,GAAG,KAAK,aAAa,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACnF,GAAG,KAAK,eAAe,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACrF,GAAG,OAAO,QAAQ,KAAK,4BAA4B,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;EACzF,GAAG,KAAK,4BAA4B,KAAK,cAAc,UAAU,UAAU;EAC3E,GAAG,KAAK,6BAA6B,SAAS,eAAe,CAC3D,WAAW,IACX,GAAI,WAAW,SAAS,mBAAmB,WAAW,eAClD,CAAC,WAAW,YAAY,IACxB,CAAC,CACP,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A,OAAO,gBAAgB,OAAO,YAC5B,OAAO,QAAQ,OAAO,aAAa,CAAC,CAAC,KAAK,CAAC,YAAY,UAAU,CAC/DA,yBAAS,KAAK,aAAa,YAAY,YAAY,GACnDA,yBAAS,KAAK,OAAO,MAAM,MAAM,CACnC,CAAC,CACH;CACA,KAAK,MAAM,SAAS;EAClB;EACA;EACA;EACA;EACA;CACF,GACE,OAAO,SAAS,OAAO,SAAS,MAAM,OAAO,MAAM,IAAI;CAEzD,IAAI,OAAO,WAET,OAAO,YAAY,wBAAwB,OAAO,WAAW;EAC3D;EACA;EACA,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,KAAK;CACtC,CAAC;CAIH,KAAK,MAAM,SAAS,CAAC,kBAAkB,cAAc,GAAY;EAC/D,MAAM,WAAW,OAAO;EACxB,IAAI,UAAU,QAAQ,SAAS,SAAS,KAAK,MAAM,IAAI,SAAS,MAAM,KAAK,SAAS;CACtF;CACA,KAAK,MAAM,SAAS,CAAC,OAAO,cAAc,OAAO,cAAc,GAC7D,KAAK,MAAM,QAAQ,SAAS,CAAC,GAAG,IAAI,KAAK,aAAa,KAAK,cAAc,MAAM,KAAK,WAAW;CAEjG,OAAO,+BAA+B,OAAO,6BAA6B,KAAK,gBAAgB;EAC7F,GAAG,gBAAgB,UAAU;EAC7B,IAAI,SAAS,WAAW,EAAE;EAC1B,cAAc,cAAc,WAAW,IAAI,WAAW,YAAY;CACpE,EAAE;CACF,OAAO,8BAA8B,OAAO,4BAA4B,KAAK,eAAe;EAC1F,GAAG;EACH,YAAY,SAAS,UAAU,UAAU;CAC3C,EAAE;CACF,OAAO,+BAA+B,OAAO,OAAO,4BAA4B;CAEhF,OAAO,0BAA0B,EAAE,GAAG,OAAO,wBAAwB;CACrE,OAAO;AACT"}
1
+ {"version":3,"file":"nodes.js","names":["required"],"sources":["../../src/transfer/nodes.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport {\n isLayerReferenceOverride,\n overriddenBindingField,\n remapInstanceOverrideState\n} from '../instances/overrides'\nimport { remapStyleRunReferences, styleRunReferences } from '../text/references'\nimport type { ComponentPropertyType, SceneNode } from '../types'\nimport { requireTransferReference as required } from './references'\nimport type { VariableTransferReferences } from './variables'\n\nexport function semanticTransferReferences(node: SceneNode): string[] {\n const runs = styleRunReferences(node.styleRuns)\n return [\n ...(node.componentId ? [node.componentId] : []),\n ...Object.values(node.boundVariables),\n ...runs.variables,\n ...runs.styles,\n ...[\n node.fillStyleId,\n node.strokeStyleId,\n node.textStyleId,\n node.effectStyleId,\n node.gridStyleId\n ].filter((id): id is string => !!id),\n ...node.fillGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...node.strokeGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...Object.entries(node.componentPropertyAssignments).flatMap(([id, value]) => [id, value]),\n ...node.componentPropertyReferences.map((reference) => reference.propertyId),\n ...node.componentPropertyDefinitions.flatMap((definition) => [\n definition.id,\n ...(definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? [definition.defaultValue]\n : [])\n ]),\n ...node.instanceOverrides.descendants.keys(),\n ...[\n ...node.instanceOverrides.self,\n ...[...node.instanceOverrides.descendants.values()].flatMap((fields) => [...fields])\n ].flatMap(([field, value]) =>\n typeof value === 'string' &&\n (isLayerReferenceOverride(field) || overriddenBindingField(field) !== null)\n ? [value]\n : []\n )\n ]\n}\n\nexport interface NodeTransferReferences extends VariableTransferReferences {\n nodes: ReadonlyMap<string, string>\n styles: ReadonlyMap<string, string>\n properties: ReadonlyMap<string, string>\n propertyTypes: ReadonlyMap<string, ComponentPropertyType>\n}\n\n/** Prepare runtime references without rewriting original format identities or ordinary text. */\nexport function prepareNodeTransfer(\n source: SceneNode,\n refs: NodeTransferReferences\n): Partial<SceneNode> {\n const node = (id: string) => required(refs.nodes, id, 'node')\n const variable = (id: string) => required(refs.variables, id, 'variable')\n const property = (id: string) => required(refs.properties, id, 'property')\n const style = (id: string) => required(refs.styles, id, 'style')\n const propertyValue = (id: string, value: string): string => {\n const type = refs.propertyTypes.get(id)\n if (!type) throw new Error(`Missing property transfer type: ${id}`)\n return type === 'INSTANCE_SWAP' && value ? node(value) : value\n }\n const values = (entries: Record<string, string>) =>\n Object.fromEntries(\n Object.entries(entries).map(([id, value]) => [property(id), propertyValue(id, value)])\n )\n const result = cloneNodeProps(source, null)\n result.componentId = source.componentId ? node(source.componentId) : null\n result.instanceOverrides = remapInstanceOverrideState(source.instanceOverrides, {\n node,\n variable,\n property: (id) => refs.properties.get(id)\n })\n result.boundVariables = Object.fromEntries(\n Object.entries(source.boundVariables).map(([field, id]) => [field, variable(id)])\n )\n result.variableModes = Object.fromEntries(\n Object.entries(source.variableModes).map(([collection, mode]) => [\n required(refs.collections, collection, 'collection'),\n required(refs.modes, mode, 'mode')\n ])\n )\n for (const field of [\n 'fillStyleId',\n 'strokeStyleId',\n 'textStyleId',\n 'effectStyleId',\n 'gridStyleId'\n ] as const) {\n result[field] = source[field] ? style(source[field]) : null\n }\n if (result.styleRuns) {\n // A link to a layer the transfer leaves behind keeps naming it.\n result.styleRuns = remapStyleRunReferences(result.styleRuns, {\n variable,\n style,\n node: (id) => refs.nodes.get(id) ?? id\n })\n }\n // A connector keeps the layers it was attached to when they are left behind; the end becomes\n // free where nothing by that ID exists, as a pasted Figma connector does.\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = result[field]\n if (endpoint?.nodeId) endpoint.nodeId = refs.nodes.get(endpoint.nodeId) ?? endpoint.nodeId\n }\n for (const paths of [result.fillGeometry, result.strokeGeometry]) {\n for (const path of paths ?? []) if (path.fillStyleId) path.fillStyleId = style(path.fillStyleId)\n }\n result.componentPropertyDefinitions = source.componentPropertyDefinitions.map((definition) => ({\n ...structuredClone(definition),\n id: property(definition.id),\n defaultValue: propertyValue(definition.id, definition.defaultValue)\n }))\n // A reference to a property that neither the transfer nor its destination defines names nothing.\n result.componentPropertyReferences = source.componentPropertyReferences.flatMap((reference) => {\n const propertyId = refs.properties.get(reference.propertyId)\n return propertyId ? [{ ...reference, propertyId }] : []\n })\n result.componentPropertyAssignments = values(source.componentPropertyAssignments)\n // Variant values are keyed by display names, unlike definition-ID assignments.\n result.componentPropertyValues = { ...source.componentPropertyValues }\n return result\n}\n"],"mappings":";;;;;AAWA,SAAgB,2BAA2B,MAA2B;CACpE,MAAM,OAAO,mBAAmB,KAAK,SAAS;CAC9C,OAAO;EACL,GAAI,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC;EAC7C,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG;GACD,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC,CAAC,QAAQ,OAAqB,CAAC,CAAC,EAAE;EACnC,GAAG,KAAK,aAAa,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACnF,GAAG,KAAK,eAAe,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACrF,GAAG,OAAO,QAAQ,KAAK,4BAA4B,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;EACzF,GAAG,KAAK,4BAA4B,KAAK,cAAc,UAAU,UAAU;EAC3E,GAAG,KAAK,6BAA6B,SAAS,eAAe,CAC3D,WAAW,IACX,GAAI,WAAW,SAAS,mBAAmB,WAAW,eAClD,CAAC,WAAW,YAAY,IACxB,CAAC,CACP,CAAC;EACD,GAAG,KAAK,kBAAkB,YAAY,KAAK;EAC3C,GAAG,CACD,GAAG,KAAK,kBAAkB,MAC1B,GAAG,CAAC,GAAG,KAAK,kBAAkB,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,MAAM,CAAC,CACrF,CAAC,CAAC,SAAS,CAAC,OAAO,WACjB,OAAO,UAAU,aAChB,yBAAyB,KAAK,KAAK,uBA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;EACA;CACF,GACE,OAAO,SAAS,OAAO,SAAS,MAAM,OAAO,MAAM,IAAI;CAEzD,IAAI,OAAO,WAET,OAAO,YAAY,wBAAwB,OAAO,WAAW;EAC3D;EACA;EACA,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,KAAK;CACtC,CAAC;CAIH,KAAK,MAAM,SAAS,CAAC,kBAAkB,cAAc,GAAY;EAC/D,MAAM,WAAW,OAAO;EACxB,IAAI,UAAU,QAAQ,SAAS,SAAS,KAAK,MAAM,IAAI,SAAS,MAAM,KAAK,SAAS;CACtF;CACA,KAAK,MAAM,SAAS,CAAC,OAAO,cAAc,OAAO,cAAc,GAC7D,KAAK,MAAM,QAAQ,SAAS,CAAC,GAAG,IAAI,KAAK,aAAa,KAAK,cAAc,MAAM,KAAK,WAAW;CAEjG,OAAO,+BAA+B,OAAO,6BAA6B,KAAK,gBAAgB;EAC7F,GAAG,gBAAgB,UAAU;EAC7B,IAAI,SAAS,WAAW,EAAE;EAC1B,cAAc,cAAc,WAAW,IAAI,WAAW,YAAY;CACpE,EAAE;CAEF,OAAO,8BAA8B,OAAO,4BAA4B,SAAS,cAAc;EAC7F,MAAM,aAAa,KAAK,WAAW,IAAI,UAAU,UAAU;EAC3D,OAAO,aAAa,CAAC;GAAE,GAAG;GAAW;EAAW,CAAC,IAAI,CAAC;CACxD,CAAC;CACD,OAAO,+BAA+B,OAAO,OAAO,4BAA4B;CAEhF,OAAO,0BAA0B,EAAE,GAAG,OAAO,wBAAwB;CACrE,OAAO;AACT"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ExportFormatId } from "./export-format.js";
2
2
  import { Color, Matrix, Rect, Vector } from "./primitives/index.js";
3
- import { CanvasGuide } from "./guides.js";
4
3
  import { InstanceOverrideState } from "./instances/overrides.js";
4
+ import { CanvasGuide } from "./guides.js";
5
5
  import { ShaderUniformValue } from "./shaders/schema.js";
6
6
  import { ShapeWithTextType } from "./shape-with-text/kinds.js";
7
7
  //#region src/types.d.ts
@@ -27,6 +27,10 @@ interface NodeChangeObserver {
27
27
  before: (node: SceneNode) => void;
28
28
  /** A node was just added. */
29
29
  created: (node: SceneNode) => void;
30
+ /** What changes from now until `resume` is someone else's; `waitOutsideEdit` calls this. */
31
+ pause?: () => void;
32
+ /** The wait ended, and what changed meanwhile belongs outside the edit. */
33
+ resume?: () => void;
30
34
  }
31
35
  type DocumentColorSpace = 'srgb' | 'display-p3';
32
36
  /** What a document is for, as Figma keeps design files and FigJam boards apart. */
@@ -104,6 +108,16 @@ interface MeshGradientPoint {
104
108
  color: Color;
105
109
  }
106
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
+ }
107
121
  interface Fill {
108
122
  type: FillType;
109
123
  color: Color;
@@ -122,6 +136,8 @@ interface Fill {
122
136
  imageTransform?: GradientTransform;
123
137
  /** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */
124
138
  imageRotation?: number;
139
+ /** An image's adjustments, kept and saved; the canvas does not draw them. */
140
+ filters?: ImageFilters;
125
141
  sourceNodeId?: string;
126
142
  scale?: number;
127
143
  spacing?: number;
@@ -911,5 +927,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
911
927
  declare const MODE_ATTRIBUTE_PATTERN: RegExp;
912
928
  declare function isModeAttributeName(name: string): boolean;
913
929
  //#endregion
914
- export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, Effect, EnabledLibraryBinding, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, MeshGradientPoint, NodeChangeObserver, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, PrototypeAction, PrototypeActionType, PrototypeBackAction, PrototypeCloseAction, PrototypeNavigationType, PrototypeNodeAction, PrototypeOverlayPositionType, PrototypeReaction, PrototypeTransition, PrototypeTransitionType, PrototypeTrigger, PrototypeTriggerType, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, ShaderEffect, ShadowEffect, 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 };
930
+ export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, Effect, EnabledLibraryBinding, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, MeshGradientPoint, NodeChangeObserver, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, PrototypeAction, PrototypeActionType, PrototypeBackAction, PrototypeCloseAction, PrototypeNavigationType, PrototypeNodeAction, PrototypeOverlayPositionType, PrototypeReaction, PrototypeTransition, PrototypeTransitionType, PrototypeTrigger, PrototypeTriggerType, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, ShaderEffect, ShadowEffect, 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 };
915
931
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;UASiB;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;;;UAKa;;EAEf,SAAS,MAAM;;EAEf,UAAU,MAAM;;KAGN;;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;;UAGe;EACf,UAAU;EACV,UAAU;EACV,SAAS;;UAGM;EACf,aAAa;EACb,cAAc;;EAEd,QAAQ;;EAER;;KAGU;KAsBA;KAYA;KAoBA;KACA;KACA;KACA;UAEK;EACf,OAAO;EACP;;;;;;;;UASe;EACf,UAAU;EACV,OAAO;;KAGG,oBAAoB;UAEf;EACf,MAAM;EACN,OAAO;EACP;EACA;EACA,YAAY;EACZ,gBAAgB;EAChB,oBAAoB;;EAEpB;EACA;EACA,aAAa;EACb;EACA,iBAAiB;;EAEjB,iBAAiB;;EAEjB;EACA;EACA;EACA;EACA,iBAAi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;EAKT,aAAa,QAAQ,OAAO;;EAE5B,OAAO;;EAEP,cAAc,eAAe;EAC7B,aAAa;;EAEb;;EAEA;;;KAIU,yBACT,WAAW,cAAc,UAAU,oBAAoB,mBAClD;UAES;EACf;EACA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;;EAEA,OAAO;EACP;EACA;;;;;EAKA;EACA,aAAa;;;;;EAKb;;EAEA;;;iBAIc,oBAAoB,YAAY,KAAK;;cAKxC,wBAAsB;iBAEnB,oBAAoB"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/* eslint-disable max-lines -- scene node contracts are kept together as the public graph type surface */\n\nimport type { ExportFormatId } from './export-format'\nimport type { CanvasGuide } from './guides'\nimport type { InstanceOverrideState } from './instances/overrides'\nimport type { Color, Matrix, Rect, Vector } from './primitives'\nimport type { ShaderUniformValue } from './shaders/schema'\nimport type { ShapeWithTextType } from './shape-with-text/kinds'\n\nexport interface SceneGraphEvents {\n 'node:created': (node: SceneNode) => void\n 'node:updated': (id: string, changes: Partial<SceneNode>) => void\n 'node:previewUpdated': (id: string, changes: Partial<SceneNode>) => void\n 'node:deleted': (id: string, parentId: string | null) => void\n 'node:reparented': (nodeId: string, oldParentId: string | null, newParentId: string) => void\n 'node:reordered': (\n nodeId: string,\n parentId: string,\n index: number,\n previousParentId: string | null\n ) => void\n}\n\nexport type SceneGraphEventHandlers = Partial<{\n created: (node: SceneNode) => void\n updated: (id: string, changes: Partial<SceneNode>) => void\n previewUpdated: (id: string, changes: Partial<SceneNode>) => void\n deleted: (id: string, parentId: string | null) => void\n reparented: (nodeId: string, oldParentId: string | null, newParentId: string) => void\n reordered: (\n nodeId: string,\n parentId: string,\n index: number,\n previousParentId: string | null\n ) => void\n}>\n\n/** Hears about nodes as an edit adds and changes them, synchronously and before each change. */\nexport interface NodeChangeObserver {\n /** A node is about to change and is still as it was. */\n before: (node: SceneNode) => void\n /** A node was just added. */\n created: (node: SceneNode) => void\n}\n\nexport type DocumentColorSpace = 'srgb' | 'display-p3'\n\n/** What a document is for, as Figma keeps design files and FigJam boards apart. */\nexport type DocumentKind = 'design' | 'board'\n\nexport interface FigmaSourcePayload {\n rawSize: Vector | null\n rawTransform: Matrix | null\n rawNodeFields: Record<string, unknown>\n layout: FigmaLayoutMetadata | null\n symbolOverrides: unknown[]\n componentPropAssignments: unknown[]\n derivedSymbolData: unknown[]\n derivedSymbolDataLayoutVersion: number | null\n uniformScaleFactor: number | null\n}\n\nexport interface SourceMetadata {\n format: 'fig' | null\n id: string | null\n orderKey: string | null\n editedFields: string[]\n fig: FigmaSourcePayload\n}\n\nexport type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH'\nexport type WindingRule = 'NONZERO' | 'EVENODD'\n\nexport interface VectorVertex {\n x: number\n y: number\n strokeCap?: string\n strokeJoin?: string\n cornerRadius?: number\n handleMirroring?: HandleMirroring\n}\n\nexport interface VectorSegment {\n start: number\n end: number\n tangentStart: Vector\n tangentEnd: Vector\n}\n\nexport interface VectorRegion {\n windingRule: WindingRule\n loops: number[][]\n}\n\nexport interface VectorNetwork {\n vertices: VectorVertex[]\n segments: VectorSegment[]\n regions: VectorRegion[]\n}\n\nexport interface GeometryPath {\n windingRule: WindingRule\n commandsBlob: Uint8Array\n /** Resolved paints for geometry using a format-specific style override. */\n fills?: Fill[]\n /** Shared fill style attached to this geometry region, when available. */\n fillStyleId?: string\n}\n\nexport type NodeType =\n | 'CANVAS'\n | 'FRAME'\n | 'RECTANGLE'\n | 'ROUNDED_RECTANGLE'\n | 'ELLIPSE'\n | 'TEXT'\n | 'LINE'\n | 'STAR'\n | 'POLYGON'\n | 'VECTOR'\n | 'BOOLEAN_OPERATION'\n | 'GROUP'\n | 'SECTION'\n | 'COMPONENT'\n | 'COMPONENT_SET'\n | 'INSTANCE'\n | 'CONNECTOR'\n | 'SHAPE_WITH_TEXT'\n | 'STICKY'\n | 'SCRIPT'\n\nexport type FillType =\n | 'SOLID'\n | 'GRADIENT_LINEAR'\n | 'GRADIENT_RADIAL'\n | 'GRADIENT_ANGULAR'\n | 'GRADIENT_DIAMOND'\n | 'MESH'\n | 'IMAGE'\n | 'VIDEO'\n | 'PATTERN'\n | 'NOISE'\n | 'CUSTOM'\nexport type BlendMode =\n | 'NORMAL'\n | 'DARKEN'\n | 'MULTIPLY'\n | 'LINEAR_BURN'\n | 'COLOR_BURN'\n | 'LIGHTEN'\n | 'SCREEN'\n | 'LINEAR_DODGE'\n | 'COLOR_DODGE'\n | 'OVERLAY'\n | 'SOFT_LIGHT'\n | 'HARD_LIGHT'\n | 'DIFFERENCE'\n | 'EXCLUSION'\n | 'HUE'\n | 'SATURATION'\n | 'COLOR'\n | 'LUMINOSITY'\n | 'PASS_THROUGH'\nexport type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE'\nexport type NoiseType = 'MULTITONE' | 'MONOTONE' | 'DUOTONE'\nexport type PatternTileType = 'RECTANGULAR' | 'HORIZONTAL_HEXAGONAL' | 'VERTICAL_HEXAGONAL'\nexport type PatternAlignment = 'START' | 'CENTER' | 'END'\n\nexport interface GradientStop {\n color: Color\n position: number\n}\n\n/**\n * One control point of a `MESH` fill: its color, and where it sits in the layer's unit square.\n * A mesh holds `(rows + 1) * (columns + 1)` points in row-major order: corners and edge points\n * first, so a 1x1 mesh is the four corners. Positions outside 0..1 are allowed; the renderer\n * clamps them to the layer.\n */\nexport interface MeshGradientPoint {\n position: Vector\n color: Color\n}\n\nexport type GradientTransform = Matrix\n\nexport interface Fill {\n type: FillType\n color: Color\n opacity: number\n visible: boolean\n blendMode?: BlendMode\n gradientStops?: GradientStop[]\n gradientTransform?: GradientTransform\n /** A `MESH` fill's grid: columns and rows of cells, with one more point than cells each way. */\n meshColumns?: number\n meshRows?: number\n meshPoints?: MeshGradientPoint[]\n imageHash?: string\n imageScaleMode?: ImageScaleMode\n /** A crop's image-space window; Fill, Fit and Tile ignore it. */\n imageTransform?: GradientTransform\n /** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */\n imageRotation?: number\n sourceNodeId?: string\n scale?: number\n spacing?: number\n patternSpacing?: Vector\n patternTileType?: PatternTileType\n verticalAlignment?: PatternAlignment\n horizontalAlignment?: PatternAlignment\n noiseType?: NoiseType\n density?: number\n noiseSize?: Vector\n customEffectId?: string\n}\n\nexport type StrokeCap =\n | 'NONE'\n | 'ROUND'\n | 'SQUARE'\n | 'ARROW_LINES'\n | 'ARROW_EQUILATERAL'\n | 'TRIANGLE_FILLED'\n | 'DIAMOND_FILLED'\n | 'CIRCLE_FILLED'\nexport type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'\nexport type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID'\nexport type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid'\nexport type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE'\n\nexport interface LayoutGrid {\n visible?: boolean\n color?: Color\n /** `STRIPES` is the archive's name for columns or rows, along `axis`. */\n pattern?: 'COLUMNS' | 'ROWS' | 'GRID' | 'STRIPES'\n axis?: 'X' | 'Y'\n type?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'\n alignment?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'\n numSections?: number\n /** Figma's plugin API reports an Auto count as `null` and accepts `Infinity` for it. */\n count?: number | null\n offset?: number\n sectionSize?: number\n gutterSize?: number\n}\n\nexport interface SharedStyle {\n id: string\n nodeId: string\n name: string\n type: SharedStyleType\n}\n\n/** A stroke is a paint with the geometry that decides where it is drawn. */\nexport interface Stroke extends Fill {\n weight: number\n align: 'INSIDE' | 'CENTER' | 'OUTSIDE'\n cap?: StrokeCap\n join?: StrokeJoin\n dashPattern?: number[]\n}\n\nexport type Effect = ShadowEffect | ShaderEffect\n\nexport interface ShadowEffect {\n type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR'\n color: Color\n offset: Vector\n radius: number\n spread: number\n visible: boolean\n blendMode?: BlendMode\n showShadowBehindNode?: boolean\n}\n\n/** A layer post-processed by shader code the user wrote; the layer is the `pencil:object` sample. */\nexport interface ShaderEffect {\n type: 'SHADER'\n source: string\n uniforms?: Record<string, ShaderUniformValue>\n uniformBindings?: Record<string, string>\n visible: boolean\n blendMode?: BlendMode\n}\n\nexport type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'\nexport type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT' | 'TRUNCATE'\n\n/** Where a connector end attaches to a layer: a side, the side Figma picks, or a fixed point. */\nexport type ConnectorMagnet =\n | 'NONE'\n | 'AUTO'\n | 'AUTO_HORIZONTAL'\n | 'TOP'\n | 'RIGHT'\n | 'BOTTOM'\n | 'LEFT'\n | 'CENTER'\n | 'EDGE'\n | 'ABSOLUTE'\n\n/**\n * One end of a connector. Bound to a layer, it follows the layer by `magnet`, or by `position`\n * in the layer's own axes when the magnet is `NONE`. Free, `nodeId` is null and `position` is in\n * the connector's parent's axes.\n */\nexport interface ConnectorEndpoint {\n nodeId: string | null\n magnet: ConnectorMagnet\n position: Vector\n}\n\nexport type ConnectorLineType = 'ELBOWED' | 'STRAIGHT' | 'CURVED'\n\n/**\n * A segment of an elbow connector that was dragged into place: the line it runs along, through\n * `position`, in the connector's own axes. `position` lies midway along the segment as last drawn.\n */\nexport interface ConnectorControlPoint {\n position: Vector\n direction: 'HORIZONTAL' | 'VERTICAL'\n}\n\n/**\n * Where a connector's label was dragged along its line: `offset` of the way from the middle of\n * the line towards one end, by length, on the line or to one side of it. `ABOVE` is the side to\n * the left of the line's direction.\n */\nexport interface ConnectorLabelPosition {\n section: 'MIDDLE_TO_START' | 'MIDDLE_TO_END'\n offset: number\n offAxis: 'NONE' | 'ABOVE' | 'BELOW'\n}\nexport type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM'\nexport type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'\nexport type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'\nexport type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY'\nexport type LeadingTrim = 'NONE' | 'CAP_HEIGHT'\nexport type TextDirection = 'AUTO' | 'LTR' | 'RTL'\nexport type LayoutDirection = 'AUTO' | 'LTR' | 'RTL'\n/** Whether a paragraph is an item of a numbered list, a bulleted list, or no list. */\nexport type TextListType = 'NONE' | 'ORDERED' | 'UNORDERED'\n\n/** How one paragraph of a text node (a line ending at a newline) sits in a list. */\n/** Spacing a text sets for all its paragraphs and a paragraph can set for itself. */\nexport type TextParagraphSpacingField = 'listSpacing' | 'paragraphSpacing' | 'paragraphIndent'\n\nexport interface TextParagraphStyle {\n listType: TextListType\n /** Nesting level: 1–5 for list items; kept but not drawn for plain paragraphs. */\n indentation: number\n /** This paragraph's own spacing, in place of the text's; absent ones follow the text. */\n listSpacing?: number\n paragraphSpacing?: number\n paragraphIndent?: number\n}\n\nexport interface FontVariation {\n axis: string\n value: number\n}\n\nexport interface FontFeature {\n tag: string\n enabled: boolean\n}\n\n/** Where a stretch of text links to, as Figma's `HyperlinkTarget`: a URL, or a node by its ID. */\nexport interface HyperlinkTarget {\n type: 'URL' | 'NODE'\n value: string\n}\n\n/** The text fields a range of characters can bind to a variable, as Figma lists them. */\nexport const TEXT_BINDABLE_FIELDS = [\n 'fontFamily',\n 'fontSize',\n 'fontStyle',\n 'fontWeight',\n 'letterSpacing',\n 'lineHeight',\n 'paragraphSpacing',\n 'paragraphIndent'\n] as const\n\nexport type TextBindableField = (typeof TEXT_BINDABLE_FIELDS)[number]\n\n/** Variable IDs bound to text fields, by field. */\nexport type TextBoundVariables = Partial<Record<TextBindableField, string>>\n\n/**\n * A line height or letter spacing as Figma keeps it: pixels, or a percent of the font size that\n * follows the size when it changes.\n */\nexport interface TextLength {\n value: number\n unit: 'PIXELS' | 'PERCENT'\n}\n\nexport interface CharacterStyleOverride {\n fontWeight?: number\n italic?: boolean\n /** The characters' face by its font's own name for it; `null` is the face their weight picks. */\n fontStyle?: string | null\n textDecoration?: TextDecoration\n textDecorationStyle?: TextDecorationStyle\n textDecorationThickness?: number | null\n textDecorationFills?: Fill[]\n textDecorationSkipInk?: boolean\n textUnderlineOffset?: number | null\n fontSize?: number\n fontFamily?: string\n letterSpacing?: TextLength\n /** `null` is automatic, from the font. */\n lineHeight?: TextLength | null\n fills?: Fill[]\n fontVariations?: FontVariation[]\n /** Whether the characters' optical size follows their font size, in place of the text's own. */\n opticalSizeFromFontSize?: boolean\n fontFeatures?: FontFeature[]\n textLanguage?: string | null\n textCase?: TextCase\n /** A link over the characters; `null`, like leaving it out, links nowhere. */\n hyperlink?: HyperlinkTarget | null\n /** The text style the characters use in place of the text's own; `null` uses none. */\n textStyleId?: string | null\n /** The fill style the characters use in place of the text's own; `null` uses none. */\n fillStyleId?: string | null\n /** The characters' text field bindings, in place of the text's own. */\n boundVariables?: TextBoundVariables\n /**\n * The scale each number the characters bind resolves with, as a rescale left it; a field without\n * one uses the layer's `variableBindingScales`, as runs did before they kept their own.\n */\n variableBindingScales?: Partial<Record<TextBindableField, number>>\n}\n\nexport interface StyleRun {\n start: number\n length: number\n style: CharacterStyleOverride\n}\n\nexport interface ArcData {\n startingAngle: number\n endingAngle: number\n innerRadius: number\n}\n\nexport type LayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'GRID'\n/** A node's sizing along one axis; fill is stored on the child, see `layoutSizing`. */\nexport type LayoutSizing = 'FIXED' | 'HUG' | 'FILL'\n/** Whether an auto-layout frame keeps its size or hugs its children along one of its axes. */\nexport type AxisSizingMode = 'FIXED' | 'HUG'\n\nexport type GridTrackSizing = 'FIXED' | 'FR' | 'AUTO'\n\nexport interface GridTrack {\n sizing: GridTrackSizing\n value: number\n}\n\nexport interface GridPosition {\n column: number\n row: number\n columnSpan: number\n rowSpan: number\n}\n/**\n * Primary axis alignment of an auto layout's children. `SPACE_AROUND` is Pairdraw's own:\n * Figma has no such mode, so `.fig` files keep it as plugin data over Figma's space between.\n */\nexport type LayoutAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN' | 'SPACE_AROUND'\nexport type LayoutCounterAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'\nexport type LayoutAlignSelf = 'AUTO' | 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'\nexport type LayoutWrap = 'NO_WRAP' | 'WRAP'\n\nexport interface PluginDataEntry {\n pluginId: string\n key: string\n value: string\n}\n\nexport interface ExportSetting {\n scale: number\n format: ExportFormatId\n /** JPG and WEBP quality from 1 to 100; absent means the encoder's default. */\n quality?: number\n}\n\nexport interface PluginRelaunchDataEntry {\n pluginId: string\n command: string\n message: string\n isDeleted: boolean\n}\n\n/**\n * One derived glyph outline for display (path text / missing-font fidelity).\n * Figma import is one producer; Pairdraw editing and reflow can regenerate it.\n * commandsBlob is in font units; paint multiplies by fontSize (and scaleX/Y).\n */\nexport interface TextPathData {\n network: VectorNetwork\n normalizedSize: Vector\n /** Where on the start segment the text starts, from 0 at its start to 1 at its end. */\n tValue: number\n forward: boolean\n /** The segment the text starts on, which Figma marks in the network blob; 0 when unmarked. */\n startSegment?: number\n}\n\nexport interface DerivedTextGlyph {\n /** UTF-16 source-text cluster start, when supplied by the shaping source. */\n firstCharacter?: number\n commandsBlob: Uint8Array\n x: number\n y: number\n fontSize: number\n /** Figma Glyph.rotation — radians, not degrees. Zero for axis-aligned text. */\n rotation?: number\n /**\n * Horizontal advance in pixels at `fontSize`, before `scaleX`, when the shaping source gave\n * one; where the glyph ends, so decorations stop at the text rather than the layer's edge.\n */\n advance?: number\n /**\n * Accumulated non-uniform resize scale (default 1). Paint order is\n * translate → scale(scaleX,Y) → rotate → scale(fontSize,-fontSize) so\n * anisotropic stretch matches scaleGeometryPaths(strokeGeometry).\n * Do not fold this into fontSize or rotated letters desync from outlines.\n */\n scaleX?: number\n scaleY?: number\n /**\n * The code points of the emoji this glyph stands for, sequence and all. Its outline is only a\n * placeholder square a 1 em wide; the emoji's image is drawn there instead, as Figma does.\n */\n emojiCodePoints?: number[]\n /** The image set Figma draws the emoji from, when the file names one other than Apple's. */\n emojiImageSet?: 'NOTO'\n}\n\nexport interface SymbolLink {\n uri: string\n displayName?: string\n displayText?: string\n}\n\nexport interface VariantPropSpec {\n propDefId: string\n value: string\n}\n\nexport type FigmaLayoutMetadata = Partial<\n Record<\n | 'stackMode'\n | 'stackCounterAlign'\n | 'stackJustify'\n | 'stackCounterAlignItems'\n | 'stackPrimaryAlignItems'\n | 'stackPrimarySizing'\n | 'stackCounterSizing'\n | 'stackWrap'\n | 'stackPositioning'\n | 'stackChildAlignSelf',\n string\n > &\n Record<\n | 'stackSpacing'\n | 'stackPadding'\n | 'stackPaddingRight'\n | 'stackPaddingBottom'\n | 'stackVerticalPadding'\n | 'stackHorizontalPadding'\n | 'stackChildPrimaryGrow'\n | 'stackCounterSpacing',\n number\n > &\n Record<'bordersTakeSpace' | 'stackReverseZIndex', boolean>\n>\n\nexport interface LibraryAssetIdentity {\n libraryId: string\n assetKey: string\n revisionId: string\n}\n\nexport interface LibraryAssetSource {\n identity: LibraryAssetIdentity\n sourceNodeId: string | null\n readOnly: boolean\n}\n\nexport interface EnabledLibraryBinding {\n libraryId: string\n revisionId: string\n enabled: boolean\n}\n\n/** The library a document publishes as. */\nexport interface SourceLibraryPublication {\n libraryId: string\n revisionId: string\n name: string\n catalogSource?: string\n}\n\n/** A reply in a canvas comment thread. */\nexport interface CommentReply {\n id: string\n author: string\n /** The author's collaboration color when they wrote it, for their avatar. */\n authorColor?: Color\n /** Markdown: bold, italic, strikethrough, links and lists. */\n text: string\n createdAt: string\n deleted?: boolean\n}\n\n/** A canvas comment thread, kept in the document's root plugin data. */\nexport interface CommentThread {\n id: string\n pageId: string\n /** Page name when the pin was placed, for readers of the raw data. */\n pageName?: string\n /** Top-level layer under the pin; the pin follows it when it moves. */\n nodeId?: string | null\n nodeName?: string | null\n /** Offset from the layer's top-left corner, in canvas units. */\n offsetX?: number\n offsetY?: number\n /** Canvas position when the pin was last saved; used when the layer is gone. */\n x: number\n y: number\n author: string\n /** The author's collaboration color when they wrote it, for their avatar. */\n authorColor?: Color\n /** Markdown: bold, italic, strikethrough, links and lists. */\n text: string\n createdAt: string\n /** Bumped on every change. */\n updatedAt: string\n resolved: boolean\n resolvedAt?: string | null\n /** Deleted threads stay as tombstones so a stale copy cannot bring them back. */\n deleted?: boolean\n replies: CommentReply[]\n}\n\n/** How a prototype reaction starts, as `.fig` keeps `PrototypeEvent.interactionType`. */\nexport type PrototypeTriggerType = 'ON_CLICK' | 'AFTER_TIMEOUT'\n\n/** What a reaction does, as `.fig` keeps `ConnectionType` on `PrototypeAction`. */\nexport type PrototypeActionType = 'NODE' | 'BACK' | 'CLOSE'\n\n/** Whether an action moves to a frame or opens it over the screen, as `NavigationType`. */\nexport type PrototypeNavigationType = 'NAVIGATE' | 'OVERLAY'\n\n/** How a reaction animates between frames, as `TransitionType` keeps them. */\nexport type PrototypeTransitionType = 'INSTANT' | 'DISSOLVE'\n\n/** Where an overlay sits over the screen, as `OverlayPositionType`. */\nexport type PrototypeOverlayPositionType =\n | 'CENTER'\n | 'TOP_LEFT'\n | 'TOP_CENTER'\n | 'TOP_RIGHT'\n | 'BOTTOM_LEFT'\n | 'BOTTOM_CENTER'\n | 'BOTTOM_RIGHT'\n\n/** How a reaction animates, and how long it takes in seconds. */\nexport interface PrototypeTransition {\n type: PrototypeTransitionType\n duration: number\n}\n\n/** A reaction's move to another frame, or the overlay it opens. */\nexport interface PrototypeNodeAction {\n type: 'NODE'\n /** The frame the action shows; `null` keeps the connection when its target is gone. */\n nodeId: string | null\n navigation: PrototypeNavigationType\n transition: PrototypeTransition\n /** Where an OVERLAY sits over the screen; NAVIGATE keeps CENTER. */\n overlayPosition: PrototypeOverlayPositionType\n}\n\n/** Goes back to the frame the play came from. */\nexport interface PrototypeBackAction {\n type: 'BACK'\n}\n\n/** Closes the overlay the play is showing. */\nexport interface PrototypeCloseAction {\n type: 'CLOSE'\n}\n\nexport type PrototypeAction = PrototypeNodeAction | PrototypeBackAction | PrototypeCloseAction\n\n/** What starts a reaction, and after how long an AFTER_TIMEOUT does. */\nexport interface PrototypeTrigger {\n type: PrototypeTriggerType\n /** AFTER_TIMEOUT only: the seconds before the reaction runs. */\n delay: number\n}\n\n/**\n * One prototype connection on a layer: what starts it and what it does, as `.fig` keeps a\n * `PrototypeInteraction` on the layer's `prototypeInteractions`.\n */\nexport interface PrototypeReaction {\n id: string\n trigger: PrototypeTrigger\n actions: PrototypeAction[]\n}\n\nexport interface SceneNode {\n id: string\n type: NodeType\n name: string\n parentId: string | null\n childIds: string[]\n\n x: number\n y: number\n width: number\n height: number\n rotation: number\n source: SourceMetadata\n /** Materialized layout hint imported or generated outside the live Yoga layout pass. */\n derivedLayout: Partial<Rect> | null\n\n fills: Fill[]\n strokes: Stroke[]\n effects: Effect[]\n layoutGrids: LayoutGrid[]\n guides: CanvasGuide[]\n fillStyleId: string | null\n strokeStyleId: string | null\n textStyleId: string | null\n effectStyleId: string | null\n gridStyleId: string | null\n sharedStyleType: SharedStyleType | null\n opacity: number\n\n cornerRadius: number\n topLeftRadius: number\n topRightRadius: number\n bottomRightRadius: number\n bottomLeftRadius: number\n independentCorners: boolean\n cornerSmoothing: number\n\n visible: boolean\n locked: boolean\n clipsContent: boolean\n\n blendMode: BlendMode\n\n text: string\n fontSize: number\n fontFamily: string\n fontWeight: number\n italic: boolean\n /**\n * The face by the name its font gives it (\"Semi Bold\", \"Book\", \"Condensed Bold\"), which Figma\n * finds a font's face by; `null` is the face the weight and slant pick in the family.\n */\n fontStyle: string | null\n textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'\n textDirection: TextDirection\n textLanguage: string | null\n textAlignVertical: TextAlignVertical\n textAutoResize: TextAutoResize\n textCase: TextCase\n textDecoration: TextDecoration\n textDecorationStyle: TextDecorationStyle\n textDecorationThickness: number | null\n textDecorationFills: Fill[]\n textDecorationSkipInk: boolean\n textUnderlineOffset: number | null\n leadingTrim: LeadingTrim\n /** `null` is automatic, from the font. */\n lineHeight: TextLength | null\n letterSpacing: TextLength\n maxLines: number | null\n /**\n * One entry per paragraph of `text`, in order. Missing entries are plain paragraphs, so text\n * without lists keeps this empty.\n */\n textParagraphs: TextParagraphStyle[]\n /** Space after a list item followed by another; a paragraph's own value comes first. */\n listSpacing: number\n /** Space after a paragraph other than between two list items. */\n paragraphSpacing: number\n /** Indent of the first line of each plain paragraph. */\n paragraphIndent: number\n /** Whether list markers hang outside the text box instead of indenting the items. */\n hangingList: boolean\n\n styleRuns: StyleRun[]\n fontVariations: FontVariation[]\n /**\n * Whether a variable font's optical size follows the font size, as Figma's \"Set optical size\n * automatically\" does by default; when it does not, the `opsz` in `fontVariations` applies.\n */\n opticalSizeFromFontSize: boolean\n fontFeatures: FontFeature[]\n\n horizontalConstraint: ConstraintType\n verticalConstraint: ConstraintType\n\n layoutMode: LayoutMode\n layoutDirection: LayoutDirection\n layoutWrap: LayoutWrap\n primaryAxisAlign: LayoutAlign\n counterAxisAlign: LayoutCounterAlign\n primaryAxisSizing: AxisSizingMode\n counterAxisSizing: AxisSizingMode\n itemSpacing: number\n counterAxisSpacing: number\n paddingTop: number\n paddingRight: number\n paddingBottom: number\n paddingLeft: number\n\n layoutPositioning: 'AUTO' | 'ABSOLUTE'\n layoutGrow: number\n layoutAlignSelf: LayoutAlignSelf\n\n vectorNetwork: VectorNetwork | null\n handleMirroring: HandleMirroring\n booleanOperation: 'UNION' | 'SUBTRACT' | 'INTERSECT' | 'EXCLUDE' | undefined\n fillGeometry: GeometryPath[]\n strokeGeometry: GeometryPath[]\n\n arcData: ArcData | null\n\n strokeCap: StrokeCap\n strokeJoin: StrokeJoin\n dashPattern: number[]\n\n borderTopWeight: number\n borderRightWeight: number\n borderBottomWeight: number\n borderLeftWeight: number\n independentStrokeWeights: boolean\n\n /**\n * The weight and alignment a node keeps for its strokes, as Figma keeps them on the node: they\n * last while it has no strokes, and a stroke added to it takes them. Each stroke still carries\n * its own `weight` and `align`, which win while the node has strokes.\n */\n strokeWeight: number\n strokeAlign: Stroke['align']\n\n strokeMiterLimit: number\n\n minWidth: number | null\n maxWidth: number | null\n minHeight: number | null\n maxHeight: number | null\n /**\n * The size whose proportions the layer keeps, as Figma stores it: the width and height it had\n * when the ratio was locked, not a reduced ratio. Null leaves the proportions free.\n */\n targetAspectRatio: Vector | null\n\n /** A connector's ends and the line between them; null on other layers. */\n connectorStart: ConnectorEndpoint | null\n connectorEnd: ConnectorEndpoint | null\n connectorLineType: ConnectorLineType\n connectorStartCap: StrokeCap\n connectorEndCap: StrokeCap\n /**\n * An elbow connector's segments between its first and last, in order, once one was dragged;\n * empty while it routes itself. Kept, unused, while the line is straight or curved.\n */\n connectorControlPoints: ConnectorControlPoint[]\n /**\n * A curved connector's two cubic control points, in the connector's own axes, once its curve\n * was dragged; null while it curves by itself. Kept, unused, while the line is not curved.\n */\n connectorCurveHandles: [Vector, Vector] | null\n /** Where a connector's label was dragged to; null while it sits midway along the line. */\n connectorLabelPosition: ConnectorLabelPosition | null\n\n isMask: boolean\n maskType: MaskType\n maskIsOutline: boolean\n\n gridTemplateColumns: GridTrack[]\n gridTemplateRows: GridTrack[]\n gridColumnGap: number\n gridRowGap: number\n gridPosition: GridPosition | null\n\n counterAxisAlignContent: 'AUTO' | 'SPACE_BETWEEN'\n itemReverseZIndex: boolean\n strokesIncludedInLayout: boolean\n\n expanded: boolean\n textTruncation: 'DISABLED' | 'ENDING'\n autoRename: boolean\n\n pointCount: number\n starInnerRadius: number\n /** The FigJam kind a SHAPE_WITH_TEXT draws; its label is the node's own text. */\n shapeWithTextType: ShapeWithTextType\n /** The height a shape with text was given; it grows past it to fit its label. 0 is unset. */\n shapeUserHeight: number\n /**\n * Whether a shape with text keeps its height and cuts its label off with \"…\" instead of growing,\n * as FigJam does once the shape's height was set.\n */\n shapeTruncates: boolean\n\n componentId: string | null\n instanceOverrides: InstanceOverrideState\n componentPropertyDefinitions: ComponentPropertyDefinition[]\n componentPropertyReferences: ComponentPropertyReference[]\n componentPropertyAssignments: Record<string, string>\n componentPropertyValues: Record<string, string>\n componentKey: string | null\n sourceLibraryKey: string | null\n publishId: string | null\n overrideKey: string | null\n sharedSymbolVersion: string | null\n publishedVersion: string | null\n librarySource: LibraryAssetSource | null\n isPublishable: boolean\n isSymbolPublishable: boolean\n /**\n * On an instance inside a component: its properties show on instances of that component,\n * as Figma's `isExposedInstance`.\n */\n isExposedInstance: boolean\n symbolDescription: string\n symbolLinks: SymbolLink[]\n variantPropSpecs: VariantPropSpec[]\n\n boundVariables: Record<string, string>\n /** Multipliers from bound numeric values to this occurrence's scene units. */\n variableBindingScales: Partial<Record<string, number>>\n /** Numeric units for new declarations owned by this node's occurrence scope. */\n variableAssignmentScales: Partial<Record<string, number>>\n /** Explicit coordinate scale relative to the containing component definition. */\n componentScale: number\n variableModes: VariableModeMap\n exportSettings: ExportSetting[]\n /**\n * The id of the status a team gave the layer, a state of the document's workflow such as Ready\n * for dev. It stays while the layer sits where it cannot show one; `effectiveStatus` tells\n * whether it shows.\n */\n status: string | null\n\n pluginData: PluginDataEntry[]\n pluginRelaunchData: PluginRelaunchDataEntry[]\n\n /** The prototype reactions this layer starts, as Figma's prototype keeps them. */\n prototypeReactions: PrototypeReaction[]\n\n internalOnly: boolean\n\n flipX: boolean\n flipY: boolean\n\n textPicture: Uint8Array | null\n derivedTextGlyphs: DerivedTextGlyph[] | null\n /**\n * How far a text's lines reach down from its top: measured at its width when its text or width\n * changes, or read from the lines a file saved, and never saved itself. A fixed-size box does not\n * clip them, as in Figma, so its visual bounds reach this far. Null when not known.\n */\n derivedTextHeight: number | null\n /** Format-neutral layout path for text-on-path nodes. */\n textPathData: TextPathData | null\n /** Node-local box that maps textPathData into the node coordinate space. */\n textPathBox: Rect | null\n}\n\nexport type ComponentPropertyType = 'VARIANT' | 'TEXT' | 'BOOLEAN' | 'INSTANCE_SWAP' | 'SLOT'\n\n/** `SLOT_CONTENT` marks a frame whose children are the slot's content. */\nexport type ComponentPropertyReferenceField = 'VISIBLE' | 'TEXT' | 'INSTANCE_SWAP' | 'SLOT_CONTENT'\n\nexport interface ComponentPropertyReference {\n propertyId: string\n field: ComponentPropertyReferenceField\n}\n\n/** Guidance for a slot property; Figma reports a breach but still accepts the content. */\nexport interface SlotSettings {\n minChildren?: number\n maxChildren?: number\n allowPreferredValuesOnly: boolean\n displayEmptyByDefault: boolean\n /** Content added to the slot fills its counter axis. */\n stretchChildOnInsert: boolean\n}\n\n/**\n * For a `SLOT` property, an instance assignment (whatever its value) means the instance owns\n * that slot's content: the slot frame's children in the instance, which component sync keeps.\n */\nexport interface ComponentPropertyDefinition {\n id: string\n name: string\n type: ComponentPropertyType\n defaultValue: string\n variantOptions?: string[]\n preferredValues?: string[]\n description?: string\n slotSettings?: SlotSettings\n}\n\nexport type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN'\nexport interface VariableAlias {\n aliasId: string\n}\n\n/** Figma's two-argument color expression; opacity is a percentage, not an alpha multiplier. */\nexport interface VariableColorExpression {\n expression: 'COMPOSE_COLOR'\n color: Color | VariableAlias\n opacity: number | VariableAlias\n}\n\nexport type VariableLiteral = Color | number | string | boolean\n/** The arithmetic, comparison, logic and conversions a formula combines values with. */\nexport const VARIABLE_FORMULA_OPERATORS = [\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'negate',\n 'equal',\n 'notEqual',\n 'less',\n 'lessOrEqual',\n 'greater',\n 'greaterOrEqual',\n 'and',\n 'or',\n 'not',\n 'text',\n 'truthy',\n 'if'\n] as const\nexport type VariableFormulaOperator = (typeof VARIABLE_FORMULA_OPERATORS)[number]\nexport interface VariableFormulaOperation {\n operator: VariableFormulaOperator\n operands: VariableFormulaNode[]\n}\nexport type VariableFormulaNode = VariableLiteral | VariableAlias | VariableFormulaOperation\nexport interface VariableFormula {\n expression: 'FORMULA'\n type: VariableType\n value: VariableFormulaNode\n}\n/**\n * An imported expression Pairdraw cannot evaluate, kept as the file wrote it so saving writes it\n * back. `references` holds one entry per alias in `value`, in the order the format walks them, and\n * `null` where the alias names a variable this document does not have. `modes` holds the mode id of\n * each mode key in `value`, in the same walk order.\n */\nexport interface VariableUnsupportedExpression {\n expression: 'UNSUPPORTED'\n /** The function name the file gives, such as `VAR_MODE_LOOKUP`. */\n function: string\n value: Record<string, unknown>\n references: (string | null)[]\n modes: string[]\n}\nexport type VariableValue =\n | VariableLiteral\n | VariableAlias\n | VariableColorExpression\n | VariableFormula\n | VariableUnsupportedExpression\nexport type VariableModeMap = Record<string, string>\n\n/** Property pickers a variable is offered in, as Figma names them. */\nexport const VARIABLE_SCOPES = [\n 'ALL_SCOPES',\n 'TEXT_CONTENT',\n 'CORNER_RADIUS',\n 'WIDTH_HEIGHT',\n 'GAP',\n 'ALL_FILLS',\n 'FRAME_FILL',\n 'SHAPE_FILL',\n 'TEXT_FILL',\n 'STROKE',\n 'STROKE_FLOAT',\n 'EFFECT_FLOAT',\n 'EFFECT_COLOR',\n 'OPACITY',\n 'FONT_STYLE',\n 'FONT_FAMILY',\n 'FONT_SIZE',\n 'LINE_HEIGHT',\n 'LETTER_SPACING',\n 'PARAGRAPH_SPACING',\n 'PARAGRAPH_INDENT',\n 'FONT_VARIATIONS',\n 'TRANSFORM'\n] as const\nexport type VariableScope = (typeof VARIABLE_SCOPES)[number]\n\nexport const CODE_SYNTAX_PLATFORMS = ['WEB', 'ANDROID', 'iOS'] as const\nexport type CodeSyntaxPlatform = (typeof CODE_SYNTAX_PLATFORMS)[number]\n\n/**\n * The CSS unit a numeric token is written in. Lengths (`px`, `rem`) stay in canvas pixels in\n * the document and convert only when written as CSS; the other units store the number as written.\n */\nexport const TOKEN_UNITS = ['none', 'px', 'rem', '%', 'ms', 's', 'deg'] as const\nexport type TokenUnit = (typeof TOKEN_UNITS)[number]\n\n/**\n * CSS written in place of a number mode's value, such as `clamp(1rem, 4vw, 1.5rem)`. While the\n * mode holds a plain number, `resolved` records it, so a number later edited elsewhere, Figma\n * included, shows the CSS no longer describes it.\n */\nexport interface TokenExpression {\n css: string\n resolved?: number\n}\n\nexport interface Variable {\n id: string\n name: string\n type: VariableType\n collectionId: string\n valuesByMode: Record<string, VariableValue>\n description: string\n hiddenFromPublishing: boolean\n /** Absent means every scope. */\n scopes?: VariableScope[]\n /**\n * Per-platform code snippets, as Figma's Dev Mode shows them. A `WEB` snippet of `--x` or\n * `var(--x)` names the token's CSS custom property; otherwise the name is derived.\n */\n codeSyntax?: Partial<Record<CodeSyntaxPlatform, string>>\n /** FLOAT only. Absent means inferred when written as CSS. */\n unit?: TokenUnit\n /** Raw CSS by mode id, for values a number cannot express (`clamp()`, `calc()`). */\n expressions?: Record<string, TokenExpression>\n pluginData?: PluginDataEntry[]\n /** Published library key (from NodeChange.key). Used for assetRef resolution in colorVar. */\n key?: string\n /** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */\n version?: string\n}\n\n/** Scalar numeric node fields accepted by numeric property controls. */\nexport type NumericNodeProperty = {\n [K in keyof SceneNode]-?: SceneNode[K] extends number ? K : never\n}[keyof SceneNode]\n\nexport interface VariableCollectionMode {\n modeId: string\n name: string\n /**\n * Where the mode applies in CSS: a selector (`[data-theme=\"dark\"]`, `.compact`) or an\n * at-rule prelude (`@media (max-width: 640px)`). Absent means the default for its axis.\n */\n condition?: string\n /** Where Figma lists the mode, as the file saved it; Figma orders a collection's modes by it. */\n sortPosition?: string\n}\n\nexport interface VariableCollection {\n id: string\n name: string\n /** The default mode comes first, as in Figma. */\n modes: VariableCollectionMode[]\n defaultModeId: string\n variableIds: string[]\n /**\n * The attribute that switches a mode with no condition of its own, `data-theme` for\n * `[data-theme=\"dark\"]`. Absent means one named after the collection.\n */\n modeAttribute?: string\n pluginData?: PluginDataEntry[]\n /**\n * Published library key, for a collection the file copies from a library. Such a collection\n * belongs to the library: Figma lists it with the library's, not the file's own.\n */\n key?: string\n /** Published library version, which references by key carry with it. */\n version?: string\n}\n\n/** Whether a collection is a library's copy, which takes no variables or modes of the file's. */\nexport function isLibraryCollection(collection: Pick<VariableCollection, 'key'>): boolean {\n return !!collection.key\n}\n\n/** An HTML attribute name a stylesheet can select on unescaped: `data-theme`, `theme`. */\nexport const MODE_ATTRIBUTE_PATTERN = /^[A-Za-z_][\\w-]*$/\n\nexport function isModeAttributeName(name: string): boolean {\n return name.length <= 100 && MODE_ATTRIBUTE_PATTERN.test(name)\n}\n"],"mappings":";;AAuXA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AA0oBA,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAmCA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,wBAAwB;CAAC;CAAO;CAAW;AAAK;;;;;AAO7D,MAAa,cAAc;CAAC;CAAQ;CAAM;CAAO;CAAK;CAAM;CAAK;AAAK;;AA+EtE,SAAgB,oBAAoB,YAAsD;CACxF,OAAO,CAAC,CAAC,WAAW;AACtB;;AAGA,MAAa,yBAAyB;AAEtC,SAAgB,oBAAoB,MAAuB;CACzD,OAAO,KAAK,UAAU,OAAO,uBAAuB,KAAK,IAAI;AAC/D"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/* eslint-disable max-lines -- scene node contracts are kept together as the public graph type surface */\n\nimport type { ExportFormatId } from './export-format'\nimport type { CanvasGuide } from './guides'\nimport type { InstanceOverrideState } from './instances/overrides'\nimport type { Color, Matrix, Rect, Vector } from './primitives'\nimport type { ShaderUniformValue } from './shaders/schema'\nimport type { ShapeWithTextType } from './shape-with-text/kinds'\n\nexport interface SceneGraphEvents {\n 'node:created': (node: SceneNode) => void\n 'node:updated': (id: string, changes: Partial<SceneNode>) => void\n 'node:previewUpdated': (id: string, changes: Partial<SceneNode>) => void\n 'node:deleted': (id: string, parentId: string | null) => void\n 'node:reparented': (nodeId: string, oldParentId: string | null, newParentId: string) => void\n 'node:reordered': (\n nodeId: string,\n parentId: string,\n index: number,\n previousParentId: string | null\n ) => void\n}\n\nexport type SceneGraphEventHandlers = Partial<{\n created: (node: SceneNode) => void\n updated: (id: string, changes: Partial<SceneNode>) => void\n previewUpdated: (id: string, changes: Partial<SceneNode>) => void\n deleted: (id: string, parentId: string | null) => void\n reparented: (nodeId: string, oldParentId: string | null, newParentId: string) => void\n reordered: (\n nodeId: string,\n parentId: string,\n index: number,\n previousParentId: string | null\n ) => void\n}>\n\n/** Hears about nodes as an edit adds and changes them, synchronously and before each change. */\nexport interface NodeChangeObserver {\n /** A node is about to change and is still as it was. */\n before: (node: SceneNode) => void\n /** A node was just added. */\n created: (node: SceneNode) => void\n /** What changes from now until `resume` is someone else's; `waitOutsideEdit` calls this. */\n pause?: () => void\n /** The wait ended, and what changed meanwhile belongs outside the edit. */\n resume?: () => void\n}\n\nexport type DocumentColorSpace = 'srgb' | 'display-p3'\n\n/** What a document is for, as Figma keeps design files and FigJam boards apart. */\nexport type DocumentKind = 'design' | 'board'\n\nexport interface FigmaSourcePayload {\n rawSize: Vector | null\n rawTransform: Matrix | null\n rawNodeFields: Record<string, unknown>\n layout: FigmaLayoutMetadata | null\n symbolOverrides: unknown[]\n componentPropAssignments: unknown[]\n derivedSymbolData: unknown[]\n derivedSymbolDataLayoutVersion: number | null\n uniformScaleFactor: number | null\n}\n\nexport interface SourceMetadata {\n format: 'fig' | null\n id: string | null\n orderKey: string | null\n editedFields: string[]\n fig: FigmaSourcePayload\n}\n\nexport type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH'\nexport type WindingRule = 'NONZERO' | 'EVENODD'\n\nexport interface VectorVertex {\n x: number\n y: number\n strokeCap?: string\n strokeJoin?: string\n cornerRadius?: number\n handleMirroring?: HandleMirroring\n}\n\nexport interface VectorSegment {\n start: number\n end: number\n tangentStart: Vector\n tangentEnd: Vector\n}\n\nexport interface VectorRegion {\n windingRule: WindingRule\n loops: number[][]\n}\n\nexport interface VectorNetwork {\n vertices: VectorVertex[]\n segments: VectorSegment[]\n regions: VectorRegion[]\n}\n\nexport interface GeometryPath {\n windingRule: WindingRule\n commandsBlob: Uint8Array\n /** Resolved paints for geometry using a format-specific style override. */\n fills?: Fill[]\n /** Shared fill style attached to this geometry region, when available. */\n fillStyleId?: string\n}\n\nexport type NodeType =\n | 'CANVAS'\n | 'FRAME'\n | 'RECTANGLE'\n | 'ROUNDED_RECTANGLE'\n | 'ELLIPSE'\n | 'TEXT'\n | 'LINE'\n | 'STAR'\n | 'POLYGON'\n | 'VECTOR'\n | 'BOOLEAN_OPERATION'\n | 'GROUP'\n | 'SECTION'\n | 'COMPONENT'\n | 'COMPONENT_SET'\n | 'INSTANCE'\n | 'CONNECTOR'\n | 'SHAPE_WITH_TEXT'\n | 'STICKY'\n | 'SCRIPT'\n\nexport type FillType =\n | 'SOLID'\n | 'GRADIENT_LINEAR'\n | 'GRADIENT_RADIAL'\n | 'GRADIENT_ANGULAR'\n | 'GRADIENT_DIAMOND'\n | 'MESH'\n | 'IMAGE'\n | 'VIDEO'\n | 'PATTERN'\n | 'NOISE'\n | 'CUSTOM'\nexport type BlendMode =\n | 'NORMAL'\n | 'DARKEN'\n | 'MULTIPLY'\n | 'LINEAR_BURN'\n | 'COLOR_BURN'\n | 'LIGHTEN'\n | 'SCREEN'\n | 'LINEAR_DODGE'\n | 'COLOR_DODGE'\n | 'OVERLAY'\n | 'SOFT_LIGHT'\n | 'HARD_LIGHT'\n | 'DIFFERENCE'\n | 'EXCLUSION'\n | 'HUE'\n | 'SATURATION'\n | 'COLOR'\n | 'LUMINOSITY'\n | 'PASS_THROUGH'\nexport type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE'\nexport type NoiseType = 'MULTITONE' | 'MONOTONE' | 'DUOTONE'\nexport type PatternTileType = 'RECTANGULAR' | 'HORIZONTAL_HEXAGONAL' | 'VERTICAL_HEXAGONAL'\nexport type PatternAlignment = 'START' | 'CENTER' | 'END'\n\nexport interface GradientStop {\n color: Color\n position: number\n}\n\n/**\n * One control point of a `MESH` fill: its color, and where it sits in the layer's unit square.\n * A mesh holds `(rows + 1) * (columns + 1)` points in row-major order: corners and edge points\n * first, so a 1x1 mesh is the four corners. Positions outside 0..1 are allowed; the renderer\n * clamps them to the layer.\n */\nexport interface MeshGradientPoint {\n position: Vector\n color: Color\n}\n\nexport type GradientTransform = Matrix\n\n/** Figma's adjustments of an image paint, each from -1 to 1; 0 leaves the image as it is. */\nexport interface ImageFilters {\n exposure?: number\n contrast?: number\n saturation?: number\n temperature?: number\n tint?: number\n highlights?: number\n shadows?: number\n}\n\nexport interface Fill {\n type: FillType\n color: Color\n opacity: number\n visible: boolean\n blendMode?: BlendMode\n gradientStops?: GradientStop[]\n gradientTransform?: GradientTransform\n /** A `MESH` fill's grid: columns and rows of cells, with one more point than cells each way. */\n meshColumns?: number\n meshRows?: number\n meshPoints?: MeshGradientPoint[]\n imageHash?: string\n imageScaleMode?: ImageScaleMode\n /** A crop's image-space window; Fill, Fit and Tile ignore it. */\n imageTransform?: GradientTransform\n /** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */\n imageRotation?: number\n /** An image's adjustments, kept and saved; the canvas does not draw them. */\n filters?: ImageFilters\n sourceNodeId?: string\n scale?: number\n spacing?: number\n patternSpacing?: Vector\n patternTileType?: PatternTileType\n verticalAlignment?: PatternAlignment\n horizontalAlignment?: PatternAlignment\n noiseType?: NoiseType\n density?: number\n noiseSize?: Vector\n customEffectId?: string\n}\n\nexport type StrokeCap =\n | 'NONE'\n | 'ROUND'\n | 'SQUARE'\n | 'ARROW_LINES'\n | 'ARROW_EQUILATERAL'\n | 'TRIANGLE_FILLED'\n | 'DIAMOND_FILLED'\n | 'CIRCLE_FILLED'\nexport type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'\nexport type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID'\nexport type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid'\nexport type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE'\n\nexport interface LayoutGrid {\n visible?: boolean\n color?: Color\n /** `STRIPES` is the archive's name for columns or rows, along `axis`. */\n pattern?: 'COLUMNS' | 'ROWS' | 'GRID' | 'STRIPES'\n axis?: 'X' | 'Y'\n type?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'\n alignment?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'\n numSections?: number\n /** Figma's plugin API reports an Auto count as `null` and accepts `Infinity` for it. */\n count?: number | null\n offset?: number\n sectionSize?: number\n gutterSize?: number\n}\n\nexport interface SharedStyle {\n id: string\n nodeId: string\n name: string\n type: SharedStyleType\n}\n\n/** A stroke is a paint with the geometry that decides where it is drawn. */\nexport interface Stroke extends Fill {\n weight: number\n align: 'INSIDE' | 'CENTER' | 'OUTSIDE'\n cap?: StrokeCap\n join?: StrokeJoin\n dashPattern?: number[]\n}\n\nexport type Effect = ShadowEffect | ShaderEffect\n\nexport interface ShadowEffect {\n type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR'\n color: Color\n offset: Vector\n radius: number\n spread: number\n visible: boolean\n blendMode?: BlendMode\n showShadowBehindNode?: boolean\n}\n\n/** A layer post-processed by shader code the user wrote; the layer is the `pencil:object` sample. */\nexport interface ShaderEffect {\n type: 'SHADER'\n source: string\n uniforms?: Record<string, ShaderUniformValue>\n uniformBindings?: Record<string, string>\n visible: boolean\n blendMode?: BlendMode\n}\n\nexport type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'\nexport type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT' | 'TRUNCATE'\n\n/** Where a connector end attaches to a layer: a side, the side Figma picks, or a fixed point. */\nexport type ConnectorMagnet =\n | 'NONE'\n | 'AUTO'\n | 'AUTO_HORIZONTAL'\n | 'TOP'\n | 'RIGHT'\n | 'BOTTOM'\n | 'LEFT'\n | 'CENTER'\n | 'EDGE'\n | 'ABSOLUTE'\n\n/**\n * One end of a connector. Bound to a layer, it follows the layer by `magnet`, or by `position`\n * in the layer's own axes when the magnet is `NONE`. Free, `nodeId` is null and `position` is in\n * the connector's parent's axes.\n */\nexport interface ConnectorEndpoint {\n nodeId: string | null\n magnet: ConnectorMagnet\n position: Vector\n}\n\nexport type ConnectorLineType = 'ELBOWED' | 'STRAIGHT' | 'CURVED'\n\n/**\n * A segment of an elbow connector that was dragged into place: the line it runs along, through\n * `position`, in the connector's own axes. `position` lies midway along the segment as last drawn.\n */\nexport interface ConnectorControlPoint {\n position: Vector\n direction: 'HORIZONTAL' | 'VERTICAL'\n}\n\n/**\n * Where a connector's label was dragged along its line: `offset` of the way from the middle of\n * the line towards one end, by length, on the line or to one side of it. `ABOVE` is the side to\n * the left of the line's direction.\n */\nexport interface ConnectorLabelPosition {\n section: 'MIDDLE_TO_START' | 'MIDDLE_TO_END'\n offset: number\n offAxis: 'NONE' | 'ABOVE' | 'BELOW'\n}\nexport type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM'\nexport type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'\nexport type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'\nexport type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY'\nexport type LeadingTrim = 'NONE' | 'CAP_HEIGHT'\nexport type TextDirection = 'AUTO' | 'LTR' | 'RTL'\nexport type LayoutDirection = 'AUTO' | 'LTR' | 'RTL'\n/** Whether a paragraph is an item of a numbered list, a bulleted list, or no list. */\nexport type TextListType = 'NONE' | 'ORDERED' | 'UNORDERED'\n\n/** How one paragraph of a text node (a line ending at a newline) sits in a list. */\n/** Spacing a text sets for all its paragraphs and a paragraph can set for itself. */\nexport type TextParagraphSpacingField = 'listSpacing' | 'paragraphSpacing' | 'paragraphIndent'\n\nexport interface TextParagraphStyle {\n listType: TextListType\n /** Nesting level: 1–5 for list items; kept but not drawn for plain paragraphs. */\n indentation: number\n /** This paragraph's own spacing, in place of the text's; absent ones follow the text. */\n listSpacing?: number\n paragraphSpacing?: number\n paragraphIndent?: number\n}\n\nexport interface FontVariation {\n axis: string\n value: number\n}\n\nexport interface FontFeature {\n tag: string\n enabled: boolean\n}\n\n/** Where a stretch of text links to, as Figma's `HyperlinkTarget`: a URL, or a node by its ID. */\nexport interface HyperlinkTarget {\n type: 'URL' | 'NODE'\n value: string\n}\n\n/** The text fields a range of characters can bind to a variable, as Figma lists them. */\nexport const TEXT_BINDABLE_FIELDS = [\n 'fontFamily',\n 'fontSize',\n 'fontStyle',\n 'fontWeight',\n 'letterSpacing',\n 'lineHeight',\n 'paragraphSpacing',\n 'paragraphIndent'\n] as const\n\nexport type TextBindableField = (typeof TEXT_BINDABLE_FIELDS)[number]\n\n/** Variable IDs bound to text fields, by field. */\nexport type TextBoundVariables = Partial<Record<TextBindableField, string>>\n\n/**\n * A line height or letter spacing as Figma keeps it: pixels, or a percent of the font size that\n * follows the size when it changes.\n */\nexport interface TextLength {\n value: number\n unit: 'PIXELS' | 'PERCENT'\n}\n\nexport interface CharacterStyleOverride {\n fontWeight?: number\n italic?: boolean\n /** The characters' face by its font's own name for it; `null` is the face their weight picks. */\n fontStyle?: string | null\n textDecoration?: TextDecoration\n textDecorationStyle?: TextDecorationStyle\n textDecorationThickness?: number | null\n textDecorationFills?: Fill[]\n textDecorationSkipInk?: boolean\n textUnderlineOffset?: number | null\n fontSize?: number\n fontFamily?: string\n letterSpacing?: TextLength\n /** `null` is automatic, from the font. */\n lineHeight?: TextLength | null\n fills?: Fill[]\n fontVariations?: FontVariation[]\n /** Whether the characters' optical size follows their font size, in place of the text's own. */\n opticalSizeFromFontSize?: boolean\n fontFeatures?: FontFeature[]\n textLanguage?: string | null\n textCase?: TextCase\n /** A link over the characters; `null`, like leaving it out, links nowhere. */\n hyperlink?: HyperlinkTarget | null\n /** The text style the characters use in place of the text's own; `null` uses none. */\n textStyleId?: string | null\n /** The fill style the characters use in place of the text's own; `null` uses none. */\n fillStyleId?: string | null\n /** The characters' text field bindings, in place of the text's own. */\n boundVariables?: TextBoundVariables\n /**\n * The scale each number the characters bind resolves with, as a rescale left it; a field without\n * one uses the layer's `variableBindingScales`, as runs did before they kept their own.\n */\n variableBindingScales?: Partial<Record<TextBindableField, number>>\n}\n\nexport interface StyleRun {\n start: number\n length: number\n style: CharacterStyleOverride\n}\n\nexport interface ArcData {\n startingAngle: number\n endingAngle: number\n innerRadius: number\n}\n\nexport type LayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'GRID'\n/** A node's sizing along one axis; fill is stored on the child, see `layoutSizing`. */\nexport type LayoutSizing = 'FIXED' | 'HUG' | 'FILL'\n/** Whether an auto-layout frame keeps its size or hugs its children along one of its axes. */\nexport type AxisSizingMode = 'FIXED' | 'HUG'\n\nexport type GridTrackSizing = 'FIXED' | 'FR' | 'AUTO'\n\nexport interface GridTrack {\n sizing: GridTrackSizing\n value: number\n}\n\nexport interface GridPosition {\n column: number\n row: number\n columnSpan: number\n rowSpan: number\n}\n/**\n * Primary axis alignment of an auto layout's children. `SPACE_AROUND` is Pairdraw's own:\n * Figma has no such mode, so `.fig` files keep it as plugin data over Figma's space between.\n */\nexport type LayoutAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN' | 'SPACE_AROUND'\nexport type LayoutCounterAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'\nexport type LayoutAlignSelf = 'AUTO' | 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'\nexport type LayoutWrap = 'NO_WRAP' | 'WRAP'\n\nexport interface PluginDataEntry {\n pluginId: string\n key: string\n value: string\n}\n\nexport interface ExportSetting {\n scale: number\n format: ExportFormatId\n /** JPG and WEBP quality from 1 to 100; absent means the encoder's default. */\n quality?: number\n}\n\nexport interface PluginRelaunchDataEntry {\n pluginId: string\n command: string\n message: string\n isDeleted: boolean\n}\n\n/**\n * One derived glyph outline for display (path text / missing-font fidelity).\n * Figma import is one producer; Pairdraw editing and reflow can regenerate it.\n * commandsBlob is in font units; paint multiplies by fontSize (and scaleX/Y).\n */\nexport interface TextPathData {\n network: VectorNetwork\n normalizedSize: Vector\n /** Where on the start segment the text starts, from 0 at its start to 1 at its end. */\n tValue: number\n forward: boolean\n /** The segment the text starts on, which Figma marks in the network blob; 0 when unmarked. */\n startSegment?: number\n}\n\nexport interface DerivedTextGlyph {\n /** UTF-16 source-text cluster start, when supplied by the shaping source. */\n firstCharacter?: number\n commandsBlob: Uint8Array\n x: number\n y: number\n fontSize: number\n /** Figma Glyph.rotation — radians, not degrees. Zero for axis-aligned text. */\n rotation?: number\n /**\n * Horizontal advance in pixels at `fontSize`, before `scaleX`, when the shaping source gave\n * one; where the glyph ends, so decorations stop at the text rather than the layer's edge.\n */\n advance?: number\n /**\n * Accumulated non-uniform resize scale (default 1). Paint order is\n * translate → scale(scaleX,Y) → rotate → scale(fontSize,-fontSize) so\n * anisotropic stretch matches scaleGeometryPaths(strokeGeometry).\n * Do not fold this into fontSize or rotated letters desync from outlines.\n */\n scaleX?: number\n scaleY?: number\n /**\n * The code points of the emoji this glyph stands for, sequence and all. Its outline is only a\n * placeholder square a 1 em wide; the emoji's image is drawn there instead, as Figma does.\n */\n emojiCodePoints?: number[]\n /** The image set Figma draws the emoji from, when the file names one other than Apple's. */\n emojiImageSet?: 'NOTO'\n}\n\nexport interface SymbolLink {\n uri: string\n displayName?: string\n displayText?: string\n}\n\nexport interface VariantPropSpec {\n propDefId: string\n value: string\n}\n\nexport type FigmaLayoutMetadata = Partial<\n Record<\n | 'stackMode'\n | 'stackCounterAlign'\n | 'stackJustify'\n | 'stackCounterAlignItems'\n | 'stackPrimaryAlignItems'\n | 'stackPrimarySizing'\n | 'stackCounterSizing'\n | 'stackWrap'\n | 'stackPositioning'\n | 'stackChildAlignSelf',\n string\n > &\n Record<\n | 'stackSpacing'\n | 'stackPadding'\n | 'stackPaddingRight'\n | 'stackPaddingBottom'\n | 'stackVerticalPadding'\n | 'stackHorizontalPadding'\n | 'stackChildPrimaryGrow'\n | 'stackCounterSpacing',\n number\n > &\n Record<'bordersTakeSpace' | 'stackReverseZIndex', boolean>\n>\n\nexport interface LibraryAssetIdentity {\n libraryId: string\n assetKey: string\n revisionId: string\n}\n\nexport interface LibraryAssetSource {\n identity: LibraryAssetIdentity\n sourceNodeId: string | null\n readOnly: boolean\n}\n\nexport interface EnabledLibraryBinding {\n libraryId: string\n revisionId: string\n enabled: boolean\n}\n\n/** The library a document publishes as. */\nexport interface SourceLibraryPublication {\n libraryId: string\n revisionId: string\n name: string\n catalogSource?: string\n}\n\n/** A reply in a canvas comment thread. */\nexport interface CommentReply {\n id: string\n author: string\n /** The author's collaboration color when they wrote it, for their avatar. */\n authorColor?: Color\n /** Markdown: bold, italic, strikethrough, links and lists. */\n text: string\n createdAt: string\n deleted?: boolean\n}\n\n/** A canvas comment thread, kept in the document's root plugin data. */\nexport interface CommentThread {\n id: string\n pageId: string\n /** Page name when the pin was placed, for readers of the raw data. */\n pageName?: string\n /** Top-level layer under the pin; the pin follows it when it moves. */\n nodeId?: string | null\n nodeName?: string | null\n /** Offset from the layer's top-left corner, in canvas units. */\n offsetX?: number\n offsetY?: number\n /** Canvas position when the pin was last saved; used when the layer is gone. */\n x: number\n y: number\n author: string\n /** The author's collaboration color when they wrote it, for their avatar. */\n authorColor?: Color\n /** Markdown: bold, italic, strikethrough, links and lists. */\n text: string\n createdAt: string\n /** Bumped on every change. */\n updatedAt: string\n resolved: boolean\n resolvedAt?: string | null\n /** Deleted threads stay as tombstones so a stale copy cannot bring them back. */\n deleted?: boolean\n replies: CommentReply[]\n}\n\n/** How a prototype reaction starts, as `.fig` keeps `PrototypeEvent.interactionType`. */\nexport type PrototypeTriggerType = 'ON_CLICK' | 'AFTER_TIMEOUT'\n\n/** What a reaction does, as `.fig` keeps `ConnectionType` on `PrototypeAction`. */\nexport type PrototypeActionType = 'NODE' | 'BACK' | 'CLOSE'\n\n/** Whether an action moves to a frame or opens it over the screen, as `NavigationType`. */\nexport type PrototypeNavigationType = 'NAVIGATE' | 'OVERLAY'\n\n/** How a reaction animates between frames, as `TransitionType` keeps them. */\nexport type PrototypeTransitionType = 'INSTANT' | 'DISSOLVE'\n\n/** Where an overlay sits over the screen, as `OverlayPositionType`. */\nexport type PrototypeOverlayPositionType =\n | 'CENTER'\n | 'TOP_LEFT'\n | 'TOP_CENTER'\n | 'TOP_RIGHT'\n | 'BOTTOM_LEFT'\n | 'BOTTOM_CENTER'\n | 'BOTTOM_RIGHT'\n\n/** How a reaction animates, and how long it takes in seconds. */\nexport interface PrototypeTransition {\n type: PrototypeTransitionType\n duration: number\n}\n\n/** A reaction's move to another frame, or the overlay it opens. */\nexport interface PrototypeNodeAction {\n type: 'NODE'\n /** The frame the action shows; `null` keeps the connection when its target is gone. */\n nodeId: string | null\n navigation: PrototypeNavigationType\n transition: PrototypeTransition\n /** Where an OVERLAY sits over the screen; NAVIGATE keeps CENTER. */\n overlayPosition: PrototypeOverlayPositionType\n}\n\n/** Goes back to the frame the play came from. */\nexport interface PrototypeBackAction {\n type: 'BACK'\n}\n\n/** Closes the overlay the play is showing. */\nexport interface PrototypeCloseAction {\n type: 'CLOSE'\n}\n\nexport type PrototypeAction = PrototypeNodeAction | PrototypeBackAction | PrototypeCloseAction\n\n/** What starts a reaction, and after how long an AFTER_TIMEOUT does. */\nexport interface PrototypeTrigger {\n type: PrototypeTriggerType\n /** AFTER_TIMEOUT only: the seconds before the reaction runs. */\n delay: number\n}\n\n/**\n * One prototype connection on a layer: what starts it and what it does, as `.fig` keeps a\n * `PrototypeInteraction` on the layer's `prototypeInteractions`.\n */\nexport interface PrototypeReaction {\n id: string\n trigger: PrototypeTrigger\n actions: PrototypeAction[]\n}\n\nexport interface SceneNode {\n id: string\n type: NodeType\n name: string\n parentId: string | null\n childIds: string[]\n\n x: number\n y: number\n width: number\n height: number\n rotation: number\n source: SourceMetadata\n /** Materialized layout hint imported or generated outside the live Yoga layout pass. */\n derivedLayout: Partial<Rect> | null\n\n fills: Fill[]\n strokes: Stroke[]\n effects: Effect[]\n layoutGrids: LayoutGrid[]\n guides: CanvasGuide[]\n fillStyleId: string | null\n strokeStyleId: string | null\n textStyleId: string | null\n effectStyleId: string | null\n gridStyleId: string | null\n sharedStyleType: SharedStyleType | null\n opacity: number\n\n cornerRadius: number\n topLeftRadius: number\n topRightRadius: number\n bottomRightRadius: number\n bottomLeftRadius: number\n independentCorners: boolean\n cornerSmoothing: number\n\n visible: boolean\n locked: boolean\n clipsContent: boolean\n\n blendMode: BlendMode\n\n text: string\n fontSize: number\n fontFamily: string\n fontWeight: number\n italic: boolean\n /**\n * The face by the name its font gives it (\"Semi Bold\", \"Book\", \"Condensed Bold\"), which Figma\n * finds a font's face by; `null` is the face the weight and slant pick in the family.\n */\n fontStyle: string | null\n textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'\n textDirection: TextDirection\n textLanguage: string | null\n textAlignVertical: TextAlignVertical\n textAutoResize: TextAutoResize\n textCase: TextCase\n textDecoration: TextDecoration\n textDecorationStyle: TextDecorationStyle\n textDecorationThickness: number | null\n textDecorationFills: Fill[]\n textDecorationSkipInk: boolean\n textUnderlineOffset: number | null\n leadingTrim: LeadingTrim\n /** `null` is automatic, from the font. */\n lineHeight: TextLength | null\n letterSpacing: TextLength\n maxLines: number | null\n /**\n * One entry per paragraph of `text`, in order. Missing entries are plain paragraphs, so text\n * without lists keeps this empty.\n */\n textParagraphs: TextParagraphStyle[]\n /** Space after a list item followed by another; a paragraph's own value comes first. */\n listSpacing: number\n /** Space after a paragraph other than between two list items. */\n paragraphSpacing: number\n /** Indent of the first line of each plain paragraph. */\n paragraphIndent: number\n /** Whether list markers hang outside the text box instead of indenting the items. */\n hangingList: boolean\n\n styleRuns: StyleRun[]\n fontVariations: FontVariation[]\n /**\n * Whether a variable font's optical size follows the font size, as Figma's \"Set optical size\n * automatically\" does by default; when it does not, the `opsz` in `fontVariations` applies.\n */\n opticalSizeFromFontSize: boolean\n fontFeatures: FontFeature[]\n\n horizontalConstraint: ConstraintType\n verticalConstraint: ConstraintType\n\n layoutMode: LayoutMode\n layoutDirection: LayoutDirection\n layoutWrap: LayoutWrap\n primaryAxisAlign: LayoutAlign\n counterAxisAlign: LayoutCounterAlign\n primaryAxisSizing: AxisSizingMode\n counterAxisSizing: AxisSizingMode\n itemSpacing: number\n counterAxisSpacing: number\n paddingTop: number\n paddingRight: number\n paddingBottom: number\n paddingLeft: number\n\n layoutPositioning: 'AUTO' | 'ABSOLUTE'\n layoutGrow: number\n layoutAlignSelf: LayoutAlignSelf\n\n vectorNetwork: VectorNetwork | null\n handleMirroring: HandleMirroring\n booleanOperation: 'UNION' | 'SUBTRACT' | 'INTERSECT' | 'EXCLUDE' | undefined\n fillGeometry: GeometryPath[]\n strokeGeometry: GeometryPath[]\n\n arcData: ArcData | null\n\n strokeCap: StrokeCap\n strokeJoin: StrokeJoin\n dashPattern: number[]\n\n borderTopWeight: number\n borderRightWeight: number\n borderBottomWeight: number\n borderLeftWeight: number\n independentStrokeWeights: boolean\n\n /**\n * The weight and alignment a node keeps for its strokes, as Figma keeps them on the node: they\n * last while it has no strokes, and a stroke added to it takes them. Each stroke still carries\n * its own `weight` and `align`, which win while the node has strokes.\n */\n strokeWeight: number\n strokeAlign: Stroke['align']\n\n strokeMiterLimit: number\n\n minWidth: number | null\n maxWidth: number | null\n minHeight: number | null\n maxHeight: number | null\n /**\n * The size whose proportions the layer keeps, as Figma stores it: the width and height it had\n * when the ratio was locked, not a reduced ratio. Null leaves the proportions free.\n */\n targetAspectRatio: Vector | null\n\n /** A connector's ends and the line between them; null on other layers. */\n connectorStart: ConnectorEndpoint | null\n connectorEnd: ConnectorEndpoint | null\n connectorLineType: ConnectorLineType\n connectorStartCap: StrokeCap\n connectorEndCap: StrokeCap\n /**\n * An elbow connector's segments between its first and last, in order, once one was dragged;\n * empty while it routes itself. Kept, unused, while the line is straight or curved.\n */\n connectorControlPoints: ConnectorControlPoint[]\n /**\n * A curved connector's two cubic control points, in the connector's own axes, once its curve\n * was dragged; null while it curves by itself. Kept, unused, while the line is not curved.\n */\n connectorCurveHandles: [Vector, Vector] | null\n /** Where a connector's label was dragged to; null while it sits midway along the line. */\n connectorLabelPosition: ConnectorLabelPosition | null\n\n isMask: boolean\n maskType: MaskType\n maskIsOutline: boolean\n\n gridTemplateColumns: GridTrack[]\n gridTemplateRows: GridTrack[]\n gridColumnGap: number\n gridRowGap: number\n gridPosition: GridPosition | null\n\n counterAxisAlignContent: 'AUTO' | 'SPACE_BETWEEN'\n itemReverseZIndex: boolean\n strokesIncludedInLayout: boolean\n\n expanded: boolean\n textTruncation: 'DISABLED' | 'ENDING'\n autoRename: boolean\n\n pointCount: number\n starInnerRadius: number\n /** The FigJam kind a SHAPE_WITH_TEXT draws; its label is the node's own text. */\n shapeWithTextType: ShapeWithTextType\n /** The height a shape with text was given; it grows past it to fit its label. 0 is unset. */\n shapeUserHeight: number\n /**\n * Whether a shape with text keeps its height and cuts its label off with \"…\" instead of growing,\n * as FigJam does once the shape's height was set.\n */\n shapeTruncates: boolean\n\n componentId: string | null\n instanceOverrides: InstanceOverrideState\n componentPropertyDefinitions: ComponentPropertyDefinition[]\n componentPropertyReferences: ComponentPropertyReference[]\n componentPropertyAssignments: Record<string, string>\n componentPropertyValues: Record<string, string>\n componentKey: string | null\n sourceLibraryKey: string | null\n publishId: string | null\n overrideKey: string | null\n sharedSymbolVersion: string | null\n publishedVersion: string | null\n librarySource: LibraryAssetSource | null\n isPublishable: boolean\n isSymbolPublishable: boolean\n /**\n * On an instance inside a component: its properties show on instances of that component,\n * as Figma's `isExposedInstance`.\n */\n isExposedInstance: boolean\n symbolDescription: string\n symbolLinks: SymbolLink[]\n variantPropSpecs: VariantPropSpec[]\n\n boundVariables: Record<string, string>\n /** Multipliers from bound numeric values to this occurrence's scene units. */\n variableBindingScales: Partial<Record<string, number>>\n /** Numeric units for new declarations owned by this node's occurrence scope. */\n variableAssignmentScales: Partial<Record<string, number>>\n /** Explicit coordinate scale relative to the containing component definition. */\n componentScale: number\n variableModes: VariableModeMap\n exportSettings: ExportSetting[]\n /**\n * The id of the status a team gave the layer, a state of the document's workflow such as Ready\n * for dev. It stays while the layer sits where it cannot show one; `effectiveStatus` tells\n * whether it shows.\n */\n status: string | null\n\n pluginData: PluginDataEntry[]\n pluginRelaunchData: PluginRelaunchDataEntry[]\n\n /** The prototype reactions this layer starts, as Figma's prototype keeps them. */\n prototypeReactions: PrototypeReaction[]\n\n internalOnly: boolean\n\n flipX: boolean\n flipY: boolean\n\n textPicture: Uint8Array | null\n derivedTextGlyphs: DerivedTextGlyph[] | null\n /**\n * How far a text's lines reach down from its top: measured at its width when its text or width\n * changes, or read from the lines a file saved, and never saved itself. A fixed-size box does not\n * clip them, as in Figma, so its visual bounds reach this far. Null when not known.\n */\n derivedTextHeight: number | null\n /** Format-neutral layout path for text-on-path nodes. */\n textPathData: TextPathData | null\n /** Node-local box that maps textPathData into the node coordinate space. */\n textPathBox: Rect | null\n}\n\nexport type ComponentPropertyType = 'VARIANT' | 'TEXT' | 'BOOLEAN' | 'INSTANCE_SWAP' | 'SLOT'\n\n/** `SLOT_CONTENT` marks a frame whose children are the slot's content. */\nexport type ComponentPropertyReferenceField = 'VISIBLE' | 'TEXT' | 'INSTANCE_SWAP' | 'SLOT_CONTENT'\n\nexport interface ComponentPropertyReference {\n propertyId: string\n field: ComponentPropertyReferenceField\n}\n\n/** Guidance for a slot property; Figma reports a breach but still accepts the content. */\nexport interface SlotSettings {\n minChildren?: number\n maxChildren?: number\n allowPreferredValuesOnly: boolean\n displayEmptyByDefault: boolean\n /** Content added to the slot fills its counter axis. */\n stretchChildOnInsert: boolean\n}\n\n/**\n * For a `SLOT` property, an instance assignment (whatever its value) means the instance owns\n * that slot's content: the slot frame's children in the instance, which component sync keeps.\n */\nexport interface ComponentPropertyDefinition {\n id: string\n name: string\n type: ComponentPropertyType\n defaultValue: string\n variantOptions?: string[]\n preferredValues?: string[]\n description?: string\n slotSettings?: SlotSettings\n}\n\nexport type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN'\nexport interface VariableAlias {\n aliasId: string\n}\n\n/** Figma's two-argument color expression; opacity is a percentage, not an alpha multiplier. */\nexport interface VariableColorExpression {\n expression: 'COMPOSE_COLOR'\n color: Color | VariableAlias\n opacity: number | VariableAlias\n}\n\nexport type VariableLiteral = Color | number | string | boolean\n/** The arithmetic, comparison, logic and conversions a formula combines values with. */\nexport const VARIABLE_FORMULA_OPERATORS = [\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'negate',\n 'equal',\n 'notEqual',\n 'less',\n 'lessOrEqual',\n 'greater',\n 'greaterOrEqual',\n 'and',\n 'or',\n 'not',\n 'text',\n 'truthy',\n 'if'\n] as const\nexport type VariableFormulaOperator = (typeof VARIABLE_FORMULA_OPERATORS)[number]\nexport interface VariableFormulaOperation {\n operator: VariableFormulaOperator\n operands: VariableFormulaNode[]\n}\nexport type VariableFormulaNode = VariableLiteral | VariableAlias | VariableFormulaOperation\nexport interface VariableFormula {\n expression: 'FORMULA'\n type: VariableType\n value: VariableFormulaNode\n}\n/**\n * An imported expression Pairdraw cannot evaluate, kept as the file wrote it so saving writes it\n * back. `references` holds one entry per alias in `value`, in the order the format walks them, and\n * `null` where the alias names a variable this document does not have. `modes` holds the mode id of\n * each mode key in `value`, in the same walk order.\n */\nexport interface VariableUnsupportedExpression {\n expression: 'UNSUPPORTED'\n /** The function name the file gives, such as `VAR_MODE_LOOKUP`. */\n function: string\n value: Record<string, unknown>\n references: (string | null)[]\n modes: string[]\n}\nexport type VariableValue =\n | VariableLiteral\n | VariableAlias\n | VariableColorExpression\n | VariableFormula\n | VariableUnsupportedExpression\nexport type VariableModeMap = Record<string, string>\n\n/** Property pickers a variable is offered in, as Figma names them. */\nexport const VARIABLE_SCOPES = [\n 'ALL_SCOPES',\n 'TEXT_CONTENT',\n 'CORNER_RADIUS',\n 'WIDTH_HEIGHT',\n 'GAP',\n 'ALL_FILLS',\n 'FRAME_FILL',\n 'SHAPE_FILL',\n 'TEXT_FILL',\n 'STROKE',\n 'STROKE_FLOAT',\n 'EFFECT_FLOAT',\n 'EFFECT_COLOR',\n 'OPACITY',\n 'FONT_STYLE',\n 'FONT_FAMILY',\n 'FONT_SIZE',\n 'LINE_HEIGHT',\n 'LETTER_SPACING',\n 'PARAGRAPH_SPACING',\n 'PARAGRAPH_INDENT',\n 'FONT_VARIATIONS',\n 'TRANSFORM'\n] as const\nexport type VariableScope = (typeof VARIABLE_SCOPES)[number]\n\nexport const CODE_SYNTAX_PLATFORMS = ['WEB', 'ANDROID', 'iOS'] as const\nexport type CodeSyntaxPlatform = (typeof CODE_SYNTAX_PLATFORMS)[number]\n\n/**\n * The CSS unit a numeric token is written in. Lengths (`px`, `rem`) stay in canvas pixels in\n * the document and convert only when written as CSS; the other units store the number as written.\n */\nexport const TOKEN_UNITS = ['none', 'px', 'rem', '%', 'ms', 's', 'deg'] as const\nexport type TokenUnit = (typeof TOKEN_UNITS)[number]\n\n/**\n * CSS written in place of a number mode's value, such as `clamp(1rem, 4vw, 1.5rem)`. While the\n * mode holds a plain number, `resolved` records it, so a number later edited elsewhere, Figma\n * included, shows the CSS no longer describes it.\n */\nexport interface TokenExpression {\n css: string\n resolved?: number\n}\n\nexport interface Variable {\n id: string\n name: string\n type: VariableType\n collectionId: string\n valuesByMode: Record<string, VariableValue>\n description: string\n hiddenFromPublishing: boolean\n /** Absent means every scope. */\n scopes?: VariableScope[]\n /**\n * Per-platform code snippets, as Figma's Dev Mode shows them. A `WEB` snippet of `--x` or\n * `var(--x)` names the token's CSS custom property; otherwise the name is derived.\n */\n codeSyntax?: Partial<Record<CodeSyntaxPlatform, string>>\n /** FLOAT only. Absent means inferred when written as CSS. */\n unit?: TokenUnit\n /** Raw CSS by mode id, for values a number cannot express (`clamp()`, `calc()`). */\n expressions?: Record<string, TokenExpression>\n pluginData?: PluginDataEntry[]\n /** Published library key (from NodeChange.key). Used for assetRef resolution in colorVar. */\n key?: string\n /** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */\n version?: string\n}\n\n/** Scalar numeric node fields accepted by numeric property controls. */\nexport type NumericNodeProperty = {\n [K in keyof SceneNode]-?: SceneNode[K] extends number ? K : never\n}[keyof SceneNode]\n\nexport interface VariableCollectionMode {\n modeId: string\n name: string\n /**\n * Where the mode applies in CSS: a selector (`[data-theme=\"dark\"]`, `.compact`) or an\n * at-rule prelude (`@media (max-width: 640px)`). Absent means the default for its axis.\n */\n condition?: string\n /** Where Figma lists the mode, as the file saved it; Figma orders a collection's modes by it. */\n sortPosition?: string\n}\n\nexport interface VariableCollection {\n id: string\n name: string\n /** The default mode comes first, as in Figma. */\n modes: VariableCollectionMode[]\n defaultModeId: string\n variableIds: string[]\n /**\n * The attribute that switches a mode with no condition of its own, `data-theme` for\n * `[data-theme=\"dark\"]`. Absent means one named after the collection.\n */\n modeAttribute?: string\n pluginData?: PluginDataEntry[]\n /**\n * Published library key, for a collection the file copies from a library. Such a collection\n * belongs to the library: Figma lists it with the library's, not the file's own.\n */\n key?: string\n /** Published library version, which references by key carry with it. */\n version?: string\n}\n\n/** Whether a collection is a library's copy, which takes no variables or modes of the file's. */\nexport function isLibraryCollection(collection: Pick<VariableCollection, 'key'>): boolean {\n return !!collection.key\n}\n\n/** An HTML attribute name a stylesheet can select on unescaped: `data-theme`, `theme`. */\nexport const MODE_ATTRIBUTE_PATTERN = /^[A-Za-z_][\\w-]*$/\n\nexport function isModeAttributeName(name: string): boolean {\n return name.length <= 100 && MODE_ATTRIBUTE_PATTERN.test(name)\n}\n"],"mappings":";;AAwYA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AA0oBA,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAmCA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,wBAAwB;CAAC;CAAO;CAAW;AAAK;;;;;AAO7D,MAAa,cAAc;CAAC;CAAQ;CAAM;CAAO;CAAK;CAAM;CAAK;AAAK;;AA+EtE,SAAgB,oBAAoB,YAAsD;CACxF,OAAO,CAAC,CAAC,WAAW;AACtB;;AAGA,MAAa,yBAAyB;AAEtC,SAAgB,oBAAoB,MAAuB;CACzD,OAAO,KAAK,UAAU,OAAO,uBAAuB,KAAK,IAAI;AAC/D"}