xmlui 0.9.43 → 0.9.44

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.9.43",
3
+ "version": "0.9.44",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -148,6 +148,9 @@
148
148
  "@rollup/rollup-linux-x64-gnu": "4.20.0",
149
149
  "@rollup/rollup-win32-x64-msvc": "4.20.0"
150
150
  },
151
+ "resolutions": {
152
+ "@radix-ui/react-dismissable-layer": "1.1.10"
153
+ },
151
154
  "files": [
152
155
  "dist",
153
156
  "src/styles"
@@ -24,6 +24,7 @@ exports.CodeBlockMd = (0, ComponentDefs_1.createMetadata)({
24
24
  "backgroundColor-CodeBlock-highlightRow": "rgba($color-primary-200-rgb, .25)",
25
25
  "backgroundColor-CodeBlock-highlightString": "rgba($color-primary-200-rgb, .5)",
26
26
  "borderRadius-CodeBlock": "$space-2",
27
+ "borderColor-CodeBlock-highlightString-emphasis": "$color-attention",
27
28
  dark: {
28
29
  "backgroundColor-CodeBlock-header": "$color-surface-200",
29
30
  "backgroundColor-CodeBlock": "$color-surface-50",
@@ -88,6 +88,17 @@ function markdownCodeBlockParser() {
88
88
  `${unparsedSubstrings} ${newItemBase64}`;
89
89
  }
90
90
  }
91
+ if (item.startsWith("!/") && item.endsWith("/")) {
92
+ const unparsedSubstrings = acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstringsEmphasized.data];
93
+ const newItemBase64 = decodeValue(item.substring(2, item.length - 1));
94
+ if (!unparsedSubstrings) {
95
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstringsEmphasized.data] = newItemBase64;
96
+ }
97
+ else {
98
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstringsEmphasized.data] =
99
+ `${unparsedSubstrings} ${newItemBase64}`;
100
+ }
101
+ }
91
102
  if (item.startsWith("{") && item.endsWith("}")) {
92
103
  const unparsedRows = acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data];
93
104
  const newItem = item.substring(1, item.length - 1);
@@ -18,6 +18,7 @@ exports.isCodeHighlighter = isCodeHighlighter;
18
18
  const react_1 = require("react");
19
19
  const highlightRowsClass = "codeBlockHighlightRow";
20
20
  const highlightSubstringsClass = "codeBlockHighlightString";
