xmlui 0.9.63 → 0.9.64

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 (44) hide show
  1. package/dist/lib/{apiInterceptorWorker-DYPN1T0q.mjs → apiInterceptorWorker--1siIib9.mjs} +1 -1
  2. package/dist/lib/{index-BcEgj7aN.mjs → index-DQYBJR26.mjs} +27228 -16681
  3. package/dist/lib/index.css +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{metadata-utils-DJM8orNd.mjs → metadata-utils-Bes0jMw3.mjs} +1 -1
  7. package/dist/lib/{server-common-D0VA8gIv.mjs → server-common-CfdMYx46.mjs} +2 -2
  8. package/dist/lib/{transform-BdB0APqE.mjs → transform-C_5kSXBN.mjs} +58 -58
  9. package/dist/lib/xmlui-parser.d.ts +0 -1
  10. package/dist/lib/xmlui-parser.mjs +2 -2
  11. package/dist/lib/{xmlui-serializer-COAfRndx.mjs → xmlui-serializer-jEIItW8v.mjs} +11 -3
  12. package/dist/lib/xmlui.d.ts +2 -2
  13. package/dist/lib/xmlui.mjs +2 -2
  14. package/dist/metadata/{apiInterceptorWorker-PHZNbofw.mjs → apiInterceptorWorker-C1cI935F.mjs} +1 -1
  15. package/dist/metadata/{collectedComponentMetadata-BGIWhaXW.mjs → collectedComponentMetadata-CEyXwr66.mjs} +25799 -16508
  16. package/dist/metadata/style.css +1 -1
  17. package/dist/metadata/xmlui-metadata.mjs +1 -1
  18. package/dist/metadata/xmlui-metadata.umd.js +146 -117
  19. package/dist/scripts/package.json +6 -1
  20. package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +6 -1
  21. package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +6 -1
  22. package/dist/scripts/src/components/CodeBlock/highlight-code.js +34 -13
  23. package/dist/scripts/src/components/ComponentProvider.js +4 -0
  24. package/dist/scripts/src/components/FormItem/FormItem.js +1 -0
  25. package/dist/scripts/src/components/FormSection/FormSection.js +42 -2
  26. package/dist/scripts/src/components/Icon/TableDeleteColumnIcon.js +7 -0
  27. package/dist/scripts/src/components/Icon/TableDeleteRowIcon.js +7 -0
  28. package/dist/scripts/src/components/Icon/TableInsertColumnIcon.js +7 -0
  29. package/dist/scripts/src/components/Icon/TableInsertRowIcon.js +7 -0
  30. package/dist/scripts/src/components/IconProvider.js +11 -0
  31. package/dist/scripts/src/components/Markdown/MarkdownNative.js +3 -3
  32. package/dist/scripts/src/components/Markdown/utils.js +13 -8
  33. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +4 -0
  34. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +3 -3
  35. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +15 -12
  36. package/dist/scripts/src/components/NestedApp/defaultProps.js +1 -0
  37. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +4 -6
  38. package/dist/scripts/src/components/TableEditor/TableEditor.js +183 -0
  39. package/dist/scripts/src/components/TableEditor/TableEditorNative.js +8 -0
  40. package/dist/scripts/src/parsers/xmlui-parser/transform.js +0 -3
  41. package/dist/standalone/xmlui-standalone.es.d.ts +2 -2
  42. package/dist/standalone/xmlui-standalone.umd.js +269 -237
  43. package/package.json +6 -1
  44. package/dist/scripts/src/components-core/theming/themes/solid.js +0 -16
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.editorComponentRenderer = exports.TableEditorMd = void 0;
40
+ const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const react_1 = __importStar(require("react"));
42
+ const react_2 = require("@tiptap/react");
43
+ const starter_kit_1 = __importDefault(require("@tiptap/starter-kit"));
44
+ const extension_table_1 = __importDefault(require("@tiptap/extension-table"));
45
+ const extension_table_row_1 = __importDefault(require("@tiptap/extension-table-row"));
46
+ const extension_table_cell_1 = __importDefault(require("@tiptap/extension-table-cell"));
47
+ const extension_table_header_1 = __importDefault(require("@tiptap/extension-table-header"));
48
+ const ButtonNative_1 = require("../Button/ButtonNative");
49
+ const StackNative_1 = require("../Stack/StackNative");
50
+ const TableEditorNative_1 = require("./TableEditorNative");
51
+ const turndown_1 = __importDefault(require("turndown"));
52
+ const metadata_helpers_1 = require("../metadata-helpers");
53
+ const renderers_1 = require("../../components-core/renderers");
54
+ const abstractions_1 = require("../abstractions");
55
+ const IconNative_1 = __importDefault(require("../Icon/IconNative"));
56
+ const TableEditor_module_scss_1 = __importDefault(require("./TableEditor.module.scss"));
57
+ const themeVars_1 = require("../../components-core/theming/themeVars");
58
+ const TableEditor = (0, react_1.forwardRef)(function TableEditor({ registerComponentApi, themeColor = "primary", variant = "solid", size = "sm", onDidChange = () => { }, }, ref) {
59
+ const editor = (0, react_2.useEditor)({
60
+ extensions: [
61
+ starter_kit_1.default,
62
+ extension_table_1.default.configure({ resizable: true }),
63
+ extension_table_row_1.default,
64
+ extension_table_header_1.default,
65
+ extension_table_cell_1.default,
66
+ ],
67
+ content: `
68
+ <table>
69
+ <thead>
70
+ <tr>
71
+ <th>Fruit</th>
72
+ <th>Color</th>
73
+ </tr>
74
+ </thead>
75
+ <tbody>
76
+ <tr>
77
+ <td>Apple</td>
78
+ <td>Red</td>
79
+ </tr>
80
+ <tr>
81
+ <td>Banana</td>
82
+ <td>Yellow</td>
83
+ </tr>
84
+ </tbody>
85
+ </table>
86
+ `,
87
+ });
88
+ const turndownService = new turndown_1.default();
89
+ turndownService.addRule("table", {
90
+ filter: "table",
91
+ replacement: function (content, node) {
92
+ let rows = [];
93
+ for (let row of node.querySelectorAll("tr")) {
94
+ let cells = Array.from(row.children).map((cell) => { var _a, _b; return (_b = (_a = cell.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : ""; });
95
+ rows.push("| " + cells.join(" | ") + " |");
96
+ }
97
+ if (rows.length > 1) {
98
+ // Add a separator after the header row
99
+ const headerSep = "| " +
100
+ rows[0]
101
+ .split("|")
102
+ .slice(1, -1)
103
+ .map(() => "---")
104
+ .join(" | ") +
105
+ " |";
106
+ rows.splice(1, 0, headerSep);
107
+ }
108
+ return rows.join("\n") + "\n";
109
+ },
110
+ });
111
+ (0, react_1.useImperativeHandle)(ref, () => ({
112
+ getMarkdownSource: () => { var _a, _b; return turndownService.turndown((_b = (_a = editor === null || editor === void 0 ? void 0 : editor.getHTML) === null || _a === void 0 ? void 0 : _a.call(editor)) !== null && _b !== void 0 ? _b : ""); },
113
+ getHtmlSource: () => { var _a, _b; return (_b = (_a = editor === null || editor === void 0 ? void 0 : editor.getHTML) === null || _a === void 0 ? void 0 : _a.call(editor)) !== null && _b !== void 0 ? _b : ""; },
114
+ }), [editor]);
115
+ react_1.default.useEffect(() => {
116
+ if (registerComponentApi && editor) {
117
+ registerComponentApi({
118
+ getHtmlSource: () => editor.getHTML(),
119
+ getMarkdownSource: () => turndownService.turndown(editor.getHTML()),
120
+ });
121
+ }
122
+ }, [registerComponentApi, editor]);
123
+ // Emit onDidChange whenever the editor content changes
124
+ react_1.default.useEffect(() => {
125
+ if (!editor)
126
+ return;
127
+ const handler = () => {
128
+ const html = editor.getHTML();
129
+ const markdown = turndownService.turndown(html);
130
+ //console.log("[TableEditor] onDidChange about to fire", { html, markdown, onDidChange });
131
+ onDidChange({ html, markdown });
132
+ };
133
+ editor.on("update", handler);
134
+ // Emit once on mount
135
+ handler();
136
+ return () => {
137
+ editor.off("update", handler);
138
+ };
139
+ }, [editor, onDidChange]);
140
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "table-editor-root", children: [(0, jsx_runtime_1.jsx)("div", { className: "button-stack", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => editor && editor.commands.addRowAfter(), disabled: !editor, themeColor: themeColor, variant: variant, size: size, orientation: "horizontal", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "table-insert-row", "aria-hidden": true }), children: "Insert Row" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => editor && editor.commands.deleteRow(), disabled: !editor, themeColor: themeColor, variant: variant, size: size, orientation: "horizontal", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "table-delete-row", "aria-hidden": true }), children: "Delete Row" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => editor && editor.commands.addColumnAfter(), disabled: !editor, themeColor: themeColor, variant: variant, size: size, orientation: "horizontal", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "table-insert-column", "aria-hidden": true }), children: "Insert Column" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => editor && editor.commands.deleteColumn(), disabled: !editor, themeColor: themeColor, variant: variant, size: size, orientation: "horizontal", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "table-delete-column", "aria-hidden": true }), children: "Delete Column" })] }) }), (0, jsx_runtime_1.jsx)(TableEditorNative_1.TableEditorNative, { editor: editor, className: TableEditor_module_scss_1.default.editor })] }));
141
+ });
142
+ exports.default = TableEditor;
143
+ // Create metadata for TableEditor that defines allowed props
144
+ exports.TableEditorMd = (0, metadata_helpers_1.createMetadata)({
145
+ description: "`TableEditor` provides an interactive table editing interface with controls for adding and deleting rows and columns. It supports theme customization and exports table data in HTML and Markdown formats.",
146
+ status: "stable",
147
+ props: {
148
+ themeColor: {
149
+ description: "Sets the color scheme for all editor buttons.",
150
+ isRequired: false,
151
+ type: "string",
152
+ availableValues: abstractions_1.buttonThemeMd,
153
+ defaultValue: "primary",
154
+ },
155
+ variant: {
156
+ description: "Sets the visual style for all editor buttons.",
157
+ isRequired: false,
158
+ type: "string",
159
+ availableValues: abstractions_1.buttonVariantMd,
160
+ defaultValue: "solid",
161
+ },
162
+ size: {
163
+ description: "Sets the size for all editor buttons.",
164
+ isRequired: false,
165
+ type: "string",
166
+ availableValues: abstractions_1.sizeMd,
167
+ defaultValue: "sm",
168
+ },
169
+ },
170
+ events: {
171
+ didChange: {
172
+ description: "Fired whenever the table content changes. Payload: { html, markdown }.",
173
+ isRequired: false,
174
+ type: "function",
175
+ },
176
+ },
177
+ themeVars: (0, themeVars_1.parseScssVar)(TableEditor_module_scss_1.default.themeVars),
178
+ });
179
+ exports.editorComponentRenderer = (0, renderers_1.createComponentRenderer)("TableEditor", exports.TableEditorMd, ({ node, extractValue, registerComponentApi, lookupEventHandler }) => {
180
+ const handler = lookupEventHandler === null || lookupEventHandler === void 0 ? void 0 : lookupEventHandler("didChange");
181
+ //console.log("[TableEditor renderer] didChange handler:", handler);
182
+ return ((0, jsx_runtime_1.jsx)(TableEditor, { themeColor: extractValue.asOptionalString(node.props.themeColor), variant: extractValue.asOptionalString(node.props.variant), size: extractValue.asOptionalString(node.props.size), registerComponentApi: registerComponentApi, onDidChange: handler }));
183
+ });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableEditorNative = TableEditorNative;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@tiptap/react");
6
+ function TableEditorNative({ editor, className }) {
7
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsx)(react_1.EditorContent, { editor: editor }) }));
8
+ }
@@ -1041,7 +1041,6 @@ function desugarKeyOnlyAttrs(attrs) {
1041
1041
  }
