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

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 (138) hide show
  1. package/examples/manifest/dental-practice-management/dental-practice-management.ts +10 -10
  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 +10 -10
  11. package/examples/manifest/simple-todo-app/functions/todo-list.ts +7 -10
  12. package/examples/manifest/simple-todo-app/simple-todo-app.ts +3 -5
  13. package/internal/tslib.js +0 -4
  14. package/lib/manifest/index.d.mts +1 -1
  15. package/lib/manifest/index.d.mts.map +1 -1
  16. package/lib/manifest/index.d.ts +1 -1
  17. package/lib/manifest/index.d.ts.map +1 -1
  18. package/lib/manifest/index.js.map +1 -1
  19. package/lib/manifest/index.mjs.map +1 -1
  20. package/lib/manifest/manifest-function.d.mts +10 -7
  21. package/lib/manifest/manifest-function.d.mts.map +1 -1
  22. package/lib/manifest/manifest-function.d.ts +10 -7
  23. package/lib/manifest/manifest-function.d.ts.map +1 -1
  24. package/lib/manifest/manifest-function.js +14 -10
  25. package/lib/manifest/manifest-function.js.map +1 -1
  26. package/lib/manifest/manifest-function.mjs +13 -10
  27. package/lib/manifest/manifest-function.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/src/lib/manifest/index.ts +1 -0
  30. package/src/lib/manifest/manifest-function.ts +21 -11
  31. package/src/version.ts +1 -1
  32. package/version.d.mts +1 -1
  33. package/version.d.ts +1 -1
  34. package/version.js +1 -1
  35. package/version.mjs +1 -1
  36. package/examples/sdui/sdui-crud-todo/rippling-function.ts +0 -358
  37. package/examples/sdui/sdui-showcase/rippling-function.ts +0 -366
  38. package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +0 -1042
  39. package/examples/sdui/vote/rippling-function.ts +0 -315
  40. package/lib/sdui/actions.d.mts +0 -25
  41. package/lib/sdui/actions.d.mts.map +0 -1
  42. package/lib/sdui/actions.d.ts +0 -25
  43. package/lib/sdui/actions.d.ts.map +0 -1
  44. package/lib/sdui/actions.js +0 -63
  45. package/lib/sdui/actions.js.map +0 -1
  46. package/lib/sdui/actions.mjs +0 -52
  47. package/lib/sdui/actions.mjs.map +0 -1
  48. package/lib/sdui/component.d.mts +0 -58
  49. package/lib/sdui/component.d.mts.map +0 -1
  50. package/lib/sdui/component.d.ts +0 -58
  51. package/lib/sdui/component.d.ts.map +0 -1
  52. package/lib/sdui/component.js +0 -128
  53. package/lib/sdui/component.js.map +0 -1
  54. package/lib/sdui/component.mjs +0 -124
  55. package/lib/sdui/component.mjs.map +0 -1
  56. package/lib/sdui/components.d.mts +0 -1047
  57. package/lib/sdui/components.d.mts.map +0 -1
  58. package/lib/sdui/components.d.ts +0 -1047
  59. package/lib/sdui/components.d.ts.map +0 -1
  60. package/lib/sdui/components.js +0 -845
  61. package/lib/sdui/components.js.map +0 -1
  62. package/lib/sdui/components.mjs +0 -840
  63. package/lib/sdui/components.mjs.map +0 -1
  64. package/lib/sdui/conditions.d.mts +0 -25
  65. package/lib/sdui/conditions.d.mts.map +0 -1
  66. package/lib/sdui/conditions.d.ts +0 -25
  67. package/lib/sdui/conditions.d.ts.map +0 -1
  68. package/lib/sdui/conditions.js +0 -47
  69. package/lib/sdui/conditions.js.map +0 -1
  70. package/lib/sdui/conditions.mjs +0 -35
  71. package/lib/sdui/conditions.mjs.map +0 -1
  72. package/lib/sdui/directives.d.mts +0 -18
  73. package/lib/sdui/directives.d.mts.map +0 -1
  74. package/lib/sdui/directives.d.ts +0 -18
  75. package/lib/sdui/directives.d.ts.map +0 -1
  76. package/lib/sdui/directives.js +0 -31
  77. package/lib/sdui/directives.js.map +0 -1
  78. package/lib/sdui/directives.mjs +0 -24
  79. package/lib/sdui/directives.mjs.map +0 -1
  80. package/lib/sdui/index.d.mts +0 -375
  81. package/lib/sdui/index.d.mts.map +0 -1
  82. package/lib/sdui/index.d.ts +0 -375
  83. package/lib/sdui/index.d.ts.map +0 -1
  84. package/lib/sdui/index.js +0 -386
  85. package/lib/sdui/index.js.map +0 -1
  86. package/lib/sdui/index.mjs +0 -215
  87. package/lib/sdui/index.mjs.map +0 -1
  88. package/lib/sdui/propTypes.d.mts +0 -5971
  89. package/lib/sdui/propTypes.d.mts.map +0 -1
  90. package/lib/sdui/propTypes.d.ts +0 -5971
  91. package/lib/sdui/propTypes.d.ts.map +0 -1
  92. package/lib/sdui/propTypes.js +0 -14
  93. package/lib/sdui/propTypes.js.map +0 -1
  94. package/lib/sdui/propTypes.mjs +0 -13
  95. package/lib/sdui/propTypes.mjs.map +0 -1
  96. package/lib/sdui/props.d.mts +0 -12
  97. package/lib/sdui/props.d.mts.map +0 -1
  98. package/lib/sdui/props.d.ts +0 -12
  99. package/lib/sdui/props.d.ts.map +0 -1
  100. package/lib/sdui/props.js +0 -25
  101. package/lib/sdui/props.js.map +0 -1
  102. package/lib/sdui/props.mjs +0 -21
  103. package/lib/sdui/props.mjs.map +0 -1
  104. package/lib/sdui/render.d.mts +0 -23
  105. package/lib/sdui/render.d.mts.map +0 -1
  106. package/lib/sdui/render.d.ts +0 -23
  107. package/lib/sdui/render.d.ts.map +0 -1
  108. package/lib/sdui/render.js +0 -48
  109. package/lib/sdui/render.js.map +0 -1
  110. package/lib/sdui/render.mjs +0 -45
  111. package/lib/sdui/render.mjs.map +0 -1
  112. package/lib/sdui/state.d.mts +0 -22
  113. package/lib/sdui/state.d.mts.map +0 -1
  114. package/lib/sdui/state.d.ts +0 -22
  115. package/lib/sdui/state.d.ts.map +0 -1
  116. package/lib/sdui/state.js +0 -59
  117. package/lib/sdui/state.js.map +0 -1
  118. package/lib/sdui/state.mjs +0 -55
  119. package/lib/sdui/state.mjs.map +0 -1
  120. package/lib/sdui.d.mts +0 -3
  121. package/lib/sdui.d.mts.map +0 -1
  122. package/lib/sdui.d.ts +0 -3
  123. package/lib/sdui.d.ts.map +0 -1
  124. package/lib/sdui.js +0 -8
  125. package/lib/sdui.js.map +0 -1
  126. package/lib/sdui.mjs +0 -3
  127. package/lib/sdui.mjs.map +0 -1
  128. package/src/lib/sdui/actions.ts +0 -71
  129. package/src/lib/sdui/component.ts +0 -162
  130. package/src/lib/sdui/components.ts +0 -1572
  131. package/src/lib/sdui/conditions.ts +0 -59
  132. package/src/lib/sdui/directives.ts +0 -45
  133. package/src/lib/sdui/index.ts +0 -650
  134. package/src/lib/sdui/propTypes.ts +0 -8087
  135. package/src/lib/sdui/props.ts +0 -32
  136. package/src/lib/sdui/render.ts +0 -66
  137. package/src/lib/sdui/state.ts +0 -66
  138. package/src/lib/sdui.ts +0 -2
