@moondraft/import 0.2.0 → 0.3.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 (56) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/SOURCE.md +115 -1
  3. package/dist/adapter/convert.d.ts +2 -0
  4. package/dist/adapter/convert.js +175 -84
  5. package/dist/adapter/figma-handoff.d.ts +24 -2
  6. package/dist/adapter/figma-handoff.js +39 -18
  7. package/dist/adapter/figma.js +2 -1
  8. package/dist/adapter/file-components.d.ts +2 -1
  9. package/dist/adapter/file-components.js +5 -2
  10. package/dist/adapter/file-resources.js +234 -25
  11. package/dist/adapter/file-typography.d.ts +6 -0
  12. package/dist/adapter/file-typography.js +44 -0
  13. package/dist/adapter/link.d.ts +7 -0
  14. package/dist/adapter/link.js +87 -24
  15. package/dist/adapter/payload.js +2 -2
  16. package/dist/adapter/variables.d.ts +1 -1
  17. package/dist/figma-file.d.ts +1 -0
  18. package/dist/figma-file.js +1 -0
  19. package/dist/figma.d.ts +1 -0
  20. package/dist/figma.js +41 -19
  21. package/dist/report.d.ts +37 -6
  22. package/dist/report.js +91 -18
  23. package/dist/taco/figma-import/figFile.js +3 -0
  24. package/dist/taco/figma-import/import/converters/effects.d.ts +3 -13
  25. package/dist/taco/figma-import/import/converters/effects.js +4 -34
  26. package/dist/taco/figma-import/import/converters/exportSettings.js +26 -0
  27. package/dist/taco/figma-import/import/converters/frame.d.ts +1 -1
  28. package/dist/taco/figma-import/import/converters/frame.js +8 -7
  29. package/dist/taco/figma-import/import/converters/grid.d.ts +12 -0
  30. package/dist/taco/figma-import/import/converters/grid.js +97 -0
  31. package/dist/taco/figma-import/import/converters/image.d.ts +1 -0
  32. package/dist/taco/figma-import/import/converters/image.js +38 -5
  33. package/dist/taco/figma-import/import/converters/layout.d.ts +5 -3
  34. package/dist/taco/figma-import/import/converters/layout.js +26 -16
  35. package/dist/taco/figma-import/import/converters/rectangle.js +2 -2
  36. package/dist/taco/figma-import/import/converters/section.js +2 -2
  37. package/dist/taco/figma-import/import/converters/shared.d.ts +2 -1
  38. package/dist/taco/figma-import/import/converters/shared.js +8 -5
  39. package/dist/taco/figma-import/import/converters/text.d.ts +24 -0
  40. package/dist/taco/figma-import/import/converters/text.js +114 -29
  41. package/dist/taco/figma-import/import/instances.d.ts +9 -3
  42. package/dist/taco/figma-import/import/instances.js +319 -43
  43. package/dist/taco/figma-import/import/types.d.ts +8 -0
  44. package/dist/taco/figma-import/import/variables.d.ts +2 -0
  45. package/dist/taco/figma-import/import/variables.js +28 -1
  46. package/dist/taco/figma-import/import/variantTrees.js +2 -0
  47. package/dist/taco/figma-import/import/walk.d.ts +9 -2
  48. package/dist/taco/figma-import/import/walk.js +69 -30
  49. package/dist/taco/figma-import/kiwi/message.js +52 -10
  50. package/dist/taco/model/codec.d.ts +1 -1
  51. package/dist/taco/model/codec.js +40 -6
  52. package/dist/taco/model/instance-resolver.js +3 -1
  53. package/dist/taco/model/types.d.ts +36 -6
  54. package/dist/taco/model/types.js +4 -0
  55. package/dist/taco/svg-import/style/computed.js +1 -0
  56. package/package.json +2 -2
@@ -166,9 +166,10 @@ export interface PaintVisibility {
166
166
  */
167
167
  readonly visible?: boolean;
168
168
  /**
169
- * How the paint blends with the paints below it on the same layer: the
170
- * fills under a fill, or the fills and strokes under a stroke. Uses the
171
- * same modes as a node's `blendMode`. Defaults to `"normal"`.
169
+ * How the paint blends with what is below it: the paints under it on the
170
+ * same layer (the fills under a fill, or the fills and strokes under a
171
+ * stroke) and the layers behind. Uses the same modes as a node's
172
+ * `blendMode`. Defaults to `"normal"`.
172
173
  * @since 0.18.0
173
174
  */
174
175
  readonly blendMode?: BlendMode;
@@ -456,6 +457,11 @@ export interface TextStyle {
456
457
  * @since 0.2.0
457
458
  */
458
459
  readonly strikethrough?: boolean;
460
+ /**
461
+ * Case the glyphs are drawn in, leaving the characters as typed. `original` draws them as typed.
462
+ * @since 0.2.1
463
+ */
464
+ readonly textCase?: TextCase;
459
465
  /**
460
466
  * Explicit deviations from a font's OpenType feature defaults.
461
467
  * @since 0.2.0
@@ -467,6 +473,8 @@ export interface TextStyle {
467
473
  */
468
474
  readonly fontVariations?: Readonly<Record<string, number>>;
469
475
  }
476
+ /** A text style's case transform of the drawn glyphs. */
477
+ export type TextCase = "original" | "upper" | "lower" | "title" | "smallCaps" | "smallCapsForced";
470
478
  /**
471
479
  * Direct text formatting authored on one run or list marker.
472
480
  *
@@ -635,8 +643,19 @@ export interface StackAutoLayout extends AutoLayoutConstraints {
635
643
  */
636
644
  readonly alignContent?: "auto" | "space-between";
637
645
  }
