@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.
@@ -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. */