xmlui 0.10.23 → 0.10.25

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 (42) hide show
  1. package/dist/lib/{index-CuPvcayg.mjs → index-CCEPGw_x.mjs} +704 -506
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-BBdNO6FB.mjs → initMock-DFcCR7ey.mjs} +1 -1
  4. package/dist/lib/xmlui.d.ts +1 -0
  5. package/dist/lib/xmlui.mjs +1 -1
  6. package/dist/metadata/{collectedComponentMetadata-Cp3Ljk8F.mjs → collectedComponentMetadata-mwkNkxN_.mjs} +700 -502
  7. package/dist/metadata/{initMock-Dki8247s.mjs → initMock-BVxHA6wu.mjs} +1 -1
  8. package/dist/metadata/style.css +1 -1
  9. package/dist/metadata/xmlui-metadata.mjs +1 -1
  10. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  11. package/dist/scripts/package.json +1 -1
  12. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +2 -1
  13. package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +1 -1
  14. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +30 -5
  15. package/dist/scripts/src/components/CodeBlock/highlight-code.js +5 -32
  16. package/dist/scripts/src/components/Form/Form.spec.js +2 -2
  17. package/dist/scripts/src/components/FormItem/FormItemNative.js +5 -1
  18. package/dist/scripts/src/components/Markdown/MarkdownNative.js +4 -3
  19. package/dist/scripts/src/components/Markdown/utils.js +4 -3
  20. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +4 -6
  21. package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +19 -0
  22. package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +103 -11
  23. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +6 -1
  24. package/dist/scripts/src/components/NestedApp/utils.js +6 -5
  25. package/dist/scripts/src/components/Option/Option.spec.js +3 -1
  26. package/dist/scripts/src/components/Select/HiddenOption.js +3 -3
  27. package/dist/scripts/src/components/Select/Select.js +2 -3
  28. package/dist/scripts/src/components/Select/Select.spec.js +53 -6
  29. package/dist/scripts/src/components/Select/SelectNative.js +187 -47
  30. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +11 -0
  31. package/dist/scripts/src/components-core/rendering/Container.js +3 -4
  32. package/dist/scripts/src/components-core/rendering/StateContainer.js +16 -18
  33. package/dist/scripts/src/components-core/rendering/reducer.js +6 -3
  34. package/dist/scripts/src/components-core/utils/base64-utils.js +122 -0
  35. package/dist/scripts/src/components-core/utils/date-utils.js +12 -3
  36. package/dist/scripts/src/testing/ComponentDrivers.js +1 -1
  37. package/dist/standalone/xmlui-standalone.es.d.ts +1 -0
  38. package/dist/standalone/xmlui-standalone.umd.js +15 -15
  39. package/package.json +1 -1
  40. package/dist/scripts/src/components/Select/MultiSelectOption.js +0 -42
  41. package/dist/scripts/src/components/Select/SelectOption.js +0 -34
  42. package/dist/scripts/src/components/Select/SimpleSelect.js +0 -57
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uint8ArrayToBase64 = uint8ArrayToBase64;
4
+ exports.encodeToBase64 = encodeToBase64;
5
+ exports.decodeFromBase64 = decodeFromBase64;
6
+ /**
7
+ * Convert Uint8Array to base64 string without using btoa.
8
+ * This approach handles all Unicode characters correctly.
9
+ */
10
+ function uint8ArrayToBase64(bytes) {
11
+ const base64abc = [
12
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
13
+ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
14
+ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
15
+ "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
16
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"
17
+ ];
18
+ let result = '';
19
+ let i;
20
+ const l = bytes.length;
21
+ for (i = 2; i < l; i += 3) {
22
+ result += base64abc[bytes[i - 2] >> 2];
23
+ result += base64abc[((bytes[i - 2] & 0x03) << 4) | (bytes[i - 1] >> 4)];
24
+ result += base64abc[((bytes[i - 1] & 0x0f) << 2) | (bytes[i] >> 6)];
25
+ result += base64abc[bytes[i] & 0x3f];
26
+ }
27
+ if (i === l + 1) {
28
+ // 1 byte left
29
+ result += base64abc[bytes[i - 2] >> 2];
30
+ result += base64abc[(bytes[i - 2] & 0x03) << 4];
31
+ result += "==";
32
+ }
33
+ if (i === l) {
34
+ // 2 bytes left
35
+ result += base64abc[bytes[i - 2] >> 2];
36
+ result += base64abc[((bytes[i - 2] & 0x03) << 4) | (bytes[i - 1] >> 4)];
37
+ result += base64abc[(bytes[i - 1] & 0x0f) << 2];
38
+ result += "=";
39
+ }
40
+ return result;
41
+ }
42
+ /**
43
+ * Encode string to base64 value (handles Unicode properly).
44
+ * This is a safe alternative to btoa() that works with Unicode characters.
45
+ */
46
+ function encodeToBase64(value) {
47
+ if (value === null || value === undefined) {
48
+ return "";
49
+ }
50
+ const valueToString = typeof value === "object" ? JSON.stringify(value) : value.toString();
51
+ if (typeof window !== 'undefined') {
52
+ // Use TextEncoder to handle Unicode properly
53
+ const encoder = new TextEncoder();
54
+ const data = encoder.encode(valueToString);
55
+ return uint8ArrayToBase64(data);
56
+ }
57
+ // Node.js environment
58
+ const buff = Buffer.from(valueToString, 'utf8');
59
+ return buff.toString('base64');
60
+ }
61
+ /**
62
+ * Convert base64 string to Uint8Array without using atob.
63
+ */
64
+ function base64ToUint8Array(base64) {
65
+ const base64abc = [
66
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
67
+ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
68
+ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
69
+ "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
70
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"
71
+ ];
72
+ // Create lookup table
73
+ const lookup = new Uint8Array(256);
74
+ for (let i = 0; i < base64abc.length; i++) {
75
+ lookup[base64abc[i].charCodeAt(0)] = i;
76
+ }
77
+ // Remove padding
78
+ let paddingLength = 0;
79
+ if (base64.endsWith("==")) {
80
+ paddingLength = 2;
81
+ }
82
+ else if (base64.endsWith("=")) {
83
+ paddingLength = 1;
84
+ }
85
+ const length = base64.length;
86
+ const bufferLength = (length * 3) / 4 - paddingLength;
87
+ const bytes = new Uint8Array(bufferLength);
88
+ let p = 0;
89
+ for (let i = 0; i < length; i += 4) {
90
+ const encoded1 = lookup[base64.charCodeAt(i)];
91
+ const encoded2 = lookup[base64.charCodeAt(i + 1)];
92
+ const encoded3 = lookup[base64.charCodeAt(i + 2)];
93
+ const encoded4 = lookup[base64.charCodeAt(i + 3)];
94
+ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
95
+ if (p < bufferLength) {
96
+ bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
97
+ }
98
+ if (p < bufferLength) {
99
+ bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
100
+ }
101
+ }
102
+ return bytes;
103
+ }
104
+ /**
105
+ * Decode base64 value to string (handles Unicode properly).
106
+ * This is a safe alternative to atob() that works with Unicode characters.
107
+ */
108
+ function decodeFromBase64(value) {
109
+ if (!value) {
110
+ return null;
111
+ }
112
+ const valueToString = typeof value === "object" ? JSON.stringify(value) : value.toString();
113
+ if (typeof window !== "undefined") {
114
+ // Decode from base64 and handle Unicode properly
115
+ const bytes = base64ToUint8Array(valueToString);
116
+ const decoder = new TextDecoder();
117
+ return decoder.decode(bytes);
118
+ }
119
+ // Node.js environment
120
+ const buff = Buffer.from(valueToString, "base64");
121
+ return buff.toString("utf8");
122
+ }
@@ -19,13 +19,22 @@ const misc_1 = require("../utils/misc");
19
19
  function isoDateString(date) {
20
20
  return (!date ? new Date() : new Date(date)).toJSON();
21
21
  }
