xmlui 0.9.72 → 0.9.73
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/lib/{apiInterceptorWorker-B9Uw4ogq.mjs → apiInterceptorWorker-VgjaTiLV.mjs} +1 -1
- package/dist/lib/{index-DHZSwtDq.mjs → index-By3AkYm2.mjs} +2565 -2504
- package/dist/lib/index.css +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{server-common-LUcdzTQs.mjs → server-common-CfdMYx46.mjs} +4453 -4423
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{apiInterceptorWorker-DwXA1Dk9.mjs → apiInterceptorWorker-BGM0pNVK.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-B6Gwz_zi.mjs → collectedComponentMetadata-CduyISDB.mjs} +915 -854
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +42 -42
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +8 -2
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +12 -12
- package/dist/scripts/src/components/NestedApp/NestedApp.js +2 -2
- package/dist/scripts/src/components-core/event-handlers.js +2 -1
- package/dist/scripts/src/components-core/utils/date-utils.js +47 -8
- package/dist/standalone/xmlui-standalone.umd.js +119 -119
- package/package.json +1 -1
|
@@ -197,11 +197,17 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = exports
|
|
|
197
197
|
let label = children;
|
|
198
198
|
// --- Extract the optional target
|
|
199
199
|
if (typeof children === "string") {
|
|
200
|
-
|
|
200
|
+
// Match a non-escaped pipe followed by target specification
|
|
201
|
+
const match = children.match(/^((?:[^|]|\\\|)*[^\\])\|\s*target\s*=\s*([_a-zA-Z0-9-]+)\s*$/);
|
|
201
202
|
if (match) {
|
|
202
|
-
|
|
203
|
+
// Unescape any escaped pipes in the label
|
|
204
|
+
label = match[1].trim().replace(/\\\|/g, '|');
|
|
203
205
|
target = match[2];
|
|
204
206
|
}
|
|
207
|
+
else {
|
|
208
|
+
// If no target specification, unescape any escaped pipes in the whole text
|
|
209
|
+
label = children.replace(/\\\|/g, '|');
|
|
210
|
+
}
|
|
205
211
|
}
|
|
206
212
|
return ((0, jsx_runtime_1.jsx)(LinkNative_1.LinkNative, Object.assign({ to: href, target: target }, props, { children: label })));
|
|
207
213
|
},
|
|
@@ -60,18 +60,18 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
60
60
|
window.open(`${safePopOutUrl}/#${appQueryString}`, "_blank");
|
|
61
61
|
}), [app, components, title, activeTheme, api, activeTone, safePopOutUrl]);
|
|
62
62
|
if (withFrame) {
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [!noHeader && ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [!splitView && (0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), splitView && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.wrapper, children: (0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }) }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!markdown && !splitView && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [!noHeader && ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [!splitView && (0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), splitView && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.wrapper, children: (0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }) }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
|
|
64
|
+
[NestedApp_module_scss_1.default.show]: showCode,
|
|
65
|
+
[NestedApp_module_scss_1.default.hide]: !showCode,
|
|
66
|
+
}), children: "XML" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(false), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
|
|
67
|
+
[NestedApp_module_scss_1.default.show]: !showCode,
|
|
68
|
+
[NestedApp_module_scss_1.default.hide]: showCode,
|
|
69
|
+
}), children: "UI" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.wrapper, children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
70
|
+
openPlayground();
|
|
71
|
+
}, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
72
|
+
setShowCode(false);
|
|
73
|
+
setRefreshVersion(refreshVersion + 1);
|
|
74
|
+
}, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.contentContainer, children: [showCode && ((0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { style: { height: "100%" }, className: NestedApp_module_scss_1.default.splitViewMarkdown, children: markdown })), !showCode && ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { height: "100%", app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion }))] })] })] }));
|
|
75
75
|
}
|
|
76
76
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!markdown && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }), (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { height: height, app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion })] }));
|
|
77
77
|
}
|
|
@@ -59,9 +59,9 @@ exports.NestedAppMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
59
59
|
[`padding-viewControls-${COMP}`]: "$space-0_5",
|
|
60
60
|
[`borderBottom-header-${COMP}`]: "0.5px solid $borderColor",
|
|
61
61
|
// --- Split view styles
|
|
62
|
-
[`padding-button-splitView-${COMP}`]: "
|
|
62
|
+
[`padding-button-splitView-${COMP}`]: "1px 6px",
|
|
63
63
|
[`width-button-splitView-${COMP}`]: "60px",
|
|
64
|
-
[`width-logo-splitView-${COMP}`]: "
|
|
64
|
+
[`width-logo-splitView-${COMP}`]: "1.5rem",
|
|
65
65
|
[`height-logo-splitView-${COMP}`]: "2rem",
|
|
66
66
|
[`backgroundColor-button-splitView-${COMP}--active`]: "$color-surface-0",
|
|
67
67
|
[`color-button-splitView-${COMP}`]: "$color-surface-600",
|
|
@@ -33,8 +33,9 @@ function useMouseEventHandlers(lookupEvent, shouldSkip) {
|
|
|
33
33
|
? undefined
|
|
34
34
|
: lookupEvent(eventName);
|
|
35
35
|
const eventHandler = (0, react_1.useCallback)((event) => {
|
|
36
|
+
// If the event handler is not defined, we do nothing
|
|
36
37
|
if (onEvent) {
|
|
37
|
-
event.stopPropagation();
|
|
38
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
38
39
|
onEvent(event);
|
|
39
40
|
}
|
|
40
41
|
}, [onEvent]);
|
|
@@ -82,9 +82,10 @@ function isDateTomorrow(date) {
|
|
|
82
82
|
* Returns strings like "now", "12 seconds ago", "3 hours ago", "today", "yesterday", "3 weeks ago", etc.
|
|
83
83
|
*
|
|
84
84
|
* @param date The date to format
|
|
85
|
+
* @param shortFormat When true, uses abbreviated time units (e.g. "s" instead of "seconds")
|
|
85
86
|
* @returns A human-readable elapsed time string
|
|
86
87
|
*/
|
|
87
|
-
function formatHumanElapsedTime(date) {
|
|
88
|
+
function formatHumanElapsedTime(date, shortFormat = false) {
|
|
88
89
|
const now = new Date();
|
|
89
90
|
const inputDate = new Date(date);
|
|
90
91
|
// Calculate time difference in milliseconds
|
|
@@ -101,21 +102,55 @@ function formatHumanElapsedTime(date) {
|
|
|
101
102
|
const diffWeeks = Math.floor(diffDays / 7);
|
|
102
103
|
const diffMonths = Math.floor(diffDays / 30);
|
|
103
104
|
const diffYears = Math.floor(diffDays / 365);
|
|
105
|
+
// Define unit formats based on shortFormat parameter
|
|
106
|
+
const units = {
|
|
107
|
+
second: {
|
|
108
|
+
singular: shortFormat ? 's' : 'second',
|
|
109
|
+
plural: shortFormat ? 's' : 'seconds'
|
|
110
|
+
},
|
|
111
|
+
minute: {
|
|
112
|
+
singular: shortFormat ? 'min' : 'minute',
|
|
113
|
+
plural: shortFormat ? 'min' : 'minutes'
|
|
114
|
+
},
|
|
115
|
+
hour: {
|
|
116
|
+
singular: shortFormat ? 'hr' : 'hour',
|
|
117
|
+
plural: shortFormat ? 'hrs' : 'hours'
|
|
118
|
+
},
|
|
119
|
+
day: {
|
|
120
|
+
singular: shortFormat ? 'd' : 'day',
|
|
121
|
+
plural: shortFormat ? 'd' : 'days'
|
|
122
|
+
},
|
|
123
|
+
week: {
|
|
124
|
+
singular: shortFormat ? 'wk' : 'week',
|
|
125
|
+
plural: shortFormat ? 'wks' : 'weeks'
|
|
126
|
+
},
|
|
127
|
+
month: {
|
|
128
|
+
singular: shortFormat ? 'mo' : 'month',
|
|
129
|
+
plural: shortFormat ? 'mos' : 'months'
|
|
130
|
+
},
|
|
131
|
+
year: {
|
|
132
|
+
singular: shortFormat ? 'y' : 'year',
|
|
133
|
+
plural: shortFormat ? 'yrs' : 'years'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
104
136
|
// Just now (within 10 seconds)
|
|
105
137
|
if (diffSeconds < 10) {
|
|
106
138
|
return "now";
|
|
107
139
|
}
|
|
108
140
|
// Seconds ago (up to 1 minute)
|
|
109
141
|
if (diffSeconds < 60) {
|
|
110
|
-
|
|
142
|
+
const unit = diffSeconds === 1 ? units.second.singular : units.second.plural;
|
|
143
|
+
return `${diffSeconds} ${unit} ago`;
|
|
111
144
|
}
|
|
112
145
|
// Minutes ago (up to 1 hour)
|
|
113
146
|
if (diffMinutes < 60) {
|
|
114
|
-
|
|
147
|
+
const unit = diffMinutes === 1 ? units.minute.singular : units.minute.plural;
|
|
148
|
+
return `${diffMinutes} ${unit} ago`;
|
|
115
149
|
}
|
|
116
150
|
// Hours ago (up to today)
|
|
117
151
|
if ((0, date_fns_1.isToday)(inputDate)) {
|
|
118
|
-
|
|
152
|
+
const unit = diffHours === 1 ? units.hour.singular : units.hour.plural;
|
|
153
|
+
return `${diffHours} ${unit} ago`;
|
|
119
154
|
}
|
|
120
155
|
// Yesterday
|
|
121
156
|
if ((0, date_fns_1.isYesterday)(inputDate)) {
|
|
@@ -123,16 +158,20 @@ function formatHumanElapsedTime(date) {
|
|
|
123
158
|
}
|
|
124
159
|
// Days ago (up to 1 week)
|
|
125
160
|
if (diffDays < 7) {
|
|
126
|
-
|
|
161
|
+
const unit = diffDays === 1 ? units.day.singular : units.day.plural;
|
|
162
|
+
return `${diffDays} ${unit} ago`;
|
|
127
163
|
}
|
|
128
164
|
// Weeks ago (up to 4 weeks / 1 month)
|
|
129
165
|
if (diffWeeks < 4) {
|
|
130
|
-
|
|
166
|
+
const unit = diffWeeks === 1 ? units.week.singular : units.week.plural;
|
|
167
|
+
return `${diffWeeks} ${unit} ago`;
|
|
131
168
|
}
|
|
132
169
|
// Months ago (up to 12 months / 1 year)
|
|
133
170
|
if (diffMonths < 12) {
|
|
134
|
-
|
|
171
|
+
const unit = diffMonths === 1 ? units.month.singular : units.month.plural;
|
|
172
|
+
return `${diffMonths} ${unit} ago`;
|
|
135
173
|
}
|
|
136
174
|
// Years ago
|
|
137
|
-
|
|
175
|
+
const unit = diffYears === 1 ? units.year.singular : units.year.plural;
|
|
176
|
+
return `${diffYears} ${unit} ago`;
|
|
138
177
|
}
|