@threadlabs/looma 0.2.20 → 0.3.1

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 (51) hide show
  1. package/dist/{chunk-A5MSXQ7Y.js → chunk-RWLYVQY6.js} +2224 -1256
  2. package/dist/chunk-XDNZIKNI.js +2721 -0
  3. package/dist/declarative-generated.cjs +93 -79
  4. package/dist/declarative-generated.d.cts +7 -1
  5. package/dist/declarative-generated.d.ts +7 -1
  6. package/dist/declarative-generated.js +91 -78
  7. package/dist/declarative.cjs +1499 -1702
  8. package/dist/declarative.d.cts +77 -3
  9. package/dist/declarative.d.ts +77 -3
  10. package/dist/declarative.js +5 -3
  11. package/dist/index.cjs +3730 -3025
  12. package/dist/index.d.cts +211 -35
  13. package/dist/index.d.ts +211 -35
  14. package/dist/index.js +6 -61
  15. package/dist/loader.cjs +3724 -2963
  16. package/dist/loader.js +2 -2
  17. package/editor/{chunk-VAXI7Q6T.js → chunk-U36XNFJN.js} +105 -77
  18. package/editor/extensions/index.d.ts +272 -27
  19. package/editor/index.d.ts +1 -1
  20. package/editor/index.js +1 -1
  21. package/editor/{table-overlay-DoiLie4h.d.ts → table-overlay-DZFGHQDt.d.ts} +48 -6
  22. package/editor/ui.d.ts +15 -11
  23. package/editor/ui.js +1 -1
  24. package/layout/index.cjs +197 -340
  25. package/layout/index.d.cts +11 -0
  26. package/layout/index.d.ts +11 -0
  27. package/layout/index.js +197 -340
  28. package/layout.css +31 -134
  29. package/package.json +24 -11
  30. package/react/index.d.ts +1276 -0
  31. package/react/index.js +1526 -0
  32. package/styles.css +5 -10
  33. package/svelte/index.d.ts +204 -0
  34. package/svelte/index.js +1892 -0
  35. package/theme-dark.css +81 -2
  36. package/theme-high-contrast.css +14 -0
  37. package/theme-light.css +30 -1
  38. package/tokens.css +45 -1
  39. package/vue/chunk-OX3EACZ7.js +4369 -0
  40. package/vue/editor/index.d.ts +78 -8
  41. package/vue/editor/index.js +54 -49
  42. package/vue/index.d.ts +79 -78
  43. package/vue/index.js +3 -9
  44. package/dist/chunk-ECJQ4YGC.js +0 -2925
  45. package/dist/valibot.cjs +0 -31
  46. package/dist/valibot.d.cts +0 -10
  47. package/dist/valibot.d.ts +0 -10
  48. package/dist/valibot.js +0 -9
  49. package/dist/validation-bxcou-l-.d.cts +0 -58
  50. package/dist/validation-bxcou-l-.d.ts +0 -58
  51. package/vue/chunk-P7BZ2KJZ.js +0 -3559
@@ -1,5 +1,13 @@
1
+ /** Connects behavior only while the root participates in the document. */
1
2
  declare function manageComponentLifecycle$1(element: Element, definition: unknown, options?: { props?: Record<string, unknown>; controller?: unknown }): () => void;
2
3
 