21
+ const highlightSubstringsEmphasisClass = "codeBlockHighlightStringEmphasis";
21
22
  /*
22
23
  * Encode string, returns base64 value
23
24
  * @Params: string
@@ -27,11 +28,11 @@ function encodeValue(value) {
27
28
  return null;
28
29
  }
29
30
  const valueToString = value.toString();
30
- if (typeof window !== 'undefined') {
31
+ if (typeof window !== "undefined") {
31
32
  return window.atob(valueToString);
32
33
  }
33
- const buff = Buffer.from(valueToString, 'base64');
34
- return buff.toString('ascii');
34
+ const buff = Buffer.from(valueToString, "base64");
35
+ return buff.toString("ascii");
35
36
  }
36
37
  /**
37
38
  * This function handles two things:
@@ -129,6 +130,7 @@ function extractMetaFromChildren(node, keys, code = "") {
129
130
  [exports.CodeHighlighterMetaKeys.rowNumbers.prop]: parseBoolean(meta[exports.CodeHighlighterMetaKeys.rowNumbers.data]),
130
131
  [exports.CodeHighlighterMetaKeys.highlightRows.prop]: parseRowHighlights(code.split("\n").length, meta[exports.CodeHighlighterMetaKeys.highlightRows.data]),
131
132
  [exports.CodeHighlighterMetaKeys.highlightSubstrings.prop]: parseSubstringHighlights(code, meta[exports.CodeHighlighterMetaKeys.highlightSubstrings.data]),
133
+ [exports.CodeHighlighterMetaKeys.highlightSubstringsEmphasized.prop]: parseSubstringHighlights(code, meta[exports.CodeHighlighterMetaKeys.highlightSubstringsEmphasized.data], true),
132
134
  };
133
135
  }
134
136
  return {};
@@ -182,7 +184,7 @@ function parseRowHighlights(codeLines, str) {
182
184
  return parsed;
183
185
  }
184
186
  }
185
- function parseSubstringHighlights(code, str) {
187
+ function parseSubstringHighlights(code, str, emphasized = false) {
186
188
  if (!str)
187
189
  return [];
188
190
  if (!code)
@@ -190,6 +192,7 @@ function parseSubstringHighlights(code, str) {
190
192
  return str
191
193
  .split(" ")
192
194
  .map((item) => encodeValue(item))
195
+ .filter((item) => item.trim() !== "")
193
196
  .reduce((acc, item) => acc.concat(findAllNonOverlappingSubstrings(code, item)), []);
194
197
  function findAllNonOverlappingSubstrings(str, code) {
195
198
  const result = [];
@@ -202,7 +205,9 @@ function parseSubstringHighlights(code, str) {
202
205
  result.push({
203
206
  start: index,
204
207
  end: index + searchLength,
205
- properties: { class: highlightSubstringsClass },
208
+ properties: {
209
+ class: emphasized ? highlightSubstringsEmphasisClass : highlightSubstringsClass,
210
+ },
206
211
  });
207
212
  startIndex = index + searchLength; // Jump past this match
208
213
  }
@@ -219,5 +224,9 @@ exports.CodeHighlighterMetaKeys = {
219
224
  rowNumbers: { data: "data-row-numbers", prop: "rowNumbers" },
220
225
  highlightRows: { data: "data-highlight-rows", prop: "highlightRows" },
221
226
  highlightSubstrings: { data: "data-highlight-substrings", prop: "highlightSubstrings" },
227
+ highlightSubstringsEmphasized: {
228
+ data: "data-highlight-substrings-emp",
229
+ prop: "highlightSubstringsEmphasized",
230
+ },
222
231
  };
223
232
  exports.CodeHighlighterMetaKeysData = Object.values(exports.CodeHighlighterMetaKeys).map((item) => item.data);
@@ -328,8 +328,8 @@ exports.Table = (0, react_1.forwardRef)(({ data = constants_1.EMPTY_ARRAY, colum
328
328
  : 0;
329
329
  const paddingBottom = rowVirtualizer.getVirtualItems().length > 0
330
330
  ? rowVirtualizer.getTotalSize() -
331
- (((_d = (_c = rowVirtualizer.getVirtualItems()) === null || _c === void 0 ? void 0 : _c[rowVirtualizer.getVirtualItems().length - 1]) === null || _d === void 0 ? void 0 : _d.end) - startMargin ||
332
- 0)
331
+ (((_d = (_c = rowVirtualizer.getVirtualItems()) === null || _c === void 0 ? void 0 : _c[rowVirtualizer.getVirtualItems().length - 1]) === null || _d === void 0 ? void 0 : _d.end) -
332
+ startMargin || 0)
333
333
  : 0;
334
334
  const hasData = safeData.length !== 0;
335
335
  const touchedSizesRef = (0, react_1.useRef)({});
@@ -387,9 +387,9 @@ exports.Table = (0, react_1.forwardRef)(({ data = constants_1.EMPTY_ARRAY, colum
387
387
  var _a, _b;
388
388
  const _c = ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.style) || {}, { width } = _c, style = __rest(_c, ["width"]);
389
389
  const size = header.getSize();
390
- return ((0, jsx_runtime_1.jsxs)("th", { className: Table_module_scss_1.default.columnCell, colSpan: header.colSpan, style: Object.assign({ position: "relative", width: size }, getCommonPinningStyles(header.column)), children: [(0, jsx_runtime_1.jsx)(ClickableHeader, { hasSorting: header.column.columnDef.enableSorting, updateSorting: () => { var _a; return _updateSorting((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.accessorKey); }, children: (0, jsx_runtime_1.jsxs)("div", { className: Table_module_scss_1.default.headerContent, style: style, children: [(0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()), (0, jsx_runtime_1.jsx)("span", { style: { display: "inline-flex", maxWidth: 16 }, children: header.column.columnDef.enableSorting && ((0, jsx_runtime_1.jsx)(ColumnOrderingIndicator, { iconSortAsc: iconSortAsc, iconSortDesc: iconSortDesc, iconNoSort: iconNoSort, direction: ((_b = header.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.accessorKey) === _sortBy
390
+ return ((0, jsx_runtime_1.jsxs)("th", { className: Table_module_scss_1.default.columnCell, colSpan: header.colSpan, style: Object.assign({ position: "relative", width: size }, getCommonPinningStyles(header.column)), children: [(0, jsx_runtime_1.jsx)(ClickableHeader, { hasSorting: header.column.columnDef.enableSorting, updateSorting: () => { var _a; return _updateSorting((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.accessorKey); }, children: (0, jsx_runtime_1.jsxs)("div", { className: Table_module_scss_1.default.headerContent, style: style, children: [(0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()), header.column.columnDef.enableSorting && ((0, jsx_runtime_1.jsx)("span", { style: { display: "inline-flex", maxWidth: 16 }, children: (0, jsx_runtime_1.jsx)(ColumnOrderingIndicator, { iconSortAsc: iconSortAsc, iconSortDesc: iconSortDesc, iconNoSort: iconNoSort, direction: ((_b = header.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.accessorKey) === _sortBy
391
391
  ? _sortingDirection
392
- : undefined })) })] }) }), header.column.getCanResize() && ((0, jsx_runtime_1.jsx)("div", { onDoubleClick: () => {
392
+ : undefined }) }))] }) }), header.column.getCanResize() && ((0, jsx_runtime_1.jsx)("div", { onDoubleClick: () => {
393
393
  touchedSizesRef.current[header.column.id] = false;
394
394
  if (header.column.columnDef.size !== undefined) {
395
395
  header.column.resetSize();
@@ -112,7 +112,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
112
112
  [`borderColor-${COMP}-code`]: "$color-surface-300",
113
113
  [`backgroundColor-${COMP}-keyboard`]: "rgba($color-surface-100-rgb, .4)",
114
114
  [`borderColor-${COMP}-keyboard`]: "$color-surface-300",
115
- [`backgroundColor-${COMP}-marked`]: "yellow",
115
+ [`backgroundColor-${COMP}-marked`]: "rgba($color-primary-200-rgb, .4)",
116
116
  [`color-${COMP}-placeholder`]: "$color-surface-500",
117
117
  [`color-${COMP}-codefence`]: "$color-surface-900",
118
118
  [`color-${COMP}-subheading`]: "$textColor-secondary",
@@ -47,7 +47,8 @@ const misc_1 = require("../../components-core/utils/misc");
47
47
  const InputAdornment_1 = require("../Input/InputAdornment");
48
48
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
49
49
  exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
50
- id = id || (0, react_1.useId)();
50
+ const _id = (0, react_1.useId)();
51
+ id = id || _id;
51
52
  const inputRef = (0, react_2.useRef)(null);
52
53
  (0, react_2.useEffect)(() => {
53
54
  if (autoFocus) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toneChangerButtonComponentRenderer = exports.ToneChangerButtonMd = void 0;
4
+ exports.ToneChangerButton = ToneChangerButton;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
6
7
  const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
@@ -55,7 +55,6 @@ const constants_1 = require("../constants");
55
55
  const extendThemeUtils_1 = require("../theming/extendThemeUtils");
56
56
  const ComponentRegistryContext_1 = require("../../components/ComponentRegistryContext");
57
57
  const xmlui_1 = require("../theming/themes/xmlui");
58
- const solid_1 = require("../theming/themes/solid");
59
58
  const hooks_1 = require("../utils/hooks");
60
59
  const ThemingDefs_1 = require("../../abstractions/ThemingDefs");
61
60
  function useCompiledTheme(activeTheme, activeTone, themes = constants_1.EMPTY_ARRAY, resources = constants_1.EMPTY_OBJECT, resourceMap = constants_1.EMPTY_OBJECT) {
@@ -198,7 +197,7 @@ exports.builtInThemes = [
198
197
  xmlui_1.XmlUiPurpleThemeDefinition,
199
198
  xmlui_1.XmlUiCyanThemeDefinition,
200
199
  xmlui_1.XmlUiRedThemeDefinition,
201
- solid_1.SolidThemeDefinition,
200
+ /*SolidThemeDefinition,*/
202
201
  ];
