@pairdraw/design-jsx 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/behaviours/elements.js +2 -1
- package/dist/chunks/behaviours/elements.js.map +1 -1
- package/dist/chunks/effects.js +54 -2
- package/dist/chunks/effects.js.map +1 -1
- package/dist/chunks/elements.js +37 -5
- package/dist/chunks/elements.js.map +1 -1
- package/dist/chunks/export/index.js +22 -2
- package/dist/chunks/export/index.js.map +1 -1
- package/dist/chunks/fields.js +111 -29
- package/dist/chunks/fields.js.map +1 -1
- package/dist/chunks/index.js +3 -1
- package/dist/chunks/index.js.map +1 -1
- package/dist/index.d.ts +33 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/src/behaviours/index.ts +3 -0
- package/src/effects.ts +81 -2
- package/src/elements.ts +1 -1
- package/src/export/index.ts +2 -0
- package/src/export/paint.ts +50 -9
- package/src/export/props.ts +1 -1
- package/src/helpers.ts +26 -1
- package/src/index.ts +6 -1
- package/src/order.ts +111 -0
- package/src/reconcile.ts +2 -0
- package/src/reference/authoring.md +1 -1
- package/src/render.ts +4 -1
- package/src/renderer.ts +54 -25
- package/src/types.ts +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isTreeNode } from "../behaviours/elements.js";
|
|
2
2
|
import { BLEND_MODE, CONSTRAINT, MASK_TYPE, TEXT_ALIGN, TEXT_ALIGN_VERTICAL, TEXT_CASE, TEXT_DECORATION, defineMode, defineVars, designMode, designVar, isMode, isVariable, parseScriptInput, property, ref } from "../component-properties.js";
|
|
3
|
-
import { backgroundBlur, dropShadow, foregroundBlur, innerShadow, layerBlur } from "../effects.js";
|
|
3
|
+
import { backgroundBlur, dropShadow, foregroundBlur, innerShadow, layerBlur, noise, texture } from "../effects.js";
|
|
4
4
|
import { Reference, connectorExportScope, connectorLabel, connectorProps, connectorRefDeclarations, helperCall, layersUnder, plainValue, propAttribute, valueSyntax } from "../connectors.js";
|
|
5
5
|
import { DESIGN_JSX_ELEMENTS, collectCornerRadii, collectEffectProps, collectFillProps, collectPadding, collectStrokeProps, elementTag, emitPadding, formatColor, formatTracks, getNodeContext, shapeWithTextLabelText, shapeWithTextProps, stickyBody, stickyProps } from "../elements.js";
|
|
6
6
|
import { AUTO, collectDecorationProps, textLengthJSX } from "./decoration.js";
|
|
@@ -161,6 +161,23 @@ const BLUR_OPTIONS = {
|
|
|
161
161
|
radius: true,
|
|
162
162
|
visible: true
|
|
163
163
|
};
|
|
164
|
+
const NOISE_OPTIONS = {
|
|
165
|
+
noiseType: true,
|
|
166
|
+
noiseSize: true,
|
|
167
|
+
density: true,
|
|
168
|
+
color: true,
|
|
169
|
+
secondaryColor: true,
|
|
170
|
+
opacity: true,
|
|
171
|
+
seed: true,
|
|
172
|
+
visible: true
|
|
173
|
+
};
|
|
174
|
+
const TEXTURE_OPTIONS = {
|
|
175
|
+
noiseSize: true,
|
|
176
|
+
radius: true,
|
|
177
|
+
clipToShape: true,
|
|
178
|
+
seed: true,
|
|
179
|
+
visible: true
|
|
180
|
+
};
|
|
164
181
|
const SOLID_OPTIONS = {
|
|
165
182
|
opacity: true,
|
|
166
183
|
visible: true,
|
|
@@ -212,6 +229,8 @@ function designJSXHelpers(warnings) {
|
|
|
212
229
|
layerBlur: checked(warnings, "layerBlur", layerBlur, BLUR_OPTIONS, 0),
|
|
213
230
|
backgroundBlur: checked(warnings, "backgroundBlur", backgroundBlur, BLUR_OPTIONS, 0),
|
|
214
231
|
foregroundBlur: checked(warnings, "foregroundBlur", foregroundBlur, BLUR_OPTIONS, 0),
|
|
232
|
+
noise: checked(warnings, "noise", noise, NOISE_OPTIONS, 0),
|
|
233
|
+
texture: checked(warnings, "texture", texture, TEXTURE_OPTIONS, 0),
|
|
215
234
|
defineVars,
|
|
216
235
|
defineMode,
|
|
217
236
|
designVar,
|
|
@@ -1079,7 +1098,7 @@ function collectShapeNodeProps(node, props) {
|
|
|
1079
1098
|
if (node.starInnerRadius !== .382) props.push(["innerRadius", node.starInnerRadius]);
|
|
1080
1099
|
}
|
|
1081
1100
|
if (node.type === "POLYGON" && node.pointCount !== 3) props.push(["points", node.pointCount]);
|
|
1082
|
-
if (node.type === "VECTOR" && node.vectorNetwork) {
|
|
1101
|
+
if ((node.type === "VECTOR" || node.type === "BOOLEAN_OPERATION") && node.vectorNetwork) {
|
|
1083
1102
|
const paths = vectorNetworkPaths(node.vectorNetwork);
|
|
1084
1103
|
if (paths.length > 0) props.push(["paths", paths.map((path) => ({ ...path }))]);
|
|
1085
1104
|
}
|
|
@@ -1298,6 +1317,7 @@ function nodeToJSX(node, graph, depth, scope, variables, layerIds, outer = NO_RE
|
|
|
1298
1317
|
for (let count = elementCount(content); count > 0; count--) layerIds?.push(null);
|
|
1299
1318
|
return [jsx.element(tag, attributes, content, depth, inline)];
|
|
1300
1319
|
}
|
|
1320
|
+
if (node.type === "BOOLEAN_OPERATION") return [jsx.element(tag, attributes, [], depth)];
|
|
1301
1321
|
return [jsx.element(tag, attributes, children(depth + 1), depth)];
|
|
1302
1322
|
}
|
|
1303
1323
|
/** Printed values break lines only between tokens, never inside a string, so joining is lossless. */
|