@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,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';