203
202
  // theme-overriding properties change.
204
203
  function ThemeProvider({ children, themes: custThemes = constants_1.EMPTY_ARRAY, defaultTheme = "xmlui", defaultTone = "light", resources = constants_1.EMPTY_OBJECT, resourceMap = constants_1.EMPTY_OBJECT, localThemes = constants_1.EMPTY_OBJECT, }) {
@@ -98,7 +98,12 @@ declare namespace all {
98
98
  builtInThemes,
99
99
  XmlUiHelper,
100
100
  Text_2 as Text,
101
- NestedApp
101
+ TextBox,
102
+ NestedApp,
103
+ VisuallyHidden,
104
+ LinkNative,
105
+ ToneChangerButton,
106
+ Logo
102
107
  }
103
108
  }
104
109
 
@@ -955,7 +960,55 @@ declare const _default: {
955
960
  ellipses?: boolean;
956
961
  style?: default_2.CSSProperties;
957
962
  }, "ref"> & default_2.RefAttributes<unknown>>;
963
+ TextBox: default_2.ForwardRefExoticComponent<{
964
+ id?: string;
965
+ type?: "search" | "text" | "password";
966
+ value?: string;
967
+ updateState?: UpdateStateFn;
968
+ initialValue?: string;
969
+ style?: default_2.CSSProperties;
970
+ maxLength?: number;
971
+ enabled?: boolean;
972
+ placeholder?: string;
973
+ validationStatus?: "none" | "error" | "warning" | "valid";
974
+ onDidChange?: (newValue: string) => void;
975
+ onFocus?: () => void;
976
+ onBlur?: () => void;
977
+ registerComponentApi?: all.RegisterComponentApiFn;
978
+ startText?: string;
979
+ startIcon?: string;
980
+ endText?: string;
981
+ endIcon?: string;
982
+ gap?: string;
983
+ autoFocus?: boolean;
984
+ readOnly?: boolean;
985
+ tabIndex?: number;
986
+ label?: string;
987
+ labelPosition?: string;
988
+ labelWidth?: string;
989
+ labelBreak?: boolean;
990
+ required?: boolean;
991
+ } & default_2.RefAttributes<HTMLDivElement>>;
958
992
  NestedApp: typeof all.NestedApp;