646
+ export type GridTrack = {
647
+ kind: "fixed";
648
+ size: number;
649
+ } | {
650
+ kind: "auto";
651
+ } | {
652
+ kind: "fill";
653
+ weight?: number;
654
+ };
638
655
  export interface GridAutoLayout extends AutoLayoutConstraints {
639
656
  readonly kind: "grid";
657
+ readonly rowTracks?: readonly GridTrack[];
658
+ readonly columnTracks?: readonly GridTrack[];
640
659
  readonly columns: number;
641
660
  readonly columnGap: number;
642
661
  readonly rowGap: number;
@@ -646,9 +665,11 @@ export type AutoLayout = StackAutoLayout | GridAutoLayout;
646
665
  export type Layout = AbsoluteLayout | AutoLayout;
647
666
  /**
648
667
  * Separable and non-separable compositing modes, in CSS `mix-blend-mode` terms.
668
+ * `plus-lighter` (Figma's linear dodge) and `plus-darker` (linear burn) are
669
+ * node modes only; the importers never give them to a paint.
649
670
  * @since 0.8.0
650
671
  */
651
- export declare const BLEND_MODES: readonly ["normal", "darken", "multiply", "color-burn", "lighten", "screen", "color-dodge", "overlay", "soft-light", "hard-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
672
+ export declare const BLEND_MODES: readonly ["normal", "darken", "multiply", "color-burn", "lighten", "screen", "color-dodge", "overlay", "soft-light", "hard-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "plus-lighter", "plus-darker"];
652
673
  export type BlendMode = (typeof BLEND_MODES)[number];
653
674
  /**
654
675
  * File formats a layer can export to.
@@ -1799,8 +1820,17 @@ export interface LayerOverride {
1799
1820
  readonly clipContent?: boolean;
1800
1821
  readonly cornerSmoothing?: number;
1801
1822
  /** Per-member stack settings. Padding sides and sizing axes have their own overrides. */
1802
- readonly layout?: Partial<Omit<StackAutoLayout, "kind" | "padding" | "widthSizing" | "heightSizing">> & {
1803
- readonly kind?: "absolute" | "horizontal" | "vertical";
1823
+ readonly layout?: Partial<Omit<StackAutoLayout, "kind" | "padding" | "widthSizing" | "heightSizing">> & Partial<Pick<GridAutoLayout, "columns" | "rowTracks" | "columnTracks" | "rowGap" | "columnGap">> & {
1824
+ readonly kind?: Layout["kind"];
1825
+ };
1826
+ /** Cell settings authored on a grid child in this occurrence. */
1827
+ readonly gridCell?: {
1828
+ row?: number;
1829
+ column?: number;
1830
+ rowSpan?: number;
1831
+ columnSpan?: number;
1832
+ alignX?: "start" | "center" | "end" | "stretch";
1833
+ alignY?: "start" | "center" | "end" | "stretch";
1804
1834
  };
1805
1835
  /** Frame layers, and the component root for the instance's own size. */
1806
1836
  readonly sizing?: LayerSizingOverride;
@@ -77,6 +77,8 @@ export const DASH_CAPS = ["none", "round", "square"];
77
77
  export const DEFAULT_STROKE_MITER_ANGLE = (2 * Math.asin(1 / 4) * 180) / Math.PI;
78
78
  /**
79
79
  * Separable and non-separable compositing modes, in CSS `mix-blend-mode` terms.
80
+ * `plus-lighter` (Figma's linear dodge) and `plus-darker` (linear burn) are
81
+ * node modes only; the importers never give them to a paint.
80
82
  * @since 0.8.0
81
83
  */
82
84
  export const BLEND_MODES = [
@@ -96,6 +98,8 @@ export const BLEND_MODES = [
96
98
  "saturation",
97
99
  "color",
98
100
  "luminosity",
101
+ "plus-lighter",
102
+ "plus-darker",
99
103
  ];
100
104
  /**
101
105
  * File formats a layer can export to.
@@ -99,6 +99,7 @@ const BLEND_MODES = new Set([
99
99
  "normal", "darken", "multiply", "color-burn", "lighten", "screen",
100
100
  "color-dodge", "overlay", "soft-light", "hard-light", "difference",
101
101
  "exclusion", "hue", "saturation", "color", "luminosity",
102
+ "plus-lighter", "plus-darker",
102
103
  ]);
103
104
  /** Each `overflow` keyword, and whether it draws content outside the viewport. */
104
105
  const OVERFLOW_VISIBLE = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moondraft/import",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Editable SVG and Figma import for Moondraft.",
6
6
  "sideEffects": false,
@@ -52,6 +52,6 @@
52
52
  "access": "public"
53
53
  },
54
54
  "peerDependencies": {
55
- "@moondraft/editor": ">=0.4.0 <0.5.0"
55
+ "@moondraft/editor": ">=0.5.0 <0.6.0"
56
56
  }
57
57
  }