4
+ /**
5
+ * The small portion of an HTML Next definition that framework adapters need.
6
+ *
7
+ * The full definition remains runtime-owned. Keeping this type structural and
8
+ * deliberately narrow prevents React/Vue/Svelte adapters from learning the
9
+ * authoring format or treating Looma's former Stencil metadata as public API.
10
+ */
3
11
  type ComponentDefinition = {
4
12
  readonly contract: {
5
13
  readonly tag: string;
@@ -9,19 +17,85 @@ type ComponentDefinition = {
9
17
  readonly element: string;
10
18
  };
11
19
  };
20
+ /**
21
+ * Behavior paired with a declarative definition after its native root exists.
22
+ *
23
+ * Controllers receive the HTML Next host abstraction, never a Stencil
24
+ * instance or the legacy invocation element. Returning a disposer makes event
25
+ * and observer ownership explicit when a root disconnects or is reattached.
26
+ *
27
+ * @lifecycle The runtime invokes a returned disposer before reconnecting or
28
+ * permanently disconnecting the same native root.
29
+ */
12
30
  type LoomaControllerModule = {
13
31
  readonly default?: (host: unknown) => void | (() => void);
14
32
  };
33
+ /**
34
+ * Definition text and optional behavior that must be registered atomically.
35
+ * Keeping them paired prevents a controller from resolving against a different
36
+ * revision of the component contract during incremental package loading.
37
+ */
15
38
  type LoomaAdoptionRecord = {
16
39
  readonly tag: string;
17
40
  readonly source: string;
18
41
  readonly controller?: LoomaControllerModule;
19
42
  };
20
- /** Registers a materialized declarative package and enables live HTML lowering. */
43
+ /**
44
+ * Installs one materialized package and enables live declarative HTML.
45
+ *
46
+ * Registration has three ordered phases: publish definitions and styles,
47
+ * lower markup already in the document, then observe future markup. The
48
+ * package name is the idempotency key because facade and direct entry points
49
+ * may both call this function. On the server the operation is intentionally a
50
+ * no-op: authored HTML remains useful fallback content and hydration is a
51
+ * browser concern.
52
+ *
53
+ * @lifecycle Re-registering the same package name is a no-op; a later package
54
+ * registration replaces the document observer only after synchronous package
55
+ * registrations in the current turn have settled.
56
+ * @ownership This registry owns injected definition/style nodes and the shared
57
+ * observer. Framework adapters continue to own roots they mount.
58
+ */
21
59
  declare function registerLoomaPackage(name: string, packageRecords: readonly LoomaAdoptionRecord[], styles: string): void;
22
- /** Adopts a framework-owned native root without exposing the legacy invocation element. */
60
+ /**
61
+ * Attaches declarative behavior to a framework-owned native root.
62
+ *
63
+ * Framework adapters render the definition's native root themselves so their
64
+ * reconciliation model stays authoritative. `attachRegisteredComponent` claims
65
+ * the root from document observation and owns prop synchronization and
66
+ * controller disposal for that exact root.
67
+ *
68
+ * The explicit `tag` check is a corruption guard. A generated adapter paired
69
+ * with the wrong definition can otherwise appear to work while applying a
70
+ * different component's prop and event contract.
71
+ *
72
+ * @ownership The caller owns the native root. The returned disposer owns the
73
+ * prop bridge and controller instance installed for this attachment.
74
+ * @failure A tag/definition mismatch throws before any controller is connected.
75
+ */
23
76
  declare function attachLoomaComponent(element: Element, definition: ComponentDefinition, tag: string, props: Record<string, unknown>): () => void;
77
+ /**
78
+ * Applies a framework adapter's props to an attached root, as authored attributes would be:
79
+ * each defined value becomes explicit (reflected as `data-<name>`); `undefined` restores the default.
80
+ * Generated adapters call this on every render instead of assigning element properties.
81
+ * @failure A value that does not satisfy the prop's declared type throws `HR002`; unknown prop
82
+ * names are ignored, and a root without an attached component is left untouched.
83
+ */
84
+ declare function updateComponentProps(element: Element, props: Record<string, unknown>): void;
85
+ /**
86
+ * Resolves behavior from the shared package registry.
87
+ * Generated adapters use this lookup instead of importing controllers directly,
88
+ * ensuring live HTML and framework roots execute the same module instance.
89
+ */
24
90
  declare function controllerFor(tag: string): LoomaControllerModule | undefined;
91
+ /**
92
+ * Exposes HTML Next's connection-aware lifecycle to handwritten integrations.
93
+ * The callback can run again after reconnection; each connection's disposer is
94
+ * invoked before a later connection begins.
95
+ *
96
+ * @lifecycle The runtime invokes cleanup on disconnect and before reconnecting
97
+ * the same root, so each connection interval has exactly one active disposer.
98
+ */
25
99
  declare function manageComponentLifecycle(...args: Parameters<typeof manageComponentLifecycle$1>): ReturnType<typeof manageComponentLifecycle$1>;
26
100
 
27
- export { type ComponentDefinition, type LoomaAdoptionRecord, type LoomaControllerModule, attachLoomaComponent, controllerFor, manageComponentLifecycle, registerLoomaPackage };
101
+ export { type ComponentDefinition, type LoomaAdoptionRecord, type LoomaControllerModule, attachLoomaComponent, controllerFor, manageComponentLifecycle, registerLoomaPackage, updateComponentProps };
@@ -1,5 +1,13 @@
1
+ /** Connects behavior only while the root participates in the document. */
1
2
  declare function manageComponentLifecycle$1(element: Element, definition: unknown, options?: { props?: Record<string, unknown>; controller?: unknown }): () => void;
2
3
 
4
+ /**
5
+ * The small portion of an HTML Next definition that framework adapters need.
6
+ *
7
+ * The full definition remains runtime-owned. Keeping this type structural and
8
+ * deliberately narrow prevents React/Vue/Svelte adapters from learning the
9
+ * authoring format or treating Looma's former Stencil metadata as public API.
10
+ */
3
11
  type ComponentDefinition = {
4
12
  readonly contract: {
5
13
  readonly tag: string;
@@ -9,19 +17,85 @@ type ComponentDefinition = {
9
17
  readonly element: string;
10
18
  };
11
19
  };
20
+ /**
21
+ * Behavior paired with a declarative definition after its native root exists.
22
+ *
23
+ * Controllers receive the HTML Next host abstraction, never a Stencil
24
+ * instance or the legacy invocation element. Returning a disposer makes event
25
+ * and observer ownership explicit when a root disconnects or is reattached.
26
+ *
27
+ * @lifecycle The runtime invokes a returned disposer before reconnecting or
28
+ * permanently disconnecting the same native root.
29
+ */
12
30
  type LoomaControllerModule = {
13
31
  readonly default?: (host: unknown) => void | (() => void);
14
32
  };
33
+ /**
34
+ * Definition text and optional behavior that must be registered atomically.
35
+ * Keeping them paired prevents a controller from resolving against a different
36
+ * revision of the component contract during incremental package loading.
37
+ */
15
38
  type LoomaAdoptionRecord = {
16
39
  readonly tag: string;
17
40
  readonly source: string;
18
41
  readonly controller?: LoomaControllerModule;
19
42
  };
20
- /** Registers a materialized declarative package and enables live HTML lowering. */
43
+ /**
44
+ * Installs one materialized package and enables live declarative HTML.
45
+ *
46
+ * Registration has three ordered phases: publish definitions and styles,
47
+ * lower markup already in the document, then observe future markup. The
48
+ * package name is the idempotency key because facade and direct entry points
49
+ * may both call this function. On the server the operation is intentionally a
50
+ * no-op: authored HTML remains useful fallback content and hydration is a
51
+ * browser concern.
52
+ *
53
+ * @lifecycle Re-registering the same package name is a no-op; a later package
54
+ * registration replaces the document observer only after synchronous package
55
+ * registrations in the current turn have settled.
56
+ * @ownership This registry owns injected definition/style nodes and the shared
57
+ * observer. Framework adapters continue to own roots they mount.
58
+ */
21
59
  declare function registerLoomaPackage(name: string, packageRecords: readonly LoomaAdoptionRecord[], styles: string): void;
22
- /** Adopts a framework-owned native root without exposing the legacy invocation element. */
60
+ /**
61
+ * Attaches declarative behavior to a framework-owned native root.
62
+ *
63
+ * Framework adapters render the definition's native root themselves so their
64
+ * reconciliation model stays authoritative. `attachRegisteredComponent` claims
65
+ * the root from document observation and owns prop synchronization and
66
+ * controller disposal for that exact root.
67
+ *
68
+ * The explicit `tag` check is a corruption guard. A generated adapter paired
69
+ * with the wrong definition can otherwise appear to work while applying a
70
+ * different component's prop and event contract.
71
+ *
72
+ * @ownership The caller owns the native root. The returned disposer owns the
73
+ * prop bridge and controller instance installed for this attachment.
74
+ * @failure A tag/definition mismatch throws before any controller is connected.
75
+ */
23
76
  declare function attachLoomaComponent(element: Element, definition: ComponentDefinition, tag: string, props: Record<string, unknown>): () => void;
77
+ /**
78
+ * Applies a framework adapter's props to an attached root, as authored attributes would be:
79
+ * each defined value becomes explicit (reflected as `data-<name>`); `undefined` restores the default.
80
+ * Generated adapters call this on every render instead of assigning element properties.
81
+ * @failure A value that does not satisfy the prop's declared type throws `HR002`; unknown prop
82
+ * names are ignored, and a root without an attached component is left untouched.
83
+ */
84
+ declare function updateComponentProps(element: Element, props: Record<string, unknown>): void;
85
+ /**
86
+ * Resolves behavior from the shared package registry.
87
+ * Generated adapters use this lookup instead of importing controllers directly,
88
+ * ensuring live HTML and framework roots execute the same module instance.
89
+ */
24
90
  declare function controllerFor(tag: string): LoomaControllerModule | undefined;
91
+ /**
92
+ * Exposes HTML Next's connection-aware lifecycle to handwritten integrations.
93
+ * The callback can run again after reconnection; each connection's disposer is
94
+ * invoked before a later connection begins.
95
+ *
96
+ * @lifecycle The runtime invokes cleanup on disconnect and before reconnecting
97
+ * the same root, so each connection interval has exactly one active disposer.
98
+ */
25
99
  declare function manageComponentLifecycle(...args: Parameters<typeof manageComponentLifecycle$1>): ReturnType<typeof manageComponentLifecycle$1>;
26
100
 
27
- export { type ComponentDefinition, type LoomaAdoptionRecord, type LoomaControllerModule, attachLoomaComponent, controllerFor, manageComponentLifecycle, registerLoomaPackage };
101
+ export { type ComponentDefinition, type LoomaAdoptionRecord, type LoomaControllerModule, attachLoomaComponent, controllerFor, manageComponentLifecycle, registerLoomaPackage, updateComponentProps };
@@ -2,12 +2,14 @@ import {
2
2
  attachLoomaComponent,
3
3
  controllerFor,
4
4
  manageComponentLifecycle,
5
- registerLoomaPackage
6
- } from "./chunk-ECJQ4YGC.js";
5
+ registerLoomaPackage,
6
+ updateComponentProps
7
+ } from "./chunk-XDNZIKNI.js";
7
8
  import "./chunk-MLKGABMK.js";
8
9
  export {
9
10
  attachLoomaComponent,
10
11
  controllerFor,
11
12
  manageComponentLifecycle,
12
- registerLoomaPackage
13
+ registerLoomaPackage,
14
+ updateComponentProps
13
15
  };