993
+ VisuallyHidden: ({ children, ...props }: {
994
+ children: default_2.ReactNode;
995
+ }) => default_3.JSX.Element;
996
+ LinkNative: default_2.ForwardRefExoticComponent<{
997
+ to: string | {
998
+ pathname: string;
999
+ queryParams?: Record<string, any>;
1000
+ };
1001
+ children: default_2.ReactNode;
1002
+ icon?: string;
1003
+ active?: boolean;
1004
+ disabled?: boolean;
1005
+ onClick?: () => void;
1006
+ style?: default_2.CSSProperties;
1007
+ } & Partial<Pick<HTMLAnchorElement, "type" | "target" | "rel" | "download" | "ping" | "referrerPolicy" | "hreflang">> & default_2.RefAttributes<HTMLDivElement>>;
1008
+ ToneChangerButton: typeof all.ToneChangerButton;
1009
+ Logo: default_2.ForwardRefExoticComponent<{
1010
+ style?: default_2.CSSProperties;
1011
+ } & default_2.RefAttributes<HTMLImageElement>>;
959
1012
  };
960
1013
  export default _default;
961
1014
 
@@ -1297,6 +1350,19 @@ declare interface LetStatement extends ScripNodeBase {
1297
1350
  decls: VarDeclaration[];
1298
1351
  }
1299
1352
 
1353
+ declare const LinkNative: ForwardRefExoticComponent< {
1354
+ to: string | {
1355
+ pathname: string;
1356
+ queryParams?: Record<string, any>;
1357
+ };
1358
+ children: ReactNode;
1359
+ icon?: string;
1360
+ active?: boolean;
1361
+ disabled?: boolean;
1362
+ onClick?: () => void;
1363
+ style?: CSSProperties;
1364
+ } & Partial<Pick<HTMLAnchorElement, "type" | "target" | "rel" | "download" | "ping" | "referrerPolicy" | "hreflang">> & RefAttributes<HTMLDivElement>>;
1365
+
1300
1366
  declare type LITERAL = typeof T_LITERAL;
1301
1367
 