1042
1042
  }
1043
1043
  function addToNamespaces(namespaceStack, comp, nsKey, value) {
1044
- var _a;
1045
1044
  let nsCommaSeparated = value.split(":");
1046
1045
  if (nsCommaSeparated.length > 2) {
1047
1046
  return reportError("T028", value, "Namespace cannot contain multiple ':' (colon).");
@@ -1072,8 +1071,6 @@ function addToNamespaces(namespaceStack, comp, nsKey, value) {
1072
1071
  return reportError("T025", nsKey);
1073
1072
  }
1074
1073
  compNamespaces.set(nsKey, nsValue);
1075
- (_a = comp.namespaces) !== null && _a !== void 0 ? _a : (comp.namespaces = {});
1076
- comp.namespaces[nsKey] = nsValue;
1077
1074
  }
1078
1075
  function getTopLvlElement(node, getText) {
1079
1076
  // --- Check that the nodes contains exactly only a single component root element before the EoF token
@@ -330,7 +330,6 @@ declare interface ComponentDefCore {
330
330
  type: string;
331
331
  uid?: string;
332
332
  testId?: string;
333
- namespaces?: Record<string, string>;
334
333
  vars?: Record<string, any>;
335
334
  children?: ComponentDef[];
336
335
  slots?: Record<string, ComponentDef[]>;
@@ -881,7 +880,7 @@ declare interface NavHierarchyNode {
881
880
  lastLink?: boolean;
882
881
  }
883
882
 
884
- declare function NestedApp({ api, app, components, config, activeTheme, activeTone, title, height, allowPlaygroundPopup, popOutUrl, withFrame, style, refVersion, }: NestedAppProps): JSX_2.Element;
883
+ declare function NestedApp({ api, app, components, config, activeTheme, activeTone, title, height, allowPlaygroundPopup, popOutUrl, withFrame, noHeader, style, refVersion, }: NestedAppProps): JSX_2.Element;
885
884
 
886
885
  declare type NestedAppProps = {
887
886
  api?: any;
@@ -895,6 +894,7 @@ declare type NestedAppProps = {
895
894
  allowPlaygroundPopup?: boolean;
896
895
  popOutUrl?: string;
897
896
  withFrame?: boolean;
897
+ noHeader?: boolean;
898
898
  style?: CSSProperties;
899
899
  splitView?: boolean;
900
900
  refVersion?: number;