sdui-web 0.1.0
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.
- package/dist/index.cjs +506 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +479 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
render: () => render
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/utils.ts
|
|
28
|
+
function resolveColor(color, theme) {
|
|
29
|
+
if (!color) return void 0;
|
|
30
|
+
if (theme === "dark") {
|
|
31
|
+
return color.dark ?? color.light;
|
|
32
|
+
}
|
|
33
|
+
return color.light ?? color.dark;
|
|
34
|
+
}
|
|
35
|
+
function resolveSize(size) {
|
|
36
|
+
if (!size || !size.unit) return void 0;
|
|
37
|
+
switch (size.unit) {
|
|
38
|
+
case "dp":
|
|
39
|
+
return `${size.value ?? 0}px`;
|
|
40
|
+
case "match_parent":
|
|
41
|
+
return "100%";
|
|
42
|
+
case "wrap_content":
|
|
43
|
+
return "fit-content";
|
|
44
|
+
default:
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function resolveSpacing(spacing) {
|
|
49
|
+
if (!spacing) return {};
|
|
50
|
+
return {
|
|
51
|
+
top: spacing.top != null ? `${spacing.top}px` : void 0,
|
|
52
|
+
bottom: spacing.bottom != null ? `${spacing.bottom}px` : void 0,
|
|
53
|
+
left: spacing.start != null ? `${spacing.start}px` : void 0,
|
|
54
|
+
right: spacing.end != null ? `${spacing.end}px` : void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/modifiers.ts
|
|
59
|
+
function applyModifier(element, modifier, theme) {
|
|
60
|
+
if (!modifier) return;
|
|
61
|
+
const s = element.style;
|
|
62
|
+
if (modifier.alignment) {
|
|
63
|
+
switch (modifier.alignment) {
|
|
64
|
+
case "center":
|
|
65
|
+
case "center_horizontally":
|
|
66
|
+
case "center_vertically":
|
|
67
|
+
s.alignSelf = "center";
|
|
68
|
+
break;
|
|
69
|
+
case "start":
|
|
70
|
+
case "top":
|
|
71
|
+
case "top_start":
|
|
72
|
+
s.alignSelf = "flex-start";
|
|
73
|
+
break;
|
|
74
|
+
case "end":
|
|
75
|
+
case "bottom":
|
|
76
|
+
case "bottom_end":
|
|
77
|
+
s.alignSelf = "flex-end";
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (modifier.weight != null) {
|
|
82
|
+
s.flex = `${modifier.weight}`;
|
|
83
|
+
}
|
|
84
|
+
if (modifier.action) {
|
|
85
|
+
const action = modifier.action;
|
|
86
|
+
element.style.cursor = "pointer";
|
|
87
|
+
element.addEventListener("click", (e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
if (action.type === "navigate") {
|
|
90
|
+
const event = new CustomEvent("sdui:navigate", {
|
|
91
|
+
bubbles: true,
|
|
92
|
+
detail: { route: action.params?.route, args: action.params?.args }
|
|
93
|
+
});
|
|
94
|
+
element.dispatchEvent(event);
|
|
95
|
+
console.log("[sdui] navigate \u2192", action.params?.route, action.params?.args);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const containerMod = modifier;
|
|
100
|
+
if ("width" in containerMod && containerMod.width) {
|
|
101
|
+
const w = resolveSize(containerMod.width);
|
|
102
|
+
if (w) s.width = w;
|
|
103
|
+
}
|
|
104
|
+
if ("height" in containerMod && containerMod.height) {
|
|
105
|
+
const h = resolveSize(containerMod.height);
|
|
106
|
+
if (h) s.height = h;
|
|
107
|
+
}
|
|
108
|
+
if ("padding" in containerMod && containerMod.padding) {
|
|
109
|
+
const p = resolveSpacing(containerMod.padding);
|
|
110
|
+
if (p.top) s.paddingTop = p.top;
|
|
111
|
+
if (p.bottom) s.paddingBottom = p.bottom;
|
|
112
|
+
if (p.left) s.paddingLeft = p.left;
|
|
113
|
+
if (p.right) s.paddingRight = p.right;
|
|
114
|
+
}
|
|
115
|
+
if ("margin" in containerMod && containerMod.margin) {
|
|
116
|
+
const m = resolveSpacing(containerMod.margin);
|
|
117
|
+
if (m.top) s.marginTop = m.top;
|
|
118
|
+
if (m.bottom) s.marginBottom = m.bottom;
|
|
119
|
+
if (m.left) s.marginLeft = m.left;
|
|
120
|
+
if (m.right) s.marginRight = m.right;
|
|
121
|
+
}
|
|
122
|
+
if ("aspectRatio" in containerMod && containerMod.aspectRatio != null) {
|
|
123
|
+
s.aspectRatio = `${containerMod.aspectRatio}`;
|
|
124
|
+
}
|
|
125
|
+
if ("backgroundColor" in containerMod && containerMod.backgroundColor) {
|
|
126
|
+
applyBackground(s, containerMod.backgroundColor, theme);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function applyBackground(s, bg, theme) {
|
|
130
|
+
if (!bg.colors || bg.colors.length === 0) return;
|
|
131
|
+
const colors = bg.colors.map((c) => resolveColor(c, theme)).filter(Boolean);
|
|
132
|
+
if (colors.length === 0) return;
|
|
133
|
+
switch (bg.type) {
|
|
134
|
+
case "single":
|
|
135
|
+
s.backgroundColor = colors[0];
|
|
136
|
+
break;
|
|
137
|
+
case "vertical_gradient":
|
|
138
|
+
s.background = `linear-gradient(to bottom, ${colors.join(", ")})`;
|
|
139
|
+
break;
|
|
140
|
+
case "horizontal_gradient":
|
|
141
|
+
s.background = `linear-gradient(to right, ${colors.join(", ")})`;
|
|
142
|
+
break;
|
|
143
|
+
case "linear_gradient":
|
|
144
|
+
s.background = `linear-gradient(${colors.join(", ")})`;
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
if (colors.length === 1) {
|
|
148
|
+
s.backgroundColor = colors[0];
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/components/text.ts
|
|
155
|
+
function renderText(component, theme) {
|
|
156
|
+
const props = component.properties;
|
|
157
|
+
const el = document.createElement("span");
|
|
158
|
+
el.textContent = props?.text ?? "";
|
|
159
|
+
if (props?.fontSize != null) {
|
|
160
|
+
el.style.fontSize = `${props.fontSize}px`;
|
|
161
|
+
}
|
|
162
|
+
if (props?.color) {
|
|
163
|
+
const c = resolveColor(props.color, theme);
|
|
164
|
+
if (c) el.style.color = c;
|
|
165
|
+
}
|
|
166
|
+
if (props?.fontWeight) {
|
|
167
|
+
switch (props.fontWeight) {
|
|
168
|
+
case "bold":
|
|
169
|
+
el.style.fontWeight = "700";
|
|
170
|
+
break;
|
|
171
|
+
case "semi_bold":
|
|
172
|
+
el.style.fontWeight = "600";
|
|
173
|
+
break;
|
|
174
|
+
case "medium":
|
|
175
|
+
el.style.fontWeight = "500";
|
|
176
|
+
break;
|
|
177
|
+
case "normal":
|
|
178
|
+
el.style.fontWeight = "400";
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (props?.textAlign) {
|
|
183
|
+
el.style.display = "block";
|
|
184
|
+
switch (props.textAlign) {
|
|
185
|
+
case "left":
|
|
186
|
+
case "start":
|
|
187
|
+
el.style.textAlign = "left";
|
|
188
|
+
break;
|
|
189
|
+
case "right":
|
|
190
|
+
case "end":
|
|
191
|
+
el.style.textAlign = "right";
|
|
192
|
+
break;
|
|
193
|
+
case "center":
|
|
194
|
+
el.style.textAlign = "center";
|
|
195
|
+
break;
|
|
196
|
+
case "justify":
|
|
197
|
+
el.style.textAlign = "justify";
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (props?.overflow === "ellipsis") {
|
|
202
|
+
el.style.textOverflow = "ellipsis";
|
|
203
|
+
el.style.overflow = "hidden";
|
|
204
|
+
el.style.whiteSpace = props.maxLines === 1 ? "nowrap" : "normal";
|
|
205
|
+
}
|
|
206
|
+
if (props?.maxLines != null) {
|
|
207
|
+
el.style.display = "-webkit-box";
|
|
208
|
+
el.style.webkitLineClamp = `${props.maxLines}`;
|
|
209
|
+
el.style["-webkit-box-orient"] = "vertical";
|
|
210
|
+
el.style.overflow = "hidden";
|
|
211
|
+
}
|
|
212
|
+
if (props?.minLines != null) {
|
|
213
|
+
el.style.minHeight = `${props.minLines * (props.fontSize ?? 16) * 1.4}px`;
|
|
214
|
+
}
|
|
215
|
+
applyModifier(el, props?.modifier, theme);
|
|
216
|
+
return el;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// src/components/image.ts
|
|
220
|
+
function renderImage(component, theme) {
|
|
221
|
+
const props = component.properties;
|
|
222
|
+
const el = document.createElement("img");
|
|
223
|
+
if (props?.image) {
|
|
224
|
+
el.src = props.image;
|
|
225
|
+
}
|
|
226
|
+
if (props?.contentDescription) {
|
|
227
|
+
el.alt = props.contentDescription;
|
|
228
|
+
}
|
|
229
|
+
if (props?.scaleType) {
|
|
230
|
+
switch (props.scaleType) {
|
|
231
|
+
case "fit":
|
|
232
|
+
case "inside":
|
|
233
|
+
el.style.objectFit = "contain";
|
|
234
|
+
break;
|
|
235
|
+
case "crop":
|
|
236
|
+
el.style.objectFit = "cover";
|
|
237
|
+
break;
|
|
238
|
+
case "fill_bounds":
|
|
239
|
+
el.style.objectFit = "fill";
|
|
240
|
+
break;
|
|
241
|
+
case "fill_width":
|
|
242
|
+
el.style.objectFit = "cover";
|
|
243
|
+
el.style.width = "100%";
|
|
244
|
+
break;
|
|
245
|
+
case "fill_height":
|
|
246
|
+
el.style.objectFit = "cover";
|
|
247
|
+
el.style.height = "100%";
|
|
248
|
+
break;
|
|
249
|
+
case "none":
|
|
250
|
+
el.style.objectFit = "none";
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (props?.tintColor) {
|
|
255
|
+
const c = resolveColor(props.tintColor, theme);
|
|
256
|
+
if (c) {
|
|
257
|
+
el.style.filter = `opacity(0.5) drop-shadow(0 0 0 ${c})`;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
applyModifier(el, props?.modifier, theme);
|
|
261
|
+
return el;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// src/components/box.ts
|
|
265
|
+
function renderBox(component, theme) {
|
|
266
|
+
const props = component.properties;
|
|
267
|
+
const el = document.createElement("div");
|
|
268
|
+
el.style.display = "flex";
|
|
269
|
+
el.style.position = "relative";
|
|
270
|
+
if (props?.alignment) {
|
|
271
|
+
switch (props.alignment) {
|
|
272
|
+
case "top_start":
|
|
273
|
+
el.style.justifyContent = "flex-start";
|
|
274
|
+
el.style.alignItems = "flex-start";
|
|
275
|
+
break;
|
|
276
|
+
case "top_center":
|
|
277
|
+
el.style.justifyContent = "center";
|
|
278
|
+
el.style.alignItems = "flex-start";
|
|
279
|
+
break;
|
|
280
|
+
case "top_end":
|
|
281
|
+
el.style.justifyContent = "flex-end";
|
|
282
|
+
el.style.alignItems = "flex-start";
|
|
283
|
+
break;
|
|
284
|
+
case "center_start":
|
|
285
|
+
el.style.justifyContent = "flex-start";
|
|
286
|
+
el.style.alignItems = "center";
|
|
287
|
+
break;
|
|
288
|
+
case "center":
|
|
289
|
+
el.style.justifyContent = "center";
|
|
290
|
+
el.style.alignItems = "center";
|
|
291
|
+
break;
|
|
292
|
+
case "center_end":
|
|
293
|
+
el.style.justifyContent = "flex-end";
|
|
294
|
+
el.style.alignItems = "center";
|
|
295
|
+
break;
|
|
296
|
+
case "bottom_start":
|
|
297
|
+
el.style.justifyContent = "flex-start";
|
|
298
|
+
el.style.alignItems = "flex-end";
|
|
299
|
+
break;
|
|
300
|
+
case "bottom_center":
|
|
301
|
+
el.style.justifyContent = "center";
|
|
302
|
+
el.style.alignItems = "flex-end";
|
|
303
|
+
break;
|
|
304
|
+
case "bottom_end":
|
|
305
|
+
el.style.justifyContent = "flex-end";
|
|
306
|
+
el.style.alignItems = "flex-end";
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
applyModifier(el, props?.modifier, theme);
|
|
311
|
+
return el;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// src/components/column.ts
|
|
315
|
+
function renderColumn(component, theme) {
|
|
316
|
+
const props = component.properties;
|
|
317
|
+
const el = document.createElement("div");
|
|
318
|
+
el.style.display = "flex";
|
|
319
|
+
el.style.flexDirection = "column";
|
|
320
|
+
if (props?.verticalArrangement) {
|
|
321
|
+
const arr = props.verticalArrangement;
|
|
322
|
+
switch (arr.type) {
|
|
323
|
+
case "top":
|
|
324
|
+
el.style.justifyContent = "flex-start";
|
|
325
|
+
break;
|
|
326
|
+
case "center":
|
|
327
|
+
el.style.justifyContent = "center";
|
|
328
|
+
break;
|
|
329
|
+
case "bottom":
|
|
330
|
+
el.style.justifyContent = "flex-end";
|
|
331
|
+
break;
|
|
332
|
+
case "space_between":
|
|
333
|
+
el.style.justifyContent = "space-between";
|
|
334
|
+
break;
|
|
335
|
+
case "space_evenly":
|
|
336
|
+
el.style.justifyContent = "space-evenly";
|
|
337
|
+
break;
|
|
338
|
+
case "space_around":
|
|
339
|
+
el.style.justifyContent = "space-around";
|
|
340
|
+
break;
|
|
341
|
+
case "spaced_by":
|
|
342
|
+
if (arr.spacing != null) {
|
|
343
|
+
el.style.gap = `${arr.spacing}px`;
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (props?.horizontalAlignment) {
|
|
349
|
+
switch (props.horizontalAlignment) {
|
|
350
|
+
case "start":
|
|
351
|
+
el.style.alignItems = "flex-start";
|
|
352
|
+
break;
|
|
353
|
+
case "end":
|
|
354
|
+
el.style.alignItems = "flex-end";
|
|
355
|
+
break;
|
|
356
|
+
case "center_horizontally":
|
|
357
|
+
el.style.alignItems = "center";
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (props?.canScroll) {
|
|
362
|
+
el.style.overflowY = "auto";
|
|
363
|
+
}
|
|
364
|
+
applyModifier(el, props?.modifier, theme);
|
|
365
|
+
return el;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// src/components/row.ts
|
|
369
|
+
function renderRow(component, theme) {
|
|
370
|
+
const props = component.properties;
|
|
371
|
+
const el = document.createElement("div");
|
|
372
|
+
el.style.display = "flex";
|
|
373
|
+
el.style.flexDirection = "row";
|
|
374
|
+
if (props?.horizontalArrangement) {
|
|
375
|
+
const arr = props.horizontalArrangement;
|
|
376
|
+
switch (arr.type) {
|
|
377
|
+
case "start":
|
|
378
|
+
el.style.justifyContent = "flex-start";
|
|
379
|
+
break;
|
|
380
|
+
case "center":
|
|
381
|
+
el.style.justifyContent = "center";
|
|
382
|
+
break;
|
|
383
|
+
case "end":
|
|
384
|
+
el.style.justifyContent = "flex-end";
|
|
385
|
+
break;
|
|
386
|
+
case "space_between":
|
|
387
|
+
el.style.justifyContent = "space-between";
|
|
388
|
+
break;
|
|
389
|
+
case "space_evenly":
|
|
390
|
+
el.style.justifyContent = "space-evenly";
|
|
391
|
+
break;
|
|
392
|
+
case "space_around":
|
|
393
|
+
el.style.justifyContent = "space-around";
|
|
394
|
+
break;
|
|
395
|
+
case "spaced_by":
|
|
396
|
+
if (arr.spacing != null) {
|
|
397
|
+
el.style.gap = `${arr.spacing}px`;
|
|
398
|
+
}
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (props?.verticalAlignment) {
|
|
403
|
+
switch (props.verticalAlignment) {
|
|
404
|
+
case "top":
|
|
405
|
+
el.style.alignItems = "flex-start";
|
|
406
|
+
break;
|
|
407
|
+
case "bottom":
|
|
408
|
+
el.style.alignItems = "flex-end";
|
|
409
|
+
break;
|
|
410
|
+
case "center_vertically":
|
|
411
|
+
el.style.alignItems = "center";
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (props?.canScroll) {
|
|
416
|
+
el.style.overflowX = "auto";
|
|
417
|
+
}
|
|
418
|
+
applyModifier(el, props?.modifier, theme);
|
|
419
|
+
return el;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// src/components/lazy-column.ts
|
|
423
|
+
function renderLazyColumn(component, theme) {
|
|
424
|
+
const props = component.properties;
|
|
425
|
+
const el = document.createElement("div");
|
|
426
|
+
el.style.display = "flex";
|
|
427
|
+
el.style.flexDirection = "column";
|
|
428
|
+
el.style.overflowY = "auto";
|
|
429
|
+
if (props?.verticalArrangement) {
|
|
430
|
+
const arr = props.verticalArrangement;
|
|
431
|
+
switch (arr.type) {
|
|
432
|
+
case "top":
|
|
433
|
+
el.style.justifyContent = "flex-start";
|
|
434
|
+
break;
|
|
435
|
+
case "center":
|
|
436
|
+
el.style.justifyContent = "center";
|
|
437
|
+
break;
|
|
438
|
+
case "bottom":
|
|
439
|
+
el.style.justifyContent = "flex-end";
|
|
440
|
+
break;
|
|
441
|
+
case "space_between":
|
|
442
|
+
el.style.justifyContent = "space-between";
|
|
443
|
+
break;
|
|
444
|
+
case "space_evenly":
|
|
445
|
+
el.style.justifyContent = "space-evenly";
|
|
446
|
+
break;
|
|
447
|
+
case "space_around":
|
|
448
|
+
el.style.justifyContent = "space-around";
|
|
449
|
+
break;
|
|
450
|
+
case "spaced_by":
|
|
451
|
+
if (arr.spacing != null) {
|
|
452
|
+
el.style.gap = `${arr.spacing}px`;
|
|
453
|
+
}
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
applyModifier(el, props?.modifier, theme);
|
|
458
|
+
return el;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// src/components/index.ts
|
|
462
|
+
var renderers = {
|
|
463
|
+
text: renderText,
|
|
464
|
+
image: renderImage,
|
|
465
|
+
box: renderBox,
|
|
466
|
+
column: renderColumn,
|
|
467
|
+
row: renderRow,
|
|
468
|
+
lazy_column: renderLazyColumn
|
|
469
|
+
};
|
|
470
|
+
function getRenderer(type) {
|
|
471
|
+
return renderers[type];
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/render.ts
|
|
475
|
+
function renderComponent(component, theme) {
|
|
476
|
+
const renderer = getRenderer(component.type);
|
|
477
|
+
if (!renderer) {
|
|
478
|
+
console.warn(`[sdui] Unknown component type: "${component.type}"`);
|
|
479
|
+
const el2 = document.createElement("div");
|
|
480
|
+
el2.dataset.sduiUnknown = component.type;
|
|
481
|
+
return el2;
|
|
482
|
+
}
|
|
483
|
+
const el = renderer(component, theme);
|
|
484
|
+
el.dataset.sduiType = component.type;
|
|
485
|
+
if (component.children && component.children.length > 0) {
|
|
486
|
+
for (const child of component.children) {
|
|
487
|
+
const childEl = renderComponent(child, theme);
|
|
488
|
+
el.appendChild(childEl);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return el;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// src/index.ts
|
|
495
|
+
function render(json, container, options) {
|
|
496
|
+
const screen = JSON.parse(json);
|
|
497
|
+
const theme = options?.theme ?? "light";
|
|
498
|
+
const root = renderComponent(screen.root, theme);
|
|
499
|
+
container.innerHTML = "";
|
|
500
|
+
container.appendChild(root);
|
|
501
|
+
}
|
|
502
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
503
|
+
0 && (module.exports = {
|
|
504
|
+
render
|
|
505
|
+
});
|
|
506
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/modifiers.ts","../src/components/text.ts","../src/components/image.ts","../src/components/box.ts","../src/components/column.ts","../src/components/row.ts","../src/components/lazy-column.ts","../src/components/index.ts","../src/render.ts"],"sourcesContent":["import type { SduiScreen, Theme } from './types';\nimport { renderComponent } from './render';\n\nexport type { SduiScreen, SduiComponent, Theme } from './types';\nexport type { PropertiesModel, TextUiProperties, ImageUiProperties, BoxUiProperties, ColumnUiProperties, RowUiProperties, LazyColumnUiProperties } from './types';\n\nexport interface RenderOptions {\n theme?: Theme;\n}\n\nexport function render(json: string, container: HTMLElement, options?: RenderOptions): void {\n const screen: SduiScreen = JSON.parse(json);\n const theme: Theme = options?.theme ?? 'light';\n\n const root = renderComponent(screen.root, theme);\n\n container.innerHTML = '';\n container.appendChild(root);\n}\n","import type { ColorModel, SizeModel, SpacingModel, Theme } from './types';\n\nexport function resolveColor(color: ColorModel | undefined, theme: Theme): string | undefined {\n if (!color) return undefined;\n if (theme === 'dark') {\n return color.dark ?? color.light;\n }\n return color.light ?? color.dark;\n}\n\nexport function resolveSize(size: SizeModel | undefined): string | undefined {\n if (!size || !size.unit) return undefined;\n switch (size.unit) {\n case 'dp':\n return `${size.value ?? 0}px`;\n case 'match_parent':\n return '100%';\n case 'wrap_content':\n return 'fit-content';\n default:\n return undefined;\n }\n}\n\nexport function resolveSpacing(spacing: SpacingModel | undefined): {\n top?: string;\n bottom?: string;\n left?: string;\n right?: string;\n} {\n if (!spacing) return {};\n return {\n top: spacing.top != null ? `${spacing.top}px` : undefined,\n bottom: spacing.bottom != null ? `${spacing.bottom}px` : undefined,\n left: spacing.start != null ? `${spacing.start}px` : undefined,\n right: spacing.end != null ? `${spacing.end}px` : undefined,\n };\n}\n","import type { BackgroundColorModel, ContainerUiModifier, ImageUiModifier, ModifierBase, TextUiModifier, Theme } from './types';\nimport { resolveColor, resolveSize, resolveSpacing } from './utils';\n\nexport function applyModifier(element: HTMLElement, modifier: ModifierBase | undefined, theme: Theme): void {\n if (!modifier) return;\n\n const s = element.style;\n\n // alignment → align-self mapping\n if (modifier.alignment) {\n switch (modifier.alignment) {\n case 'center':\n case 'center_horizontally':\n case 'center_vertically':\n s.alignSelf = 'center';\n break;\n case 'start':\n case 'top':\n case 'top_start':\n s.alignSelf = 'flex-start';\n break;\n case 'end':\n case 'bottom':\n case 'bottom_end':\n s.alignSelf = 'flex-end';\n break;\n }\n }\n\n // weight → flex\n if (modifier.weight != null) {\n s.flex = `${modifier.weight}`;\n }\n\n // action → click handler\n if (modifier.action) {\n const action = modifier.action;\n element.style.cursor = 'pointer';\n element.addEventListener('click', (e) => {\n e.stopPropagation();\n if (action.type === 'navigate') {\n const event = new CustomEvent('sdui:navigate', {\n bubbles: true,\n detail: { route: action.params?.route, args: action.params?.args },\n });\n element.dispatchEvent(event);\n console.log('[sdui] navigate →', action.params?.route, action.params?.args);\n }\n });\n }\n\n // Container-like modifiers (width, height, padding, margin, backgroundColor, aspectRatio)\n const containerMod = modifier as ContainerUiModifier | ImageUiModifier | TextUiModifier;\n\n if ('width' in containerMod && containerMod.width) {\n const w = resolveSize(containerMod.width);\n if (w) s.width = w;\n }\n\n if ('height' in containerMod && containerMod.height) {\n const h = resolveSize((containerMod as ContainerUiModifier).height);\n if (h) s.height = h;\n }\n\n if ('padding' in containerMod && containerMod.padding) {\n const p = resolveSpacing((containerMod as ContainerUiModifier).padding);\n if (p.top) s.paddingTop = p.top;\n if (p.bottom) s.paddingBottom = p.bottom;\n if (p.left) s.paddingLeft = p.left;\n if (p.right) s.paddingRight = p.right;\n }\n\n if ('margin' in containerMod && containerMod.margin) {\n const m = resolveSpacing(containerMod.margin);\n if (m.top) s.marginTop = m.top;\n if (m.bottom) s.marginBottom = m.bottom;\n if (m.left) s.marginLeft = m.left;\n if (m.right) s.marginRight = m.right;\n }\n\n if ('aspectRatio' in containerMod && containerMod.aspectRatio != null) {\n s.aspectRatio = `${(containerMod as ContainerUiModifier).aspectRatio}`;\n }\n\n if ('backgroundColor' in containerMod && containerMod.backgroundColor) {\n applyBackground(s, (containerMod as ContainerUiModifier).backgroundColor!, theme);\n }\n}\n\nfunction applyBackground(s: CSSStyleDeclaration, bg: BackgroundColorModel, theme: Theme): void {\n if (!bg.colors || bg.colors.length === 0) return;\n\n const colors = bg.colors.map((c) => resolveColor(c, theme)).filter(Boolean) as string[];\n if (colors.length === 0) return;\n\n switch (bg.type) {\n case 'single':\n s.backgroundColor = colors[0];\n break;\n case 'vertical_gradient':\n s.background = `linear-gradient(to bottom, ${colors.join(', ')})`;\n break;\n case 'horizontal_gradient':\n s.background = `linear-gradient(to right, ${colors.join(', ')})`;\n break;\n case 'linear_gradient':\n s.background = `linear-gradient(${colors.join(', ')})`;\n break;\n default:\n if (colors.length === 1) {\n s.backgroundColor = colors[0];\n }\n break;\n }\n}\n","import type { SduiComponent, TextUiProperties, Theme } from '../types';\nimport { resolveColor } from '../utils';\nimport { applyModifier } from '../modifiers';\n\nexport function renderText(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as TextUiProperties | undefined;\n const el = document.createElement('span');\n\n el.textContent = props?.text ?? '';\n\n if (props?.fontSize != null) {\n el.style.fontSize = `${props.fontSize}px`;\n }\n\n if (props?.color) {\n const c = resolveColor(props.color, theme);\n if (c) el.style.color = c;\n }\n\n if (props?.fontWeight) {\n switch (props.fontWeight) {\n case 'bold':\n el.style.fontWeight = '700';\n break;\n case 'semi_bold':\n el.style.fontWeight = '600';\n break;\n case 'medium':\n el.style.fontWeight = '500';\n break;\n case 'normal':\n el.style.fontWeight = '400';\n break;\n }\n }\n\n if (props?.textAlign) {\n el.style.display = 'block';\n switch (props.textAlign) {\n case 'left':\n case 'start':\n el.style.textAlign = 'left';\n break;\n case 'right':\n case 'end':\n el.style.textAlign = 'right';\n break;\n case 'center':\n el.style.textAlign = 'center';\n break;\n case 'justify':\n el.style.textAlign = 'justify';\n break;\n }\n }\n\n if (props?.overflow === 'ellipsis') {\n el.style.textOverflow = 'ellipsis';\n el.style.overflow = 'hidden';\n el.style.whiteSpace = props.maxLines === 1 ? 'nowrap' : 'normal';\n }\n\n if (props?.maxLines != null) {\n el.style.display = '-webkit-box';\n el.style.webkitLineClamp = `${props.maxLines}`;\n (el.style as unknown as Record<string, string>)['-webkit-box-orient'] = 'vertical';\n el.style.overflow = 'hidden';\n }\n\n if (props?.minLines != null) {\n el.style.minHeight = `${props.minLines * (props.fontSize ?? 16) * 1.4}px`;\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, ImageUiProperties, Theme } from '../types';\nimport { resolveColor } from '../utils';\nimport { applyModifier } from '../modifiers';\n\nexport function renderImage(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as ImageUiProperties | undefined;\n const el = document.createElement('img');\n\n if (props?.image) {\n el.src = props.image;\n }\n\n if (props?.contentDescription) {\n el.alt = props.contentDescription;\n }\n\n if (props?.scaleType) {\n switch (props.scaleType) {\n case 'fit':\n case 'inside':\n el.style.objectFit = 'contain';\n break;\n case 'crop':\n el.style.objectFit = 'cover';\n break;\n case 'fill_bounds':\n el.style.objectFit = 'fill';\n break;\n case 'fill_width':\n el.style.objectFit = 'cover';\n el.style.width = '100%';\n break;\n case 'fill_height':\n el.style.objectFit = 'cover';\n el.style.height = '100%';\n break;\n case 'none':\n el.style.objectFit = 'none';\n break;\n }\n }\n\n if (props?.tintColor) {\n const c = resolveColor(props.tintColor, theme);\n if (c) {\n // Use CSS filter to approximate tint; for precise tinting a SVG filter would be needed\n el.style.filter = `opacity(0.5) drop-shadow(0 0 0 ${c})`;\n }\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, BoxUiProperties, Theme } from '../types';\nimport { applyModifier } from '../modifiers';\n\nexport function renderBox(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as BoxUiProperties | undefined;\n const el = document.createElement('div');\n\n el.style.display = 'flex';\n el.style.position = 'relative';\n\n if (props?.alignment) {\n // Map alignment to flex alignment\n switch (props.alignment) {\n case 'top_start':\n el.style.justifyContent = 'flex-start';\n el.style.alignItems = 'flex-start';\n break;\n case 'top_center':\n el.style.justifyContent = 'center';\n el.style.alignItems = 'flex-start';\n break;\n case 'top_end':\n el.style.justifyContent = 'flex-end';\n el.style.alignItems = 'flex-start';\n break;\n case 'center_start':\n el.style.justifyContent = 'flex-start';\n el.style.alignItems = 'center';\n break;\n case 'center':\n el.style.justifyContent = 'center';\n el.style.alignItems = 'center';\n break;\n case 'center_end':\n el.style.justifyContent = 'flex-end';\n el.style.alignItems = 'center';\n break;\n case 'bottom_start':\n el.style.justifyContent = 'flex-start';\n el.style.alignItems = 'flex-end';\n break;\n case 'bottom_center':\n el.style.justifyContent = 'center';\n el.style.alignItems = 'flex-end';\n break;\n case 'bottom_end':\n el.style.justifyContent = 'flex-end';\n el.style.alignItems = 'flex-end';\n break;\n }\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, ColumnUiProperties, Theme } from '../types';\nimport { applyModifier } from '../modifiers';\n\nexport function renderColumn(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as ColumnUiProperties | undefined;\n const el = document.createElement('div');\n\n el.style.display = 'flex';\n el.style.flexDirection = 'column';\n\n // verticalArrangement → justify-content + gap\n if (props?.verticalArrangement) {\n const arr = props.verticalArrangement;\n switch (arr.type) {\n case 'top':\n el.style.justifyContent = 'flex-start';\n break;\n case 'center':\n el.style.justifyContent = 'center';\n break;\n case 'bottom':\n el.style.justifyContent = 'flex-end';\n break;\n case 'space_between':\n el.style.justifyContent = 'space-between';\n break;\n case 'space_evenly':\n el.style.justifyContent = 'space-evenly';\n break;\n case 'space_around':\n el.style.justifyContent = 'space-around';\n break;\n case 'spaced_by':\n if (arr.spacing != null) {\n el.style.gap = `${arr.spacing}px`;\n }\n break;\n }\n }\n\n // horizontalAlignment → align-items\n if (props?.horizontalAlignment) {\n switch (props.horizontalAlignment) {\n case 'start':\n el.style.alignItems = 'flex-start';\n break;\n case 'end':\n el.style.alignItems = 'flex-end';\n break;\n case 'center_horizontally':\n el.style.alignItems = 'center';\n break;\n }\n }\n\n if (props?.canScroll) {\n el.style.overflowY = 'auto';\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, RowUiProperties, Theme } from '../types';\nimport { applyModifier } from '../modifiers';\n\nexport function renderRow(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as RowUiProperties | undefined;\n const el = document.createElement('div');\n\n el.style.display = 'flex';\n el.style.flexDirection = 'row';\n\n // horizontalArrangement → justify-content + gap\n if (props?.horizontalArrangement) {\n const arr = props.horizontalArrangement;\n switch (arr.type) {\n case 'start':\n el.style.justifyContent = 'flex-start';\n break;\n case 'center':\n el.style.justifyContent = 'center';\n break;\n case 'end':\n el.style.justifyContent = 'flex-end';\n break;\n case 'space_between':\n el.style.justifyContent = 'space-between';\n break;\n case 'space_evenly':\n el.style.justifyContent = 'space-evenly';\n break;\n case 'space_around':\n el.style.justifyContent = 'space-around';\n break;\n case 'spaced_by':\n if (arr.spacing != null) {\n el.style.gap = `${arr.spacing}px`;\n }\n break;\n }\n }\n\n // verticalAlignment → align-items\n if (props?.verticalAlignment) {\n switch (props.verticalAlignment) {\n case 'top':\n el.style.alignItems = 'flex-start';\n break;\n case 'bottom':\n el.style.alignItems = 'flex-end';\n break;\n case 'center_vertically':\n el.style.alignItems = 'center';\n break;\n }\n }\n\n if (props?.canScroll) {\n el.style.overflowX = 'auto';\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, LazyColumnUiProperties, Theme } from '../types';\nimport { applyModifier } from '../modifiers';\n\nexport function renderLazyColumn(component: SduiComponent, theme: Theme): HTMLElement {\n const props = component.properties as LazyColumnUiProperties | undefined;\n const el = document.createElement('div');\n\n el.style.display = 'flex';\n el.style.flexDirection = 'column';\n el.style.overflowY = 'auto';\n\n if (props?.verticalArrangement) {\n const arr = props.verticalArrangement;\n switch (arr.type) {\n case 'top':\n el.style.justifyContent = 'flex-start';\n break;\n case 'center':\n el.style.justifyContent = 'center';\n break;\n case 'bottom':\n el.style.justifyContent = 'flex-end';\n break;\n case 'space_between':\n el.style.justifyContent = 'space-between';\n break;\n case 'space_evenly':\n el.style.justifyContent = 'space-evenly';\n break;\n case 'space_around':\n el.style.justifyContent = 'space-around';\n break;\n case 'spaced_by':\n if (arr.spacing != null) {\n el.style.gap = `${arr.spacing}px`;\n }\n break;\n }\n }\n\n applyModifier(el, props?.modifier, theme);\n\n return el;\n}\n","import type { SduiComponent, Theme } from '../types';\nimport { renderText } from './text';\nimport { renderImage } from './image';\nimport { renderBox } from './box';\nimport { renderColumn } from './column';\nimport { renderRow } from './row';\nimport { renderLazyColumn } from './lazy-column';\n\nexport type ComponentRenderer = (component: SduiComponent, theme: Theme) => HTMLElement;\n\nconst renderers: Record<string, ComponentRenderer> = {\n text: renderText,\n image: renderImage,\n box: renderBox,\n column: renderColumn,\n row: renderRow,\n lazy_column: renderLazyColumn,\n};\n\nexport function getRenderer(type: string): ComponentRenderer | undefined {\n return renderers[type];\n}\n","import type { SduiComponent, Theme } from './types';\nimport { getRenderer } from './components';\n\nexport function renderComponent(component: SduiComponent, theme: Theme): HTMLElement {\n const renderer = getRenderer(component.type);\n\n if (!renderer) {\n console.warn(`[sdui] Unknown component type: \"${component.type}\"`);\n const el = document.createElement('div');\n el.dataset.sduiUnknown = component.type;\n return el;\n }\n\n const el = renderer(component, theme);\n el.dataset.sduiType = component.type;\n\n // Recursively render children\n if (component.children && component.children.length > 0) {\n for (const child of component.children) {\n const childEl = renderComponent(child, theme);\n el.appendChild(childEl);\n }\n }\n\n return el;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,aAAa,OAA+B,OAAkC;AAC5F,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI,UAAU,QAAQ;AACpB,WAAO,MAAM,QAAQ,MAAM;AAAA,EAC7B;AACA,SAAO,MAAM,SAAS,MAAM;AAC9B;AAEO,SAAS,YAAY,MAAiD;AAC3E,MAAI,CAAC,QAAQ,CAAC,KAAK,KAAM,QAAO;AAChC,UAAQ,KAAK,MAAM;AAAA,IACjB,KAAK;AACH,aAAO,GAAG,KAAK,SAAS,CAAC;AAAA,IAC3B,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,eAAe,SAK7B;AACA,MAAI,CAAC,QAAS,QAAO,CAAC;AACtB,SAAO;AAAA,IACL,KAAK,QAAQ,OAAO,OAAO,GAAG,QAAQ,GAAG,OAAO;AAAA,IAChD,QAAQ,QAAQ,UAAU,OAAO,GAAG,QAAQ,MAAM,OAAO;AAAA,IACzD,MAAM,QAAQ,SAAS,OAAO,GAAG,QAAQ,KAAK,OAAO;AAAA,IACrD,OAAO,QAAQ,OAAO,OAAO,GAAG,QAAQ,GAAG,OAAO;AAAA,EACpD;AACF;;;AClCO,SAAS,cAAc,SAAsB,UAAoC,OAAoB;AAC1G,MAAI,CAAC,SAAU;AAEf,QAAM,IAAI,QAAQ;AAGlB,MAAI,SAAS,WAAW;AACtB,YAAQ,SAAS,WAAW;AAAA,MAC1B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,UAAE,YAAY;AACd;AAAA,MACF,KAAK;AAAA,MACL,KAAK;A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