@rippling/rippling-sdk 0.2.0-alpha.59 → 0.2.0-alpha.60

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 (127) hide show
  1. package/examples/manifest/dental-practice-management/dental-practice-management.ts +5 -4
  2. package/examples/manifest/dental-practice-management/functions/chair-schedule.ts +7 -10
  3. package/examples/manifest/dental-practice-management/functions/operatory-list.ts +7 -10
  4. package/examples/manifest/dental-practice-management/functions/patient-list.ts +7 -10
  5. package/examples/manifest/dental-practice-management/functions/treatment-plan-list.ts +7 -10
  6. package/examples/manifest/gym-membership-management/functions/check-in-desk.ts +7 -10
  7. package/examples/manifest/gym-membership-management/functions/member-list.ts +7 -10
  8. package/examples/manifest/gym-membership-management/functions/today-schedule.ts +7 -10
  9. package/examples/manifest/gym-membership-management/functions/trainer-list.ts +7 -10
  10. package/examples/manifest/gym-membership-management/gym-membership-management.ts +5 -4
  11. package/examples/manifest/simple-todo-app/functions/todo-list.ts +7 -10
  12. package/examples/manifest/simple-todo-app/simple-todo-app.ts +2 -2
  13. package/internal/tslib.js +0 -4
  14. package/lib/manifest/manifest-function.d.mts +3 -3
  15. package/lib/manifest/manifest-function.d.ts +3 -3
  16. package/lib/manifest/manifest-function.js +3 -3
  17. package/lib/manifest/manifest-function.mjs +3 -3
  18. package/package.json +1 -1
  19. package/src/lib/manifest/manifest-function.ts +3 -3
  20. package/src/version.ts +1 -1
  21. package/version.d.mts +1 -1
  22. package/version.d.ts +1 -1
  23. package/version.js +1 -1
  24. package/version.mjs +1 -1
  25. package/examples/sdui/sdui-crud-todo/rippling-function.ts +0 -358
  26. package/examples/sdui/sdui-showcase/rippling-function.ts +0 -366
  27. package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +0 -1042
  28. package/examples/sdui/vote/rippling-function.ts +0 -315
  29. package/lib/sdui/actions.d.mts +0 -25
  30. package/lib/sdui/actions.d.mts.map +0 -1
  31. package/lib/sdui/actions.d.ts +0 -25
  32. package/lib/sdui/actions.d.ts.map +0 -1
  33. package/lib/sdui/actions.js +0 -63
  34. package/lib/sdui/actions.js.map +0 -1
  35. package/lib/sdui/actions.mjs +0 -52
  36. package/lib/sdui/actions.mjs.map +0 -1
  37. package/lib/sdui/component.d.mts +0 -58
  38. package/lib/sdui/component.d.mts.map +0 -1
  39. package/lib/sdui/component.d.ts +0 -58
  40. package/lib/sdui/component.d.ts.map +0 -1
  41. package/lib/sdui/component.js +0 -128
  42. package/lib/sdui/component.js.map +0 -1
  43. package/lib/sdui/component.mjs +0 -124
  44. package/lib/sdui/component.mjs.map +0 -1
  45. package/lib/sdui/components.d.mts +0 -1047
  46. package/lib/sdui/components.d.mts.map +0 -1
  47. package/lib/sdui/components.d.ts +0 -1047
  48. package/lib/sdui/components.d.ts.map +0 -1
  49. package/lib/sdui/components.js +0 -845
  50. package/lib/sdui/components.js.map +0 -1
  51. package/lib/sdui/components.mjs +0 -840
  52. package/lib/sdui/components.mjs.map +0 -1
  53. package/lib/sdui/conditions.d.mts +0 -25
  54. package/lib/sdui/conditions.d.mts.map +0 -1
  55. package/lib/sdui/conditions.d.ts +0 -25
  56. package/lib/sdui/conditions.d.ts.map +0 -1
  57. package/lib/sdui/conditions.js +0 -47
  58. package/lib/sdui/conditions.js.map +0 -1
  59. package/lib/sdui/conditions.mjs +0 -35
  60. package/lib/sdui/conditions.mjs.map +0 -1
  61. package/lib/sdui/directives.d.mts +0 -18
  62. package/lib/sdui/directives.d.mts.map +0 -1
  63. package/lib/sdui/directives.d.ts +0 -18
  64. package/lib/sdui/directives.d.ts.map +0 -1
  65. package/lib/sdui/directives.js +0 -31
  66. package/lib/sdui/directives.js.map +0 -1
  67. package/lib/sdui/directives.mjs +0 -24
  68. package/lib/sdui/directives.mjs.map +0 -1
  69. package/lib/sdui/index.d.mts +0 -375
  70. package/lib/sdui/index.d.mts.map +0 -1
  71. package/lib/sdui/index.d.ts +0 -375
  72. package/lib/sdui/index.d.ts.map +0 -1
  73. package/lib/sdui/index.js +0 -386
  74. package/lib/sdui/index.js.map +0 -1
  75. package/lib/sdui/index.mjs +0 -215
  76. package/lib/sdui/index.mjs.map +0 -1
  77. package/lib/sdui/propTypes.d.mts +0 -5971
  78. package/lib/sdui/propTypes.d.mts.map +0 -1
  79. package/lib/sdui/propTypes.d.ts +0 -5971
  80. package/lib/sdui/propTypes.d.ts.map +0 -1
  81. package/lib/sdui/propTypes.js +0 -14
  82. package/lib/sdui/propTypes.js.map +0 -1
  83. package/lib/sdui/propTypes.mjs +0 -13
  84. package/lib/sdui/propTypes.mjs.map +0 -1
  85. package/lib/sdui/props.d.mts +0 -12
  86. package/lib/sdui/props.d.mts.map +0 -1
  87. package/lib/sdui/props.d.ts +0 -12
  88. package/lib/sdui/props.d.ts.map +0 -1
  89. package/lib/sdui/props.js +0 -25
  90. package/lib/sdui/props.js.map +0 -1
  91. package/lib/sdui/props.mjs +0 -21
  92. package/lib/sdui/props.mjs.map +0 -1
  93. package/lib/sdui/render.d.mts +0 -23
  94. package/lib/sdui/render.d.mts.map +0 -1
  95. package/lib/sdui/render.d.ts +0 -23
  96. package/lib/sdui/render.d.ts.map +0 -1
  97. package/lib/sdui/render.js +0 -48
  98. package/lib/sdui/render.js.map +0 -1
  99. package/lib/sdui/render.mjs +0 -45
  100. package/lib/sdui/render.mjs.map +0 -1
  101. package/lib/sdui/state.d.mts +0 -22
  102. package/lib/sdui/state.d.mts.map +0 -1
  103. package/lib/sdui/state.d.ts +0 -22
  104. package/lib/sdui/state.d.ts.map +0 -1
  105. package/lib/sdui/state.js +0 -59
  106. package/lib/sdui/state.js.map +0 -1
  107. package/lib/sdui/state.mjs +0 -55
  108. package/lib/sdui/state.mjs.map +0 -1
  109. package/lib/sdui.d.mts +0 -3
  110. package/lib/sdui.d.mts.map +0 -1
  111. package/lib/sdui.d.ts +0 -3
  112. package/lib/sdui.d.ts.map +0 -1
  113. package/lib/sdui.js +0 -8
  114. package/lib/sdui.js.map +0 -1
  115. package/lib/sdui.mjs +0 -3
  116. package/lib/sdui.mjs.map +0 -1
  117. package/src/lib/sdui/actions.ts +0 -71
  118. package/src/lib/sdui/component.ts +0 -162
  119. package/src/lib/sdui/components.ts +0 -1572
  120. package/src/lib/sdui/conditions.ts +0 -59
  121. package/src/lib/sdui/directives.ts +0 -45
  122. package/src/lib/sdui/index.ts +0 -650
  123. package/src/lib/sdui/propTypes.ts +0 -8087
  124. package/src/lib/sdui/props.ts +0 -32
  125. package/src/lib/sdui/render.ts +0 -66
  126. package/src/lib/sdui/state.ts +0 -66
  127. package/src/lib/sdui.ts +0 -2
