@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,315 +0,0 @@
1
- /** One-vote priority poll with a results card (mock totals only). */
2
-
3
- import SDUI from '@rippling/rippling-sdk/lib/sdui';
4
- import { FunctionContext, FunctionEvent, FunctionResponse } from '@rippling/rippling-sdk';
5
-
6
- // Whole-number percentages that sum to 100 — matches what DistributionBar
7
- // and ProgressBar both expect, so they tell the same visual story.
8
- const PCT_V = 52;
9
- const PCT_Q = 33;
10
- const PCT_D = 15;
11
- const POLL_TOTAL = PCT_V + PCT_Q + PCT_D;
12
-
13
- const POLL_SEGMENTS = [
14
- { value: PCT_V, segmentColor: '#4F46E5' },
15
- { value: PCT_Q, segmentColor: '#059669' },
16
- { value: PCT_D, segmentColor: '#EA580C' },
17
- ];
18
-
19
- function renderSpec(_functionId: string) {
20
- const s = SDUI.createState({
21
- voteChoice: '',
22
- resultsVisible: false,
23
- });
24
-
25
- // Vote cards: every card gets the same explicit width: '33%' so they're
26
- // mathematically equal regardless of content length. justify 'space-between'
27
- // is a real CSS value (unlike 'stretch') so layout actually applies.
28
- const voteCards = SDUI.components.HStack({
29
- gap: 'space500',
30
- wrap: 'nowrap',
31
- justify: 'space-between',
32
- align: 'stretch',
33
- children: [
34
- SDUI.components.Layout({
35
- width: '33%',
36
- children: [
37
- SDUI.components.Card({
38
- title: 'Ship faster',
39
- children: [
40
- SDUI.components.VStack({
41
- gap: 'space500',
42
- align: 'stretch',
43
- children: [
44
- SDUI.components.Text({
45
- text: 'More releases, shorter cycles.',
46
- typestyle: 'bodyLg',
47
- color: 'secondary',
48
- }),
49
- SDUI.components.Button({
50
- label: 'Vote',
51
- appearance: 'PRIMARY',
52
- size: 'L',
53
- onPress: [
54
- SDUI.actions.set(s.voteChoice, 'velocity'),
55
- SDUI.actions.set(s.resultsVisible, true),
56
- ],
57
- }),
58
- ],
59
- }),
60
- ],
61
- }),
62
- ],
63
- }),
64
- SDUI.components.Layout({
65
- width: '33%',
66
- children: [
67
- SDUI.components.Card({
68
- title: 'Raise quality',
69
- children: [
70
- SDUI.components.VStack({
71
- gap: 'space500',
72
- align: 'stretch',
73
- children: [
74
- SDUI.components.Text({
75
- text: 'Fewer bugs, better UX.',
76
- typestyle: 'bodyLg',
77
- color: 'secondary',
78
- }),
79
- SDUI.components.Button({
80
- label: 'Vote',
81
- appearance: 'SUCCESS',
82
- size: 'L',
83
- onPress: [
84
- SDUI.actions.set(s.voteChoice, 'quality'),
85
- SDUI.actions.set(s.resultsVisible, true),
86
- ],
87
- }),
88
- ],
89
- }),
90
- ],
91
- }),
92
- ],
93
- }),
94
- SDUI.components.Layout({
95
- width: '33%',
96
- children: [
97
- SDUI.components.Card({
98
- title: 'Pay down debt',
99
- children: [
100
- SDUI.components.VStack({
101
- gap: 'space500',
102
- align: 'stretch',
103
- children: [
104
- SDUI.components.Text({
105
- text: 'Refactors and infra.',
106
- typestyle: 'bodyLg',
107
- color: 'secondary',
108
- }),
109
- SDUI.components.Button({
110
- label: 'Vote',
111
- appearance: 'WARNING',
112
- size: 'L',
113
- onPress: [
114
- SDUI.actions.set(s.voteChoice, 'debt'),
115
- SDUI.actions.set(s.resultsVisible, true),
116
- ],
117
- }),
118
- ],
119
- }),
120
- ],
121
- }),
122
- ],
123
- }),
124
- ],
125
- });
126
-
127
- const shell = SDUI.components.Layout({
128
- width: '100%',
129
- maxWidth: '1200px',
130
- margin: { left: 'auto', right: 'auto' },
131
- padding: { top: 48, bottom: 56, left: 32, right: 32 },
132
- children: [
133
- SDUI.components.VStack({
134
- gap: 'space700',
135
- align: 'stretch',
136
- children: [
137
- SDUI.components.VStack({
138
- gap: 'space300',
139
- align: 'center',
140
- children: [
141
- SDUI.components.Heading({
142
- level: 1,
143
- align: 'center',
144
- text: 'Where should we focus next quarter?',
145
- }),
146
- SDUI.components.Text({
147
- align: 'center',
148
- maxWidth: '680px',
149
- text: 'One vote. Percentages are mock data — swap in real counts later.',
150
- typestyle: 'bodyLg',
151
- color: 'secondary',
152
- }),
153
- ],
154
- }),
155
- SDUI.components.Divider({}),
156
- voteCards,
157
- SDUI.components.HStack({
158
- gap: 'space300',
159
- justify: 'center',
160
- wrap: 'wrap',
161
- children: [
162
- SDUI.components.Chip({
163
- text: 'Start over',
164
- appearance: 'NEUTRAL',
165
- onPress: [SDUI.actions.set(s.voteChoice, ''), SDUI.actions.set(s.resultsVisible, false)],
166
- }),
167
- ],
168
- }),
169
- SDUI.visible(
170
- SDUI.conditions.falsy(s.resultsVisible),
171
- SDUI.components.Text({
172
- align: 'center',
173
- maxWidth: '560px',
174
- typestyle: 'bodyMd',
175
- color: 'secondary',
176
- text: 'Tap Vote — results open below with a split bar plus one bar per option.',
177
- }),
178
- ),
179
- SDUI.visible(
180
- SDUI.conditions.truthy(s.resultsVisible),
181
- SDUI.components.VStack({
182
- gap: 'space500',
183
- align: 'stretch',
184
- children: [
185
- // The "you voted" badge sits centered above the result card
186
- SDUI.components.HStack({
187
- gap: 'space200',
188
- justify: 'center',
189
- wrap: 'wrap',
190
- children: [
191
- SDUI.visible(
192
- SDUI.conditions.eq(s.voteChoice, 'velocity'),
193
- SDUI.components.Badge({
194
- text: 'You voted · Ship faster',
195
- appearance: 'PRIMARY_DARK',
196
- }),
197
- ),
198
- SDUI.visible(
199
- SDUI.conditions.eq(s.voteChoice, 'quality'),
200
- SDUI.components.Badge({
201
- text: 'You voted · Raise quality',
202
- appearance: 'SUCCESS_DARK',
203
- }),
204
- ),
205
- SDUI.visible(
206
- SDUI.conditions.eq(s.voteChoice, 'debt'),
207
- SDUI.components.Badge({
208
- text: 'You voted · Pay down debt',
209
- appearance: 'WARNING_DARK',
210
- }),
211
- ),
212
- ],
213
- }),
214
- // Result card uses the Card's title prop and stretches to fill
215
- // the shell's full width because the parent VStack is align:stretch
216
- SDUI.components.Card({
217
- title: 'Vote share (mock)',
218
- children: [
219
- SDUI.components.VStack({
220
- gap: 'space500',
221
- align: 'stretch',
222
- children: [
223
- SDUI.components.Text({
224
- typestyle: 'bodyMdEmphasis',
225
- text: 'Overall mix',
226
- }),
227
- SDUI.components.Layout({
228
- width: '100%',
229
- padding: { top: 8, bottom: 16 },
230
- children: [
231
- SDUI.components.DistributionBar({
232
- segments: POLL_SEGMENTS,
233
- totalValue: POLL_TOTAL,
234
- size: 'standard',
235
- }),
236
- ],
237
- }),
238
- SDUI.components.Text({
239
- typestyle: 'bodyMdEmphasis',
240
- text: 'Each option',
241
- }),
242
- SDUI.components.VStack({
243
- gap: 'space400',
244
- children: [
245
- SDUI.components.ProgressBar({
246
- value: PCT_V,
247
- label: 'Ship faster',
248
- appearance: 'PRIMARY',
249
- showPercentage: true,
250
- }),
251
- SDUI.components.ProgressBar({
252
- value: PCT_Q,
253
- label: 'Raise quality',
254
- appearance: 'SUCCESS',
255
- showPercentage: true,
256
- }),
257
- SDUI.components.ProgressBar({
258
- value: PCT_D,
259
- label: 'Pay down debt',
260
- appearance: 'WARNING',
261
- showPercentage: true,
262
- }),
263
- ],
264
- }),
265
- SDUI.components.Text({
266
- align: 'center',
267
- typestyle: 'bodySm',
268
- color: 'secondary',
269
- text: 'Hook callFunction to replace mock totals.',
270
- }),
271
- ],
272
- }),
273
- ],
274
- }),
275
- ],
276
- }),
277
- ),
278
- ],
279
- }),
280
- ],
281
- });
282
-
283
- const root = SDUI.components.VStack({
284
- align: 'stretch',
285
- gap: 'space0',
286
- children: [shell],
287
- });
288
-
289
- return SDUI.render(s, root);
290
- }
291
-
292
- export async function onRipplingEvent(
293
- event: FunctionEvent,
294
- context: FunctionContext,
295
- ): Promise<FunctionResponse> {
296
- const params = event['parameters'] as Record<string, string | undefined> | undefined;
297
- const action = params?.['action'];
298
-
299
- if (!action || action === 'init') {
300
- const spec = renderSpec(context.function?.function_id ?? 'demo-fn');
301
- return new FunctionResponse({
302
- body: { spec: JSON.stringify(spec) },
303
- statusCode: 200,
304
- headers: {},
305
- message: '',
306
- });
307
- }
308
-
309
- return new FunctionResponse({
310
- body: {},
311
- statusCode: 200,
312
- headers: {},
313
- message: '',
314
- });
315
- }
@@ -1,25 +0,0 @@
1
- export interface ActionBinding {
2
- action: string;
3
- params?: Record<string, unknown>;
4
- onSuccess?: ActionBinding | {
5
- set: Record<string, unknown>;
6
- };
7
- onError?: ActionBinding | {
8
- set: Record<string, unknown>;
9
- };
10
- }
11
- export declare function set(ref: unknown, value: unknown): ActionBinding;
12
- export declare function push(ref: unknown, value: unknown, opts?: {
13
- clear?: unknown;
14
- }): ActionBinding;
15
- export declare function remove(ref: unknown, index: unknown): ActionBinding;
16
- export declare function callFunction(functionId: string, action: string, opts?: Record<string, unknown>): ActionBinding;
17
- export declare function nav(config: {
18
- path: string;
19
- openInNewTab?: boolean;
20
- }): ActionBinding;
21
- export declare function notify(message: string, variant: string): ActionBinding;
22
- export declare function validate(statePath?: string): ActionBinding;
23
- export declare function openModal(modalId: string): ActionBinding;
24
- export declare function closeModal(): ActionBinding;
25
- //# sourceMappingURL=actions.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.mts","sourceRoot":"","sources":["../../src/lib/sdui/actions.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,aAAa,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC7D,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC5D;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAE/D;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAO5F;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAKlE;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,aAAa,CAiBf;AAED,wBAAgB,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAEnF;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAEtE;AAED,wBAAgB,QAAQ,CAAC,SAAS,SAAoB,GAAG,aAAa,CAErE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAExD;AAED,wBAAgB,UAAU,IAAI,aAAa,CAE1C"}
@@ -1,25 +0,0 @@
1
- export interface ActionBinding {
2
- action: string;
3
- params?: Record<string, unknown>;
4
- onSuccess?: ActionBinding | {
5
- set: Record<string, unknown>;
6
- };
7
- onError?: ActionBinding | {
8
- set: Record<string, unknown>;
9
- };
10
- }
11
- export declare function set(ref: unknown, value: unknown): ActionBinding;
12
- export declare function push(ref: unknown, value: unknown, opts?: {
13
- clear?: unknown;
14
- }): ActionBinding;
15
- export declare function remove(ref: unknown, index: unknown): ActionBinding;
16
- export declare function callFunction(functionId: string, action: string, opts?: Record<string, unknown>): ActionBinding;
17
- export declare function nav(config: {
18
- path: string;
19
- openInNewTab?: boolean;
20
- }): ActionBinding;
21
- export declare function notify(message: string, variant: string): ActionBinding;
22
- export declare function validate(statePath?: string): ActionBinding;
23
- export declare function openModal(modalId: string): ActionBinding;
24
- export declare function closeModal(): ActionBinding;
25
- //# sourceMappingURL=actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/lib/sdui/actions.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,aAAa,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC7D,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC5D;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAE/D;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAO5F;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAKlE;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,aAAa,CAiBf;AAED,wBAAgB,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAEnF;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAEtE;AAED,wBAAgB,QAAQ,CAAC,SAAS,SAAoB,GAAG,aAAa,CAErE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAExD;AAED,wBAAgB,UAAU,IAAI,aAAa,CAE1C"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.set = set;
4
- exports.push = push;
5
- exports.remove = remove;
6
- exports.callFunction = callFunction;
7
- exports.nav = nav;
8
- exports.notify = notify;
9
- exports.validate = validate;
10
- exports.openModal = openModal;
11
- exports.closeModal = closeModal;
12
- const state_1 = require("./state.js");
13
- function set(ref, value) {
14
- return { action: 'setState', params: { statePath: (0, state_1.extractPath)(ref), value } };
15
- }
16
- function push(ref, value, opts) {
17
- const params = {
18
- statePath: (0, state_1.extractPath)(ref),
19
- value,
20
- ...(opts?.clear ? { clearStatePath: (0, state_1.extractPath)(opts.clear) } : {}),
21
- };
22
- return { action: 'pushState', params };
23
- }
24
- function remove(ref, index) {
25
- return {
26
- action: 'removeState',
27
- params: { statePath: (0, state_1.extractPath)(ref), index },
28
- };
29
- }
30
- function callFunction(functionId, action, opts) {
31
- const { responsePath, onSuccess, onError, ...rest } = opts || {};
32
- // Spread rest FIRST so explicit functionId/action always win if opts
33
- // happens to carry colliding keys.
34
- const params = {
35
- ...rest,
36
- functionId,
37
- action,
38
- ...(responsePath !== undefined ? { responsePath } : {}),
39
- };
40
- const binding = {
41
- action: 'triggerFunction',
42
- params,
43
- ...(onSuccess ? { onSuccess: onSuccess } : {}),
44
- ...(onError ? { onError: onError } : {}),
45
- };
46
- return binding;
47
- }
48
- function nav(config) {
49
- return { action: 'navigate', params: config };
50
- }
51
- function notify(message, variant) {
52
- return { action: 'showNotification', params: { message, variant } };
53
- }
54
- function validate(statePath = '/formValidation') {
55
- return { action: 'validateForm', params: { statePath } };
56
- }
57
- function openModal(modalId) {
58
- return { action: 'openModal', params: { modalId } };
59
- }
60
- function closeModal() {
61
- return { action: 'closeModal' };
62
- }
63
- //# sourceMappingURL=actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/lib/sdui/actions.ts"],"names":[],"mappings":";;AASA,kBAEC;AAED,oBAOC;AAED,wBAKC;AAED,oCAqBC;AAED,kBAEC;AAED,wBAEC;AAED,4BAEC;AAED,8BAEC;AAED,gCAEC;AAtED,sCAAsC;AAStC,SAAgB,GAAG,CAAC,GAAY,EAAE,KAAc;IAC9C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAA,mBAAW,EAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;AAChF,CAAC;AAED,SAAgB,IAAI,CAAC,GAAY,EAAE,KAAc,EAAE,IAA0B;IAC3E,MAAM,MAAM,GAA4B;QACtC,SAAS,EAAE,IAAA,mBAAW,EAAC,GAAG,CAAC;QAC3B,KAAK;QACL,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAA,mBAAW,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC;AAED,SAAgB,MAAM,CAAC,GAAY,EAAE,KAAc;IACjD,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAA,mBAAW,EAAC,GAAG,CAAC,EAAE,KAAK,EAAE;KAC/C,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY,CAC1B,UAAkB,EAClB,M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YAAY,EAAE,CAAC;AAClC,CAAC"}
@@ -1,52 +0,0 @@
1
- import { extractPath } from "./state.mjs";
2
- export function set(ref, value) {
3
- return { action: 'setState', params: { statePath: extractPath(ref), value } };
4
- }
5
- export function push(ref, value, opts) {
6
- const params = {
7
- statePath: extractPath(ref),
8
- value,
9
- ...(opts?.clear ? { clearStatePath: extractPath(opts.clear) } : {}),
10
- };
11
- return { action: 'pushState', params };
12
- }
13
- export function remove(ref, index) {
14
- return {
15
- action: 'removeState',
16
- params: { statePath: extractPath(ref), index },
17
- };
18
- }
19
- export function callFunction(functionId, action, opts) {
20
- const { responsePath, onSuccess, onError, ...rest } = opts || {};
21
- // Spread rest FIRST so explicit functionId/action always win if opts
22
- // happens to carry colliding keys.
23
- const params = {
24
- ...rest,
25
- functionId,
26
- action,
27
- ...(responsePath !== undefined ? { responsePath } : {}),
28
- };
29
- const binding = {
30
- action: 'triggerFunction',
31
- params,
32
- ...(onSuccess ? { onSuccess: onSuccess } : {}),
33
- ...(onError ? { onError: onError } : {}),
34
- };
35
- return binding;
36
- }
37
- export function nav(config) {
38
- return { action: 'navigate', params: config };
39
- }
40
- export function notify(message, variant) {
41
- return { action: 'showNotification', params: { message, variant } };
42
- }
43
- export function validate(statePath = '/formValidation') {
44
- return { action: 'validateForm', params: { statePath } };
45
- }
46
- export function openModal(modalId) {
47
- return { action: 'openModal', params: { modalId } };
48
- }
49
- export function closeModal() {
50
- return { action: 'closeModal' };
51
- }
52
- //# sourceMappingURL=actions.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.mjs","sourceRoot":"","sources":["../../src/lib/sdui/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oBAAgB;AAStC,MAAM,UAAU,GAAG,CAAC,GAAY,EAAE,KAAc;IAC9C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE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,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,MAAgD;IAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,OAAe;IACrD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,SAAS,GAAG,iBAAiB;IACpD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC"}
@@ -1,58 +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
- import type { ActionBinding } from "./actions.mjs";
25
- import type { SpecNode } from "./components.mjs";
26
- export declare function _resetIdCounter(): void;
27
- export interface StateScope {
28
- /** Read state value: { $state: "/auto_xxx/field" } */
29
- readonly [key: string]: any;
30
- /** Two-way bind: { $bindState: "/auto_xxx/field" } */
31
- readonly $bind: {
32
- $bindState: string;
33
- };
34
- /** Raw path string */
35
- readonly $path: string;
36
- }
37
- interface ComponentContext {
38
- /**
39
- * Declare a scoped local state slot. Returns a path-builder proxy whose
40
- * property accesses produce `{ $state: '/path' }` references for reading
41
- * and `.$bind` for two-way binding. Not a React hook — runs once when
42
- * the factory is invoked, never returns `[value, setter]`.
43
- */
44
- localState<T extends Record<string, unknown>>(initial: T): StateScope;
45
- /**
46
- * Register a JSON action to fire once when the component mounts on the
47
- * client. Not a React effect — does not re-run, has no dependency
48
- * tracking. Pass an `ActionBinding` (e.g. from `set(...)`, `callFunction(...)`)
49
- * or an array of them.
50
- */
51
- onMount(action: ActionBinding | ActionBinding[]): void;
52
- }
53
- interface ComponentResult {
54
- element: SpecNode;
55
- }
56
- export declare function component(factory: (ctx: ComponentContext) => ComponentResult): ComponentResult;
57
- export {};
58
- //# sourceMappingURL=component.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.mts","sourceRoot":"","sources":["../../src/lib/sdui/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAkB;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAqB;AAa7C,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,gBAAgB;IACxB;;;;;OAKG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;IAEtE;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC;CACxD;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,QAAQ,CAAC;CACnB;AAkBD,wBAAgB,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,eAAe,GAAG,eAAe,CAwE9F"}
@@ -1,58 +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
- import type { ActionBinding } from "./actions.js";
25
- import type { SpecNode } from "./components.js";
26
- export declare function _resetIdCounter(): void;
27
- export interface StateScope {
28
- /** Read state value: { $state: "/auto_xxx/field" } */
29
- readonly [key: string]: any;
30
- /** Two-way bind: { $bindState: "/auto_xxx/field" } */
31
- readonly $bind: {
32
- $bindState: string;
33
- };
34
- /** Raw path string */
35
- readonly $path: string;
36
- }
37
- interface ComponentContext {
38
- /**
39
- * Declare a scoped local state slot. Returns a path-builder proxy whose
40
- * property accesses produce `{ $state: '/path' }` references for reading
41
- * and `.$bind` for two-way binding. Not a React hook — runs once when
42
- * the factory is invoked, never returns `[value, setter]`.
43
- */
44
- localState<T extends Record<string, unknown>>(initial: T): StateScope;
45
- /**
46
- * Register a JSON action to fire once when the component mounts on the
47
- * client. Not a React effect — does not re-run, has no dependency
48
- * tracking. Pass an `ActionBinding` (e.g. from `set(...)`, `callFunction(...)`)
49
- * or an array of them.
50
- */
51
- onMount(action: ActionBinding | ActionBinding[]): void;
52
- }
53
- interface ComponentResult {
54
- element: SpecNode;
55
- }
56
- export declare function component(factory: (ctx: ComponentContext) => ComponentResult): ComponentResult;
57
- export {};
58
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/lib/sdui/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAkB;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAqB;AAa7C,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,gBAAgB;IACxB;;;;;OAKG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;IAEtE;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC;CACxD;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,QAAQ,CAAC;CACnB;AAkBD,wBAAgB,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,eAAe,GAAG,eAAe,CAwE9F"}