22
- function formatDate(date) {
22
+ function formatDate(date, formatString) {
23
+ if (formatString) {
24
+ return (0, date_fns_1.format)(new Date(date), formatString);
25
+ }
23
26
  return new Date(date).toLocaleDateString();
24
27
  }
25
- function formatDateTime(date) {
28
+ function formatDateTime(date, formatString) {
29
+ if (formatString) {
30
+ return (0, date_fns_1.format)(new Date(date), formatString);
31
+ }
26
32
  return new Date(date).toLocaleString();
27
33
  }
28
- function formatTime(date) {
34
+ function formatTime(date, formatString) {
35
+ if (formatString) {
36
+ return (0, date_fns_1.format)(new Date(date), formatString);
37
+ }
29
38
  return new Date(date).toLocaleTimeString();
30
39
  }
31
40
  function formatTimeWithoutSeconds(date) {
@@ -693,7 +693,7 @@ class SelectDriver extends ComponentDriver {
693
693
  }
694
694
  searchFor(value) {
695
695
  return __awaiter(this, void 0, void 0, function* () {
696
- yield this.page.getByRole("combobox").fill(value);
696
+ yield this.page.getByRole("searchbox").fill(value);
697
697
  });
698
698
  }
699
699
  chooseIndex(index) {
@@ -1322,6 +1322,7 @@ declare type RenderChildFn<L extends ComponentDef = ComponentDef> = (children?:
1322
1322
  declare interface RendererContext<TMd extends ComponentMetadata = ComponentMetadata> extends ComponentRendererContextBase<TMd> {
1323
1323
  uid: symbol;
1324
1324
  updateState: UpdateStateFn;
1325
+ contextVars: Record<string, any>;
1325
1326
  extractValue: ValueExtractor;
1326
1327
  extractResourceUrl: (url?: string) => string | undefined;
1327
1328
  lookupEventHandler: LookupEventHandlerFn<TMd>;