@@ -1,45 +0,0 @@
1
- export function render(stateProxy, rootElement) {
2
- const elements = {};
3
- const localStates = [];
4
- let counter = 0;
5
- function flattenNode(node) {
6
- if (!node)
7
- return null;
8
- // Collect local state registrations from component() wrappers
9
- const registration = node._localStateRegistration;
10
- if (registration) {
11
- localStates.push(registration);
12
- }
13
- counter += 1;
14
- const id = `${node.type.toLowerCase()}_${counter}`;
15
- const childIds = node.children.map(flattenNode).filter((childId) => childId !== null);
16
- const element = {
17
- type: node.type,
18
- props: node.props,
19
- children: childIds,
20
- };
21
- if (node.visible !== undefined)
22
- element.visible = node.visible;
23
- if (node.on)
24
- element.on = node.on;
25
- if (node.watch)
26
- element.watch = node.watch;
27
- if (node.repeat)
28
- element.repeat = node.repeat;
29
- elements[id] = element;
30
- return id;
31
- }
32
- const rootId = flattenNode(rootElement);
33
- if (rootId === null) {
34
- throw new Error('render(): root element produced no id');
35
- }
36
- // Merge global state + local states from component() calls
37
- const state = { ...stateProxy.$initialValues };
38
- for (const { path, initial } of localStates) {
39
- // path is like "/auto_xxx" — strip leading / for state key
40
- const key = path.startsWith('/') ? path.slice(1) : path;
41
- state[key] = initial;
42
- }
43
- return { root: rootId, elements, state };
44
- }
45
- //# sourceMappingURL=render.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.mjs","sourceRoot":"","sources":["../../src/lib/sdui/render.ts"],"names":[],"mappings":"AAmBA,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ACZ,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,2DAA2D;IAC3D,MAAM,KAAK,GAA4B,EAAE,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;IACxE,KAAK,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC;QAC5C,2DAA2D;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC"}
@@ -1,22 +0,0 @@
1
- export type StateRef = {
2
- $state: string;
3
- };
4
- export type BindStateRef = {
5
- $bindState: string;
6
- };
7
- type DeepStateProxy = {
8
- readonly [key: string]: DeepStateProxy;
9
- } & {
10
- readonly $state: string;
11
- readonly $bind: BindStateRef;
12
- readonly $path: string;
13
- };
14
- export type StateProxy<T> = {
15
- [K in keyof T]: T[K] extends Record<string, unknown> ? StateProxy<T[K]> & DeepStateProxy : DeepStateProxy;
16
- } & DeepStateProxy & {
17
- readonly $initialValues: T;
18
- };
19
- export declare function extractPath(ref: unknown): string;
20
- export declare function createState<T extends Record<string, unknown>>(shape: T): StateProxy<T>;
21
- export {};
22
- //# sourceMappingURL=state.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.d.mts","sourceRoot":"","sources":["../../src/lib/sdui/state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAIlD,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;CACxC,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,cAAc;CAC1G,GAAG,cAAc,GAAG;IAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAA;CAAE,CAAC;AASpD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAahD;AAwBD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAEtF"}
@@ -1,22 +0,0 @@
1
- export type StateRef = {
2
- $state: string;
3
- };
4
- export type BindStateRef = {
5
- $bindState: string;
6
- };
7
- type DeepStateProxy = {
8
- readonly [key: string]: DeepStateProxy;
9
- } & {
10
- readonly $state: string;
11
- readonly $bind: BindStateRef;
12
- readonly $path: string;
13
- };
14
- export type StateProxy<T> = {
15
- [K in keyof T]: T[K] extends Record<string, unknown> ? StateProxy<T[K]> & DeepStateProxy : DeepStateProxy;
16
- } & DeepStateProxy & {
17
- readonly $initialValues: T;
18
- };
19
- export declare function extractPath(ref: unknown): string;
20
- export declare function createState<T extends Record<string, unknown>>(shape: T): StateProxy<T>;
21
- export {};
22
- //# sourceMappingURL=state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/lib/sdui/state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAIlD,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;CACxC,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,cAAc;CAC1G,GAAG,cAAc,GAAG;IAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAA;CAAE,CAAC;AASpD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAahD;AAwBD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAEtF"}
package/lib/sdui/state.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- // State proxy — creates deeply nested proxies that produce $state refs on access
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.extractPath = extractPath;
5
- exports.createState = createState;
6
- const PROXY_MARKER = Symbol('stateProxy');
7
- const INITIAL_VALUES = Symbol('initialValues');
8
- function isStateProxy(value) {
9
- return typeof value === 'object' && value !== null && value[PROXY_MARKER] === true;
10
- }
11
- function extractPath(ref) {
12
- if (isStateProxy(ref))
13
- return ref.$path;
14
- if (typeof ref === 'object' && ref !== null && '$state' in ref)
15
- return ref.$state;
16
- // Support scope proxies from component() — they have $path as a getter
17
- if (typeof ref === 'object' && ref !== null) {
18
- try {
19
- const p = ref.$path;
20
- if (typeof p === 'string')
21
- return p;
22
- }
23
- catch {
24
- // proxy access threw; fall through to the error below
25
- }
26
- }
27
- throw new Error('Expected a state proxy or { $state } ref');
28
- }
29
- function createProxy(path, initialValues) {
30
- const handler = {
31
- get(_target, prop) {
32
- if (prop === PROXY_MARKER)
33
- return true;
34
- if (prop === INITIAL_VALUES)
35
- return initialValues;
36
- if (prop === '$initialValues')
37
- return initialValues;
38
- if (prop === '$state')
39
- return path;
40
- if (prop === '$bind')
41
- return { $bindState: path };
42
- if (prop === '$path')
43
- return path;
44
- // Support JSON serialization — toJSON returns { $state: path }
45
- if (prop === 'toJSON')
46
- return () => ({ $state: path });
47
- // For equality checks
48
- if (prop === Symbol.toPrimitive)
49
- return () => `$state:${path}`;
50
- const childPath = `${path}/${String(prop)}`;
51
- return createProxy(childPath, undefined);
52
- },
53
- };
54
- return new Proxy({}, handler);
55
- }
56
- function createState(shape) {
57
- return createProxy('', shape);
58
- }
59
- //# sourceMappingURL=state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/lib/sdui/state.ts"],"names":[],"mappings":";AAAA,iFAAiF;;AA0BjF,kCAaC;AAwBD,kCAEC;AA9CD,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAE/C,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAa,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AAC9F,CAAC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O,GAAG,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC;YAE/D,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,OAAO,WAAW,CAAC,SAAS,EAAE,SAAgB,CAAC,CAAC;QAClD,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,EAAS,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,SAAgB,WAAW,CAAoC,KAAQ;IACrE,OAAO,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -1,55 +0,0 @@
1
- // State proxy — creates deeply nested proxies that produce $state refs on access
2
- const PROXY_MARKER = Symbol('stateProxy');
3
- const INITIAL_VALUES = Symbol('initialValues');
4
- function isStateProxy(value) {
5
- return typeof value === 'object' && value !== null && value[PROXY_MARKER] === true;
6
- }
7
- export function extractPath(ref) {
8
- if (isStateProxy(ref))
9
- return ref.$path;
10
- if (typeof ref === 'object' && ref !== null && '$state' in ref)
11
- return ref.$state;
12
- // Support scope proxies from component() — they have $path as a getter
13
- if (typeof ref === 'object' && ref !== null) {
14
- try {
15
- const p = ref.$path;
16
- if (typeof p === 'string')
17
- return p;
18
- }
19
- catch {
20
- // proxy access threw; fall through to the error below
21
- }
22
- }
23
- throw new Error('Expected a state proxy or { $state } ref');
24
- }
25
- function createProxy(path, initialValues) {
26
- const handler = {
27
- get(_target, prop) {
28
- if (prop === PROXY_MARKER)
29
- return true;
30
- if (prop === INITIAL_VALUES)
31
- return initialValues;
32
- if (prop === '$initialValues')
33
- return initialValues;
34
- if (prop === '$state')
35
- return path;
36
- if (prop === '$bind')
37
- return { $bindState: path };
38
- if (prop === '$path')
39
- return path;
40
- // Support JSON serialization — toJSON returns { $state: path }
41
- if (prop === 'toJSON')
42
- return () => ({ $state: path });
43
- // For equality checks
44
- if (prop === Symbol.toPrimitive)
45
- return () => `$state:${path}`;
46
- const childPath = `${path}/${String(prop)}`;
47
- return createProxy(childPath, undefined);
48
- },
49
- };
50
- return new Proxy({}, handler);
51
- }
52
- export function createState(shape) {
53
- return createProxy('', shape);
54
- }
55
- //# sourceMappingURL=state.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.mjs","sourceRoot":"","sources":["../../src/lib/sdui/state.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAmBjF,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAE/C,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAa,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,YAAY,CAAC,GAAG,CAAC;QAAE,OAAQ,GAAW,CAAC,KAAK,CAAC;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,QAAQ,IAAI,GAAG;QAAE,OAAQ,GAAW,CAAC,MAAM,CAAC;IAC3F,uEAAuE;IACvE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,CAAC,GAAI,GAAW,CAAC,KAAK,CAAC;YAC7B,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,sDAAsD;QACxD,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,WAAW,CAAI,IAAY,EAAE,aAAgB;IACpD,MAAM,OAAO,GAAyB;QACpC,GAAG,CAAC,OAAO,EAAE,IAAI;YACf,IAAI,IAAI,KAAK,YAAY;gBAAE,OAAO,IAAI,CAAC;YACvC,IAAI,IAAI,KAAK,cAAc;gBAAE,OAAO,aAAa,CAAC;YAClD,IAAI,IAAI,KAAK,gBAAgB;gBAAE,OAAO,aAAa,CAAC;YACpD,IAAI,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YACnC,IAAI,IAAI,KAAK,OAAO;gBAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;YAClD,IAAI,IAAI,KAAK,OAAO;gBAAE,OAAO,IAAI,CAAC;YAClC,+DAA+D;YAC/D,IAAI,IAAI,KAAK,QAAQ;gBAAE,OAAO,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,sBAAsB;YACtB,IAAI,IAAI,KAAK,MAAM,CAAC,WAAW;gBAAE,OAAO,GAAG,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC;YAE/D,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,OAAO,WAAW,CAAC,SAAS,EAAE,SAAgB,CAAC,CAAC;QAClD,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,EAAS,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,WAAW,CAAoC,KAAQ;IACrE,OAAO,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC"}
package/lib/sdui.d.mts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./sdui/index.mjs";
2
- export { default } from "./sdui/index.mjs";
3
- //# sourceMappingURL=sdui.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdui.d.mts","sourceRoot":"","sources":["../src/lib/sdui.ts"],"names":[],"mappings":"AAAA,iCAA6B;AAC7B,OAAO,EAAE,OAAO,EAAE,yBAAqB"}
package/lib/sdui.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./sdui/index.js";
2
- export { default } from "./sdui/index.js";
3
- //# sourceMappingURL=sdui.d.ts.map
package/lib/sdui.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdui.d.ts","sourceRoot":"","sources":["../src/lib/sdui.ts"],"names":[],"mappings":"AAAA,gCAA6B;AAC7B,OAAO,EAAE,OAAO,EAAE,wBAAqB"}
package/lib/sdui.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = void 0;
4
- const tslib_1 = require("../internal/tslib.js");
5
- tslib_1.__exportStar(require("./sdui/index.js"), exports);
6
- var index_1 = require("./sdui/index.js");
7
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(index_1).default; } });
8
- //# sourceMappingURL=sdui.js.map
package/lib/sdui.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdui.js","sourceRoot":"","sources":["../src/lib/sdui.ts"],"names":[],"mappings":";;;;AAAA,0DAA6B;AAC7B,yCAAuC;AAA9B,yHAAA,OAAO,OAAA"}
package/lib/sdui.mjs DELETED
@@ -1,3 +0,0 @@
1
- export * from "./sdui/index.mjs";
2
- export { default } from "./sdui/index.mjs";
3
- //# sourceMappingURL=sdui.mjs.map
package/lib/sdui.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdui.mjs","sourceRoot":"","sources":["../src/lib/sdui.ts"],"names":[],"mappings":"AAAA,iCAA6B;AAC7B,OAAO,EAAE,OAAO,EAAE,yBAAqB"}
@@ -1,71 +0,0 @@
1
- import { extractPath } from './state';
2
-
3
- export interface ActionBinding {
4
- action: string;
5
- params?: Record<string, unknown>;
6
- onSuccess?: ActionBinding | { set: Record<string, unknown> };
7
- onError?: ActionBinding | { set: Record<string, unknown> };
8
- }
9
-
10
- export function set(ref: unknown, value: unknown): ActionBinding {
11
- return { action: 'setState', params: { statePath: extractPath(ref), value } };
12
- }
13
-
14
- export function push(ref: unknown, value: unknown, opts?: { clear?: unknown }): ActionBinding {
15
- const params: Record<string, unknown> = {
16
- statePath: extractPath(ref),
17
- value,
18
- ...(opts?.clear ? { clearStatePath: extractPath(opts.clear) } : {}),
19
- };
20
- return { action: 'pushState', params };
21
- }
22
-
23
- export function remove(ref: unknown, index: unknown): ActionBinding {
24
- return {
25
- action: 'removeState',
26
- params: { statePath: extractPath(ref), index },
27
- };
28
- }
29
-
30
- export function callFunction(
31
- functionId: string,
32
- action: string,
33
- opts?: Record<string, unknown>,
34
- ): ActionBinding {
35
- const { responsePath, onSuccess, onError, ...rest } = opts || {};
36
- // Spread rest FIRST so explicit functionId/action always win if opts
37
- // happens to carry colliding keys.
38
- const params: Record<string, unknown> = {
39
- ...rest,
40
- functionId,
41
- action,
42
- ...(responsePath !== undefined ? { responsePath } : {}),
43
- };
44
- const binding: ActionBinding = {
45
- action: 'triggerFunction',
46
- params,
47
- ...(onSuccess ? { onSuccess: onSuccess as ActionBinding } : {}),
48
- ...(onError ? { onError: onError as ActionBinding } : {}),
49
- };
50
- return binding;
51
- }
52
-
53
- export function nav(config: { path: string; openInNewTab?: boolean }): ActionBinding {
54
- return { action: 'navigate', params: config };
55
- }
56
-
57
- export function notify(message: string, variant: string): ActionBinding {
58
- return { action: 'showNotification', params: { message, variant } };
59
- }
60
-
61
- export function validate(statePath = '/formValidation'): ActionBinding {
62
- return { action: 'validateForm', params: { statePath } };
63
- }
64
-
65
- export function openModal(modalId: string): ActionBinding {
66
- return { action: 'openModal', params: { modalId } };
67
- }
68
-
69
- export function closeModal(): ActionBinding {
70
- return { action: 'closeModal' };
71
- }
@@ -1,162 +0,0 @@
1
- /**
2
- * component() — creates a stateful component boundary.
3
- *
4
- * Provides ctx.localState (scoped local state slot) and ctx.onMount (an
5
- * action that fires once when the component mounts on the client). The
6
- * runtime handles state setup and mount firing; consumers don't need to
7
- * know how the wrapping is implemented.
8
- *
9
- * NOTE: these are NOT React hooks. The factory runs ONCE at spec-build
10
- * time, producing a JSON description of the UI. `localState` returns a
11
- * path-builder proxy (not a [value, setter] tuple); `onMount` registers
12
- * a JSON action that fires on first client render (not an effect that
13
- * re-runs).
14
- *
15
- * Usage:
16
- * function MembersGrid(props) {
17
- * return component((ctx) => {
18
- * const local = ctx.localState({ data: [], loading: true })
19
- * ctx.onMount(fetchAction)
20
- * return { element: DataGrid({ ... }) }
21
- * })
22
- * }
23
- */
24
-
25
- import type { ActionBinding } from './actions';
26
- import type { SpecNode } from './components';
27
-
28
- let _idCounter = 0;
29
- // Counter-only IDs (no Date.now()) so the same factory body produces the
30
- // same paths across runs. The counter is monotonic per process; calling
31
- // `_resetIdCounter()` (tests only) brings it back to 0 so snapshot tests
32
- // stay stable.
33
- function generateId(): string {
34
- _idCounter += 1;
35
- return `auto_${_idCounter.toString(36)}`;
36
- }
37
-
38
- // Reset counter (for testing)
39
- export function _resetIdCounter(): void {
40
- _idCounter = 0;
41
- }
42
-
43
- export interface StateScope {
44
- /** Read state value: { $state: "/auto_xxx/field" } */
45
- readonly [key: string]: any;
46
- /** Two-way bind: { $bindState: "/auto_xxx/field" } */
47
- readonly $bind: { $bindState: string };
48
- /** Raw path string */
49
- readonly $path: string;
50
- }
51
-
52
- interface ComponentContext {
53
- /**
54
- * Declare a scoped local state slot. Returns a path-builder proxy whose
55
- * property accesses produce `{ $state: '/path' }` references for reading
56
- * and `.$bind` for two-way binding. Not a React hook — runs once when
57
- * the factory is invoked, never returns `[value, setter]`.
58
- */
59
- localState<T extends Record<string, unknown>>(initial: T): StateScope;
60
-
61
- /**
62
- * Register a JSON action to fire once when the component mounts on the
63
- * client. Not a React effect — does not re-run, has no dependency
64
- * tracking. Pass an `ActionBinding` (e.g. from `set(...)`, `callFunction(...)`)
65
- * or an array of them.
66
- */
67
- onMount(action: ActionBinding | ActionBinding[]): void;
68
- }
69
-
70
- interface ComponentResult {
71
- element: SpecNode;
72
- }
73
-
74
- function createScopeProxy(basePath: string): StateScope {
75
- const handler: ProxyHandler<object> = {
76
- get(_target, prop) {
77
- if (prop === '$bind') return { $bindState: basePath };
78
- if (prop === '$path') return basePath;
79
- if (prop === '$state') return basePath;
80
- if (prop === 'toJSON') return () => ({ $state: basePath });
81
- if (prop === Symbol.toPrimitive) return () => `$state:${basePath}`;
82
-
83
- const childPath = `${basePath}/${String(prop)}`;
84
- return createScopeProxy(childPath);
85
- },
86
- };
87
- return new Proxy({} as any, handler);
88
- }
89
-
90
- export function component(factory: (ctx: ComponentContext) => ComponentResult): ComponentResult {
91
- const states: { path: string; initial: unknown }[] = [];
92
- const mountActions: (ActionBinding | ActionBinding[])[] = [];
93
-
94
- const ctx: ComponentContext = {
95
- localState<T extends Record<string, unknown>>(initial: T): StateScope {
96
- const path = `/${generateId()}`;
97
- states.push({ path, initial });
98
- return createScopeProxy(path);
99
- },
100
- onMount(action: ActionBinding | ActionBinding[]) {
101
- mountActions.push(action);
102
- },
103
- };
104
-
105
- const result = factory(ctx);
106
-
107
- // No state, no effects → return as-is.
108
- if (states.length === 0 && mountActions.length === 0) {
109
- return result;
110
- }
111
-
112
- // Collapse zero/one/many mount actions for the single onMountAction slot
113
- // on the innermost wrapper.
114
- let combinedMount: ActionBinding | ActionBinding[] | undefined;
115
- if (mountActions.length === 1) {
116
- combinedMount = mountActions[0];
117
- } else if (mountActions.length > 1) {
118
- combinedMount = mountActions.flatMap((a) => (Array.isArray(a) ? a : [a]));
119
- }
120
-
121
- let wrapped: SpecNode = result.element;
122
-
123
- if (states.length === 0) {
124
- // Mount-only: a single state-provider wrapper carries onMountAction.
125
- wrapped = {
126
- type: '_LocalStateProvider',
127
- props: combinedMount ? { onMountAction: combinedMount } : {},
128
- children: [wrapped],
129
- };
130
- } else {
131
- // One state-provider wrapper per localState() call, nested
132
- // innermost-first. Mount actions attach to the innermost wrapper so
133
- // every state slot is initialized before any action fires.
134
- for (let i = states.length - 1; i >= 0; i--) {
135
- const state = states[i];
136
- if (state) {
137
- const isInnermost = i === states.length - 1;
138
- const props: Record<string, unknown> = {
139
- statePath: state.path,
140
- initialValue: state.initial,
141
- ...(isInnermost && combinedMount ? { onMountAction: combinedMount } : {}),
142
- };
143
- const wrapper: SpecNode = {
144
- type: '_LocalStateProvider',
145
- props,
146
- children: [wrapped],
147
- };
148
- // render() picks up this marker to populate spec.state.
149
- (wrapper as any)._localStateRegistration = {
150
- path: state.path,
151
- initial: state.initial,
152
- };
153
- wrapped = wrapper;
154
- }
155
- }
156
- }
157
-
158
- return {
159
- ...result,
160
- element: wrapped,
161
- };
162
- }