@glissade/scene 0.22.0-pre.1 → 0.22.0-pre.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.
@@ -51,6 +51,13 @@ interface DescribedNode {
51
51
  props: {
52
52
  [prop: string]: DescribedProp;
53
53
  };
54
+ /**
55
+ * What this node's `position` points at WITHOUT an explicit `anchor` (its
56
+ * legacy origin): 'center' for shapes, 'baseline-left' for Text, etc. Override
57
+ * with the base `anchor` prop. Surfaced so consumers stop discovering the
58
+ * shape-vs-Text anchor mismatch by pixel-measuring.
59
+ */
60
+ positionAnchor: string;
54
61
  /**
55
62
  * The tree-shakeable subpath this node is imported from, when not the base
56
63
  * `@glissade/scene` index (e.g. the Layout family lives on
package/dist/describe.js CHANGED
@@ -22,7 +22,7 @@ import { easings, listValueTypes } from "@glissade/core";
22
22
  * never pulled onto the base embed path — a scene that never calls `describe()`
23
23
  * pays zero bytes for it.
24
24
  */
25
- const RAW_VERSION = "0.22.0-pre.1";
25
+ const RAW_VERSION = "0.22.0-pre.3";
26
26
  const PACKAGE_VERSION = RAW_VERSION.includes("GLISSADE_".concat("VERSION")) ? "0.0.0-dev" : RAW_VERSION;
27
27
  /** Arity of a value type's numeric repr: vec2/vec2-arc → 2, number → 1; others (color/paint/path/string/boolean) carry no scalar arity. */
28
28
  function arityOf(type) {
@@ -103,9 +103,24 @@ const BASE_CONSTRUCTION_PROP_META = {
103
103
  id: { type: "string" },
104
104
  blend: { type: "BlendMode" },
105
105
  filters: { type: "FilterSpec[]" },
106
- anchor: { type: "AnchorSpec" },
106
+ anchor: { type: "'center'|'top-left'|'top'|'top-right'|'left'|'right'|'bottom-left'|'bottom'|'bottom-right'|[ax,ay]" },
107
107
  cache: { type: "boolean" }
108
108
  };
109
+ /**
110
+ * What an unanchored node's `position` POINTS AT (its legacy origin). Shapes are
111
+ * box-centered; Text sits at the baseline-left; Path uses the author's path
112
+ * coords. Surfaced per node so a consumer aligning a card + its label stops
113
+ * pixel-measuring the mismatch — and knows `anchor` (above) overrides it.
114
+ */
115
+ const POSITION_ANCHOR = {
116
+ Rect: "center",
117
+ Circle: "center",
118
+ Image: "center",
119
+ Video: "center",
120
+ Text: "baseline-left",
121
+ Path: "author-coords",
122
+ Group: "none (no intrinsic box — anchor warns and is ignored)"
123
+ };
109
124
  /** Introspect one freshly-instantiated node into its prop manifest: the
110
125
  * ANIMATABLE props come from the REAL `registerTarget` calls via `listTargets()`
111
126
  * (so they can't drift); the CONSTRUCTION-only props are merged from the curated
@@ -136,7 +151,10 @@ function describeNode(node, typeName) {
136
151
  ...spec.required ? { required: true } : {}
137
152
  };
138
153
  }
139
- return { props };
154
+ return {
155
+ props,
156
+ positionAnchor: POSITION_ANCHOR[typeName] ?? "center"
157
+ };
140
158
  }
141
159
  /**
142
160
  * The Layout family — `Layout` and its `Stack`/`Row`/`Column` ergonomic
@@ -192,6 +210,7 @@ function describeLayoutNode() {
192
210
  }
193
211
  return {
194
212
  props,
213
+ positionAnchor: "top-left",
195
214
  subpath: LAYOUT_SUBPATH
196
215
  };
197
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.22.0-pre.1",
3
+ "version": "0.22.0-pre.3",
4
4
  "description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -59,7 +59,7 @@
59
59
  ],
60
60
  "dependencies": {
61
61
  "yoga-layout": "^3.2.1",
62
- "@glissade/core": "0.22.0-pre.1"
62
+ "@glissade/core": "0.22.0-pre.3"
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",