1302
1368
  declare interface Literal extends ExpressionBase {
@@ -1322,6 +1388,10 @@ declare type LoggedInUserDto = {
1322
1388
  permissions: Record<string, string>;
1323
1389
  };
1324
1390
 
1391
+ declare const Logo: ForwardRefExoticComponent< {
1392
+ style?: CSSProperties;
1393
+ } & RefAttributes<HTMLImageElement>>;
1394
+
1325
1395
  /**
1326
1396
  * This type represents the options to use for looking up actions.
1327
1397
  */
@@ -1533,6 +1603,36 @@ declare type Props_3 = {
1533
1603
  distributeEvenly?: boolean;
1534
1604
  };
1535
1605
 
1606
+ declare type Props_4 = {
1607
+ id?: string;
1608
+ type?: "text" | "password" | "search";
1609
+ value?: string;
1610
+ updateState?: UpdateStateFn;
1611
+ initialValue?: string;
1612
+ style?: CSSProperties;
1613
+ maxLength?: number;
1614
+ enabled?: boolean;
1615
+ placeholder?: string;
1616
+ validationStatus?: ValidationStatus;
1617
+ onDidChange?: (newValue: string) => void;
1618
+ onFocus?: () => void;
1619
+ onBlur?: () => void;
1620
+ registerComponentApi?: RegisterComponentApiFn;
1621
+ startText?: string;
1622
+ startIcon?: string;
1623
+ endText?: string;
1624
+ endIcon?: string;
1625
+ gap?: string;
1626
+ autoFocus?: boolean;
1627
+ readOnly?: boolean;
1628
+ tabIndex?: number;
1629
+ label?: string;
1630
+ labelPosition?: string;
1631
+ labelWidth?: string;
1632
+ labelBreak?: boolean;
1633
+ required?: boolean;
1634
+ };
1635
+
1536
1636
  declare type REACTIVE_VAR_DECLARATION = typeof T_REACTIVE_VAR_DECLARATION;
1537
1637
 
1538
1638
  declare interface ReactiveVarDeclaration extends ExpressionBase {
@@ -1907,6 +2007,8 @@ declare interface TemplateLiteralExpression extends ExpressionBase {
1907
2007
 
1908
2008
  declare const Text_2: default_2.ForwardRefExoticComponent<Omit<TextProps, "ref"> & default_2.RefAttributes<unknown>>;
1909
2009
 
2010
+ declare const TextBox: default_2.ForwardRefExoticComponent<Props_4 & default_2.RefAttributes<HTMLDivElement>>;
2011
+
1910
2012
  declare type TextProps = {
1911
2013
  uid?: string;
1912
2014
  children?: default_2.ReactNode;
@@ -2136,6 +2238,11 @@ declare enum TokenType {
2136
2238
  From = 97
2137
2239
  }
2138
2240
 
2241
+ declare function ToneChangerButton({ lightToDarkIcon, darkToLightIcon }: {
2242
+ lightToDarkIcon?: string;
2243
+ darkToLightIcon?: string;
2244
+ }): JSX_2.Element;
2245
+
2139
2246
  declare type TrackContainerHeight = "auto" | "fixed";
2140
2247
 
2141
2248
  declare interface TreeNode {
@@ -2196,6 +2303,10 @@ declare const useLogger: () => LogContextType;
2196
2303
 
2197
2304
  declare function useTheme(): ThemeScope;
2198
2305
 
2306
+ declare type ValidationStatus = (typeof validationStatusValues)[number];
2307
+
2308
+ declare const validationStatusValues: readonly ["none", "error", "warning", "valid"];
2309
+
2199
2310
  /**
2200
2311
  * This type represent the function that extracts the value from a component property
2201
2312
  */
@@ -2273,6 +2384,10 @@ declare interface VarStatement extends ScripNodeBase {
2273
2384
  decls: ReactiveVarDeclaration[];
2274
2385
  }
2275
2386
 
2387
+ declare const VisuallyHidden: ({ children, ...props }: {
2388
+ children: React.ReactNode;
2389
+ }) => JSX_2.Element;
2390
+
2276
2391
  declare type WHILE_STATEMENT = typeof T_WHILE_STATEMENT;
2277
2392
 
2278
2393
  declare interface WhileStatement extends ScripNodeBase {