@open-pencil/scene-graph 0.17.0-beta.1 → 0.17.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +2 -5
- package/dist/arrow-caps.js.map +1 -1
- package/dist/asset-keys.d.ts +11 -1
- package/dist/asset-keys.d.ts.map +1 -1
- package/dist/asset-keys.js +16 -1
- package/dist/asset-keys.js.map +1 -1
- package/dist/behaviours/index.d.ts +2 -2
- package/dist/behaviours/index.js +2 -2
- package/dist/behaviours/kinds.d.ts +11 -5
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +76 -75
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/layers.d.ts.map +1 -1
- package/dist/behaviours/layers.js +3 -2
- package/dist/behaviours/layers.js.map +1 -1
- package/dist/behaviours/model.d.ts +7 -4
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js +16 -9
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +118 -4
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +18 -3
- package/dist/behaviours/schema.js.map +1 -1
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +3 -2
- package/dist/behaviours/spec.js.map +1 -1
- package/dist/bindings.js +9 -1
- package/dist/bindings.js.map +1 -1
- package/dist/checkpoint.d.ts +31 -2
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +211 -10
- package/dist/checkpoint.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +3 -3
- package/dist/components/properties.d.ts +18 -1
- package/dist/components/properties.d.ts.map +1 -1
- package/dist/components/properties.js +66 -3
- package/dist/components/properties.js.map +1 -1
- package/dist/components/variants.d.ts +16 -10
- package/dist/components/variants.d.ts.map +1 -1
- package/dist/components/variants.js +39 -13
- package/dist/components/variants.js.map +1 -1
- package/dist/connectors/hit.d.ts.map +1 -1
- package/dist/connectors/hit.js +1 -7
- package/dist/connectors/hit.js.map +1 -1
- package/dist/connectors/pieces.d.ts.map +1 -1
- package/dist/connectors/pieces.js +2 -5
- package/dist/connectors/pieces.js.map +1 -1
- package/dist/constants.d.ts +6 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -1
- package/dist/constants.js.map +1 -1
- package/dist/constraints.d.ts +25 -0
- package/dist/constraints.d.ts.map +1 -0
- package/dist/constraints.js +51 -0
- package/dist/constraints.js.map +1 -0
- package/dist/coordinate.d.ts +64 -1
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +217 -1
- package/dist/coordinate.js.map +1 -1
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +17 -16
- package/dist/copy.js.map +1 -1
- package/dist/css/blend.d.ts +11 -0
- package/dist/css/blend.d.ts.map +1 -0
- package/dist/css/blend.js +30 -0
- package/dist/css/blend.js.map +1 -0
- package/dist/css/index.d.ts +4 -2
- package/dist/css/index.js +4 -2
- package/dist/css/text.d.ts +28 -1
- package/dist/css/text.d.ts.map +1 -1
- package/dist/css/text.js +84 -17
- package/dist/css/text.js.map +1 -1
- package/dist/css/transform.d.ts +34 -0
- package/dist/css/transform.d.ts.map +1 -0
- package/dist/css/transform.js +320 -0
- package/dist/css/transform.js.map +1 -0
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +11 -1
- package/dist/css/values.js.map +1 -1
- package/dist/cubic.d.ts +7 -0
- package/dist/cubic.d.ts.map +1 -0
- package/dist/cubic.js +17 -0
- package/dist/cubic.js.map +1 -0
- package/dist/export-format.d.ts +14 -1
- package/dist/export-format.d.ts.map +1 -1
- package/dist/export-format.js +26 -1
- package/dist/export-format.js.map +1 -1
- package/dist/fields/text.d.ts +2 -2
- package/dist/fields/text.d.ts.map +1 -1
- package/dist/fields/text.js +2 -1
- package/dist/fields/text.js.map +1 -1
- package/dist/figjam/index.d.ts +2 -2
- package/dist/figjam/index.js +2 -2
- package/dist/figjam/palette.d.ts +13 -2
- package/dist/figjam/palette.d.ts.map +1 -1
- package/dist/figjam/palette.js +30 -2
- package/dist/figjam/palette.js.map +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +2 -2
- package/dist/generated/shape-with-text.d.ts +7 -2
- package/dist/generated/shape-with-text.d.ts.map +1 -1
- package/dist/generated/shape-with-text.js +20 -3
- package/dist/generated/shape-with-text.js.map +1 -1
- package/dist/geometry.d.ts +37 -46
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +80 -137
- package/dist/geometry.js.map +1 -1
- package/dist/graph.d.ts +49 -12
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +125 -27
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +14 -4
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +76 -11
- package/dist/group-bounds.js.map +1 -1
- package/dist/guides.d.ts +3 -1
- package/dist/guides.d.ts.map +1 -1
- package/dist/guides.js +5 -1
- package/dist/guides.js.map +1 -1
- package/dist/hit-test.d.ts +5 -0
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +57 -38
- package/dist/hit-test.js.map +1 -1
- package/dist/images.d.ts +27 -3
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +57 -3
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/instances/fields.d.ts +2 -2
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +8 -0
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts +1 -3
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +39 -30
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/kept-overrides.js +204 -0
- package/dist/instances/kept-overrides.js.map +1 -0
- package/dist/instances/main-component.d.ts +3 -1
- package/dist/instances/main-component.d.ts.map +1 -1
- package/dist/instances/main-component.js +10 -2
- package/dist/instances/main-component.js.map +1 -1
- package/dist/instances/overrides.d.ts +4 -1
- package/dist/instances/overrides.d.ts.map +1 -1
- package/dist/instances/overrides.js +18 -2
- package/dist/instances/overrides.js.map +1 -1
- package/dist/instances/placement.js +55 -12
- package/dist/instances/placement.js.map +1 -1
- package/dist/instances/swap.js +291 -0
- package/dist/instances/swap.js.map +1 -0
- package/dist/instances/sync.js +112 -39
- package/dist/instances/sync.js.map +1 -1
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +2 -1
- package/dist/node-defaults.js.map +1 -1
- package/dist/order-keys.d.ts +3 -1
- package/dist/order-keys.d.ts.map +1 -1
- package/dist/order-keys.js +6 -1
- package/dist/order-keys.js.map +1 -1
- package/dist/outline/flatten.d.ts +15 -0
- package/dist/outline/flatten.d.ts.map +1 -0
- package/dist/outline/flatten.js +189 -0
- package/dist/outline/flatten.js.map +1 -0
- package/dist/outline/heads.js +34 -0
- package/dist/outline/heads.js.map +1 -0
- package/dist/outline/hit.d.ts +21 -0
- package/dist/outline/hit.d.ts.map +1 -0
- package/dist/outline/hit.js +276 -0
- package/dist/outline/hit.js.map +1 -0
- package/dist/outline/index.d.ts +5 -0
- package/dist/outline/index.js +5 -0
- package/dist/outline/point.d.ts +16 -0
- package/dist/outline/point.d.ts.map +1 -0
- package/dist/outline/point.js +42 -0
- package/dist/outline/point.js.map +1 -0
- package/dist/outline/shapes.d.ts +35 -0
- package/dist/outline/shapes.d.ts.map +1 -0
- package/dist/outline/shapes.js +181 -0
- package/dist/outline/shapes.js.map +1 -0
- package/dist/plugin-data/fields.d.ts +4 -1
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +21 -4
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/resize.d.ts +22 -11
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +227 -93
- package/dist/resize.js.map +1 -1
- package/dist/scaling/index.d.ts +3 -2
- package/dist/scaling/index.js +3 -2
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +5 -1
- package/dist/scaling/node.js.map +1 -1
- package/dist/scaling/snapshot.d.ts +25 -0
- package/dist/scaling/snapshot.d.ts.map +1 -0
- package/dist/scaling/snapshot.js +39 -0
- package/dist/scaling/snapshot.js.map +1 -0
- package/dist/scaling/tree.d.ts +24 -2
- package/dist/scaling/tree.d.ts.map +1 -1
- package/dist/scaling/tree.js +38 -15
- package/dist/scaling/tree.js.map +1 -1
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +2 -1
- package/dist/shaders/model.js.map +1 -1
- package/dist/shared-styles.d.ts +16 -1
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +69 -2
- package/dist/shared-styles.js.map +1 -1
- package/dist/slots/authoring.d.ts +3 -2
- package/dist/slots/authoring.d.ts.map +1 -1
- package/dist/slots/authoring.js +5 -3
- package/dist/slots/authoring.js.map +1 -1
- package/dist/slots/content.d.ts.map +1 -1
- package/dist/slots/content.js +6 -1
- package/dist/slots/content.js.map +1 -1
- package/dist/slots/frames.d.ts +2 -0
- package/dist/slots/frames.d.ts.map +1 -1
- package/dist/slots/frames.js +7 -2
- package/dist/slots/frames.js.map +1 -1
- package/dist/text/direction.d.ts +3 -1
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +5 -1
- package/dist/text/direction.js.map +1 -1
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +3 -3
- package/dist/text/lengths.d.ts +6 -1
- package/dist/text/lengths.d.ts.map +1 -1
- package/dist/text/lengths.js +10 -1
- package/dist/text/lengths.js.map +1 -1
- package/dist/text/overflow.d.ts +2 -2
- package/dist/text/overflow.js.map +1 -1
- package/dist/text/picture.d.ts +1 -2
- package/dist/text/picture.d.ts.map +1 -1
- package/dist/text/picture.js +1 -4
- package/dist/text/picture.js.map +1 -1
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +1 -6
- package/dist/transfer/apply.js.map +1 -1
- package/dist/transfer/copied.d.ts +35 -3
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +44 -13
- package/dist/transfer/copied.js.map +1 -1
- package/dist/transfer/dependencies.d.ts +38 -0
- package/dist/transfer/dependencies.d.ts.map +1 -0
- package/dist/transfer/dependencies.js +100 -0
- package/dist/transfer/dependencies.js.map +1 -0
- package/dist/transfer/history.js +0 -1
- package/dist/transfer/history.js.map +1 -1
- package/dist/transfer/index.d.ts +5 -3
- package/dist/transfer/index.js +5 -3
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +16 -19
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +0 -1
- package/dist/transfer/plan.js +3 -5
- package/dist/transfer/plan.js.map +1 -1
- package/dist/transfer/remove.js +5 -2
- package/dist/transfer/remove.js.map +1 -1
- package/dist/transfer/resources.d.ts +21 -0
- package/dist/transfer/resources.d.ts.map +1 -0
- package/dist/transfer/resources.js +38 -0
- package/dist/transfer/resources.js.map +1 -0
- package/dist/transfer/variables.d.ts +8 -1
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +24 -1
- package/dist/transfer/variables.js.map +1 -1
- package/dist/types.d.ts +73 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/undo.d.ts +28 -3
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +24 -7
- package/dist/undo.js.map +1 -1
- package/dist/variables/bindings.d.ts +37 -11
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +122 -74
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/fields.d.ts +19 -1
- package/dist/variables/fields.d.ts.map +1 -1
- package/dist/variables/fields.js +36 -1
- package/dist/variables/fields.js.map +1 -1
- package/dist/variables/formula/check.d.ts +1 -1
- package/dist/variables/formula/index.d.ts +2 -2
- package/dist/variables/formula/index.js +1 -1
- package/dist/variables/formula/index.js.map +1 -1
- package/dist/variables/formula/print.d.ts +1 -1
- package/dist/variables/formula/signatures.js +1 -1
- package/dist/variables/index.d.ts +7 -7
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +57 -26
- package/dist/variables/index.js.map +1 -1
- package/dist/variables/paints.d.ts +57 -0
- package/dist/variables/paints.d.ts.map +1 -0
- package/dist/variables/paints.js +231 -0
- package/dist/variables/paints.js.map +1 -0
- package/dist/variables/resolution.d.ts +14 -11
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +36 -17
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/subtree.js +17 -0
- package/dist/variables/subtree.js.map +1 -0
- package/dist/vector-network.d.ts.map +1 -1
- package/dist/vector-network.js +2 -8
- package/dist/vector-network.js.map +1 -1
- package/package.json +14 -1
- package/src/arrow-caps.ts +2 -5
- package/src/asset-keys.ts +20 -0
- package/src/behaviours/kinds.ts +51 -34
- package/src/behaviours/layers.ts +4 -2
- package/src/behaviours/model.ts +22 -11
- package/src/behaviours/schema.ts +20 -4
- package/src/behaviours/spec.ts +8 -2
- package/src/bindings.ts +11 -2
- package/src/checkpoint.ts +319 -17
- package/src/components/properties.ts +101 -2
- package/src/components/variants.ts +51 -30
- package/src/connectors/hit.ts +1 -12
- package/src/connectors/pieces.ts +2 -5
- package/src/constants.ts +17 -0
- package/src/constraints.ts +60 -0
- package/src/coordinate.ts +220 -0
- package/src/copy.ts +18 -19
- package/src/css/blend.ts +27 -0
- package/src/css/index.ts +18 -1
- package/src/css/text.ts +85 -17
- package/src/css/transform.ts +266 -0
- package/src/css/values.ts +8 -0
- package/src/cubic.ts +14 -0
- package/src/export-format.ts +29 -0
- package/src/fields/text.ts +3 -1
- package/src/figjam/palette.ts +29 -1
- package/src/generated/shape-with-text.ts +28 -2
- package/src/geometry.ts +97 -206
- package/src/graph.ts +155 -45
- package/src/group-bounds.ts +84 -17
- package/src/guides.ts +5 -0
- package/src/hit-test.ts +93 -64
- package/src/images.ts +71 -3
- package/src/instances/fields.ts +8 -0
- package/src/instances/index.ts +62 -31
- package/src/instances/kept-overrides.ts +280 -0
- package/src/instances/main-component.ts +12 -0
- package/src/instances/overrides.ts +27 -1
- package/src/instances/placement.ts +63 -10
- package/src/instances/swap.ts +456 -0
- package/src/instances/sync.ts +176 -50
- package/src/node-defaults.ts +3 -1
- package/src/order-keys.ts +6 -0
- package/src/outline/flatten.ts +190 -0
- package/src/outline/heads.ts +52 -0
- package/src/outline/hit.ts +369 -0
- package/src/outline/index.ts +4 -0
- package/src/outline/point.ts +59 -0
- package/src/outline/shapes.ts +207 -0
- package/src/plugin-data/fields.ts +21 -2
- package/src/resize.ts +267 -119
- package/src/scaling/index.ts +9 -1
- package/src/scaling/node.ts +9 -1
- package/src/scaling/snapshot.ts +51 -0
- package/src/scaling/tree.ts +63 -19
- package/src/shaders/model.ts +2 -3
- package/src/shared-styles.ts +90 -1
- package/src/slots/authoring.ts +5 -3
- package/src/slots/content.ts +6 -1
- package/src/slots/frames.ts +9 -7
- package/src/text/direction.ts +5 -0
- package/src/text/lengths.ts +10 -0
- package/src/text/overflow.ts +2 -2
- package/src/text/picture.ts +0 -4
- package/src/transfer/apply.ts +1 -13
- package/src/transfer/copied.ts +83 -15
- package/src/transfer/dependencies.ts +126 -0
- package/src/transfer/history.ts +0 -6
- package/src/transfer/index.ts +20 -2
- package/src/transfer/nodes.ts +17 -31
- package/src/transfer/plan.ts +3 -11
- package/src/transfer/remove.ts +5 -2
- package/src/transfer/resources.ts +54 -0
- package/src/transfer/variables.ts +34 -0
- package/src/types.ts +83 -1
- package/src/undo.ts +48 -10
- package/src/variables/bindings.ts +152 -88
- package/src/variables/fields.ts +46 -1
- package/src/variables/formula/index.ts +3 -1
- package/src/variables/index.ts +90 -39
- package/src/variables/paints.ts +296 -0
- package/src/variables/resolution.ts +39 -28
- package/src/variables/subtree.ts +15 -0
- package/src/vector-network.ts +4 -2
package/dist/export-format.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ExportSetting } from "./types.js";
|
|
1
2
|
//#region src/export-format.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Formats a node's export settings may persist. Each id must name a Core IO
|
|
@@ -7,6 +8,18 @@
|
|
|
7
8
|
declare const EXPORT_FORMAT_IDS: readonly ["png", "jpg", "webp", "svg", "pdf", "pptx", "drawio"];
|
|
8
9
|
type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number];
|
|
9
10
|
declare function isExportFormatId(value: unknown): value is ExportFormatId;
|
|
11
|
+
/** What each of Figma's export options reads as when an export leaves it out. */
|
|
12
|
+
declare const EXPORT_OPTION_DEFAULTS: {
|
|
13
|
+
readonly suffix: "";
|
|
14
|
+
readonly contentsOnly: true;
|
|
15
|
+
readonly useAbsoluteBounds: false;
|
|
16
|
+
readonly colorProfile: "DOCUMENT";
|
|
17
|
+
readonly svgOutlineText: true;
|
|
18
|
+
readonly svgIdAttribute: false;
|
|
19
|
+
readonly svgSimplifyStroke: true;
|
|
20
|
+
};
|
|
21
|
+
/** An export as the model keeps it: options that are unset or at Figma's default left out. */
|
|
22
|
+
declare function compactExportSetting({ scale, format, size, ...options }: ExportSetting): ExportSetting;
|
|
10
23
|
//#endregion
|
|
11
|
-
export { EXPORT_FORMAT_IDS, ExportFormatId, isExportFormatId };
|
|
24
|
+
export { EXPORT_FORMAT_IDS, EXPORT_OPTION_DEFAULTS, ExportFormatId, compactExportSetting, isExportFormatId };
|
|
12
25
|
//# sourceMappingURL=export-format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-format.d.ts","names":[],"sources":["../src/export-format.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"export-format.d.ts","names":[],"sources":["../src/export-format.ts"],"mappings":";;;;;;;cASa;KAED,yBAAyB;iBAErB,iBAAiB,iBAAiB,SAAS;;cAK9C;;;;;;;;;;iBAWG,uBACd,OACA,QACA,SACG,WACF,gBAAgB"}
|
package/dist/export-format.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { omitBy } from "es-toolkit/object";
|
|
1
2
|
//#region src/export-format.ts
|
|
2
3
|
/**
|
|
3
4
|
* Formats a node's export settings may persist. Each id must name a Core IO
|
|
@@ -16,7 +17,31 @@ const EXPORT_FORMAT_IDS = [
|
|
|
16
17
|
function isExportFormatId(value) {
|
|
17
18
|
return EXPORT_FORMAT_IDS.some((id) => id === value);
|
|
18
19
|
}
|
|
20
|
+
/** What each of Figma's export options reads as when an export leaves it out. */
|
|
21
|
+
const EXPORT_OPTION_DEFAULTS = {
|
|
22
|
+
suffix: "",
|
|
23
|
+
contentsOnly: true,
|
|
24
|
+
useAbsoluteBounds: false,
|
|
25
|
+
colorProfile: "DOCUMENT",
|
|
26
|
+
svgOutlineText: true,
|
|
27
|
+
svgIdAttribute: false,
|
|
28
|
+
svgSimplifyStroke: true
|
|
29
|
+
};
|
|
30
|
+
/** An export as the model keeps it: options that are unset or at Figma's default left out. */
|
|
31
|
+
function compactExportSetting({ scale, format, size, ...options }) {
|
|
32
|
+
const changed = omitBy(options, (value, key) => value === void 0 || value === EXPORT_OPTION_DEFAULTS[key]);
|
|
33
|
+
return size ? {
|
|
34
|
+
scale,
|
|
35
|
+
format,
|
|
36
|
+
size,
|
|
37
|
+
...changed
|
|
38
|
+
} : {
|
|
39
|
+
scale,
|
|
40
|
+
format,
|
|
41
|
+
...changed
|
|
42
|
+
};
|
|
43
|
+
}
|
|
19
44
|
//#endregion
|
|
20
|
-
export { EXPORT_FORMAT_IDS, isExportFormatId };
|
|
45
|
+
export { EXPORT_FORMAT_IDS, EXPORT_OPTION_DEFAULTS, compactExportSetting, isExportFormatId };
|
|
21
46
|
|
|
22
47
|
//# sourceMappingURL=export-format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-format.js","names":[],"sources":["../src/export-format.ts"],"sourcesContent":["/**\n * Formats a node's export settings may persist. Each id must name a Core IO\n * export adapter that supports node export; labels and options come from that\n * adapter, so this list only decides what the Export panel offers.\n */\nexport const EXPORT_FORMAT_IDS = ['png', 'jpg', 'webp', 'svg', 'pdf', 'pptx', 'drawio'] as const\n\nexport type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number]\n\nexport function isExportFormatId(value: unknown): value is ExportFormatId {\n return EXPORT_FORMAT_IDS.some((id) => id === value)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"export-format.js","names":[],"sources":["../src/export-format.ts"],"sourcesContent":["import { omitBy } from 'es-toolkit/object'\n\nimport type { ExportSetting } from './types'\n\n/**\n * Formats a node's export settings may persist. Each id must name a Core IO\n * export adapter that supports node export; labels and options come from that\n * adapter, so this list only decides what the Export panel offers.\n */\nexport const EXPORT_FORMAT_IDS = ['png', 'jpg', 'webp', 'svg', 'pdf', 'pptx', 'drawio'] as const\n\nexport type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number]\n\nexport function isExportFormatId(value: unknown): value is ExportFormatId {\n return EXPORT_FORMAT_IDS.some((id) => id === value)\n}\n\n/** What each of Figma's export options reads as when an export leaves it out. */\nexport const EXPORT_OPTION_DEFAULTS = {\n suffix: '',\n contentsOnly: true,\n useAbsoluteBounds: false,\n colorProfile: 'DOCUMENT',\n svgOutlineText: true,\n svgIdAttribute: false,\n svgSimplifyStroke: true\n} as const satisfies Required<Omit<ExportSetting, 'scale' | 'format' | 'size'>>\n\n/** An export as the model keeps it: options that are unset or at Figma's default left out. */\nexport function compactExportSetting({\n scale,\n format,\n size,\n ...options\n}: ExportSetting): ExportSetting {\n const changed = omitBy(\n options,\n (value, key) => value === undefined || value === EXPORT_OPTION_DEFAULTS[key]\n )\n return size ? { scale, format, size, ...changed } : { scale, format, ...changed }\n}\n"],"mappings":";;;;;;;AASA,MAAa,oBAAoB;CAAC;CAAO;CAAO;CAAQ;CAAO;CAAO;CAAQ;AAAQ;AAItF,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,kBAAkB,MAAM,OAAO,OAAO,KAAK;AACpD;;AAGA,MAAa,yBAAyB;CACpC,QAAQ;CACR,cAAc;CACd,mBAAmB;CACnB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,mBAAmB;AACrB;;AAGA,SAAgB,qBAAqB,EACnC,OACA,QACA,MACA,GAAG,WAC4B;CAC/B,MAAM,UAAU,OACd,UACC,OAAO,QAAQ,UAAU,KAAA,KAAa,UAAU,uBAAuB,IAC1E;CACA,OAAO,OAAO;EAAE;EAAO;EAAQ;EAAM,GAAG;CAAQ,IAAI;EAAE;EAAO;EAAQ,GAAG;CAAQ;AAClF"}
|
package/dist/fields/text.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/fields/text.d.ts
|
|
2
2
|
/** Fields shared by shaping, paragraph measurement, and auto-width invalidation. */
|
|
3
|
-
declare const TEXT_METRIC_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "opticalSizeFromFontSize", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList"];
|
|
4
|
-
declare const TEXT_SHAPING_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "opticalSizeFromFontSize", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList", "lineHeight", "textCase", "textDirection", "textAlignHorizontal", "textAlignVertical"];
|
|
3
|
+
declare const TEXT_METRIC_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "opticalSizeFromFontSize", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList", "leadingTrim"];
|
|
4
|
+
declare const TEXT_SHAPING_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "opticalSizeFromFontSize", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList", "leadingTrim", "lineHeight", "textCase", "textDirection", "textAlignHorizontal", "textAlignVertical"];
|
|
5
5
|
declare const TEXT_LAYOUT_FIELDS: readonly ["width", "height", "textAutoResize", "maxLines"];
|
|
6
6
|
declare const TEXT_DECORATION_FIELDS: readonly ["textDecoration", "textDecorationStyle", "textDecorationThickness", "textUnderlineOffset", "textDecorationFills", "textDecorationSkipInk"];
|
|
7
7
|
/** How text is styled, apart from its content and how its box sizes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","names":[],"sources":["../../src/fields/text.ts"],"mappings":";;cAGa;
|
|
1
|
+
{"version":3,"file":"text.d.ts","names":[],"sources":["../../src/fields/text.ts"],"mappings":";;cAGa;cAoBA;cASA;cAOA;;cAUA"}
|
package/dist/fields/text.js
CHANGED
package/dist/fields/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../src/fields/text.ts"],"sourcesContent":["import type { SceneNode } from '../types'\n\n/** Fields shared by shaping, paragraph measurement, and auto-width invalidation. */\nexport const TEXT_METRIC_FIELDS = [\n 'text',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'italic',\n 'letterSpacing',\n 'styleRuns',\n 'fontVariations',\n 'opticalSizeFromFontSize',\n 'fontFeatures',\n 'textParagraphs',\n 'listSpacing',\n 'paragraphSpacing',\n 'paragraphIndent',\n 'hangingList'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_SHAPING_FIELDS = [\n ...TEXT_METRIC_FIELDS,\n 'lineHeight',\n 'textCase',\n 'textDirection',\n 'textAlignHorizontal',\n 'textAlignVertical'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_LAYOUT_FIELDS = [\n 'width',\n 'height',\n 'textAutoResize',\n 'maxLines'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_DECORATION_FIELDS = [\n 'textDecoration',\n 'textDecorationStyle',\n 'textDecorationThickness',\n 'textUnderlineOffset',\n 'textDecorationFills',\n 'textDecorationSkipInk'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/** How text is styled, apart from its content and how its box sizes. */\nexport const TEXT_STYLE_FIELDS = [\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'italic',\n 'lineHeight',\n 'letterSpacing',\n 'paragraphSpacing',\n 'paragraphIndent',\n 'textAlignHorizontal',\n 'textAlignVertical',\n 'textCase',\n ...TEXT_DECORATION_FIELDS,\n 'fontFeatures',\n 'fontVariations',\n 'opticalSizeFromFontSize'\n] as const satisfies readonly (keyof SceneNode)[]\n"],"mappings":";;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,sBAAsB;CACjC,GAAG;CACH;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG;CACH;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/fields/text.ts"],"sourcesContent":["import type { SceneNode } from '../types'\n\n/** Fields shared by shaping, paragraph measurement, and auto-width invalidation. */\nexport const TEXT_METRIC_FIELDS = [\n 'text',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'italic',\n 'letterSpacing',\n 'styleRuns',\n 'fontVariations',\n 'opticalSizeFromFontSize',\n 'fontFeatures',\n 'textParagraphs',\n 'listSpacing',\n 'paragraphSpacing',\n 'paragraphIndent',\n 'hangingList',\n // A cap-height trim drops the space above and below the glyphs, so the text measures shorter.\n 'leadingTrim'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_SHAPING_FIELDS = [\n ...TEXT_METRIC_FIELDS,\n 'lineHeight',\n 'textCase',\n 'textDirection',\n 'textAlignHorizontal',\n 'textAlignVertical'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_LAYOUT_FIELDS = [\n 'width',\n 'height',\n 'textAutoResize',\n 'maxLines'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport const TEXT_DECORATION_FIELDS = [\n 'textDecoration',\n 'textDecorationStyle',\n 'textDecorationThickness',\n 'textUnderlineOffset',\n 'textDecorationFills',\n 'textDecorationSkipInk'\n] as const satisfies readonly (keyof SceneNode)[]\n\n/** How text is styled, apart from its content and how its box sizes. */\nexport const TEXT_STYLE_FIELDS = [\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'italic',\n 'lineHeight',\n 'letterSpacing',\n 'paragraphSpacing',\n 'paragraphIndent',\n 'textAlignHorizontal',\n 'textAlignVertical',\n 'textCase',\n ...TEXT_DECORATION_FIELDS,\n 'fontFeatures',\n 'fontVariations',\n 'opticalSizeFromFontSize'\n] as const satisfies readonly (keyof SceneNode)[]\n"],"mappings":";;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;AACF;AAEA,MAAa,sBAAsB;CACjC,GAAG;CACH;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;AACF;AAEA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG;CACH;CACA;CACA;AACF"}
|
package/dist/figjam/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint } from "./palette.js";
|
|
1
|
+
import { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint } from "./palette.js";
|
|
2
2
|
import { FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, FigJamTextSize, FigJamTypeface, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface } from "./text.js";
|
|
3
|
-
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, FigJamTextSize, FigJamTypeface, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface };
|
|
3
|
+
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, FigJamTextSize, FigJamTypeface, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface };
|
package/dist/figjam/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface } from "./text.js";
|
|
2
|
-
import { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint } from "./palette.js";
|
|
3
|
-
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface };
|
|
2
|
+
import { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint } from "./palette.js";
|
|
3
|
+
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FIGJAM_TEXT_SIZES, FIGJAM_TYPEFACES, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint, figJamTextSize, figJamTextSizeFields, figJamTypeface, figJamTypefaceFaceFields, figJamTypefaceFields, isFigJamTypeface };
|
package/dist/figjam/palette.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color } from "../primitives/index.js";
|
|
2
|
-
import { Fill, SceneNode } from "../types.js";
|
|
2
|
+
import { Fill, SceneNode, Stroke } from "../types.js";
|
|
3
3
|
//#region src/figjam/palette.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* FigJam's board palette, in its menus' order, as its colour menu paints a shape with text: each
|
|
@@ -215,6 +215,17 @@ declare function figJamColorName(color: Color | undefined): FigJamColorName | nu
|
|
|
215
215
|
* colour takes, which is darker for black and lighter for white.
|
|
216
216
|
*/
|
|
217
217
|
declare function figJamOutlineColorName(color: Color | undefined): FigJamColorName | null;
|
|
218
|
+
/**
|
|
219
|
+
* How FigJam draws a section's title on a board, measured in FigJam: a pill in the colour of the
|
|
220
|
+
* outline drawn on top, with white text on the palette's darkest colours and black on the rest;
|
|
221
|
+
* null for a section without an outline from the palette. `colorOf` reads an outline's colour as
|
|
222
|
+
* drawn, such as a variable's value in the section's mode.
|
|
223
|
+
*/
|
|
224
|
+
declare function figJamSectionTitleColors(section: Pick<SceneNode, 'strokes'>, colorOf?: (stroke: Stroke, index: number) => Color): {
|
|
225
|
+
strokeIndex: number;
|
|
226
|
+
background: Color;
|
|
227
|
+
lightText: boolean;
|
|
228
|
+
} | null;
|
|
218
229
|
/** The fill mode a shape's first fill shows. */
|
|
219
230
|
declare function figJamFillMode(fill: Fill | undefined): FigJamFillMode;
|
|
220
231
|
/** The outline FigJam pairs with a colour in a fill mode. */
|
|
@@ -255,5 +266,5 @@ declare function figJamLayerColorFields(node: Pick<SceneNode, 'type' | 'fills' |
|
|
|
255
266
|
/** The palette colour a plain layer shows, read where {@link figJamLayerColorFields} paints it. */
|
|
256
267
|
declare function figJamLayerColorName(node: Pick<SceneNode, 'type' | 'fills' | 'strokes'>): FigJamColorName | null;
|
|
257
268
|
//#endregion
|
|
258
|
-
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint };
|
|
269
|
+
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, FigJamColorName, FigJamFillMode, FigJamLineStyle, FigJamShapePaint, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint };
|
|
259
270
|
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette.d.ts","names":[],"sources":["../../src/figjam/palette.ts"],"mappings":";;;;;;;;;cAaM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgMM,+BAA+B;cAE9B,oBAA6C;;KAG9C;;KAGA;;cAGC;;iBAGG,YAAY,MAAM,kBAAkB;;iBAWpC,gBAAgB,OAAO,oBAAoB;;;;;iBAQ3C,uBAAuB,OAAO,oBAAoB
|
|
1
|
+
{"version":3,"file":"palette.d.ts","names":[],"sources":["../../src/figjam/palette.ts"],"mappings":";;;;;;;;;cAaM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgMM,+BAA+B;cAE9B,oBAA6C;;KAG9C;;KAGA;;cAGC;;iBAGG,YAAY,MAAM,kBAAkB;;iBAWpC,gBAAgB,OAAO,oBAAoB;;;;;iBAQ3C,uBAAuB,OAAO,oBAAoB;;;;;;;iBAclD,yBACd,SAAS,KAAK,uBACd,WAAU,QAAQ,QAAQ,kBAAkB;EACzC;EAAqB,YAAY;EAAO;;;iBAa7B,eAAe,MAAM,mBAAmB;;iBAMxC,mBAAmB,MAAM,iBAAiB,MAAM,iBAAiB;;UAoBhE;EACf,OAAO,QAAQ;EACf,OAAO,QAAQ;;;;;;;iBAQD,iBACd,OAAO,KAAK,iCACZ,OAAO,KAAK,4BACZ,MAAM,iBACN,MAAM,iBACL;;;;;iBAiCa,sBACd,OAAO,KAAK,uBACZ,OAAO,kBACN,QAAQ;;iBAWK,gBAAgB,OAAO,KAAK,wBAAwB;;;;;iBAUpD,sBACd,OAAO,KAAK,uBACZ,MAAM,kBACL,QAAQ;;iBA6BK,yBACd,SAAS,KAAK,uBACd,MAAM,kBACL,QAAQ;;iBAyBK,uBAAuB,SAAS,KAAK,sBAAsB;;;;;;iBAsB3D,uBACd,MAAM,KAAK,wDACX,MAAM,kBACL,QAAQ;;iBAgBK,qBACd,MAAM,KAAK,2CACV"}
|
package/dist/figjam/palette.js
CHANGED
|
@@ -222,6 +222,28 @@ function figJamColorName(color) {
|
|
|
222
222
|
function figJamOutlineColorName(color) {
|
|
223
223
|
return figJamColorName(color) ?? FIGJAM_COLOR_NAMES.find((name) => sameColor(color, parseColor(PALETTE[name].sectionStroke))) ?? null;
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* How FigJam draws a section's title on a board, measured in FigJam: a pill in the colour of the
|
|
227
|
+
* outline drawn on top, with white text on the palette's darkest colours and black on the rest;
|
|
228
|
+
* null for a section without an outline from the palette. `colorOf` reads an outline's colour as
|
|
229
|
+
* drawn, such as a variable's value in the section's mode.
|
|
230
|
+
*/
|
|
231
|
+
function figJamSectionTitleColors(section, colorOf = (stroke) => stroke.color) {
|
|
232
|
+
const strokeIndex = section.strokes.findLastIndex((stroke) => stroke.visible && stroke.opacity > 0);
|
|
233
|
+
const outline = section.strokes.at(strokeIndex);
|
|
234
|
+
if (strokeIndex === -1 || !outline) return null;
|
|
235
|
+
const color = colorOf(outline, strokeIndex);
|
|
236
|
+
const name = figJamOutlineColorName(color);
|
|
237
|
+
if (!name) return null;
|
|
238
|
+
return {
|
|
239
|
+
strokeIndex,
|
|
240
|
+
background: {
|
|
241
|
+
...color,
|
|
242
|
+
a: 1
|
|
243
|
+
},
|
|
244
|
+
lightText: PALETTE[name].lightLabel
|
|
245
|
+
};
|
|
246
|
+
}
|
|
225
247
|
/** The fill mode a shape's first fill shows. */
|
|
226
248
|
function figJamFillMode(fill) {
|
|
227
249
|
if (!fill || !fill.visible || fill.opacity === 0) return "none";
|
|
@@ -344,6 +366,12 @@ function strokesIn(strokes, color, weight) {
|
|
|
344
366
|
/** A section painted `name`, as FigJam's colour menu paints one: a pale tint outlined in the colour. */
|
|
345
367
|
function figJamSectionColorFields(section, name) {
|
|
346
368
|
const { sectionFill, sectionStroke } = PALETTE[name];
|
|
369
|
+
const strokes = strokesIn(section.strokes, parseColor(sectionStroke), SECTION_STROKE_WEIGHT).map((stroke) => stroke.opacity === 0 ? stroke : {
|
|
370
|
+
...stroke,
|
|
371
|
+
opacity: 1,
|
|
372
|
+
visible: true,
|
|
373
|
+
weight: SECTION_STROKE_WEIGHT
|
|
374
|
+
});
|
|
347
375
|
return {
|
|
348
376
|
fills: [{
|
|
349
377
|
type: "SOLID",
|
|
@@ -351,7 +379,7 @@ function figJamSectionColorFields(section, name) {
|
|
|
351
379
|
opacity: 1,
|
|
352
380
|
visible: true
|
|
353
381
|
}],
|
|
354
|
-
strokes
|
|
382
|
+
strokes,
|
|
355
383
|
strokeWeight: SECTION_STROKE_WEIGHT
|
|
356
384
|
};
|
|
357
385
|
}
|
|
@@ -406,6 +434,6 @@ function figJamLayerColorName(node) {
|
|
|
406
434
|
return figJamColorName(drawnPaint(colorsStroke(node) ? node.strokes : node.fills)?.color);
|
|
407
435
|
}
|
|
408
436
|
//#endregion
|
|
409
|
-
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamShapePaint };
|
|
437
|
+
export { FIGJAM_COLOR_NAMES, FIGJAM_SHAPE_DASH, figJamColor, figJamColorName, figJamFillMode, figJamLayerColorFields, figJamLayerColorName, figJamLineColorFields, figJamLineStyle, figJamLineStyleFields, figJamOutlineColorName, figJamPairedStroke, figJamSectionColorFields, figJamSectionColorName, figJamSectionTitleColors, figJamShapePaint };
|
|
410
438
|
|
|
411
439
|
//# sourceMappingURL=palette.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette.js","names":[],"sources":["../../src/figjam/palette.ts"],"sourcesContent":["import { omit } from 'es-toolkit'\n\nimport { parseColor } from '../color'\nimport { BLACK, WHITE } from '../constants'\nimport type { Color } from '../primitives'\nimport type { Fill, SceneNode, Stroke } from '../types'\n\n/**\n * FigJam's board palette, in its menus' order, as its colour menu paints a shape with text: each\n * fill pairs with a darker stroke, a light label on the darkest fills, and, made transparent, a\n * lighter fill and its own stroke. Its line menu and connectors take the fills as line colours, and\n * a section takes a pale tint of each with the colour itself as its outline.\n */\nconst PALETTE = {\n black: {\n fill: '#1e1e1e',\n stroke: '#242424',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#929292',\n sectionFill: '#dddddd',\n sectionStroke: '#2c2c2c'\n },\n darkGray: {\n fill: '#757575',\n stroke: '#424242',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#a1a1a1',\n sectionFill: '#eaeaea',\n sectionStroke: '#757575'\n },\n red: {\n fill: '#f24822',\n stroke: '#bd2915',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#c7968f',\n sectionFill: '#ffe2e0',\n sectionStroke: '#f24822'\n },\n orange: {\n fill: '#ff9e42',\n stroke: '#eb7500',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#e9b780',\n sectionFill: '#ffead6',\n sectionStroke: '#ff9e42'\n },\n yellow: {\n fill: '#ffc943',\n stroke: '#e8a302',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#f5d280',\n sectionFill: '#fff3d6',\n sectionStroke: '#ffc943'\n },\n green: {\n fill: '#66d575',\n stroke: '#3e9b4b',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#80c79e',\n sectionFill: '#ddf8e2',\n sectionStroke: '#66d575'\n },\n teal: {\n fill: '#5ad8cc',\n stroke: '#369e94',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#80c9c6',\n sectionFill: '#defcfa',\n sectionStroke: '#5ad8cc'\n },\n blue: {\n fill: '#3dadff',\n stroke: '#007ad2',\n lightLabel: true,\n transparent: 0.7,\n transparentStroke: '#4d99d3',\n sectionFill: '#dbf0ff',\n sectionStroke: '#3dadff'\n },\n violet: {\n fill: '#874fff',\n stroke: '#5427b4',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#a792d0',\n sectionFill: '#eae1ff',\n sectionStroke: '#874fff'\n },\n pink: {\n fill: '#f849c1',\n stroke: '#b42487',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#ce92bb',\n sectionFill: '#ffd6f2',\n sectionStroke: '#f849c1'\n },\n white: {\n fill: '#ffffff',\n stroke: '#757575',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#f1f1f1',\n sectionFill: '#ffffff',\n sectionStroke: '#e6e6e6'\n },\n gray: {\n fill: '#b3b3b3',\n stroke: '#797979',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#bcbcbc',\n sectionFill: '#f4f4f4',\n sectionStroke: '#b3b3b3'\n },\n lightGray: {\n fill: '#d9d9d9',\n stroke: '#a5a5a5',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#c0c0c0',\n sectionFill: '#f9f9f9',\n sectionStroke: '#d9d9d9'\n },\n lightRed: {\n fill: '#ffc7c2',\n stroke: '#f24822',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#ff9d8f',\n sectionFill: '#fff5f5',\n sectionStroke: '#ffc7c2'\n },\n lightOrange: {\n fill: '#ffe0c2',\n stroke: '#ff9e42',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#f6c34d',\n sectionFill: '#fff7f0',\n sectionStroke: '#ffe0c2'\n },\n lightYellow: {\n fill: '#ffecbd',\n stroke: '#ffc943',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#efd54d',\n sectionFill: '#fffbf0',\n sectionStroke: '#ffecbd'\n },\n lightGreen: {\n fill: '#cdf4d3',\n stroke: '#66d575',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#a8d7b4',\n sectionFill: '#ebffee',\n sectionStroke: '#cdf4d3'\n },\n lightTeal: {\n fill: '#c6faf6',\n stroke: '#5ad8cc',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#bcebeb',\n sectionFill: '#f1fefd',\n sectionStroke: '#c6faf6'\n },\n lightBlue: {\n fill: '#c2e5ff',\n stroke: '#3dadff',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#76ccff',\n sectionFill: '#f5fbff',\n sectionStroke: '#c2e5ff'\n },\n lightViolet: {\n fill: '#dcccff',\n stroke: '#874fff',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#d5a3ff',\n sectionFill: '#f8f5ff',\n sectionStroke: '#dcccff'\n },\n lightPink: {\n fill: '#ffc2ec',\n stroke: '#f849c1',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#ffaaeb',\n sectionFill: '#fff0fa',\n sectionStroke: '#ffc2ec'\n }\n} as const\n\nexport type FigJamColorName = keyof typeof PALETTE\n\nexport const FIGJAM_COLOR_NAMES = Object.keys(PALETTE) as FigJamColorName[]\n\n/** How a shape's colour fills it: solid, see-through, or not at all, as FigJam's menu sets it. */\nexport type FigJamFillMode = 'fill' | 'transparent' | 'none'\n\n/** How a shape's outline is drawn, as FigJam's line menu sets it. */\nexport type FigJamLineStyle = 'solid' | 'dashed' | 'none'\n\n/** The dash FigJam's line menu draws a shape's outline with. */\nexport const FIGJAM_SHAPE_DASH = [16, 10] as const\n\n/** A palette colour as a colour. */\nexport function figJamColor(name: FigJamColorName): Color {\n return parseColor(PALETTE[name].fill)\n}\n\nfunction sameColor(a: Color | undefined, b: Color): boolean {\n if (!a) return false\n const close = (x: number, y: number) => Math.abs(x - y) < 1 / 512\n return close(a.r, b.r) && close(a.g, b.g) && close(a.b, b.b)\n}\n\n/** The palette colour a paint is, if any. */\nexport function figJamColorName(color: Color | undefined): FigJamColorName | null {\n return FIGJAM_COLOR_NAMES.find((name) => sameColor(color, figJamColor(name))) ?? null\n}\n\n/**\n * The palette colour an outline is drawn in: a colour itself, or the outline a section of that\n * colour takes, which is darker for black and lighter for white.\n */\nexport function figJamOutlineColorName(color: Color | undefined): FigJamColorName | null {\n return (\n figJamColorName(color) ??\n FIGJAM_COLOR_NAMES.find((name) => sameColor(color, parseColor(PALETTE[name].sectionStroke))) ??\n null\n )\n}\n\n/** The fill mode a shape's first fill shows. */\nexport function figJamFillMode(fill: Fill | undefined): FigJamFillMode {\n if (!fill || !fill.visible || fill.opacity === 0) return 'none'\n return fill.opacity < 1 ? 'transparent' : 'fill'\n}\n\n/** The outline FigJam pairs with a colour in a fill mode. */\nexport function figJamPairedStroke(name: FigJamColorName, mode: FigJamFillMode): Color {\n const entry = PALETTE[name]\n return parseColor(mode === 'fill' ? entry.stroke : entry.transparentStroke)\n}\n\n/** The label paint FigJam pairs with a colour in a fill mode. */\nfunction pairedLabel(name: FigJamColorName, mode: FigJamFillMode): Fill {\n const light = PALETTE[name].lightLabel && (mode === 'fill' || name === 'black') && mode !== 'none'\n return light\n ? { type: 'SOLID', color: { ...WHITE }, opacity: 1, visible: true }\n : { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n}\n\n/** How opaque FigJam fills a colour in a fill mode. */\nfunction fillOpacity(name: FigJamColorName, mode: FigJamFillMode): number {\n if (mode === 'transparent') return PALETTE[name].transparent\n return mode === 'fill' ? 1 : 0\n}\n\n/** What a shape with text and its label become when painted `name` in `mode`. */\nexport interface FigJamShapePaint {\n shape: Partial<SceneNode>\n label: Partial<SceneNode>\n}\n\n/**\n * A shape painted `name` in `mode`, as FigJam's colour menu paints it. The stroke and label follow\n * the colour only while they are still the ones FigJam paired with the current paint: a line or\n * text colour set by hand stays.\n */\nexport function figJamShapePaint(\n shape: Pick<SceneNode, 'fills' | 'strokes'>,\n label: Pick<SceneNode, 'fills'> | null,\n name: FigJamColorName,\n mode: FigJamFillMode\n): FigJamShapePaint {\n const fill = shape.fills.at(0)\n const current = figJamColorName(fill?.color)\n const currentMode = figJamFillMode(fill)\n const opacity = fillOpacity(name, mode)\n const result: FigJamShapePaint = {\n shape: { fills: [{ type: 'SOLID', color: figJamColor(name), opacity, visible: true }] },\n label: {}\n }\n const stroke = shape.strokes.at(0)\n const strokeFollows =\n !stroke || !current || sameColor(stroke.color, figJamPairedStroke(current, currentMode))\n if (stroke && strokeFollows) {\n result.shape.strokes = [\n { ...stroke, color: figJamPairedStroke(name, mode) },\n ...shape.strokes.slice(1)\n ]\n }\n const labelFill = label?.fills.at(0)\n const paired = current ? pairedLabel(current, currentMode) : null\n const labelFollows =\n !labelFill ||\n !paired ||\n (sameColor(labelFill.color, paired.color) &&\n Math.abs(labelFill.opacity - paired.opacity) < 0.01)\n if (label && labelFollows) result.label = { fills: [pairedLabel(name, mode)] }\n return result\n}\n\n/**\n * A shape's outline drawn `style`, as FigJam's line menu draws it; the weight stays. The dash is\n * the layer's, as files keep it, and each stroke's, as it is drawn.\n */\nexport function figJamLineStyleFields(\n shape: Pick<SceneNode, 'strokes'>,\n style: FigJamLineStyle\n): Partial<SceneNode> {\n const dashPattern = style === 'dashed' ? [...FIGJAM_SHAPE_DASH] : []\n const strokes = shape.strokes.map((stroke): Stroke => ({\n ...stroke,\n opacity: style === 'none' ? 0 : 1,\n dashPattern: [...dashPattern]\n }))\n return { strokes, dashPattern }\n}\n\n/** The line style a shape's outline shows. */\nexport function figJamLineStyle(shape: Pick<SceneNode, 'strokes'>): FigJamLineStyle {\n const stroke = shape.strokes.at(0)\n if (!stroke || !stroke.visible || stroke.opacity === 0) return 'none'\n return (stroke.dashPattern?.length ?? 0) > 0 ? 'dashed' : 'solid'\n}\n\n/**\n * A shape's outline in palette colour `name`, as FigJam's line menu colours it; a hidden outline\n * shows again, keeping its dash.\n */\nexport function figJamLineColorFields(\n shape: Pick<SceneNode, 'strokes'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const color = figJamColor(name)\n const strokes =\n shape.strokes.length > 0\n ? shape.strokes.map((stroke): Stroke => ({ ...stroke, color, opacity: 1 }))\n : [\n {\n type: 'SOLID',\n color,\n opacity: 1,\n visible: true,\n weight: 4,\n align: 'CENTER'\n } satisfies Stroke\n ]\n return { strokes }\n}\n\n/** How heavy FigJam outlines a coloured section, and a coloured layer that had no stroke. */\nconst SECTION_STROKE_WEIGHT = 2\nconst LAYER_STROKE_WEIGHT = 1\n\n/** `strokes` recoloured, or a new stroke of `weight` when there are none. */\nfunction strokesIn(strokes: Stroke[], color: Color, weight: number): Stroke[] {\n if (strokes.length > 0) return strokes.map((stroke) => ({ ...stroke, type: 'SOLID', color }))\n return [{ type: 'SOLID', color, opacity: 1, visible: true, weight, align: 'INSIDE' }]\n}\n\n/** A section painted `name`, as FigJam's colour menu paints one: a pale tint outlined in the colour. */\nexport function figJamSectionColorFields(\n section: Pick<SceneNode, 'strokes'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const { sectionFill, sectionStroke } = PALETTE[name]\n return {\n fills: [{ type: 'SOLID', color: parseColor(sectionFill), opacity: 1, visible: true }],\n strokes: strokesIn(section.strokes, parseColor(sectionStroke), SECTION_STROKE_WEIGHT),\n strokeWeight: SECTION_STROKE_WEIGHT\n }\n}\n\n/**\n * The paint of `paints` the canvas shows on top: the last it draws, skipping hidden and fully\n * transparent ones, which show nothing.\n */\nfunction drawnPaint<P extends Fill>(paints: readonly P[]): P | undefined {\n return paints.findLast((paint) => paint.visible && paint.opacity > 0)\n}\n\n/** The palette colour a section is painted, by its tint. */\nexport function figJamSectionColorName(section: Pick<SceneNode, 'fills'>): FigJamColorName | null {\n const fill = drawnPaint(section.fills)?.color\n return (\n FIGJAM_COLOR_NAMES.find((name) => sameColor(fill, parseColor(PALETTE[name].sectionFill))) ??\n null\n )\n}\n\n/**\n * Whether a layer takes a palette colour as its stroke alone: a line, or a pen stroke, which is a\n * vector with nothing filled. A filled vector takes it as any other layer does.\n */\nfunction colorsStroke(node: Pick<SceneNode, 'type' | 'fills'>): boolean {\n if (node.type === 'LINE') return true\n return node.type === 'VECTOR' && !drawnPaint(node.fills)\n}\n\n/**\n * A plain layer painted `name`, as FigJam's colour menu paints one: text takes it as its fill, a\n * line or a pen stroke as its stroke, and any other layer as its fill and a stroke of the same\n * colour.\n */\nexport function figJamLayerColorFields(\n node: Pick<SceneNode, 'type' | 'fills' | 'strokes' | 'styleRuns'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const color = figJamColor(name)\n const fills: Fill[] = [{ type: 'SOLID', color, opacity: 1, visible: true }]\n if (node.type === 'TEXT') {\n // The whole text takes the colour, ranges coloured on their own included.\n const styleRuns = node.styleRuns.map((run) => ({\n ...run,\n style: omit(run.style, ['fills', 'fillStyleId'])\n }))\n return { fills, styleRuns }\n }\n const strokes = strokesIn(node.strokes, color, LAYER_STROKE_WEIGHT)\n return colorsStroke(node) ? { strokes } : { fills, strokes }\n}\n\n/** The palette colour a plain layer shows, read where {@link figJamLayerColorFields} paints it. */\nexport function figJamLayerColorName(\n node: Pick<SceneNode, 'type' | 'fills' | 'strokes'>\n): FigJamColorName | null {\n const paints: Fill[] = colorsStroke(node) ? node.strokes : node.fills\n return figJamColorName(drawnPaint(paints)?.color)\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAM,UAAU;CACd,OAAO;EACL,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,UAAU;EACR,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,KAAK;EACH,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,OAAO;EACL,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,MAAM;EACJ,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,MAAM;EACJ,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB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AAM,SAAS,UAAU,MAAM,WAAW,QAAQ,KAAK,CAAC,WAAW,CAAC,CAAC,KACxF;AAEJ;;;;;AAMA,SAAS,aAAa,MAAkD;CACtE,IAAI,KAAK,SAAS,QAAQ,OAAO;CACjC,OAAO,KAAK,SAAS,YAAY,CAAC,WAAW,KAAK,KAAK;AACzD;;;;;;AAOA,SAAgB,uBACd,MACA,MACoB;CACpB,MAAM,QAAQ,YAAY,IAAI;CAC9B,MAAM,QAAgB,CAAC;EAAE,MAAM;EAAS;EAAO,SAAS;EAAG,SAAS;CAAK,CAAC;CAC1E,IAAI,KAAK,SAAS,QAMhB,OAAO;EAAE;EAAO,WAJE,KAAK,UAAU,KAAK,SAAS;GAC7C,GAAG;GACH,OAAO,KAAK,IAAI,OAAO,CAAC,SAAS,aAAa,CAAC;EACjD,EACwB;CAAE;CAE5B,MAAM,UAAU,UAAU,KAAK,SAAS,OAAO,mBAAmB;CAClE,OAAO,aAAa,IAAI,IAAI,EAAE,QAAQ,IAAI;EAAE;EAAO;CAAQ;AAC7D;;AAGA,SAAgB,qBACd,MACwB;CAExB,OAAO,gBAAgB,WADA,aAAa,IAAI,IAAI,KAAK,UAAU,KAAK,KACxB,CAAC,EAAE,KAAK;AAClD"}
|
|
1
|
+
{"version":3,"file":"palette.js","names":[],"sources":["../../src/figjam/palette.ts"],"sourcesContent":["import { omit } from 'es-toolkit'\n\nimport { parseColor } from '../color'\nimport { BLACK, WHITE } from '../constants'\nimport type { Color } from '../primitives'\nimport type { Fill, SceneNode, Stroke } from '../types'\n\n/**\n * FigJam's board palette, in its menus' order, as its colour menu paints a shape with text: each\n * fill pairs with a darker stroke, a light label on the darkest fills, and, made transparent, a\n * lighter fill and its own stroke. Its line menu and connectors take the fills as line colours, and\n * a section takes a pale tint of each with the colour itself as its outline.\n */\nconst PALETTE = {\n black: {\n fill: '#1e1e1e',\n stroke: '#242424',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#929292',\n sectionFill: '#dddddd',\n sectionStroke: '#2c2c2c'\n },\n darkGray: {\n fill: '#757575',\n stroke: '#424242',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#a1a1a1',\n sectionFill: '#eaeaea',\n sectionStroke: '#757575'\n },\n red: {\n fill: '#f24822',\n stroke: '#bd2915',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#c7968f',\n sectionFill: '#ffe2e0',\n sectionStroke: '#f24822'\n },\n orange: {\n fill: '#ff9e42',\n stroke: '#eb7500',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#e9b780',\n sectionFill: '#ffead6',\n sectionStroke: '#ff9e42'\n },\n yellow: {\n fill: '#ffc943',\n stroke: '#e8a302',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#f5d280',\n sectionFill: '#fff3d6',\n sectionStroke: '#ffc943'\n },\n green: {\n fill: '#66d575',\n stroke: '#3e9b4b',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#80c79e',\n sectionFill: '#ddf8e2',\n sectionStroke: '#66d575'\n },\n teal: {\n fill: '#5ad8cc',\n stroke: '#369e94',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#80c9c6',\n sectionFill: '#defcfa',\n sectionStroke: '#5ad8cc'\n },\n blue: {\n fill: '#3dadff',\n stroke: '#007ad2',\n lightLabel: true,\n transparent: 0.7,\n transparentStroke: '#4d99d3',\n sectionFill: '#dbf0ff',\n sectionStroke: '#3dadff'\n },\n violet: {\n fill: '#874fff',\n stroke: '#5427b4',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#a792d0',\n sectionFill: '#eae1ff',\n sectionStroke: '#874fff'\n },\n pink: {\n fill: '#f849c1',\n stroke: '#b42487',\n lightLabel: true,\n transparent: 0.5,\n transparentStroke: '#ce92bb',\n sectionFill: '#ffd6f2',\n sectionStroke: '#f849c1'\n },\n white: {\n fill: '#ffffff',\n stroke: '#757575',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#f1f1f1',\n sectionFill: '#ffffff',\n sectionStroke: '#e6e6e6'\n },\n gray: {\n fill: '#b3b3b3',\n stroke: '#797979',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#bcbcbc',\n sectionFill: '#f4f4f4',\n sectionStroke: '#b3b3b3'\n },\n lightGray: {\n fill: '#d9d9d9',\n stroke: '#a5a5a5',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#c0c0c0',\n sectionFill: '#f9f9f9',\n sectionStroke: '#d9d9d9'\n },\n lightRed: {\n fill: '#ffc7c2',\n stroke: '#f24822',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#ff9d8f',\n sectionFill: '#fff5f5',\n sectionStroke: '#ffc7c2'\n },\n lightOrange: {\n fill: '#ffe0c2',\n stroke: '#ff9e42',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#f6c34d',\n sectionFill: '#fff7f0',\n sectionStroke: '#ffe0c2'\n },\n lightYellow: {\n fill: '#ffecbd',\n stroke: '#ffc943',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#efd54d',\n sectionFill: '#fffbf0',\n sectionStroke: '#ffecbd'\n },\n lightGreen: {\n fill: '#cdf4d3',\n stroke: '#66d575',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#a8d7b4',\n sectionFill: '#ebffee',\n sectionStroke: '#cdf4d3'\n },\n lightTeal: {\n fill: '#c6faf6',\n stroke: '#5ad8cc',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#bcebeb',\n sectionFill: '#f1fefd',\n sectionStroke: '#c6faf6'\n },\n lightBlue: {\n fill: '#c2e5ff',\n stroke: '#3dadff',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#76ccff',\n sectionFill: '#f5fbff',\n sectionStroke: '#c2e5ff'\n },\n lightViolet: {\n fill: '#dcccff',\n stroke: '#874fff',\n lightLabel: false,\n transparent: 0.7,\n transparentStroke: '#d5a3ff',\n sectionFill: '#f8f5ff',\n sectionStroke: '#dcccff'\n },\n lightPink: {\n fill: '#ffc2ec',\n stroke: '#f849c1',\n lightLabel: false,\n transparent: 0.5,\n transparentStroke: '#ffaaeb',\n sectionFill: '#fff0fa',\n sectionStroke: '#ffc2ec'\n }\n} as const\n\nexport type FigJamColorName = keyof typeof PALETTE\n\nexport const FIGJAM_COLOR_NAMES = Object.keys(PALETTE) as FigJamColorName[]\n\n/** How a shape's colour fills it: solid, see-through, or not at all, as FigJam's menu sets it. */\nexport type FigJamFillMode = 'fill' | 'transparent' | 'none'\n\n/** How a shape's outline is drawn, as FigJam's line menu sets it. */\nexport type FigJamLineStyle = 'solid' | 'dashed' | 'none'\n\n/** The dash FigJam's line menu draws a shape's outline with. */\nexport const FIGJAM_SHAPE_DASH = [16, 10] as const\n\n/** A palette colour as a colour. */\nexport function figJamColor(name: FigJamColorName): Color {\n return parseColor(PALETTE[name].fill)\n}\n\nfunction sameColor(a: Color | undefined, b: Color): boolean {\n if (!a) return false\n const close = (x: number, y: number) => Math.abs(x - y) < 1 / 512\n return close(a.r, b.r) && close(a.g, b.g) && close(a.b, b.b)\n}\n\n/** The palette colour a paint is, if any. */\nexport function figJamColorName(color: Color | undefined): FigJamColorName | null {\n return FIGJAM_COLOR_NAMES.find((name) => sameColor(color, figJamColor(name))) ?? null\n}\n\n/**\n * The palette colour an outline is drawn in: a colour itself, or the outline a section of that\n * colour takes, which is darker for black and lighter for white.\n */\nexport function figJamOutlineColorName(color: Color | undefined): FigJamColorName | null {\n return (\n figJamColorName(color) ??\n FIGJAM_COLOR_NAMES.find((name) => sameColor(color, parseColor(PALETTE[name].sectionStroke))) ??\n null\n )\n}\n\n/**\n * How FigJam draws a section's title on a board, measured in FigJam: a pill in the colour of the\n * outline drawn on top, with white text on the palette's darkest colours and black on the rest;\n * null for a section without an outline from the palette. `colorOf` reads an outline's colour as\n * drawn, such as a variable's value in the section's mode.\n */\nexport function figJamSectionTitleColors(\n section: Pick<SceneNode, 'strokes'>,\n colorOf: (stroke: Stroke, index: number) => Color = (stroke) => stroke.color\n): { strokeIndex: number; background: Color; lightText: boolean } | null {\n const strokeIndex = section.strokes.findLastIndex(\n (stroke) => stroke.visible && stroke.opacity > 0\n )\n const outline = section.strokes.at(strokeIndex)\n if (strokeIndex === -1 || !outline) return null\n const color = colorOf(outline, strokeIndex)\n const name = figJamOutlineColorName(color)\n if (!name) return null\n return { strokeIndex, background: { ...color, a: 1 }, lightText: PALETTE[name].lightLabel }\n}\n\n/** The fill mode a shape's first fill shows. */\nexport function figJamFillMode(fill: Fill | undefined): FigJamFillMode {\n if (!fill || !fill.visible || fill.opacity === 0) return 'none'\n return fill.opacity < 1 ? 'transparent' : 'fill'\n}\n\n/** The outline FigJam pairs with a colour in a fill mode. */\nexport function figJamPairedStroke(name: FigJamColorName, mode: FigJamFillMode): Color {\n const entry = PALETTE[name]\n return parseColor(mode === 'fill' ? entry.stroke : entry.transparentStroke)\n}\n\n/** The label paint FigJam pairs with a colour in a fill mode. */\nfunction pairedLabel(name: FigJamColorName, mode: FigJamFillMode): Fill {\n const light = PALETTE[name].lightLabel && (mode === 'fill' || name === 'black') && mode !== 'none'\n return light\n ? { type: 'SOLID', color: { ...WHITE }, opacity: 1, visible: true }\n : { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n}\n\n/** How opaque FigJam fills a colour in a fill mode. */\nfunction fillOpacity(name: FigJamColorName, mode: FigJamFillMode): number {\n if (mode === 'transparent') return PALETTE[name].transparent\n return mode === 'fill' ? 1 : 0\n}\n\n/** What a shape with text and its label become when painted `name` in `mode`. */\nexport interface FigJamShapePaint {\n shape: Partial<SceneNode>\n label: Partial<SceneNode>\n}\n\n/**\n * A shape painted `name` in `mode`, as FigJam's colour menu paints it. The stroke and label follow\n * the colour only while they are still the ones FigJam paired with the current paint: a line or\n * text colour set by hand stays.\n */\nexport function figJamShapePaint(\n shape: Pick<SceneNode, 'fills' | 'strokes'>,\n label: Pick<SceneNode, 'fills'> | null,\n name: FigJamColorName,\n mode: FigJamFillMode\n): FigJamShapePaint {\n const fill = shape.fills.at(0)\n const current = figJamColorName(fill?.color)\n const currentMode = figJamFillMode(fill)\n const opacity = fillOpacity(name, mode)\n const result: FigJamShapePaint = {\n shape: { fills: [{ type: 'SOLID', color: figJamColor(name), opacity, visible: true }] },\n label: {}\n }\n const stroke = shape.strokes.at(0)\n const strokeFollows =\n !stroke || !current || sameColor(stroke.color, figJamPairedStroke(current, currentMode))\n if (stroke && strokeFollows) {\n result.shape.strokes = [\n { ...stroke, color: figJamPairedStroke(name, mode) },\n ...shape.strokes.slice(1)\n ]\n }\n const labelFill = label?.fills.at(0)\n const paired = current ? pairedLabel(current, currentMode) : null\n const labelFollows =\n !labelFill ||\n !paired ||\n (sameColor(labelFill.color, paired.color) &&\n Math.abs(labelFill.opacity - paired.opacity) < 0.01)\n if (label && labelFollows) result.label = { fills: [pairedLabel(name, mode)] }\n return result\n}\n\n/**\n * A shape's outline drawn `style`, as FigJam's line menu draws it; the weight stays. The dash is\n * the layer's, as files keep it, and each stroke's, as it is drawn.\n */\nexport function figJamLineStyleFields(\n shape: Pick<SceneNode, 'strokes'>,\n style: FigJamLineStyle\n): Partial<SceneNode> {\n const dashPattern = style === 'dashed' ? [...FIGJAM_SHAPE_DASH] : []\n const strokes = shape.strokes.map((stroke): Stroke => ({\n ...stroke,\n opacity: style === 'none' ? 0 : 1,\n dashPattern: [...dashPattern]\n }))\n return { strokes, dashPattern }\n}\n\n/** The line style a shape's outline shows. */\nexport function figJamLineStyle(shape: Pick<SceneNode, 'strokes'>): FigJamLineStyle {\n const stroke = shape.strokes.at(0)\n if (!stroke || !stroke.visible || stroke.opacity === 0) return 'none'\n return (stroke.dashPattern?.length ?? 0) > 0 ? 'dashed' : 'solid'\n}\n\n/**\n * A shape's outline in palette colour `name`, as FigJam's line menu colours it; a hidden outline\n * shows again, keeping its dash.\n */\nexport function figJamLineColorFields(\n shape: Pick<SceneNode, 'strokes'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const color = figJamColor(name)\n const strokes =\n shape.strokes.length > 0\n ? shape.strokes.map((stroke): Stroke => ({ ...stroke, color, opacity: 1 }))\n : [\n {\n type: 'SOLID',\n color,\n opacity: 1,\n visible: true,\n weight: 4,\n align: 'CENTER'\n } satisfies Stroke\n ]\n return { strokes }\n}\n\n/** How heavy FigJam outlines a coloured section, and a coloured layer that had no stroke. */\nconst SECTION_STROKE_WEIGHT = 2\nconst LAYER_STROKE_WEIGHT = 1\n\n/** `strokes` recoloured, or a new stroke of `weight` when there are none. */\nfunction strokesIn(strokes: Stroke[], color: Color, weight: number): Stroke[] {\n if (strokes.length > 0) return strokes.map((stroke) => ({ ...stroke, type: 'SOLID', color }))\n return [{ type: 'SOLID', color, opacity: 1, visible: true, weight, align: 'INSIDE' }]\n}\n\n/** A section painted `name`, as FigJam's colour menu paints one: a pale tint outlined in the colour. */\nexport function figJamSectionColorFields(\n section: Pick<SceneNode, 'strokes'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const { sectionFill, sectionStroke } = PALETTE[name]\n // The outline shows in full at FigJam's 2, as its menu draws it, unless the line menu hid it.\n const strokes = strokesIn(section.strokes, parseColor(sectionStroke), SECTION_STROKE_WEIGHT).map(\n (stroke): Stroke =>\n stroke.opacity === 0\n ? stroke\n : { ...stroke, opacity: 1, visible: true, weight: SECTION_STROKE_WEIGHT }\n )\n return {\n fills: [{ type: 'SOLID', color: parseColor(sectionFill), opacity: 1, visible: true }],\n strokes,\n strokeWeight: SECTION_STROKE_WEIGHT\n }\n}\n\n/**\n * The paint of `paints` the canvas shows on top: the last it draws, skipping hidden and fully\n * transparent ones, which show nothing.\n */\nfunction drawnPaint<P extends Fill>(paints: readonly P[]): P | undefined {\n return paints.findLast((paint) => paint.visible && paint.opacity > 0)\n}\n\n/** The palette colour a section is painted, by its tint. */\nexport function figJamSectionColorName(section: Pick<SceneNode, 'fills'>): FigJamColorName | null {\n const fill = drawnPaint(section.fills)?.color\n return (\n FIGJAM_COLOR_NAMES.find((name) => sameColor(fill, parseColor(PALETTE[name].sectionFill))) ??\n null\n )\n}\n\n/**\n * Whether a layer takes a palette colour as its stroke alone: a line, or a pen stroke, which is a\n * vector with nothing filled. A filled vector takes it as any other layer does.\n */\nfunction colorsStroke(node: Pick<SceneNode, 'type' | 'fills'>): boolean {\n if (node.type === 'LINE') return true\n return node.type === 'VECTOR' && !drawnPaint(node.fills)\n}\n\n/**\n * A plain layer painted `name`, as FigJam's colour menu paints one: text takes it as its fill, a\n * line or a pen stroke as its stroke, and any other layer as its fill and a stroke of the same\n * colour.\n */\nexport function figJamLayerColorFields(\n node: Pick<SceneNode, 'type' | 'fills' | 'strokes' | 'styleRuns'>,\n name: FigJamColorName\n): Partial<SceneNode> {\n const color = figJamColor(name)\n const fills: Fill[] = [{ type: 'SOLID', color, opacity: 1, visible: true }]\n if (node.type === 'TEXT') {\n // The whole text takes the colour, ranges coloured on their own included.\n const styleRuns = node.styleRuns.map((run) => ({\n ...run,\n style: omit(run.style, ['fills', 'fillStyleId'])\n }))\n return { fills, styleRuns }\n }\n const strokes = strokesIn(node.strokes, color, LAYER_STROKE_WEIGHT)\n return colorsStroke(node) ? { strokes } : { fills, strokes }\n}\n\n/** The palette colour a plain layer shows, read where {@link figJamLayerColorFields} paints it. */\nexport function figJamLayerColorName(\n node: Pick<SceneNode, 'type' | 'fills' | 'strokes'>\n): FigJamColorName | null {\n const paints: Fill[] = colorsStroke(node) ? node.strokes : node.fills\n return figJamColorName(drawnPaint(paints)?.color)\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAM,UAAU;CACd,OAAO;EACL,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,UAAU;EACR,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;CACjB;CACA,KAAK;EACH,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,aAAa;EACb,eAAe;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AkD;CACtE,IAAI,KAAK,SAAS,QAAQ,OAAO;CACjC,OAAO,KAAK,SAAS,YAAY,CAAC,WAAW,KAAK,KAAK;AACzD;;;;;;AAOA,SAAgB,uBACd,MACA,MACoB;CACpB,MAAM,QAAQ,YAAY,IAAI;CAC9B,MAAM,QAAgB,CAAC;EAAE,MAAM;EAAS;EAAO,SAAS;EAAG,SAAS;CAAK,CAAC;CAC1E,IAAI,KAAK,SAAS,QAMhB,OAAO;EAAE;EAAO,WAJE,KAAK,UAAU,KAAK,SAAS;GAC7C,GAAG;GACH,OAAO,KAAK,IAAI,OAAO,CAAC,SAAS,aAAa,CAAC;EACjD,EACwB;CAAE;CAE5B,MAAM,UAAU,UAAU,KAAK,SAAS,OAAO,mBAAmB;CAClE,OAAO,aAAa,IAAI,IAAI,EAAE,QAAQ,IAAI;EAAE;EAAO;CAAQ;AAC7D;;AAGA,SAAgB,qBACd,MACwB;CAExB,OAAO,gBAAgB,WADA,aAAa,IAAI,IAAI,KAAK,UAAU,KAAK,KACxB,CAAC,EAAE,KAAK;AAClD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { NodeType, SceneNode } from "../types.js";
|
|
3
3
|
import { GeneratedFrameKind } from "./kind.js";
|
|
4
|
-
import { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields } from "./shape-with-text.js";
|
|
4
|
+
import { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields } from "./shape-with-text.js";
|
|
5
5
|
import { DEFAULT_STICKY_COLOR, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, StickyContent, StickySublayers, StickyTextRole, buildStickySublayers, createSticky, isWideSticky, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth } from "./sticky.js";
|
|
6
6
|
//#region src/generated/index.d.ts
|
|
7
7
|
/**
|
|
@@ -40,5 +40,5 @@ declare function layerRotates(node: Pick<SceneNode, 'type'>): boolean;
|
|
|
40
40
|
/** Whether a layer's resize handles and W and H fields resize it freely. */
|
|
41
41
|
declare function layerResizes(node: Pick<SceneNode, 'type'>): boolean;
|
|
42
42
|
//#endregion
|
|
43
|
-
export { DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, type GeneratedFrameKind, GeneratedFrameType, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, StickyContent, StickySublayers, StickyTextRole, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerResizes, layerRotates, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
43
|
+
export { DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, type GeneratedFrameKind, GeneratedFrameType, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, StickyContent, StickySublayers, StickyTextRole, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerResizes, layerRotates, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
44
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/generated/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CONNECTOR_KIND } from "../connectors/sublayers.js";
|
|
2
|
-
import { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields } from "./shape-with-text.js";
|
|
2
|
+
import { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields } from "./shape-with-text.js";
|
|
3
3
|
import { DEFAULT_STICKY_COLOR, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildStickySublayers, createSticky, isWideSticky, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth } from "./sticky.js";
|
|
4
4
|
//#region src/generated/index.ts
|
|
5
5
|
/**
|
|
@@ -53,6 +53,6 @@ function layerResizes(node) {
|
|
|
53
53
|
return generatedFrameKind(node)?.resizes ?? true;
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
|
-
export { DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerResizes, layerRotates, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
56
|
+
export { DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerResizes, layerRotates, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
57
57
|
|
|
58
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,7 @@ import { GeneratedFrameKind } from "./kind.js";
|
|
|
5
5
|
//#region src/generated/shape-with-text.d.ts
|
|
6
6
|
/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */
|
|
7
7
|
declare const SHAPE_WITH_TEXT_SIZE = 176;
|
|
8
|
-
/** FigJam rounds every corner of a shape by 6 px. */
|
|
8
|
+
/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */
|
|
9
9
|
declare const SHAPE_WITH_TEXT_CORNER_RADIUS = 6;
|
|
10
10
|
/** How the label sits in its shape: as wide as the label box, as tall as its text. */
|
|
11
11
|
declare const SHAPE_WITH_TEXT_LABEL_LAYOUT: {
|
|
@@ -18,6 +18,11 @@ declare const SHAPE_WITH_TEXT_LABEL_LAYOUT: {
|
|
|
18
18
|
* whenever either changes.
|
|
19
19
|
*/
|
|
20
20
|
declare function shapeWithTextFrameFields(kind: ShapeWithTextType, width: number, height: number): Partial<SceneNode>;
|
|
21
|
+
/**
|
|
22
|
+
* What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the
|
|
23
|
+
* label area, and the corners a rounded rectangle leaves go back to FigJam's 6.
|
|
24
|
+
*/
|
|
25
|
+
declare function shapeWithTextKindFields(shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>, kind: ShapeWithTextType): Partial<SceneNode>;
|
|
21
26
|
/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */
|
|
22
27
|
declare function shapeWithTextLabelFields(): Partial<SceneNode>;
|
|
23
28
|
/** A shape's label: its one text sublayer. */
|
|
@@ -34,5 +39,5 @@ declare function buildShapeWithTextLabel(graph: SceneGraph, shape: SceneNode, pr
|
|
|
34
39
|
/** A new shape with text and its label; the caller lays it out to grow it to its text. */
|
|
35
40
|
declare function createShapeWithText(graph: SceneGraph, parentId: string, props?: Partial<SceneNode>, label?: Partial<SceneNode>): SceneNode;
|
|
36
41
|
//#endregion
|
|
37
|
-
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
42
|
+
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
38
43
|
//# sourceMappingURL=shape-with-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-with-text.d.ts","names":[],"sources":["../../src/generated/shape-with-text.ts"],"mappings":";;;;;;cAUa;;cAEA;;
|
|
1
|
+
{"version":3,"file":"shape-with-text.d.ts","names":[],"sources":["../../src/generated/shape-with-text.ts"],"mappings":";;;;;;cAUa;;cAEA;;cAWA;WAAA;WAAA;;;;;;;iBAUG,yBACd,MAAM,mBACN,eACA,iBACC,QAAQ;;;;;iBAwBK,wBACd,OAAO,KAAK,sDACZ,MAAM,oBACL,QAAQ;;iBAWK,4BAA4B,QAAQ;;iBAcpC,mBAAmB,OAAO,YAAY,OAAO,YAAY;;;;;;;cAc5D,sBAAsB;;iBAanB,wBACd,OAAO,YACP,OAAO,WACP,QAAO,QAAQ,aACd;;iBAea,oBACd,OAAO,YACP,kBACA,QAAO,QAAQ,YACf,QAAO,QAAQ,aACd"}
|
|
@@ -5,8 +5,13 @@ import { shapeWithTextLabelBox } from "../shape-with-text/fit.js";
|
|
|
5
5
|
//#region src/generated/shape-with-text.ts
|
|
6
6
|
/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */
|
|
7
7
|
const SHAPE_WITH_TEXT_SIZE = 176;
|
|
8
|
-
/** FigJam rounds every corner of a shape by 6 px. */
|
|
8
|
+
/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */
|
|
9
9
|
const SHAPE_WITH_TEXT_CORNER_RADIUS = 6;
|
|
10
|
+
/**
|
|
11
|
+
* FigJam keeps a rounded rectangle's corner radius at 0.4 of its shorter side, through resizes,
|
|
12
|
+
* measured in FigJam; Figma draws the shape from that radius.
|
|
13
|
+
*/
|
|
14
|
+
const ROUNDED_RECTANGLE_RADIUS = .4;
|
|
10
15
|
const LABEL_FILL = {
|
|
11
16
|
type: "SOLID",
|
|
12
17
|
color: { ...BLACK },
|
|
@@ -36,7 +41,19 @@ function shapeWithTextFrameFields(kind, width, height) {
|
|
|
36
41
|
paddingRight: Math.max(0, width - box.x - box.width),
|
|
37
42
|
paddingBottom: Math.max(0, height - box.y - box.height),
|
|
38
43
|
paddingLeft: box.x,
|
|
39
|
-
clipsContent: false
|
|
44
|
+
clipsContent: false,
|
|
45
|
+
...kind === "ROUNDED_RECTANGLE" ? { cornerRadius: ROUNDED_RECTANGLE_RADIUS * Math.min(width, height) } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the
|
|
50
|
+
* label area, and the corners a rounded rectangle leaves go back to FigJam's 6.
|
|
51
|
+
*/
|
|
52
|
+
function shapeWithTextKindFields(shape, kind) {
|
|
53
|
+
return {
|
|
54
|
+
shapeWithTextType: kind,
|
|
55
|
+
...shape.shapeWithTextType === "ROUNDED_RECTANGLE" && kind !== shape.shapeWithTextType ? { cornerRadius: 6 } : {},
|
|
56
|
+
...shapeWithTextFrameFields(kind, shape.width, shape.height)
|
|
40
57
|
};
|
|
41
58
|
}
|
|
42
59
|
/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */
|
|
@@ -113,6 +130,6 @@ function createShapeWithText(graph, parentId, props = {}, label = {}) {
|
|
|
113
130
|
return shape;
|
|
114
131
|
}
|
|
115
132
|
//#endregion
|
|
116
|
-
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
133
|
+
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
117
134
|
|
|
118
135
|
//# sourceMappingURL=shape-with-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/generated/shape-with-text.ts"],"sourcesContent":["import { BLACK } from '../constants'\nimport { FIGJAM_TYPEFACES, figJamTextSizeFields } from '../figjam/text'\nimport type { SceneGraph } from '../index'\nimport { shapeWithTextLabelBox } from '../shape-with-text/fit'\nimport type { ShapeWithTextType } from '../shape-with-text/kinds'\nimport { lineHeightPixels } from '../text/lengths'\nimport type { Fill, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\n\n/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */\nexport const SHAPE_WITH_TEXT_SIZE = 176\n/** FigJam rounds every corner of a shape by 6 px. */\nexport const SHAPE_WITH_TEXT_CORNER_RADIUS = 6\n\nconst LABEL_FILL: Fill = { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n\n/** How the label sits in its shape: as wide as the label box, as tall as its text. */\nexport const SHAPE_WITH_TEXT_LABEL_LAYOUT = {\n textAutoResize: 'HEIGHT',\n layoutAlignSelf: 'STRETCH'\n} as const satisfies Partial<SceneNode>\n\n/**\n * The shape's own layout: a vertical auto layout that centres the label in the label box of its\n * kind, which the padding leaves free. The padding follows the kind and size, so it is set again\n * whenever either changes.\n */\nexport function shapeWithTextFrameFields(\n kind: ShapeWithTextType,\n width: number,\n height: number\n): Partial<SceneNode> {\n const box = shapeWithTextLabelBox(kind, width, height)\n return {\n layoutMode: 'VERTICAL',\n primaryAxisAlign: 'CENTER',\n counterAxisAlign: 'CENTER',\n primaryAxisSizing: 'FIXED',\n counterAxisSizing: 'FIXED',\n itemSpacing: 0,\n paddingTop: box.y,\n paddingRight: Math.max(0, width - box.x - box.width),\n paddingBottom: Math.max(0, height - box.y - box.height),\n paddingLeft: box.x,\n clipsContent: false\n }\n}\n\n/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */\nexport function shapeWithTextLabelFields(): Partial<SceneNode> {\n return {\n name: 'Text',\n fontFamily: FIGJAM_TYPEFACES.simple.fontFamily,\n fontWeight: FIGJAM_TYPEFACES.simple.fontWeight,\n ...figJamTextSizeFields('small'),\n textAlignHorizontal: 'CENTER',\n textAlignVertical: 'TOP',\n fills: [{ ...LABEL_FILL, color: { ...LABEL_FILL.color } }],\n ...SHAPE_WITH_TEXT_LABEL_LAYOUT\n }\n}\n\n/** A shape's label: its one text sublayer. */\nexport function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null {\n if (shape.type !== 'SHAPE_WITH_TEXT') return null\n const children = graph.getChildren(shape.id)\n if (children.length !== 1) return null\n const [label] = children\n return label.type === 'TEXT' ? label : null\n}\n\n/**\n * A shape with text edits its label in place, turns and resizes freely, and, as in FigJam, takes\n * its name from its label until it is named. A height set on it by a resize, a field or a script\n * is the height it was given, which layout grows it from when its label needs more room; once\n * that height changes, FigJam keeps it and truncates the label instead.\n */\nexport const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind = {\n complete: (graph, frame) => shapeWithTextLabel(graph, frame) !== null,\n text: (graph, frame) => shapeWithTextLabel(graph, frame) ?? undefined,\n rotates: true,\n resizes: true,\n namedByText: true,\n sized: ({ height }, shape) =>\n height === undefined || height === shape.height\n ? {}\n : { shapeUserHeight: height, shapeTruncates: true }\n}\n\n/** Adds the label to a SHAPE_WITH_TEXT the caller created, styled as FigJam generates it. */\nexport function buildShapeWithTextLabel(\n graph: SceneGraph,\n shape: SceneNode,\n props: Partial<SceneNode> = {}\n): SceneNode {\n const box = shapeWithTextLabelBox(shape.shapeWithTextType, shape.width, shape.height)\n const fields = shapeWithTextLabelFields()\n return graph.createNode('TEXT', shape.id, {\n ...fields,\n x: box.x,\n y: box.y,\n width: box.width,\n height: lineHeightPixels(fields.lineHeight ?? null, fields.fontSize ?? 0) ?? undefined,\n text: '',\n ...props\n })\n}\n\n/** A new shape with text and its label; the caller lays it out to grow it to its text. */\nexport function createShapeWithText(\n graph: SceneGraph,\n parentId: string,\n props: Partial<SceneNode> = {},\n label: Partial<SceneNode> = {}\n): SceneNode {\n const kind = props.shapeWithTextType ?? 'SQUARE'\n const width = props.width ?? SHAPE_WITH_TEXT_SIZE\n const height = props.height ?? SHAPE_WITH_TEXT_SIZE\n const shape = graph.createNode('SHAPE_WITH_TEXT', parentId, {\n name: 'Shape with text',\n cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS,\n ...props,\n shapeWithTextType: kind,\n width,\n height,\n shapeUserHeight: props.shapeUserHeight ?? height,\n ...shapeWithTextFrameFields(kind, width, height)\n })\n buildShapeWithTextLabel(graph, shape, label)\n return shape\n}\n"],"mappings":";;;;;;AAUA,MAAa,uBAAuB;;AAEpC,MAAa,gCAAgC;
|
|
1
|
+
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/generated/shape-with-text.ts"],"sourcesContent":["import { BLACK } from '../constants'\nimport { FIGJAM_TYPEFACES, figJamTextSizeFields } from '../figjam/text'\nimport type { SceneGraph } from '../index'\nimport { shapeWithTextLabelBox } from '../shape-with-text/fit'\nimport type { ShapeWithTextType } from '../shape-with-text/kinds'\nimport { lineHeightPixels } from '../text/lengths'\nimport type { Fill, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\n\n/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */\nexport const SHAPE_WITH_TEXT_SIZE = 176\n/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */\nexport const SHAPE_WITH_TEXT_CORNER_RADIUS = 6\n\n/**\n * FigJam keeps a rounded rectangle's corner radius at 0.4 of its shorter side, through resizes,\n * measured in FigJam; Figma draws the shape from that radius.\n */\nconst ROUNDED_RECTANGLE_RADIUS = 0.4\n\nconst LABEL_FILL: Fill = { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n\n/** How the label sits in its shape: as wide as the label box, as tall as its text. */\nexport const SHAPE_WITH_TEXT_LABEL_LAYOUT = {\n textAutoResize: 'HEIGHT',\n layoutAlignSelf: 'STRETCH'\n} as const satisfies Partial<SceneNode>\n\n/**\n * The shape's own layout: a vertical auto layout that centres the label in the label box of its\n * kind, which the padding leaves free. The padding follows the kind and size, so it is set again\n * whenever either changes.\n */\nexport function shapeWithTextFrameFields(\n kind: ShapeWithTextType,\n width: number,\n height: number\n): Partial<SceneNode> {\n const box = shapeWithTextLabelBox(kind, width, height)\n return {\n layoutMode: 'VERTICAL',\n primaryAxisAlign: 'CENTER',\n counterAxisAlign: 'CENTER',\n primaryAxisSizing: 'FIXED',\n counterAxisSizing: 'FIXED',\n itemSpacing: 0,\n paddingTop: box.y,\n paddingRight: Math.max(0, width - box.x - box.width),\n paddingBottom: Math.max(0, height - box.y - box.height),\n paddingLeft: box.x,\n clipsContent: false,\n ...(kind === 'ROUNDED_RECTANGLE'\n ? { cornerRadius: ROUNDED_RECTANGLE_RADIUS * Math.min(width, height) }\n : {})\n }\n}\n\n/**\n * What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the\n * label area, and the corners a rounded rectangle leaves go back to FigJam's 6.\n */\nexport function shapeWithTextKindFields(\n shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>,\n kind: ShapeWithTextType\n): Partial<SceneNode> {\n const leavesRounded =\n shape.shapeWithTextType === 'ROUNDED_RECTANGLE' && kind !== shape.shapeWithTextType\n return {\n shapeWithTextType: kind,\n ...(leavesRounded ? { cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS } : {}),\n ...shapeWithTextFrameFields(kind, shape.width, shape.height)\n }\n}\n\n/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */\nexport function shapeWithTextLabelFields(): Partial<SceneNode> {\n return {\n name: 'Text',\n fontFamily: FIGJAM_TYPEFACES.simple.fontFamily,\n fontWeight: FIGJAM_TYPEFACES.simple.fontWeight,\n ...figJamTextSizeFields('small'),\n textAlignHorizontal: 'CENTER',\n textAlignVertical: 'TOP',\n fills: [{ ...LABEL_FILL, color: { ...LABEL_FILL.color } }],\n ...SHAPE_WITH_TEXT_LABEL_LAYOUT\n }\n}\n\n/** A shape's label: its one text sublayer. */\nexport function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null {\n if (shape.type !== 'SHAPE_WITH_TEXT') return null\n const children = graph.getChildren(shape.id)\n if (children.length !== 1) return null\n const [label] = children\n return label.type === 'TEXT' ? label : null\n}\n\n/**\n * A shape with text edits its label in place, turns and resizes freely, and, as in FigJam, takes\n * its name from its label until it is named. A height set on it by a resize, a field or a script\n * is the height it was given, which layout grows it from when its label needs more room; once\n * that height changes, FigJam keeps it and truncates the label instead.\n */\nexport const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind = {\n complete: (graph, frame) => shapeWithTextLabel(graph, frame) !== null,\n text: (graph, frame) => shapeWithTextLabel(graph, frame) ?? undefined,\n rotates: true,\n resizes: true,\n namedByText: true,\n sized: ({ height }, shape) =>\n height === undefined || height === shape.height\n ? {}\n : { shapeUserHeight: height, shapeTruncates: true }\n}\n\n/** Adds the label to a SHAPE_WITH_TEXT the caller created, styled as FigJam generates it. */\nexport function buildShapeWithTextLabel(\n graph: SceneGraph,\n shape: SceneNode,\n props: Partial<SceneNode> = {}\n): SceneNode {\n const box = shapeWithTextLabelBox(shape.shapeWithTextType, shape.width, shape.height)\n const fields = shapeWithTextLabelFields()\n return graph.createNode('TEXT', shape.id, {\n ...fields,\n x: box.x,\n y: box.y,\n width: box.width,\n height: lineHeightPixels(fields.lineHeight ?? null, fields.fontSize ?? 0) ?? undefined,\n text: '',\n ...props\n })\n}\n\n/** A new shape with text and its label; the caller lays it out to grow it to its text. */\nexport function createShapeWithText(\n graph: SceneGraph,\n parentId: string,\n props: Partial<SceneNode> = {},\n label: Partial<SceneNode> = {}\n): SceneNode {\n const kind = props.shapeWithTextType ?? 'SQUARE'\n const width = props.width ?? SHAPE_WITH_TEXT_SIZE\n const height = props.height ?? SHAPE_WITH_TEXT_SIZE\n const shape = graph.createNode('SHAPE_WITH_TEXT', parentId, {\n name: 'Shape with text',\n cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS,\n ...props,\n shapeWithTextType: kind,\n width,\n height,\n shapeUserHeight: props.shapeUserHeight ?? height,\n ...shapeWithTextFrameFields(kind, width, height)\n })\n buildShapeWithTextLabel(graph, shape, label)\n return shape\n}\n"],"mappings":";;;;;;AAUA,MAAa,uBAAuB;;AAEpC,MAAa,gCAAgC;;;;;AAM7C,MAAM,2BAA2B;AAEjC,MAAM,aAAmB;CAAE,MAAM;CAAS,OAAO,EAAE,GAAG,MAAM;CAAG,SAAS;CAAK,SAAS;AAAK;;AAG3F,MAAa,+BAA+B;CAC1C,gBAAgB;CAChB,iBAAiB;AACnB;;;;;;AAOA,SAAgB,yBACd,MACA,OACA,QACoB;CACpB,MAAM,MAAM,sBAAsB,MAAM,OAAO,MAAM;CACrD,OAAO;EACL,YAAY;EACZ,kBAAkB;EAClB,kBAAkB;EAClB,mBAAmB;EACnB,mBAAmB;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