@@ -1,32 +0,0 @@
1
- import type { VisibilityCondition } from './conditions';
2
- import { extractPath } from './state';
3
-
4
- export interface CondRef {
5
- $cond: VisibilityCondition;
6
- $then: unknown;
7
- $else: unknown;
8
- }
9
-
10
- export interface TemplateRef {
11
- $template: string;
12
- }
13
-
14
- export function cond(condition: VisibilityCondition, thenValue: unknown, elseValue: unknown): CondRef {
15
- return { $cond: condition, $then: thenValue, $else: elseValue };
16
- }
17
-
18
- export function template(strings: TemplateStringsArray, ...values: unknown[]): TemplateRef {
19
- let result = '';
20
- for (let i = 0; i < strings.length; i++) {
21
- result += strings[i];
22
- if (i < values.length) {
23
- try {
24
- const path = extractPath(values[i]);
25
- result += `\${${path}}`;
26
- } catch {
27
- result += String(values[i]);
28
- }
29
- }
30
- }
31
- return { $template: result };
32
- }
@@ -1,66 +0,0 @@
1
- import type { ActionBinding } from './actions';
2
- import type { SpecNode } from './components';
3
-
4
- export interface FlatElement {
5
- type: string;
6
- props: Record<string, unknown>;
7
- children: string[];
8
- on?: Record<string, ActionBinding | ActionBinding[]>;
9
- visible?: unknown;
10
- watch?: Record<string, unknown>;
11
- repeat?: { statePath: string; key?: string };
12
- }
13
-
14
- export interface Spec {
15
- root: string;
16
- elements: Record<string, FlatElement>;
17
- state: Record<string, unknown>;
18
- }
19
-
20
- export function render(stateProxy: { $initialValues: Record<string, unknown> }, rootElement: SpecNode): Spec {
21
- const elements: Record<string, FlatElement> = {};
22
- const localStates: { path: string; initial: unknown }[] = [];
23
- let counter = 0;
24
-
25
- function flattenNode(node: SpecNode | null | undefined): string | null {
26
- if (!node) return null;
27
-
28
- // Collect local state registrations from component() wrappers
29
- const registration = (node as any)._localStateRegistration;
30
- if (registration) {
31
- localStates.push(registration);
32
- }
33
-
34
- counter += 1;
35
- const id = `${node.type.toLowerCase()}_${counter}`;
36
- const childIds = node.children.map(flattenNode).filter((childId): childId is string => childId !== null);
37
-
38
- const element: FlatElement = {
39
- type: node.type,
40
- props: node.props,
41
- children: childIds,
42
- };
43
- if (node.visible !== undefined) element.visible = node.visible;
44
- if (node.on) element.on = node.on;
45
- if (node.watch) element.watch = node.watch;
46
- if (node.repeat) element.repeat = node.repeat;
47
-
48
- elements[id] = element;
49
- return id;
50
- }
51
-
52
- const rootId = flattenNode(rootElement);
53
- if (rootId === null) {
54
- throw new Error('render(): root element produced no id');
55
- }
56
-
57
- // Merge global state + local states from component() calls
58
- const state: Record<string, unknown> = { ...stateProxy.$initialValues };
59
- for (const { path, initial } of localStates) {
60
- // path is like "/auto_xxx" — strip leading / for state key
61
- const key = path.startsWith('/') ? path.slice(1) : path;
62
- state[key] = initial;
63
- }
64
-
65
- return { root: rootId, elements, state };
66
- }
@@ -1,66 +0,0 @@
1
- // State proxy — creates deeply nested proxies that produce $state refs on access
2
-
3
- export type StateRef = { $state: string };
4
- export type BindStateRef = { $bindState: string };
5
-
6
- // Deep proxy type — every property access returns another proxy (for s.teamData.team.name)
7
- // This allows deep access regardless of the initial value (even null)
8
- type DeepStateProxy = {
9
- readonly [key: string]: DeepStateProxy;
10
- } & {
11
- readonly $state: string;
12
- readonly $bind: BindStateRef;
13
- readonly $path: string;
14
- };
15
-
16
- export type StateProxy<T> = {
17
- [K in keyof T]: T[K] extends Record<string, unknown> ? StateProxy<T[K]> & DeepStateProxy : DeepStateProxy;
18
- } & DeepStateProxy & { readonly $initialValues: T };
19
-
20
- const PROXY_MARKER = Symbol('stateProxy');
21
- const INITIAL_VALUES = Symbol('initialValues');
22
-
23
- function isStateProxy(value: unknown): boolean {
24
- return typeof value === 'object' && value !== null && (value as any)[PROXY_MARKER] === true;
25
- }
26
-
27
- export function extractPath(ref: unknown): string {
28
- if (isStateProxy(ref)) return (ref as any).$path;
29
- if (typeof ref === 'object' && ref !== null && '$state' in ref) return (ref as any).$state;
30
- // Support scope proxies from component() — they have $path as a getter
31
- if (typeof ref === 'object' && ref !== null) {
32
- try {
33
- const p = (ref as any).$path;
34
- if (typeof p === 'string') return p;
35
- } catch {
36
- // proxy access threw; fall through to the error below
37
- }
38
- }
39
- throw new Error('Expected a state proxy or { $state } ref');
40
- }
41
-
42
- function createProxy<T>(path: string, initialValues: T): StateProxy<T> {
43
- const handler: ProxyHandler<object> = {
44
- get(_target, prop) {
45
- if (prop === PROXY_MARKER) return true;
46
- if (prop === INITIAL_VALUES) return initialValues;
47
- if (prop === '$initialValues') return initialValues;
48
- if (prop === '$state') return path;
49
- if (prop === '$bind') return { $bindState: path };
50
- if (prop === '$path') return path;
51
- // Support JSON serialization — toJSON returns { $state: path }
52
- if (prop === 'toJSON') return () => ({ $state: path });
53
- // For equality checks
54
- if (prop === Symbol.toPrimitive) return () => `$state:${path}`;
55
-
56
- const childPath = `${path}/${String(prop)}`;
57
- return createProxy(childPath, undefined as any);
58
- },
59
- };
60
-
61
- return new Proxy({} as any, handler);
62
- }
63
-
64
- export function createState<T extends Record<string, unknown>>(shape: T): StateProxy<T> {
65
- return createProxy('', shape);
66
- }
package/src/lib/sdui.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './sdui/index';
2
- export { default } from './sdui/index';