@yahoo/uds-create-config 4.51.3 → 4.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/capture/node-ops.js +1 -11
  2. package/dist/configs/CanvasConfig.js +5 -1
  3. package/dist/configs/system.js +6 -0
  4. package/dist/entities/canvas/node-gestures.d.ts +2 -0
  5. package/dist/entities/canvas/node-gestures.js +616 -0
  6. package/dist/{capture → entities/canvas}/node-patches.d.ts +6 -4
  7. package/dist/{capture → entities/canvas}/node-patches.js +16 -3
  8. package/dist/entities/system/Component.d.ts +47 -32
  9. package/dist/entities/system/Component.js +181 -30
  10. package/dist/entities/system/LinkedSystem.d.ts +10 -3
  11. package/dist/entities/system/Motion.d.ts +5 -1
  12. package/dist/entities/system/Motion.js +7 -2
  13. package/dist/entities/system/component-forwards.d.ts +46 -0
  14. package/dist/entities/system/component-forwards.js +131 -0
  15. package/dist/entities/system/token-values.d.ts +9 -1
  16. package/dist/entities/system/token-values.js +4 -3
  17. package/dist/framework/Config.d.ts +1 -1
  18. package/dist/framework/Config.js +1 -1
  19. package/dist/framework/defineSubEntity.d.ts +10 -1
  20. package/dist/framework/defineSubEntity.js +19 -1
  21. package/dist/framework/rejection.js +16 -4
  22. package/dist/framework/schema-version.d.ts +1 -1
  23. package/dist/framework/schema-version.js +5 -5
  24. package/dist/framework/schemas.js +14 -3
  25. package/dist/index.d.ts +7 -6
  26. package/dist/index.js +5 -5
  27. package/dist/migrations/20261001112308_style_rules_as_list.d.ts +12 -0
  28. package/dist/migrations/20261001112308_style_rules_as_list.js +8 -0
  29. package/dist/migrations/20261001130958_motion_exit_and_element_duplicate.d.ts +9 -0
  30. package/dist/migrations/20261001130958_motion_exit_and_element_duplicate.js +10 -0
  31. package/dist/migrations/20261001131000_layer_style_and_forward_ops.d.ts +11 -0
  32. package/dist/migrations/20261001131000_layer_style_and_forward_ops.js +10 -0
  33. package/dist/spec/slot.d.ts +19 -1
  34. package/dist/spec/slot.js +49 -11
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +2 -2
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20261001130958_motion_exit_and_element_duplicate.ts
2
+ const MOTION_EXIT_AND_ELEMENT_DUPLICATE_VERSION = 20261001130958;
3
+ const motionExitAndElementDuplicateMigration = {
4
+ version: MOTION_EXIT_AND_ELEMENT_DUPLICATE_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { MOTION_EXIT_AND_ELEMENT_DUPLICATE_VERSION, motionExitAndElementDuplicateMigration };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `sub-update` on a collection that derives its members' keys takes no `key` and finds the member
3
+ * from `data`, so a style rule is addressed by its `when`. A write to a component's `forwards`
4
+ * refuses a prop its layer can't forward, and `layer-forward` writes one from a request. No stored
5
+ * config or patch changes shape: a key-less update is stored with the key it derived, and
6
+ * `layer-forward` stores the generic `forwards` write. Additive, so the envelope passes through as
7
+ * it is.
8
+ */
9
+ import type { SchemaMigration } from '../framework/schema-version';
10
+ export declare const LAYER_STYLE_AND_FORWARD_OPS_VERSION = 20261001131000;
11
+ export declare const layerStyleAndForwardOpsMigration: SchemaMigration;
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20261001131000_layer_style_and_forward_ops.ts
2
+ const LAYER_STYLE_AND_FORWARD_OPS_VERSION = 20261001131e3;
3
+ const layerStyleAndForwardOpsMigration = {
4
+ version: LAYER_STYLE_AND_FORWARD_OPS_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { LAYER_STYLE_AND_FORWARD_OPS_VERSION, layerStyleAndForwardOpsMigration };
@@ -176,6 +176,24 @@ declare function listSlots({
176
176
  config: Config;
177
177
  path: string;
178
178
  }): readonly Slot[];
179
+ /** A component and the slot prop that takes content: `children` or a named slot. */
180
+ interface SlotHost {
181
+ readonly component: string;
182
+ readonly slot: string;
183
+ }
184
+ /**
185
+ * Every place, on any component, whose `accepts` names `element`: its declared slots, and the
186
+ * `children` its root layer holds when that declares what it accepts. These are where the config
187
+ * says the element belongs, as opposed to the containers that take anything. `element` is a spec
188
+ * type or a bare component path.
189
+ */
190
+ declare function slotsFor({
191
+ config,
192
+ element
193
+ }: {
194
+ config: Config;
195
+ element: string;
196
+ }): readonly SlotHost[];
179
197
  /** The named node slots alone: what a design node's render injects an empty placeholder for. */
180
198
  declare function namedSlots({
181
199
  config,
@@ -206,4 +224,4 @@ declare function slotHostedBy({
206
224
  layer: string;
207
225
  }): Slot | undefined;
208
226
  //#endregion
209
- export { Slot, SlotCell, listSlots, namedSlots, slotHostedBy, slotOf };
227
+ export { Slot, SlotCell, SlotHost, listSlots, namedSlots, slotHostedBy, slotOf, slotsFor };
package/dist/spec/slot.js CHANGED
@@ -65,16 +65,10 @@ var Slot = class {
65
65
  * element stores.
66
66
  */
67
67
  takes(element) {
68
- if (this.accepts.length === 0) return true;
69
- const named = elementRefOf(this.config, element);
70
- if (!named) return false;
71
- const kind = kindOf(named);
72
- const elementPath = pathOf(named);
73
- return this.accepts.some((accepted) => {
74
- if (kindOf(accepted) !== kind) return false;
75
- const acceptedPath = pathOf(accepted);
76
- if (acceptedPath === elementPath) return true;
77
- return !(this.config.resolve(kind, acceptedPath) !== void 0) && elementPath.startsWith(`${acceptedPath}/`);
68
+ return acceptsElement({
69
+ config: this.config,
70
+ accepts: this.accepts,
71
+ element
78
72
  });
79
73
  }
80
74
  /** The stored field a cell reads the slot's content from, or `undefined` when nothing is stored. */
@@ -304,6 +298,36 @@ function listSlots({ config, path }) {
304
298
  byPath.set(path, slots);
305
299
  return slots;
306
300
  }
301
+ /**
302
+ * Every place, on any component, whose `accepts` names `element`: its declared slots, and the
303
+ * `children` its root layer holds when that declares what it accepts. These are where the config
304
+ * says the element belongs, as opposed to the containers that take anything. `element` is a spec
305
+ * type or a bare component path.
306
+ */
307
+ function slotsFor({ config, element }) {
308
+ const out = [];
309
+ for (const { path } of config.list("component")) {
310
+ const slots = listSlots({
311
+ config,
312
+ path
313
+ });
314
+ for (const slot of slots) if (slot.accepts.length > 0 && slot.takes(element)) out.push({
315
+ component: path,
316
+ slot: slot.from
317
+ });
318
+ if (slots.some((slot) => slot.isChildren)) continue;
319
+ const accepts = acceptsRefsOf(resolveComponentProps(config, path).children?.accepts ?? []);
320
+ if (accepts.length > 0 && acceptsElement({
321
+ config,
322
+ accepts,
323
+ element
324
+ })) out.push({
325
+ component: path,
326
+ slot: "children"
327
+ });
328
+ }
329
+ return out;
330
+ }
307
331
  /** The named node slots alone: what a design node's render injects an empty placeholder for. */
308
332
  function namedSlots({ config, path }) {
309
333
  return listSlots({
@@ -468,6 +492,20 @@ function elementRefOf(config, element) {
468
492
  if (kind && kind !== element && config.entityOf(kind)) return element;
469
493
  return config.resolve("component", element) ? `component:${element}` : void 0;
470
494
  }
495
+ /** Whether an `accepts` list takes an element; see {@link Slot.takes}. */
496
+ function acceptsElement({ config, accepts, element }) {
497
+ if (accepts.length === 0) return true;
498
+ const named = elementRefOf(config, element);
499
+ if (!named) return false;
500
+ const kind = kindOf(named);
501
+ const elementPath = pathOf(named);
502
+ return accepts.some((accepted) => {
503
+ if (kindOf(accepted) !== kind) return false;
504
+ const acceptedPath = pathOf(accepted);
505
+ if (acceptedPath === elementPath) return true;
506
+ return !(config.resolve(kind, acceptedPath) !== void 0) && elementPath.startsWith(`${acceptedPath}/`);
507
+ });
508
+ }
471
509
  /** Every ref an `accepts` declaration names, one or a list. */
472
510
  function acceptsRefsOf(accepts) {
473
511
  return (Array.isArray(accepts) ? accepts : [accepts]).filter(isRef).map((entry) => entry.__ref);
@@ -542,4 +580,4 @@ function routesToText(config, layers, route) {
542
580
  return routesIntoText(owner, hostLayers, into);
543
581
  }
544
582
  //#endregion
545
- export { listSlots, namedSlots, slotHostedBy, slotOf };
583
+ export { listSlots, namedSlots, slotHostedBy, slotOf, slotsFor };