dsh-generative-ui 0.0.3 → 0.0.4
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/lib/client.js +313 -306
- package/lib/client.js.map +4 -4
- package/lib/index.js +11 -10
- package/lib/types/client/runtime/inline-fence.d.ts +5 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +42 -25
- package/src/client/index.ts +4 -1
- package/src/client/runtime/inline-fence.ts +10 -2
- package/src/index.ts +10 -11
package/lib/client.js
CHANGED
|
@@ -20,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
20
20
|
return cached;
|
|
21
21
|
}
|
|
22
22
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
23
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
24
24
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
25
25
|
for (let key of __getOwnPropNames(mod))
|
|
26
26
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -353,8 +353,8 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
353
353
|
}
|
|
354
354
|
function ua(a) {
|
|
355
355
|
var b = "";
|
|
356
|
-
aa.Children.forEach(a, function(
|
|
357
|
-
|
|
356
|
+
aa.Children.forEach(a, function(a) {
|
|
357
|
+
a != null && (b += a);
|
|
358
358
|
});
|
|
359
359
|
return b;
|
|
360
360
|
}
|
|
@@ -696,8 +696,8 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
696
696
|
}
|
|
697
697
|
var Ca = /[<\u2028\u2029]/g;
|
|
698
698
|
function Da(a) {
|
|
699
|
-
return JSON.stringify(a).replace(Ca, function(
|
|
700
|
-
switch (
|
|
699
|
+
return JSON.stringify(a).replace(Ca, function(a) {
|
|
700
|
+
switch (a) {
|
|
701
701
|
case "<":
|
|
702
702
|
return "\\u003c";
|
|
703
703
|
case "\u2028":
|
|
@@ -1065,9 +1065,9 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
1065
1065
|
a.allPendingTasks++;
|
|
1066
1066
|
c === null ? a.pendingRootTasks++ : c.pendingTasks++;
|
|
1067
1067
|
var k = { node: b, ping: function() {
|
|
1068
|
-
var
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
var b = a.pingedTasks;
|
|
1069
|
+
b.push(k);
|
|
1070
|
+
b.length === 1 && Cb(a);
|
|
1071
1071
|
}, blockedBoundary: c, blockedSegment: d, abortSet: f, legacyContext: e, context: g, treeContext: h };
|
|
1072
1072
|
f.add(k);
|
|
1073
1073
|
return k;
|
|
@@ -1322,7 +1322,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
1322
1322
|
}
|
|
1323
1323
|
}
|
|
1324
1324
|
function Hb(a, b, c) {
|
|
1325
|
-
var d = b.blockedSegment.formatContext,
|
|
1325
|
+
var d = b.blockedSegment.formatContext, { legacyContext: f, context: e } = b;
|
|
1326
1326
|
try {
|
|
1327
1327
|
return X(a, b, c);
|
|
1328
1328
|
} catch (k) {
|
|
@@ -1350,8 +1350,8 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
1350
1350
|
function Lb(a, b, c) {
|
|
1351
1351
|
var d = a.blockedBoundary;
|
|
1352
1352
|
a.blockedSegment.status = 3;
|
|
1353
|
-
d === null ? (b.allPendingTasks--, b.status !== 2 && (b.status = 2, b.destination !== null && b.destination.push(null))) : (d.pendingTasks--, d.forceClientRender || (d.forceClientRender = true, a = c === undefined ? Error(l(432)) : c, d.errorDigest = b.onError(a), d.parentFlushed && b.clientRenderedBoundaries.push(d)), d.fallbackAbortableTasks.forEach(function(
|
|
1354
|
-
return Lb(
|
|
1353
|
+
d === null ? (b.allPendingTasks--, b.status !== 2 && (b.status = 2, b.destination !== null && b.destination.push(null))) : (d.pendingTasks--, d.forceClientRender || (d.forceClientRender = true, a = c === undefined ? Error(l(432)) : c, d.errorDigest = b.onError(a), d.parentFlushed && b.clientRenderedBoundaries.push(d)), d.fallbackAbortableTasks.forEach(function(a) {
|
|
1354
|
+
return Lb(a, b, c);
|
|
1355
1355
|
}), d.fallbackAbortableTasks.clear(), b.allPendingTasks--, b.allPendingTasks === 0 && (d = b.onAllReady, d()));
|
|
1356
1356
|
}
|
|
1357
1357
|
function Y(a, b) {
|
|
@@ -1618,8 +1618,8 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
1618
1618
|
function Rb(a, b) {
|
|
1619
1619
|
try {
|
|
1620
1620
|
var c = a.abortableTasks;
|
|
1621
|
-
c.forEach(function(
|
|
1622
|
-
return Lb(
|
|
1621
|
+
c.forEach(function(c) {
|
|
1622
|
+
return Lb(c, a, b);
|
|
1623
1623
|
});
|
|
1624
1624
|
c.clear();
|
|
1625
1625
|
a.destination !== null && Mb(a, a.destination);
|
|
@@ -1629,12 +1629,12 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS(function
|
|
|
1629
1629
|
}
|
|
1630
1630
|
function Sb() {}
|
|
1631
1631
|
function Tb(a, b, c, d) {
|
|
1632
|
-
var f = false, e = null, g = "", h = { push: function(
|
|
1633
|
-
|
|
1632
|
+
var f = false, e = null, g = "", h = { push: function(a) {
|
|
1633
|
+
a !== null && (g += a);
|
|
1634
1634
|
return true;
|
|
1635
|
-
}, destroy: function(
|
|
1635
|
+
}, destroy: function(a) {
|
|
1636
1636
|
f = true;
|
|
1637
|
-
e =
|
|
1637
|
+
e = a;
|
|
1638
1638
|
} }, k = false;
|
|
1639
1639
|
a = Ab(a, Ea(c, b ? b.identifierPrefix : undefined), { insertionMode: 1, selectedValue: null }, Infinity, Sb, undefined, function() {
|
|
1640
1640
|
k = true;
|
|
@@ -2032,8 +2032,8 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
2032
2032
|
}
|
|
2033
2033
|
function La(a) {
|
|
2034
2034
|
var b = "";
|
|
2035
|
-
aa.Children.forEach(a, function(
|
|
2036
|
-
|
|
2035
|
+
aa.Children.forEach(a, function(a) {
|
|
2036
|
+
a != null && (b += a);
|
|
2037
2037
|
});
|
|
2038
2038
|
return b;
|
|
2039
2039
|
}
|
|
@@ -2425,8 +2425,8 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
2425
2425
|
var Qb = w(",");
|
|
2426
2426
|
var Rb = /[<\u2028\u2029]/g;
|
|
2427
2427
|
function Sb(a) {
|
|
2428
|
-
return JSON.stringify(a).replace(Rb, function(
|
|
2429
|
-
switch (
|
|
2428
|
+
return JSON.stringify(a).replace(Rb, function(a) {
|
|
2429
|
+
switch (a) {
|
|
2430
2430
|
case "<":
|
|
2431
2431
|
return "\\u003c";
|
|
2432
2432
|
case "\u2028":
|
|
@@ -2781,9 +2781,9 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
2781
2781
|
a.allPendingTasks++;
|
|
2782
2782
|
c === null ? a.pendingRootTasks++ : c.pendingTasks++;
|
|
2783
2783
|
var m = { node: b, ping: function() {
|
|
2784
|
-
var
|
|
2785
|
-
|
|
2786
|
-
|
|
2784
|
+
var b = a.pingedTasks;
|
|
2785
|
+
b.push(m);
|
|
2786
|
+
b.length === 1 && Uc(a);
|
|
2787
2787
|
}, blockedBoundary: c, blockedSegment: d, abortSet: f, legacyContext: e, context: g, treeContext: h };
|
|
2788
2788
|
f.add(m);
|
|
2789
2789
|
return m;
|
|
@@ -3038,7 +3038,7 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
3038
3038
|
}
|
|
3039
3039
|
}
|
|
3040
3040
|
function $c(a, b, c) {
|
|
3041
|
-
var d = b.blockedSegment.formatContext,
|
|
3041
|
+
var d = b.blockedSegment.formatContext, { legacyContext: f, context: e } = b;
|
|
3042
3042
|
try {
|
|
3043
3043
|
return Z(a, b, c);
|
|
3044
3044
|
} catch (m) {
|
|
@@ -3066,8 +3066,8 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
3066
3066
|
function ed(a, b, c) {
|
|
3067
3067
|
var d = a.blockedBoundary;
|
|
3068
3068
|
a.blockedSegment.status = 3;
|
|
3069
|
-
d === null ? (b.allPendingTasks--, b.status !== 2 && (b.status = 2, b.destination !== null && b.destination.close())) : (d.pendingTasks--, d.forceClientRender || (d.forceClientRender = true, a = c === undefined ? Error(k(432)) : c, d.errorDigest = b.onError(a), d.parentFlushed && b.clientRenderedBoundaries.push(d)), d.fallbackAbortableTasks.forEach(function(
|
|
3070
|
-
return ed(
|
|
3069
|
+
d === null ? (b.allPendingTasks--, b.status !== 2 && (b.status = 2, b.destination !== null && b.destination.close())) : (d.pendingTasks--, d.forceClientRender || (d.forceClientRender = true, a = c === undefined ? Error(k(432)) : c, d.errorDigest = b.onError(a), d.parentFlushed && b.clientRenderedBoundaries.push(d)), d.fallbackAbortableTasks.forEach(function(a) {
|
|
3070
|
+
return ed(a, b, c);
|
|
3071
3071
|
}), d.fallbackAbortableTasks.clear(), b.allPendingTasks--, b.allPendingTasks === 0 && (d = b.onAllReady, d()));
|
|
3072
3072
|
}
|
|
3073
3073
|
function ad(a, b) {
|
|
@@ -3328,8 +3328,8 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
3328
3328
|
function ld(a, b) {
|
|
3329
3329
|
try {
|
|
3330
3330
|
var c = a.abortableTasks;
|
|
3331
|
-
c.forEach(function(
|
|
3332
|
-
return ed(
|
|
3331
|
+
c.forEach(function(c) {
|
|
3332
|
+
return ed(c, a, b);
|
|
3333
3333
|
});
|
|
3334
3334
|
c.clear();
|
|
3335
3335
|
a.destination !== null && fd(a, a.destination);
|
|
@@ -3339,17 +3339,17 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
3339
3339
|
}
|
|
3340
3340
|
exports2.renderToReadableStream = function(a, b) {
|
|
3341
3341
|
return new Promise(function(c, d) {
|
|
3342
|
-
var f, e, g = new Promise(function(
|
|
3343
|
-
e =
|
|
3344
|
-
f =
|
|
3342
|
+
var f, e, g = new Promise(function(a, b) {
|
|
3343
|
+
e = a;
|
|
3344
|
+
f = b;
|
|
3345
3345
|
}), h = Rc(a, za(b ? b.identifierPrefix : undefined, b ? b.nonce : undefined, b ? b.bootstrapScriptContent : undefined, b ? b.bootstrapScripts : undefined, b ? b.bootstrapModules : undefined), Aa(b ? b.namespaceURI : undefined), b ? b.progressiveChunkSize : undefined, b ? b.onError : undefined, e, function() {
|
|
3346
|
-
var
|
|
3346
|
+
var a = new ReadableStream({ type: "bytes", pull: function(a) {
|
|
3347
3347
|
if (h.status === 1)
|
|
3348
|
-
h.status = 2, da(
|
|
3348
|
+
h.status = 2, da(a, h.fatalError);
|
|
3349
3349
|
else if (h.status !== 2 && h.destination === null) {
|
|
3350
|
-
h.destination =
|
|
3350
|
+
h.destination = a;
|
|
3351
3351
|
try {
|
|
3352
|
-
fd(h,
|
|
3352
|
+
fd(h, a);
|
|
3353
3353
|
} catch (A) {
|
|
3354
3354
|
Y(h, A), Vc(h, A);
|
|
3355
3355
|
}
|
|
@@ -3357,11 +3357,11 @@ var require_react_dom_server_browser_production_min = __commonJS(function(export
|
|
|
3357
3357
|
}, cancel: function() {
|
|
3358
3358
|
ld(h);
|
|
3359
3359
|
} }, { highWaterMark: 0 });
|
|
3360
|
-
|
|
3361
|
-
c(
|
|
3362
|
-
}, function(
|
|
3360
|
+
a.allReady = g;
|
|
3361
|
+
c(a);
|
|
3362
|
+
}, function(a) {
|
|
3363
3363
|
g.catch(function() {});
|
|
3364
|
-
d(
|
|
3364
|
+
d(a);
|
|
3365
3365
|
}, f);
|
|
3366
3366
|
if (b && b.signal) {
|
|
3367
3367
|
var m = b.signal, q = function() {
|
|
@@ -3988,8 +3988,8 @@ var readImportBindings = (code, index) => {
|
|
|
3988
3988
|
index = after;
|
|
3989
3989
|
}
|
|
3990
3990
|
}
|
|
3991
|
-
const
|
|
3992
|
-
const imported =
|
|
3991
|
+
const literal = readStringLiteral(code, index);
|
|
3992
|
+
const imported = literal ? { name: literal.value, end: literal.end } : readIdentifierWord(code, index);
|
|
3993
3993
|
if (!imported)
|
|
3994
3994
|
return null;
|
|
3995
3995
|
index = skipWhitespaceAndComments(code, imported.end);
|
|
@@ -4559,10 +4559,10 @@ function isLikeNone(x) {
|
|
|
4559
4559
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
4560
4560
|
if (realloc === undefined) {
|
|
4561
4561
|
const buf = cachedTextEncoder.encode(arg);
|
|
4562
|
-
const
|
|
4563
|
-
getUint8ArrayMemory0().subarray(
|
|
4562
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
4563
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
4564
4564
|
WASM_VECTOR_LEN = buf.length;
|
|
4565
|
-
return
|
|
4565
|
+
return ptr;
|
|
4566
4566
|
}
|
|
4567
4567
|
let len = arg.length;
|
|
4568
4568
|
let ptr = malloc(len, 1) >>> 0;
|
|
@@ -6034,7 +6034,7 @@ var isJsxShellPreview = (code, scan) => {
|
|
|
6034
6034
|
return false;
|
|
6035
6035
|
if (scan.stack.some((frame) => frame.type === "block" && frame.jsxExpression))
|
|
6036
6036
|
return false;
|
|
6037
|
-
const allFramesAllowed = (
|
|
6037
|
+
const allFramesAllowed = (componentArrow) => scan.stack.every((frame) => frame.type !== "block" || isAllowedJsxShellFrame(code, frame, componentArrow));
|
|
6038
6038
|
const rootReturnBefore = (end) => {
|
|
6039
6039
|
const before = code.slice(0, end);
|
|
6040
6040
|
return /\breturn\s*\(?\s*$/.test(before.slice(Math.max(0, before.lastIndexOf(";"), before.lastIndexOf("{"))));
|
|
@@ -6042,12 +6042,12 @@ var isJsxShellPreview = (code, scan) => {
|
|
|
6042
6042
|
const arrowFrameActive = scan.stack.some((frame) => frame.type === "block" && frame.kind === "arrow" && isComponentArrowFrame(code, frame));
|
|
6043
6043
|
if (!jsxFrame) {
|
|
6044
6044
|
if (scan.incompleteJsxTagStart === null) {
|
|
6045
|
-
const
|
|
6046
|
-
return (isCompleteJsxTail(code, scan) || hasCompletedRenderMethodTail(code, scan)) && allFramesAllowed(
|
|
6045
|
+
const componentArrow = isComponentArrowPrefix(code, code.length) || arrowFrameActive;
|
|
6046
|
+
return (isCompleteJsxTail(code, scan) || hasCompletedRenderMethodTail(code, scan)) && allFramesAllowed(componentArrow);
|
|
6047
6047
|
}
|
|
6048
|
-
const
|
|
6049
|
-
const incompleteComponentArrow = isComponentArrowPrefix(code,
|
|
6050
|
-
if (!rootReturnBefore(
|
|
6048
|
+
const jsxStart = scan.incompleteJsxTagStart;
|
|
6049
|
+
const incompleteComponentArrow = isComponentArrowPrefix(code, jsxStart);
|
|
6050
|
+
if (!rootReturnBefore(jsxStart) && !incompleteComponentArrow && !/^\s*</.test(code))
|
|
6051
6051
|
return false;
|
|
6052
6052
|
return allFramesAllowed(incompleteComponentArrow);
|
|
6053
6053
|
}
|
|
@@ -7398,10 +7398,10 @@ function owningCanvasIdOf(path) {
|
|
|
7398
7398
|
}
|
|
7399
7399
|
|
|
7400
7400
|
// src/client/runtime/register.ts
|
|
7401
|
-
var React = __toESM(require("react"));
|
|
7402
|
-
var ReactJsxRuntime = __toESM(require("react/jsx-runtime"));
|
|
7403
|
-
var ReactDom = __toESM(require("react-dom"));
|
|
7404
|
-
var ReactDomClient = __toESM(require("react-dom/client"));
|
|
7401
|
+
var React = __toESM(require("react"), 1);
|
|
7402
|
+
var ReactJsxRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
7403
|
+
var ReactDom = __toESM(require("react-dom"), 1);
|
|
7404
|
+
var ReactDomClient = __toESM(require("react-dom/client"), 1);
|
|
7405
7405
|
var Scheduler = __toESM(require_scheduler(), 1);
|
|
7406
7406
|
var installed = false;
|
|
7407
7407
|
function installDocumentImportMap() {
|
|
@@ -7430,7 +7430,7 @@ function registerRuntimeModules() {
|
|
|
7430
7430
|
}
|
|
7431
7431
|
|
|
7432
7432
|
// src/client/runtime/state.ts
|
|
7433
|
-
var React2 = __toESM(require("react"));
|
|
7433
|
+
var React2 = __toESM(require("react"), 1);
|
|
7434
7434
|
var scope = (key) => `dsh-genui:${key}`;
|
|
7435
7435
|
function read(key, initial) {
|
|
7436
7436
|
const fallback = () => typeof initial === "function" ? initial() : initial;
|
|
@@ -7551,11 +7551,11 @@ async function execRequest(cwd, sessionId, command, signal) {
|
|
|
7551
7551
|
throw new Error(`[dsh-generative-ui] $dsh/exec: ${body.error ?? response.statusText}`);
|
|
7552
7552
|
return body;
|
|
7553
7553
|
}
|
|
7554
|
-
async function* streamFrom(cwd,
|
|
7554
|
+
async function* streamFrom(cwd, request, signal) {
|
|
7555
7555
|
const response = await fetch(`${AI_STREAM_PATH}?cwd=${encodeURIComponent(cwd)}`, {
|
|
7556
7556
|
method: "POST",
|
|
7557
7557
|
headers: { "content-type": "application/json" },
|
|
7558
|
-
body: JSON.stringify(
|
|
7558
|
+
body: JSON.stringify(request),
|
|
7559
7559
|
signal
|
|
7560
7560
|
});
|
|
7561
7561
|
if (!response.ok)
|
|
@@ -8111,7 +8111,7 @@ async function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
8111
8111
|
const resolved = {
|
|
8112
8112
|
mergeSelectors: true,
|
|
8113
8113
|
warn: true,
|
|
8114
|
-
sortLayers: (
|
|
8114
|
+
sortLayers: (layers) => layers,
|
|
8115
8115
|
...config,
|
|
8116
8116
|
blocklist: getMerged("blocklist"),
|
|
8117
8117
|
presets: sortedPresets,
|
|
@@ -8234,8 +8234,8 @@ var TokenProcessor = class {
|
|
|
8234
8234
|
return false;
|
|
8235
8235
|
}
|
|
8236
8236
|
getBlocked(raw, blocklist) {
|
|
8237
|
-
const rule = blocklist.find((
|
|
8238
|
-
const value = Array.isArray(
|
|
8237
|
+
const rule = blocklist.find((e) => {
|
|
8238
|
+
const value = Array.isArray(e) ? e[0] : e;
|
|
8239
8239
|
return typeof value === "function" ? value(raw) : isString(value) ? value === raw : value.test(raw);
|
|
8240
8240
|
});
|
|
8241
8241
|
return rule ? Array.isArray(rule) ? rule : [rule, undefined] : undefined;
|
|
@@ -8270,7 +8270,7 @@ var TokenProcessor = class {
|
|
|
8270
8270
|
this.blocked.delete(token);
|
|
8271
8271
|
}
|
|
8272
8272
|
};
|
|
8273
|
-
var UnoGeneratorInternal = class
|
|
8273
|
+
var UnoGeneratorInternal = class UnoGeneratorInternal {
|
|
8274
8274
|
userConfig;
|
|
8275
8275
|
defaults;
|
|
8276
8276
|
version = version2;
|
|
@@ -8282,7 +8282,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8282
8282
|
this.defaults = defaults;
|
|
8283
8283
|
}
|
|
8284
8284
|
static async create(userConfig = {}, defaults = {}) {
|
|
8285
|
-
const uno = new
|
|
8285
|
+
const uno = new UnoGeneratorInternal(userConfig, defaults);
|
|
8286
8286
|
uno.config = await resolveConfig(uno.userConfig, uno.defaults);
|
|
8287
8287
|
uno.events.emit("config", uno.config);
|
|
8288
8288
|
return uno;
|
|
@@ -8356,7 +8356,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8356
8356
|
return this.tokenProcessor.parse(this, raw, alias);
|
|
8357
8357
|
}
|
|
8358
8358
|
async generate(input, options = {}) {
|
|
8359
|
-
const { id, scope
|
|
8359
|
+
const { id, scope, preflights = true, safelist = true, minify = false, extendedInfo = false } = options;
|
|
8360
8360
|
const tokens = isString(input) ? await this.applyExtractors(input, id, extendedInfo ? new CountableSet : /* @__PURE__ */ new Set) : Array.isArray(input) ? new Set(input) : input;
|
|
8361
8361
|
if (safelist) {
|
|
8362
8362
|
const safelistContext = {
|
|
@@ -8423,7 +8423,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8423
8423
|
return [layer, (await Promise.all(this.config.preflights.filter((i) => (i.layer || "preflights") === layer).map(async (i) => await i.getCSS(preflightContext)))).filter(Boolean).join(nl)];
|
|
8424
8424
|
})));
|
|
8425
8425
|
})();
|
|
8426
|
-
const sortLayers = (
|
|
8426
|
+
const sortLayers = (layers) => this.config.sortLayers(layers.sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b)));
|
|
8427
8427
|
const layers = sortLayers(Array.from(layerSet));
|
|
8428
8428
|
const layerCache = {};
|
|
8429
8429
|
const outputCssLayers = this.config.outputToCssLayers;
|
|
@@ -8441,7 +8441,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8441
8441
|
return a[0] - b[0] || (a[4]?.sort || 0) - (b[4]?.sort || 0) || a[5]?.currentSelector?.localeCompare(b[5]?.currentSelector ?? "") || a[1]?.localeCompare(b[1] || "") || a[2]?.localeCompare(b[2] || "") || 0;
|
|
8442
8442
|
}).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
8443
8443
|
return [
|
|
8444
|
-
[[(selector && !meta?.noScope ? applyScope(selector,
|
|
8444
|
+
[[(selector && !meta?.noScope ? applyScope(selector, scope) : selector) ?? "", meta?.sort ?? 0]],
|
|
8445
8445
|
body,
|
|
8446
8446
|
!!(variantNoMerge ?? meta?.noMerge)
|
|
8447
8447
|
];
|
|
@@ -8910,17 +8910,17 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8910
8910
|
}
|
|
8911
8911
|
const isNoMerge = Object.fromEntries(item[2])[symbols.shortcutsNoMerge];
|
|
8912
8912
|
const variants = [...item[4], ...!isNoMerge ? parentVariants : []];
|
|
8913
|
-
for (const { selector, entries, parent
|
|
8914
|
-
layerMap.getFallback(layer ?? meta.layer, new TwoKeyMap).getFallback(selector,
|
|
8913
|
+
for (const { selector, entries, parent, sort, noMerge, layer } of this.applyVariants(item, variants, raw))
|
|
8914
|
+
layerMap.getFallback(layer ?? meta.layer, new TwoKeyMap).getFallback(selector, parent, [[], item[0]])[0].push([
|
|
8915
8915
|
entries,
|
|
8916
8916
|
!!(noMerge ?? item[3]?.noMerge),
|
|
8917
8917
|
sort ?? 0
|
|
8918
8918
|
]);
|
|
8919
8919
|
}
|
|
8920
|
-
return rawStringifiedUtil.concat(layerMap.flatMap((selectorMap, layer) => selectorMap.map(([
|
|
8920
|
+
return rawStringifiedUtil.concat(layerMap.flatMap((selectorMap, layer) => selectorMap.map(([e, index], selector, joinedParents) => {
|
|
8921
8921
|
const stringify = (flatten, noMerge, entrySortPair) => {
|
|
8922
|
-
const maxSort = Math.max(...entrySortPair.map((
|
|
8923
|
-
const entriesList = entrySortPair.map((
|
|
8922
|
+
const maxSort = Math.max(...entrySortPair.map((e) => e[1]));
|
|
8923
|
+
const entriesList = entrySortPair.map((e) => e[0]);
|
|
8924
8924
|
return (flatten ? [entriesList.flat(1)] : entriesList).map((entries) => {
|
|
8925
8925
|
const body = entriesToCss(entries);
|
|
8926
8926
|
if (body)
|
|
@@ -8940,7 +8940,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal2 {
|
|
|
8940
8940
|
];
|
|
8941
8941
|
});
|
|
8942
8942
|
};
|
|
8943
|
-
return [[
|
|
8943
|
+
return [[e.filter(([, noMerge]) => noMerge).map(([entries, , sort]) => [entries, sort]), true], [e.filter(([, noMerge]) => !noMerge).map(([entries, , sort]) => [entries, sort]), false]].map(([e, noMerge]) => [...stringify(false, noMerge, e.filter(([entries]) => entries.some((entry) => entry[0] === symbols.shortcutsNoMerge))), ...stringify(true, noMerge, e.filter(([entries]) => entries.every((entry) => entry[0] !== symbols.shortcutsNoMerge)))]);
|
|
8944
8944
|
}).flat(2).filter(Boolean)));
|
|
8945
8945
|
}
|
|
8946
8946
|
isBlocked(raw) {
|
|
@@ -8957,11 +8957,11 @@ var regexScopePlaceholder = /\s\$\$\s+/g;
|
|
|
8957
8957
|
function hasScopePlaceholder(css) {
|
|
8958
8958
|
return regexScopePlaceholder.test(css);
|
|
8959
8959
|
}
|
|
8960
|
-
function applyScope(css,
|
|
8960
|
+
function applyScope(css, scope) {
|
|
8961
8961
|
if (hasScopePlaceholder(css))
|
|
8962
|
-
return css.replace(regexScopePlaceholder,
|
|
8962
|
+
return css.replace(regexScopePlaceholder, scope ? ` ${scope} ` : " ");
|
|
8963
8963
|
else
|
|
8964
|
-
return
|
|
8964
|
+
return scope ? `${scope} ${css}` : css;
|
|
8965
8965
|
}
|
|
8966
8966
|
var attributifyRe = /^\[(.+?)(~?=)"(.*)"\]$/;
|
|
8967
8967
|
function toEscapedSelector(raw) {
|
|
@@ -9115,9 +9115,9 @@ function encode(decoded) {
|
|
|
9115
9115
|
}
|
|
9116
9116
|
|
|
9117
9117
|
// node_modules/magic-string/dist/index.mjs
|
|
9118
|
-
var BitSet = class
|
|
9118
|
+
var BitSet = class BitSet {
|
|
9119
9119
|
constructor(arg) {
|
|
9120
|
-
this.bits = arg instanceof
|
|
9120
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
9121
9121
|
}
|
|
9122
9122
|
add(n) {
|
|
9123
9123
|
this.bits[n >> 5] |= 1 << (n & 31);
|
|
@@ -9126,7 +9126,7 @@ var BitSet = class BitSet2 {
|
|
|
9126
9126
|
return !!(this.bits[n >> 5] & 1 << (n & 31));
|
|
9127
9127
|
}
|
|
9128
9128
|
};
|
|
9129
|
-
var Chunk = class
|
|
9129
|
+
var Chunk = class Chunk {
|
|
9130
9130
|
constructor(start, end, content) {
|
|
9131
9131
|
this.start = start;
|
|
9132
9132
|
this.end = end;
|
|
@@ -9146,7 +9146,7 @@ var Chunk = class Chunk2 {
|
|
|
9146
9146
|
this.intro = this.intro + content;
|
|
9147
9147
|
}
|
|
9148
9148
|
clone() {
|
|
9149
|
-
const chunk = new
|
|
9149
|
+
const chunk = new Chunk(this.start, this.end, this.original);
|
|
9150
9150
|
chunk.intro = this.intro;
|
|
9151
9151
|
chunk.outro = this.outro;
|
|
9152
9152
|
chunk.content = this.content;
|
|
@@ -9203,7 +9203,7 @@ var Chunk = class Chunk2 {
|
|
|
9203
9203
|
const originalBefore = this.original.slice(0, sliceIndex);
|
|
9204
9204
|
const originalAfter = this.original.slice(sliceIndex);
|
|
9205
9205
|
this.original = originalBefore;
|
|
9206
|
-
const newChunk = new
|
|
9206
|
+
const newChunk = new Chunk(index, this.end, originalAfter);
|
|
9207
9207
|
newChunk.outro = this.outro;
|
|
9208
9208
|
this.outro = "";
|
|
9209
9209
|
this.end = index;
|
|
@@ -9376,15 +9376,15 @@ var Mappings = class {
|
|
|
9376
9376
|
`, 0);
|
|
9377
9377
|
let previousContentLineEnd = -1;
|
|
9378
9378
|
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
|
9379
|
-
const
|
|
9379
|
+
const segment = [
|
|
9380
9380
|
this.generatedCodeColumn,
|
|
9381
9381
|
sourceIndex,
|
|
9382
9382
|
loc.line,
|
|
9383
9383
|
loc.column
|
|
9384
9384
|
];
|
|
9385
9385
|
if (nameIndex >= 0)
|
|
9386
|
-
|
|
9387
|
-
this.rawSegments.push(
|
|
9386
|
+
segment.push(nameIndex);
|
|
9387
|
+
this.rawSegments.push(segment);
|
|
9388
9388
|
this.generatedCodeLine += 1;
|
|
9389
9389
|
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
9390
9390
|
this.generatedCodeColumn = 0;
|
|
@@ -9475,7 +9475,7 @@ var warned2 = {
|
|
|
9475
9475
|
insertRight: false,
|
|
9476
9476
|
storeName: false
|
|
9477
9477
|
};
|
|
9478
|
-
var MagicString = class
|
|
9478
|
+
var MagicString = class MagicString {
|
|
9479
9479
|
constructor(string, options = {}) {
|
|
9480
9480
|
const chunk = new Chunk(0, string.length, string);
|
|
9481
9481
|
Object.defineProperties(this, {
|
|
@@ -9579,7 +9579,7 @@ var MagicString = class MagicString2 {
|
|
|
9579
9579
|
return this;
|
|
9580
9580
|
}
|
|
9581
9581
|
clone() {
|
|
9582
|
-
const cloned = new
|
|
9582
|
+
const cloned = new MagicString(this.original, {
|
|
9583
9583
|
filename: this.filename,
|
|
9584
9584
|
ignoreList: this.ignoreList,
|
|
9585
9585
|
offset: this.offset
|
|
@@ -10037,10 +10037,10 @@ var MagicString = class MagicString2 {
|
|
|
10037
10037
|
return result;
|
|
10038
10038
|
}
|
|
10039
10039
|
snip(start, end) {
|
|
10040
|
-
const
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
return
|
|
10040
|
+
const clone = this.clone();
|
|
10041
|
+
clone.remove(0, start);
|
|
10042
|
+
clone.remove(end, clone.original.length);
|
|
10043
|
+
return clone;
|
|
10044
10044
|
}
|
|
10045
10045
|
_split(index) {
|
|
10046
10046
|
if (this.byStart.get(index) || this.byEnd.get(index))
|
|
@@ -10203,17 +10203,17 @@ var MagicString = class MagicString2 {
|
|
|
10203
10203
|
if (searchValue.global)
|
|
10204
10204
|
matchAll(searchValue, this.original).forEach((match) => {
|
|
10205
10205
|
if (match.index != null) {
|
|
10206
|
-
const
|
|
10207
|
-
if (
|
|
10208
|
-
this.overwrite(match.index, match.index + match[0].length,
|
|
10206
|
+
const replacement = getReplacement(match, this.original);
|
|
10207
|
+
if (replacement !== match[0])
|
|
10208
|
+
this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
10209
10209
|
}
|
|
10210
10210
|
});
|
|
10211
10211
|
else {
|
|
10212
10212
|
const match = this.original.match(searchValue);
|
|
10213
10213
|
if (match && match.index != null) {
|
|
10214
|
-
const
|
|
10215
|
-
if (
|
|
10216
|
-
this.overwrite(match.index, match.index + match[0].length,
|
|
10214
|
+
const replacement = getReplacement(match, this.original);
|
|
10215
|
+
if (replacement !== match[0])
|
|
10216
|
+
this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
10217
10217
|
}
|
|
10218
10218
|
}
|
|
10219
10219
|
return this;
|
|
@@ -10429,7 +10429,7 @@ function parseHexColor(str) {
|
|
|
10429
10429
|
switch (body.length) {
|
|
10430
10430
|
case 3:
|
|
10431
10431
|
case 4: {
|
|
10432
|
-
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((
|
|
10432
|
+
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
|
|
10433
10433
|
return {
|
|
10434
10434
|
type: "rgb",
|
|
10435
10435
|
components: digits.slice(0, 3),
|
|
@@ -10590,8 +10590,8 @@ function createValueHandler(handlers) {
|
|
|
10590
10590
|
const handler = function(str, theme) {
|
|
10591
10591
|
const s = this.__options?.sequence || [];
|
|
10592
10592
|
this.__options.sequence = [];
|
|
10593
|
-
for (const
|
|
10594
|
-
const res = handlers[
|
|
10593
|
+
for (const n of s) {
|
|
10594
|
+
const res = handlers[n](str, theme);
|
|
10595
10595
|
if (res != null)
|
|
10596
10596
|
return res;
|
|
10597
10597
|
}
|
|
@@ -10763,9 +10763,9 @@ function createTaggedPseudoClassMatcher(tag, parent, combinator, utils) {
|
|
|
10763
10763
|
const [_label, matcher, prefix, pseudoName = ""] = result;
|
|
10764
10764
|
return {
|
|
10765
10765
|
matcher,
|
|
10766
|
-
handle: (
|
|
10767
|
-
...
|
|
10768
|
-
prefix: `${prefix}${combinator}${
|
|
10766
|
+
handle: (input, next) => next({
|
|
10767
|
+
...input,
|
|
10768
|
+
prefix: `${prefix}${combinator}${input.prefix}`.replace(rawRE, "$1$2:"),
|
|
10769
10769
|
sort: PseudoClassesKeys.indexOf(pseudoName) ?? PseudoClassesColonKeys.indexOf(pseudoName)
|
|
10770
10770
|
})
|
|
10771
10771
|
};
|
|
@@ -10804,10 +10804,10 @@ function createPseudoClassesAndElements(utils) {
|
|
|
10804
10804
|
index = undefined;
|
|
10805
10805
|
return {
|
|
10806
10806
|
matcher: input.slice(match[0].length),
|
|
10807
|
-
handle: (
|
|
10808
|
-
const selectors = pseudo.includes("::") && !excludedPseudo.includes(pseudo) ? { pseudo: `${
|
|
10807
|
+
handle: (input, next) => {
|
|
10808
|
+
const selectors = pseudo.includes("::") && !excludedPseudo.includes(pseudo) ? { pseudo: `${input.pseudo}${pseudo}` } : { selector: `${input.selector}${pseudo}` };
|
|
10809
10809
|
return next({
|
|
10810
|
-
...
|
|
10810
|
+
...input,
|
|
10811
10811
|
...selectors,
|
|
10812
10812
|
sort: index,
|
|
10813
10813
|
noMerge: true
|
|
@@ -10828,9 +10828,9 @@ function createPseudoClassesAndElements(utils) {
|
|
|
10828
10828
|
return PseudoClassesMulti[match[1]].map((pseudo) => {
|
|
10829
10829
|
return {
|
|
10830
10830
|
matcher: input.slice(match[0].length),
|
|
10831
|
-
handle: (
|
|
10832
|
-
...
|
|
10833
|
-
pseudo: `${
|
|
10831
|
+
handle: (input, next) => next({
|
|
10832
|
+
...input,
|
|
10833
|
+
pseudo: `${input.pseudo}${pseudo}`
|
|
10834
10834
|
})
|
|
10835
10835
|
};
|
|
10836
10836
|
});
|
|
@@ -10840,7 +10840,7 @@ function createPseudoClassesAndElements(utils) {
|
|
|
10840
10840
|
}];
|
|
10841
10841
|
}
|
|
10842
10842
|
function createPseudoClassFunctions(utils) {
|
|
10843
|
-
const { getBracket
|
|
10843
|
+
const { getBracket, h } = utils;
|
|
10844
10844
|
let PseudoClassFunctionsRE;
|
|
10845
10845
|
let PseudoClassColonFunctionsRE;
|
|
10846
10846
|
let PseudoClassVarFunctionRE;
|
|
@@ -10854,7 +10854,7 @@ function createPseudoClassFunctions(utils) {
|
|
|
10854
10854
|
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE) || input.match(PseudoClassVarFunctionRE);
|
|
10855
10855
|
if (match) {
|
|
10856
10856
|
const fn = match[1];
|
|
10857
|
-
const pseudo =
|
|
10857
|
+
const pseudo = getBracket(match[2], "[", "]") ? h.bracket(match[2]) : PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
10858
10858
|
return {
|
|
10859
10859
|
matcher: input.slice(match[0].length),
|
|
10860
10860
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -10903,11 +10903,11 @@ function variantMatcher(name, handler, options = {}) {
|
|
|
10903
10903
|
const match = input.match(re);
|
|
10904
10904
|
if (match) {
|
|
10905
10905
|
const matcher = input.slice(match[0].length);
|
|
10906
|
-
const handlers = toArray(handler).map((
|
|
10906
|
+
const handlers = toArray(handler).map((handler) => ({
|
|
10907
10907
|
matcher,
|
|
10908
|
-
handle: (
|
|
10909
|
-
...
|
|
10910
|
-
...
|
|
10908
|
+
handle: (input, next) => next({
|
|
10909
|
+
...input,
|
|
10910
|
+
...handler(input)
|
|
10911
10911
|
}),
|
|
10912
10912
|
...options
|
|
10913
10913
|
}));
|
|
@@ -10928,9 +10928,9 @@ function variantParentMatcher(name, parent) {
|
|
|
10928
10928
|
if (match)
|
|
10929
10929
|
return {
|
|
10930
10930
|
matcher: input.slice(match[0].length),
|
|
10931
|
-
handle: (
|
|
10932
|
-
...
|
|
10933
|
-
parent: `${
|
|
10931
|
+
handle: (input, next) => next({
|
|
10932
|
+
...input,
|
|
10933
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}${parent}`
|
|
10934
10934
|
})
|
|
10935
10935
|
};
|
|
10936
10936
|
},
|
|
@@ -11199,15 +11199,15 @@ var cssProps = [
|
|
|
11199
11199
|
"clip",
|
|
11200
11200
|
"border-radius"
|
|
11201
11201
|
];
|
|
11202
|
-
function round(
|
|
11203
|
-
return +
|
|
11202
|
+
function round(n) {
|
|
11203
|
+
return +n.toFixed(10);
|
|
11204
11204
|
}
|
|
11205
11205
|
function numberWithUnit(str) {
|
|
11206
11206
|
const match = str.match(numberWithUnitRE);
|
|
11207
11207
|
if (!match)
|
|
11208
11208
|
return;
|
|
11209
|
-
const [,
|
|
11210
|
-
const num = Number.parseFloat(
|
|
11209
|
+
const [, n, unit] = match;
|
|
11210
|
+
const num = Number.parseFloat(n);
|
|
11211
11211
|
if (unit && !Number.isNaN(num))
|
|
11212
11212
|
return `${round(num)}${unit}`;
|
|
11213
11213
|
}
|
|
@@ -11223,8 +11223,8 @@ function rem(str) {
|
|
|
11223
11223
|
const match = str.match(numberWithUnitRE);
|
|
11224
11224
|
if (!match)
|
|
11225
11225
|
return;
|
|
11226
|
-
const [,
|
|
11227
|
-
const num = Number.parseFloat(
|
|
11226
|
+
const [, n, unit] = match;
|
|
11227
|
+
const num = Number.parseFloat(n);
|
|
11228
11228
|
if (!Number.isNaN(num)) {
|
|
11229
11229
|
if (num === 0)
|
|
11230
11230
|
return "0";
|
|
@@ -11237,8 +11237,8 @@ function px(str) {
|
|
|
11237
11237
|
const match = str.match(numberWithUnitRE);
|
|
11238
11238
|
if (!match)
|
|
11239
11239
|
return;
|
|
11240
|
-
const [,
|
|
11241
|
-
const num = Number.parseFloat(
|
|
11240
|
+
const [, n, unit] = match;
|
|
11241
|
+
const num = Number.parseFloat(n);
|
|
11242
11242
|
if (!Number.isNaN(num))
|
|
11243
11243
|
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
11244
11244
|
}
|
|
@@ -11304,8 +11304,8 @@ function bracketWithType(str, requiredType, theme) {
|
|
|
11304
11304
|
if (theme)
|
|
11305
11305
|
base = transformThemeFn(base, theme);
|
|
11306
11306
|
const matches = Array.from(base.matchAll(cssVarsRE));
|
|
11307
|
-
for (const
|
|
11308
|
-
const [full, varPaths, _value] =
|
|
11307
|
+
for (const match of matches) {
|
|
11308
|
+
const [full, varPaths, _value] = match;
|
|
11309
11309
|
if (theme) {
|
|
11310
11310
|
const [key, ...paths] = varPaths.split(".");
|
|
11311
11311
|
const { val, varKey } = processThemeVariable(theme, key, paths, varPaths);
|
|
@@ -11339,11 +11339,11 @@ function bracketWithType(str, requiredType, theme) {
|
|
|
11339
11339
|
case "quoted":
|
|
11340
11340
|
return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(["\\])/g, "\\$1").replace(/^(.+)$/, '"$1"');
|
|
11341
11341
|
}
|
|
11342
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(?:calc|clamp|max|min)\((.*)/g, (
|
|
11342
|
+
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(?:calc|clamp|max|min)\((.*)/g, (match) => {
|
|
11343
11343
|
const vars = [];
|
|
11344
|
-
return
|
|
11344
|
+
return match.replace(/var\((--.+?)[,)]/g, (match, g1) => {
|
|
11345
11345
|
vars.push(g1);
|
|
11346
|
-
return
|
|
11346
|
+
return match.replace(g1, "--un-calc");
|
|
11347
11347
|
}).replace(/(-?\d*\.?\d(?!-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(/--un-calc/g, () => vars.shift());
|
|
11348
11348
|
});
|
|
11349
11349
|
}
|
|
@@ -11379,8 +11379,8 @@ function time(str) {
|
|
|
11379
11379
|
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
11380
11380
|
if (!match)
|
|
11381
11381
|
return;
|
|
11382
|
-
const [,
|
|
11383
|
-
const num = Number.parseFloat(
|
|
11382
|
+
const [, n, unit] = match;
|
|
11383
|
+
const num = Number.parseFloat(n);
|
|
11384
11384
|
if (!Number.isNaN(num)) {
|
|
11385
11385
|
if (num === 0 && !unit)
|
|
11386
11386
|
return "0s";
|
|
@@ -11391,8 +11391,8 @@ function degree(str) {
|
|
|
11391
11391
|
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
11392
11392
|
if (!match)
|
|
11393
11393
|
return;
|
|
11394
|
-
const [,
|
|
11395
|
-
const num = Number.parseFloat(
|
|
11394
|
+
const [, n, unit] = match;
|
|
11395
|
+
const num = Number.parseFloat(n);
|
|
11396
11396
|
if (!Number.isNaN(num)) {
|
|
11397
11397
|
if (num === 0)
|
|
11398
11398
|
return "0deg";
|
|
@@ -11482,8 +11482,8 @@ function parseColor2(body, theme) {
|
|
|
11482
11482
|
}
|
|
11483
11483
|
let { no, keys, color } = parsed ?? {};
|
|
11484
11484
|
if (!color) {
|
|
11485
|
-
const
|
|
11486
|
-
const bracketOrMain =
|
|
11485
|
+
const bracket = h.bracketOfColor(main, theme);
|
|
11486
|
+
const bracketOrMain = bracket || main;
|
|
11487
11487
|
if (h.numberWithUnit(bracketOrMain))
|
|
11488
11488
|
return;
|
|
11489
11489
|
if (/^#[\da-f]+$/i.test(bracketOrMain))
|
|
@@ -11492,7 +11492,7 @@ function parseColor2(body, theme) {
|
|
|
11492
11492
|
color = `#${bracketOrMain.slice(4)}`;
|
|
11493
11493
|
else if (main.startsWith("$"))
|
|
11494
11494
|
color = h.cssvar(main);
|
|
11495
|
-
color = color ||
|
|
11495
|
+
color = color || bracket;
|
|
11496
11496
|
}
|
|
11497
11497
|
return {
|
|
11498
11498
|
opacity,
|
|
@@ -11959,19 +11959,19 @@ function resolveModifier(modifier) {
|
|
|
11959
11959
|
return interpolationMethod;
|
|
11960
11960
|
}
|
|
11961
11961
|
function bgGradientColorResolver() {
|
|
11962
|
-
return function* ([,
|
|
11962
|
+
return function* ([, position, body], { theme }) {
|
|
11963
11963
|
const css = {};
|
|
11964
11964
|
const data = parseColor2(body, theme);
|
|
11965
11965
|
if (data) {
|
|
11966
11966
|
const { color, keys, alpha } = data;
|
|
11967
11967
|
if (color) {
|
|
11968
11968
|
if (Object.values(SpecialColorKey).includes(color))
|
|
11969
|
-
css[`--un-gradient-${
|
|
11969
|
+
css[`--un-gradient-${position}`] = color;
|
|
11970
11970
|
else {
|
|
11971
|
-
css[`--un-${
|
|
11971
|
+
css[`--un-${position}-opacity`] = alpha;
|
|
11972
11972
|
const value = keys ? generateThemeVariable("colors", keys) : color;
|
|
11973
|
-
css[`--un-gradient-${
|
|
11974
|
-
yield defineProperty(`--un-${
|
|
11973
|
+
css[`--un-gradient-${position}`] = `color-mix(in oklab, ${value} var(--un-${position}-opacity), transparent)`;
|
|
11974
|
+
yield defineProperty(`--un-${position}-opacity`, {
|
|
11975
11975
|
syntax: "<percentage>",
|
|
11976
11976
|
initialValue: "100%"
|
|
11977
11977
|
});
|
|
@@ -11982,9 +11982,9 @@ function bgGradientColorResolver() {
|
|
|
11982
11982
|
detectThemeValue(color, theme);
|
|
11983
11983
|
}
|
|
11984
11984
|
} else
|
|
11985
|
-
css[`--un-gradient-${
|
|
11986
|
-
if (css[`--un-gradient-${
|
|
11987
|
-
switch (
|
|
11985
|
+
css[`--un-gradient-${position}`] = h.bracket.cssvar(body, theme);
|
|
11986
|
+
if (css[`--un-gradient-${position}`]) {
|
|
11987
|
+
switch (position) {
|
|
11988
11988
|
case "from":
|
|
11989
11989
|
yield {
|
|
11990
11990
|
...css,
|
|
@@ -12042,7 +12042,7 @@ var backgroundStyles = [
|
|
|
12042
12042
|
] }
|
|
12043
12043
|
],
|
|
12044
12044
|
[/^(from|via|to|stops)-(.+)$/, bgGradientColorResolver()],
|
|
12045
|
-
[/^(from|via|to)-op(?:acity)?-?(.+)$/, ([,
|
|
12045
|
+
[/^(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity], { theme }) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity, theme) })],
|
|
12046
12046
|
[/^(from|via|to)-([\d.]+%)$/, bgGradientPositionResolver()],
|
|
12047
12047
|
[
|
|
12048
12048
|
/^bg-((?:repeating-)?(?:linear|radial|conic))$/,
|
|
@@ -12219,12 +12219,12 @@ var listStyles = {
|
|
|
12219
12219
|
var listStyle = [
|
|
12220
12220
|
[
|
|
12221
12221
|
/^list-(.+?)(?:-(outside|inside))?$/,
|
|
12222
|
-
([, alias,
|
|
12222
|
+
([, alias, position]) => {
|
|
12223
12223
|
const style = listStyles[alias];
|
|
12224
12224
|
if (style) {
|
|
12225
|
-
if (
|
|
12225
|
+
if (position)
|
|
12226
12226
|
return {
|
|
12227
|
-
"list-style-position":
|
|
12227
|
+
"list-style-position": position,
|
|
12228
12228
|
"list-style-type": style
|
|
12229
12229
|
};
|
|
12230
12230
|
return { "list-style-type": style };
|
|
@@ -12450,10 +12450,10 @@ var bgColors = [[
|
|
|
12450
12450
|
};
|
|
12451
12451
|
const bracketLength = h.bracketOfLength(d, theme);
|
|
12452
12452
|
if (bgLengthRE.test(d) && bracketLength != null)
|
|
12453
|
-
return { "background-size": bracketLength.split(" ").map((
|
|
12453
|
+
return { "background-size": bracketLength.split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
12454
12454
|
const bracketPosition = h.bracketOfPosition(d, theme);
|
|
12455
12455
|
if ((isSize(d) || bgPositionRE.test(d)) && bracketPosition != null)
|
|
12456
|
-
return { "background-position": bracketPosition.split(" ").map((
|
|
12456
|
+
return { "background-position": bracketPosition.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
12457
12457
|
if (bgGradientRE.test(d) || bgImageRE.test(d)) {
|
|
12458
12458
|
const s = h.bracket(d, theme);
|
|
12459
12459
|
if (s)
|
|
@@ -12464,7 +12464,7 @@ var bgColors = [[
|
|
|
12464
12464
|
{ autocomplete: "bg-$colors" }
|
|
12465
12465
|
], [
|
|
12466
12466
|
/^bg-op(?:acity)?-?(.+)$/,
|
|
12467
|
-
([,
|
|
12467
|
+
([, opacity], { theme }) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
12468
12468
|
{ autocomplete: "bg-(op|opacity)-<percent>" }
|
|
12469
12469
|
]];
|
|
12470
12470
|
var colorScheme = [[/^(?:color-)?scheme-(.+)$/, ([, v]) => ({ "color-scheme": v.split("-").join(" ") })]];
|
|
@@ -12536,7 +12536,7 @@ var textDecorations = [
|
|
|
12536
12536
|
],
|
|
12537
12537
|
[
|
|
12538
12538
|
/^(?:underline|decoration)-op(?:acity)?-?(.+)$/,
|
|
12539
|
-
([,
|
|
12539
|
+
([, opacity], { theme }) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
12540
12540
|
{ autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }
|
|
12541
12541
|
],
|
|
12542
12542
|
[
|
|
@@ -12663,10 +12663,10 @@ var divides = [
|
|
|
12663
12663
|
],
|
|
12664
12664
|
[
|
|
12665
12665
|
/^divide-op(?:acity)?-?(.+)$/,
|
|
12666
|
-
function* ([match,
|
|
12666
|
+
function* ([match, opacity], { symbols: symbols2, theme }) {
|
|
12667
12667
|
yield {
|
|
12668
12668
|
[symbols2.variants]: [notLastChildSelectorVariant(match)],
|
|
12669
|
-
"--un-divide-opacity": h.bracket.percent(
|
|
12669
|
+
"--un-divide-opacity": h.bracket.percent(opacity, theme)
|
|
12670
12670
|
};
|
|
12671
12671
|
},
|
|
12672
12672
|
{ autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }
|
|
@@ -12840,7 +12840,7 @@ var filters = [
|
|
|
12840
12840
|
] }
|
|
12841
12841
|
],
|
|
12842
12842
|
[/^(?:filter-)?drop-shadow-color-(.+)$/, colorResolver("--un-drop-shadow-color", "drop-shadow")],
|
|
12843
|
-
[/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([,
|
|
12843
|
+
[/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([, opacity], { theme }) => ({ "--un-drop-shadow-opacity": h.bracket.percent(opacity, theme) })],
|
|
12844
12844
|
[
|
|
12845
12845
|
/^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/,
|
|
12846
12846
|
toFilter("grayscale", percentWithDefault),
|
|
@@ -12905,7 +12905,7 @@ var flex = [
|
|
|
12905
12905
|
["flex-inline", { display: "inline-flex" }],
|
|
12906
12906
|
[/^flex-(.*)$/, ([, d], { theme }) => {
|
|
12907
12907
|
const value = h.bracket(d, theme);
|
|
12908
|
-
return { flex: value != null ? value.split(" ").map((
|
|
12908
|
+
return { flex: value != null ? value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) };
|
|
12909
12909
|
}],
|
|
12910
12910
|
["flex-1", { flex: "1 1 0%" }],
|
|
12911
12911
|
["flex-auto", { flex: "1 1 auto" }],
|
|
@@ -13065,10 +13065,10 @@ function handlerRuleSize([, d = "", widthLabel, s = "1"], { theme }) {
|
|
|
13065
13065
|
const v = h.bracket.cssvar.px(s, theme);
|
|
13066
13066
|
if (!v)
|
|
13067
13067
|
return;
|
|
13068
|
-
const values = splitRuleValues(v).map((
|
|
13068
|
+
const values = splitRuleValues(v).map((s) => h.cssvar.px(s) ?? s);
|
|
13069
13069
|
if (!widthLabel && values.some(isRuleCSSVariable))
|
|
13070
13070
|
return;
|
|
13071
|
-
if (values.every((
|
|
13071
|
+
if (values.every((s) => isSize(s) || s.startsWith("var(")))
|
|
13072
13072
|
return { [property]: values.join(",") };
|
|
13073
13073
|
}
|
|
13074
13074
|
function handlerRule([, d = "", v], { theme }) {
|
|
@@ -13160,7 +13160,7 @@ var grids = [
|
|
|
13160
13160
|
],
|
|
13161
13161
|
[/^grid-area(s)?-(.+)$/, ([, s, v], { theme }) => {
|
|
13162
13162
|
if (s != null)
|
|
13163
|
-
return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((
|
|
13163
|
+
return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s, theme)}"`).join(" ") };
|
|
13164
13164
|
return { "grid-area": h.bracket.cssvar(v, theme) };
|
|
13165
13165
|
}],
|
|
13166
13166
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
@@ -13379,7 +13379,7 @@ var placeholders = [[
|
|
|
13379
13379
|
{ autocomplete: "placeholder-$colors" }
|
|
13380
13380
|
], [
|
|
13381
13381
|
/^\$ placeholder-op(?:acity)?-?(.+)$/,
|
|
13382
|
-
([,
|
|
13382
|
+
([, opacity], { theme }) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity, theme) }),
|
|
13383
13383
|
{ autocomplete: ["placeholder-(op|opacity)", "placeholder-(op|opacity)-<percent>"] }
|
|
13384
13384
|
]];
|
|
13385
13385
|
var positions = [
|
|
@@ -13584,7 +13584,7 @@ var boxShadows = [
|
|
|
13584
13584
|
],
|
|
13585
13585
|
[
|
|
13586
13586
|
/^shadow-op(?:acity)?-?(.+)$/,
|
|
13587
|
-
([,
|
|
13587
|
+
([, opacity], { theme }) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
13588
13588
|
{ autocomplete: "shadow-(op|opacity)-<percent>" }
|
|
13589
13589
|
],
|
|
13590
13590
|
[
|
|
@@ -13594,7 +13594,7 @@ var boxShadows = [
|
|
|
13594
13594
|
],
|
|
13595
13595
|
[
|
|
13596
13596
|
/^inset-shadow-op(?:acity)?-?(.+)$/,
|
|
13597
|
-
([,
|
|
13597
|
+
([, opacity], { theme }) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
13598
13598
|
{ autocomplete: "shadow-(op|opacity)-<percent>" }
|
|
13599
13599
|
]
|
|
13600
13600
|
];
|
|
@@ -13638,7 +13638,7 @@ var rings = [
|
|
|
13638
13638
|
],
|
|
13639
13639
|
[
|
|
13640
13640
|
/^ring-op(?:acity)?-?(.+)$/,
|
|
13641
|
-
([,
|
|
13641
|
+
([, opacity], { theme }) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
13642
13642
|
{ autocomplete: "ring-(op|opacity)-<percent>" }
|
|
13643
13643
|
],
|
|
13644
13644
|
[/^inset-ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
@@ -13656,7 +13656,7 @@ var rings = [
|
|
|
13656
13656
|
],
|
|
13657
13657
|
[
|
|
13658
13658
|
/^inset-ring-op(?:acity)?-?(.+)$/,
|
|
13659
|
-
([,
|
|
13659
|
+
([, opacity], { theme }) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
13660
13660
|
{ autocomplete: "inset-ring-(op|opacity)-<percent>" }
|
|
13661
13661
|
],
|
|
13662
13662
|
[
|
|
@@ -13678,7 +13678,7 @@ var rings = [
|
|
|
13678
13678
|
],
|
|
13679
13679
|
[
|
|
13680
13680
|
/^ring-offset-op(?:acity)?-?(.+)$/,
|
|
13681
|
-
([,
|
|
13681
|
+
([, opacity], { theme }) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
13682
13682
|
{ autocomplete: "ring-offset-(op|opacity)-<percent>" }
|
|
13683
13683
|
],
|
|
13684
13684
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
@@ -13879,7 +13879,7 @@ var contains = [
|
|
|
13879
13879
|
[/^contain-(.*)$/, ([, d], { theme }) => {
|
|
13880
13880
|
const value = h.bracket(d, theme);
|
|
13881
13881
|
if (value != null)
|
|
13882
|
-
return { contain: value.split(" ").map((
|
|
13882
|
+
return { contain: value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") };
|
|
13883
13883
|
return containValues.includes(d) ? [{
|
|
13884
13884
|
"--un-contain-size": d,
|
|
13885
13885
|
contain: containValues.map((i) => `var(--un-contain-${i})`).join(" ")
|
|
@@ -14085,9 +14085,9 @@ var objectPositions = [
|
|
|
14085
14085
|
([, d], { theme }) => {
|
|
14086
14086
|
if (positionMap[d])
|
|
14087
14087
|
return { "object-position": positionMap[d] };
|
|
14088
|
-
const
|
|
14089
|
-
if (
|
|
14090
|
-
return { "object-position":
|
|
14088
|
+
const position = h.bracketOfPosition(d, theme);
|
|
14089
|
+
if (position != null)
|
|
14090
|
+
return { "object-position": position.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
14091
14091
|
},
|
|
14092
14092
|
{ autocomplete: `object-(${Object.keys(positionMap).join("|")})` }
|
|
14093
14093
|
]
|
|
@@ -14152,7 +14152,7 @@ var svgUtilities = [
|
|
|
14152
14152
|
],
|
|
14153
14153
|
[
|
|
14154
14154
|
/^fill-op(?:acity)?-?(.+)$/,
|
|
14155
|
-
([,
|
|
14155
|
+
([, opacity], { theme }) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
14156
14156
|
{ autocomplete: "fill-(op|opacity)-<percent>" }
|
|
14157
14157
|
],
|
|
14158
14158
|
["fill-none", { fill: "none" }],
|
|
@@ -14170,7 +14170,7 @@ var svgUtilities = [
|
|
|
14170
14170
|
],
|
|
14171
14171
|
[
|
|
14172
14172
|
/^stroke-op(?:acity)?-?(.+)$/,
|
|
14173
|
-
([,
|
|
14173
|
+
([, opacity], { theme }) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
14174
14174
|
{ autocomplete: "stroke-(op|opacity)-<percent>" }
|
|
14175
14175
|
],
|
|
14176
14176
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -14232,8 +14232,8 @@ var tables = [
|
|
|
14232
14232
|
[`--un-border-spacing-${d}`]: v,
|
|
14233
14233
|
"border-spacing": "var(--un-border-spacing-x) var(--un-border-spacing-y)"
|
|
14234
14234
|
};
|
|
14235
|
-
for (const
|
|
14236
|
-
yield defineProperty(`--un-border-spacing-${
|
|
14235
|
+
for (const d of ["x", "y"])
|
|
14236
|
+
yield defineProperty(`--un-border-spacing-${d}`, {
|
|
14237
14237
|
syntax: "<length>",
|
|
14238
14238
|
initialValue: "0"
|
|
14239
14239
|
});
|
|
@@ -14394,7 +14394,7 @@ function handleTranslate([, d, b], { theme }) {
|
|
|
14394
14394
|
"x",
|
|
14395
14395
|
"y",
|
|
14396
14396
|
"z"
|
|
14397
|
-
].map((
|
|
14397
|
+
].map((d) => defineProperty(`--un-translate-${d}`, { initialValue: 0 }))];
|
|
14398
14398
|
}
|
|
14399
14399
|
}
|
|
14400
14400
|
function handleScale([, d, b], { theme }) {
|
|
@@ -14406,7 +14406,7 @@ function handleScale([, d, b], { theme }) {
|
|
|
14406
14406
|
"x",
|
|
14407
14407
|
"y",
|
|
14408
14408
|
"z"
|
|
14409
|
-
].map((
|
|
14409
|
+
].map((d) => defineProperty(`--un-scale-${d}`, { initialValue: 1 }))];
|
|
14410
14410
|
}
|
|
14411
14411
|
}
|
|
14412
14412
|
function handleRotate([, d = "", b], { theme }) {
|
|
@@ -14421,8 +14421,8 @@ function handleRotate([, d = "", b], { theme }) {
|
|
|
14421
14421
|
"x",
|
|
14422
14422
|
"y",
|
|
14423
14423
|
"z"
|
|
14424
|
-
].map((
|
|
14425
|
-
...["x", "y"].map((
|
|
14424
|
+
].map((d) => defineProperty(`--un-rotate-${d}`, { initialValue: `rotate${d.toUpperCase()}(0)` })),
|
|
14425
|
+
...["x", "y"].map((d) => defineProperty(`--un-skew-${d}`, { initialValue: `skew${d.toUpperCase()}(0)` }))
|
|
14426
14426
|
];
|
|
14427
14427
|
else
|
|
14428
14428
|
return { rotate: h.bracket.cssvar.degree(b, theme) };
|
|
@@ -14438,15 +14438,15 @@ function handleSkew([, d, b], { theme }) {
|
|
|
14438
14438
|
"x",
|
|
14439
14439
|
"y",
|
|
14440
14440
|
"z"
|
|
14441
|
-
].map((
|
|
14442
|
-
...["x", "y"].map((
|
|
14441
|
+
].map((d) => defineProperty(`--un-rotate-${d}`, { initialValue: `rotate${d.toUpperCase()}(0)` })),
|
|
14442
|
+
...["x", "y"].map((d) => defineProperty(`--un-skew-${d}`, { initialValue: `skew${d.toUpperCase()}(0)` }))
|
|
14443
14443
|
];
|
|
14444
14444
|
}
|
|
14445
14445
|
function transformXYZ(d, v, name) {
|
|
14446
14446
|
const values = v.split(splitComma);
|
|
14447
14447
|
if (d || !d && values.length === 1)
|
|
14448
14448
|
return xyzMap[d].map((i) => [`--un-${name}${i}`, v]);
|
|
14449
|
-
return values.map((
|
|
14449
|
+
return values.map((v, i) => [`--un-${name}-${xyzArray[i]}`, v]);
|
|
14450
14450
|
}
|
|
14451
14451
|
function resolveTransitionProperty(prop, theme) {
|
|
14452
14452
|
let p;
|
|
@@ -14455,7 +14455,7 @@ function resolveTransitionProperty(prop, theme) {
|
|
|
14455
14455
|
else {
|
|
14456
14456
|
if (prop.startsWith("[") && prop.endsWith("]"))
|
|
14457
14457
|
prop = prop.slice(1, -1);
|
|
14458
|
-
const props = prop.split(",").map((
|
|
14458
|
+
const props = prop.split(",").map((p) => theme.property?.[p] ?? h.properties(p));
|
|
14459
14459
|
if (props.every(Boolean))
|
|
14460
14460
|
p = props.join(",");
|
|
14461
14461
|
}
|
|
@@ -14545,7 +14545,7 @@ var fonts = [
|
|
|
14545
14545
|
],
|
|
14546
14546
|
[
|
|
14547
14547
|
/^(?:text|color|c)-op(?:acity)?-?(.+)$/,
|
|
14548
|
-
([,
|
|
14548
|
+
([, opacity], { theme }) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
14549
14549
|
{ autocomplete: "(text|color|c)-(op|opacity)-<percent>" }
|
|
14550
14550
|
],
|
|
14551
14551
|
[
|
|
@@ -14717,7 +14717,7 @@ var textStrokes = [
|
|
|
14717
14717
|
],
|
|
14718
14718
|
[
|
|
14719
14719
|
/^text-stroke-op(?:acity)?-?(.+)$/,
|
|
14720
|
-
([,
|
|
14720
|
+
([, opacity], { theme }) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
14721
14721
|
{ autocomplete: "text-stroke-(op|opacity)-<percent>" }
|
|
14722
14722
|
]
|
|
14723
14723
|
];
|
|
@@ -14756,7 +14756,7 @@ var textShadows = [
|
|
|
14756
14756
|
],
|
|
14757
14757
|
[
|
|
14758
14758
|
/^text-shadow(?:-color)?-op(?:acity)?-?(.+)$/,
|
|
14759
|
-
([,
|
|
14759
|
+
([, opacity], { theme }) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
14760
14760
|
{ autocomplete: "text-shadow(-color)?-(op|opacity)-<percent>" }
|
|
14761
14761
|
]
|
|
14762
14762
|
];
|
|
@@ -16038,11 +16038,11 @@ var variantAria = {
|
|
|
16038
16038
|
const variant = variantGetParameter("aria-", matcher, ctx.generator.config.separators);
|
|
16039
16039
|
if (variant) {
|
|
16040
16040
|
const [match, rest] = variant;
|
|
16041
|
-
const
|
|
16042
|
-
if (
|
|
16041
|
+
const aria = h.bracket(match, ctx.theme) ?? ctx.theme.aria?.[match] ?? "";
|
|
16042
|
+
if (aria)
|
|
16043
16043
|
return {
|
|
16044
16044
|
matcher: rest,
|
|
16045
|
-
selector: (s) => `${s}[aria-${
|
|
16045
|
+
selector: (s) => `${s}[aria-${aria}]`
|
|
16046
16046
|
};
|
|
16047
16047
|
}
|
|
16048
16048
|
},
|
|
@@ -16090,7 +16090,7 @@ var variantTaggedAriaAttributes = [
|
|
|
16090
16090
|
];
|
|
16091
16091
|
var sizePseudo = /(max|min)-\[([^\]]*)\]:/;
|
|
16092
16092
|
function variantBreakpoints() {
|
|
16093
|
-
const
|
|
16093
|
+
const regexCache = {};
|
|
16094
16094
|
return {
|
|
16095
16095
|
name: "breakpoints",
|
|
16096
16096
|
match(matcher, context) {
|
|
@@ -16110,9 +16110,9 @@ function variantBreakpoints() {
|
|
|
16110
16110
|
idx
|
|
16111
16111
|
]);
|
|
16112
16112
|
for (const [point, size, idx] of variantEntries) {
|
|
16113
|
-
if (!
|
|
16114
|
-
|
|
16115
|
-
const match = matcher.match(
|
|
16113
|
+
if (!regexCache[point])
|
|
16114
|
+
regexCache[point] = new RegExp(`^((?:([al]t-|[<~]|max-))?${point}(?:${context.generator.config.separators.join("|")}))`);
|
|
16115
|
+
const match = matcher.match(regexCache[point]);
|
|
16116
16116
|
if (!match)
|
|
16117
16117
|
continue;
|
|
16118
16118
|
const [, pre] = match;
|
|
@@ -16203,12 +16203,12 @@ var variantContainerQuery = {
|
|
|
16203
16203
|
if (variant) {
|
|
16204
16204
|
const [match, rest, label] = variant;
|
|
16205
16205
|
const unbracket = h.bracket(match, ctx.theme);
|
|
16206
|
-
let
|
|
16206
|
+
let container;
|
|
16207
16207
|
if (unbracket)
|
|
16208
|
-
|
|
16208
|
+
container = h.numberWithUnit(unbracket);
|
|
16209
16209
|
else
|
|
16210
|
-
|
|
16211
|
-
if (
|
|
16210
|
+
container = ctx.theme.container?.[match] ?? "";
|
|
16211
|
+
if (container) {
|
|
16212
16212
|
let order = 1000 + Object.keys(ctx.theme.container ?? {}).indexOf(match);
|
|
16213
16213
|
if (label)
|
|
16214
16214
|
order += 1000;
|
|
@@ -16216,7 +16216,7 @@ var variantContainerQuery = {
|
|
|
16216
16216
|
matcher: rest,
|
|
16217
16217
|
handle: (input, next) => next({
|
|
16218
16218
|
...input,
|
|
16219
|
-
parent: `${input.parent ? `${input.parent} $$ ` : ""}@container${label ? ` ${label} ` : " "}(min-width: ${
|
|
16219
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@container${label ? ` ${label} ` : " "}(min-width: ${container})`,
|
|
16220
16220
|
parentOrder: order
|
|
16221
16221
|
})
|
|
16222
16222
|
};
|
|
@@ -16357,15 +16357,15 @@ var variantCustomMedia = {
|
|
|
16357
16357
|
const variant = variantGetParameter("media-", matcher, ctx.generator.config.separators);
|
|
16358
16358
|
if (variant) {
|
|
16359
16359
|
const [match, rest] = variant;
|
|
16360
|
-
let
|
|
16361
|
-
if (
|
|
16362
|
-
|
|
16363
|
-
if (
|
|
16360
|
+
let media = h.bracket(match, ctx.theme) ?? "";
|
|
16361
|
+
if (media === "")
|
|
16362
|
+
media = ctx.theme.media?.[match] ?? "";
|
|
16363
|
+
if (media)
|
|
16364
16364
|
return {
|
|
16365
16365
|
matcher: rest,
|
|
16366
16366
|
handle: (input, next) => next({
|
|
16367
16367
|
...input,
|
|
16368
|
-
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media ${
|
|
16368
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media ${media}`
|
|
16369
16369
|
})
|
|
16370
16370
|
};
|
|
16371
16371
|
}
|
|
@@ -16431,11 +16431,11 @@ var variantScope = {
|
|
|
16431
16431
|
const variant = variantGetBracket("scope-", matcher, ctx.generator.config.separators);
|
|
16432
16432
|
if (variant) {
|
|
16433
16433
|
const [match, rest] = variant;
|
|
16434
|
-
const
|
|
16435
|
-
if (
|
|
16434
|
+
const scope = h.bracket(match, ctx.theme);
|
|
16435
|
+
if (scope)
|
|
16436
16436
|
return {
|
|
16437
16437
|
matcher: rest,
|
|
16438
|
-
selector: (s) => `${
|
|
16438
|
+
selector: (s) => `${scope} $$ ${s}`
|
|
16439
16439
|
};
|
|
16440
16440
|
}
|
|
16441
16441
|
}
|
|
@@ -16578,18 +16578,18 @@ var variantNegative = {
|
|
|
16578
16578
|
};
|
|
16579
16579
|
}
|
|
16580
16580
|
};
|
|
16581
|
-
var placeholderModifier = (input, { theme
|
|
16581
|
+
var placeholderModifier = (input, { theme }) => {
|
|
16582
16582
|
const m = input.match(/^(.*)\b(placeholder-)(.+)$/);
|
|
16583
16583
|
if (m) {
|
|
16584
16584
|
const [, pre = "", p, body] = m;
|
|
16585
|
-
if (hasParseableColor(body,
|
|
16585
|
+
if (hasParseableColor(body, theme) || hasOpacityValue(body, theme))
|
|
16586
16586
|
return { matcher: `${pre}placeholder-$ ${p}${body}` };
|
|
16587
16587
|
}
|
|
16588
16588
|
};
|
|
16589
|
-
function hasOpacityValue(body,
|
|
16589
|
+
function hasOpacityValue(body, theme) {
|
|
16590
16590
|
const match = body.match(/^op(?:acity)?-?(.+)$/);
|
|
16591
16591
|
if (match && match[1] != null)
|
|
16592
|
-
return h.bracket.percent(match[1],
|
|
16592
|
+
return h.bracket.percent(match[1], theme) != null;
|
|
16593
16593
|
return false;
|
|
16594
16594
|
}
|
|
16595
16595
|
function variantPseudoClassesAndElements() {
|
|
@@ -16634,20 +16634,20 @@ var variantSupports = {
|
|
|
16634
16634
|
const variant = variantGetParameter("supports-", matcher, ctx.generator.config.separators);
|
|
16635
16635
|
if (variant) {
|
|
16636
16636
|
const [match, rest] = variant;
|
|
16637
|
-
let
|
|
16638
|
-
if (
|
|
16639
|
-
|
|
16640
|
-
if (
|
|
16641
|
-
if (/^[\w-]+$/.test(
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
if (!(
|
|
16645
|
-
|
|
16637
|
+
let supports = h.bracket(match, ctx.theme) ?? "";
|
|
16638
|
+
if (supports === "")
|
|
16639
|
+
supports = ctx.theme.supports?.[match] ?? "";
|
|
16640
|
+
if (supports) {
|
|
16641
|
+
if (/^[\w-]+$/.test(supports))
|
|
16642
|
+
supports = `(${supports}: var(--un))`;
|
|
16643
|
+
supports = supports.replace(/\b(and|or|not)\b/gi, " $1 ").replace(/\s+/g, " ").trim();
|
|
16644
|
+
if (!(supports.startsWith("(") && supports.endsWith(")")) && !/^not\b/i.test(supports))
|
|
16645
|
+
supports = `(${supports})`;
|
|
16646
16646
|
return {
|
|
16647
16647
|
matcher: rest,
|
|
16648
16648
|
handle: (input, next) => next({
|
|
16649
16649
|
...input,
|
|
16650
|
-
parent: `${input.parent ? `${input.parent} $$ ` : ""}@supports ${
|
|
16650
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@supports ${supports}`
|
|
16651
16651
|
})
|
|
16652
16652
|
};
|
|
16653
16653
|
}
|
|
@@ -16777,7 +16777,7 @@ function property2(options) {
|
|
|
16777
16777
|
getCSS: () => {
|
|
16778
16778
|
if (trackedProperties.size === 0)
|
|
16779
16779
|
return;
|
|
16780
|
-
const css = Array.from(trackedProperties.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([
|
|
16780
|
+
const css = Array.from(trackedProperties.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([property, value]) => `${property.replace(/^--un-/, `--${prefix}`)}:${value};`).join("");
|
|
16781
16781
|
return parentSelector === false ? `${selector}{${css}}` : `${parentSelector}{${selector}{${css}}}`;
|
|
16782
16782
|
},
|
|
16783
16783
|
layer: "properties"
|
|
@@ -17212,8 +17212,8 @@ var ExcludeCssVarKeys = [
|
|
|
17212
17212
|
"supports",
|
|
17213
17213
|
"containers"
|
|
17214
17214
|
];
|
|
17215
|
-
function getThemeVarsMap(
|
|
17216
|
-
const themeMap = /* @__PURE__ */ new Map([["--spacing",
|
|
17215
|
+
function getThemeVarsMap(theme, keys) {
|
|
17216
|
+
const themeMap = /* @__PURE__ */ new Map([["--spacing", theme.spacing.DEFAULT]]);
|
|
17217
17217
|
const normalizeValue = (value) => value.replace(alphaPlaceholdersRE, "1");
|
|
17218
17218
|
function process(obj, prefix) {
|
|
17219
17219
|
for (const key in obj)
|
|
@@ -17224,10 +17224,10 @@ function getThemeVarsMap(theme2, keys) {
|
|
|
17224
17224
|
else
|
|
17225
17225
|
themeMap.set(`--${prefix}-${key}`, normalizeValue(obj[key]));
|
|
17226
17226
|
}
|
|
17227
|
-
for (const key in
|
|
17227
|
+
for (const key in theme) {
|
|
17228
17228
|
if (!keys.includes(key))
|
|
17229
17229
|
continue;
|
|
17230
|
-
process(
|
|
17230
|
+
process(theme[key], key);
|
|
17231
17231
|
}
|
|
17232
17232
|
return themeMap;
|
|
17233
17233
|
}
|
|
@@ -17239,7 +17239,7 @@ function theme$1(options) {
|
|
|
17239
17239
|
return {
|
|
17240
17240
|
layer: "theme",
|
|
17241
17241
|
getCSS(ctx) {
|
|
17242
|
-
const { theme
|
|
17242
|
+
const { theme, generator } = ctx;
|
|
17243
17243
|
const safelist = uniq(generator.config.safelist.flatMap((s) => typeof s === "function" ? s(ctx) : s));
|
|
17244
17244
|
const { mode, process } = preflightsTheme;
|
|
17245
17245
|
if (mode === false)
|
|
@@ -17247,22 +17247,22 @@ function theme$1(options) {
|
|
|
17247
17247
|
if (safelist.length > 0)
|
|
17248
17248
|
for (const s of safelist) {
|
|
17249
17249
|
const [key, ...prop] = s.trim().split(":");
|
|
17250
|
-
if (key in
|
|
17250
|
+
if (key in theme && prop.length <= 1) {
|
|
17251
17251
|
const props = prop.length === 0 ? ["DEFAULT"] : prop[0].split("-");
|
|
17252
|
-
const v = getThemeByKey(
|
|
17252
|
+
const v = getThemeByKey(theme, key, props);
|
|
17253
17253
|
if (typeof v === "string") {
|
|
17254
17254
|
themeTracking(key, props);
|
|
17255
|
-
detectThemeValue(v,
|
|
17255
|
+
detectThemeValue(v, theme);
|
|
17256
17256
|
}
|
|
17257
17257
|
}
|
|
17258
17258
|
}
|
|
17259
17259
|
let deps;
|
|
17260
|
-
const generateCSS = (
|
|
17260
|
+
const generateCSS = (deps) => {
|
|
17261
17261
|
if (process)
|
|
17262
|
-
for (const utility of
|
|
17262
|
+
for (const utility of deps)
|
|
17263
17263
|
for (const p of toArray(process))
|
|
17264
17264
|
p(utility, ctx);
|
|
17265
|
-
const resolvedDeps =
|
|
17265
|
+
const resolvedDeps = deps.map(([key, value]) => key && value ? `${escapeSelector(key)}: ${value};` : undefined).filter(Boolean);
|
|
17266
17266
|
if (resolvedDeps.length === 0)
|
|
17267
17267
|
return;
|
|
17268
17268
|
const depCSS = resolvedDeps.join(`
|
|
@@ -17277,13 +17277,13 @@ ${depCSS}
|
|
|
17277
17277
|
return;
|
|
17278
17278
|
deps = Array.from(trackedTheme).map((k) => {
|
|
17279
17279
|
const [key, prop] = k.split(":");
|
|
17280
|
-
const v = getThemeByKey(
|
|
17280
|
+
const v = getThemeByKey(theme, key, prop.split("-"));
|
|
17281
17281
|
if (typeof v === "string")
|
|
17282
17282
|
return [`--${key}${`${key === "spacing" && prop === "DEFAULT" ? "" : `-${prop}`}`}`, v];
|
|
17283
17283
|
}).filter(Boolean);
|
|
17284
17284
|
} else {
|
|
17285
|
-
const keys = Object.keys(
|
|
17286
|
-
deps = Array.from(getThemeVarsMap(
|
|
17285
|
+
const keys = Object.keys(theme).filter((k) => !ExcludeCssVarKeys.includes(k));
|
|
17286
|
+
deps = Array.from(getThemeVarsMap(theme, keys));
|
|
17287
17287
|
}
|
|
17288
17288
|
return generateCSS(deps);
|
|
17289
17289
|
}
|
|
@@ -17341,19 +17341,19 @@ var presetWind4 = definePreset((options = {}) => {
|
|
|
17341
17341
|
});
|
|
17342
17342
|
|
|
17343
17343
|
// src/client/runtime/uno-config.ts
|
|
17344
|
-
var unoConfig = (
|
|
17345
|
-
presets: [presetWind4({ important:
|
|
17344
|
+
var unoConfig = (scope) => ({
|
|
17345
|
+
presets: [presetWind4({ important: scope, preflights: { reset: false } })],
|
|
17346
17346
|
preflights: [
|
|
17347
17347
|
{
|
|
17348
|
-
getCSS: () => `${
|
|
17349
|
-
${
|
|
17350
|
-
${
|
|
17351
|
-
${
|
|
17352
|
-
${
|
|
17353
|
-
${
|
|
17348
|
+
getCSS: () => `${scope} *, ${scope} *::before, ${scope} *::after { box-sizing: border-box; }
|
|
17349
|
+
${scope} ul, ${scope} ol { list-style: none; margin: 0; padding: 0; }
|
|
17350
|
+
${scope} h1, ${scope} h2, ${scope} h3, ${scope} h4, ${scope} h5, ${scope} h6,
|
|
17351
|
+
${scope} p, ${scope} blockquote, ${scope} figure, ${scope} figcaption,
|
|
17352
|
+
${scope} dl, ${scope} dd, ${scope} pre, ${scope} hr { margin: 0; }
|
|
17353
|
+
${scope} button, ${scope} input, ${scope} select, ${scope} textarea {
|
|
17354
17354
|
background: transparent; color: inherit; font: inherit; border: 0 solid; cursor: pointer;
|
|
17355
17355
|
}
|
|
17356
|
-
${
|
|
17356
|
+
${scope} input, ${scope} select, ${scope} textarea { cursor: auto; }`
|
|
17357
17357
|
}
|
|
17358
17358
|
],
|
|
17359
17359
|
theme: {
|
|
@@ -17395,13 +17395,13 @@ async function ensureUnoStyles(code, streaming = false) {
|
|
|
17395
17395
|
if (streaming) {
|
|
17396
17396
|
if (!preflighted) {
|
|
17397
17397
|
preflighted = true;
|
|
17398
|
-
const { css
|
|
17399
|
-
sheet.textContent += splitVendorRules(
|
|
17398
|
+
const { css } = await uno.generate([], { preflights: true });
|
|
17399
|
+
sheet.textContent += splitVendorRules(css);
|
|
17400
17400
|
}
|
|
17401
17401
|
if (fresh.length === 0)
|
|
17402
17402
|
return;
|
|
17403
|
-
const { css
|
|
17404
|
-
sheet.textContent += splitVendorRules(
|
|
17403
|
+
const { css } = await uno.generate(fresh, { preflights: false });
|
|
17404
|
+
sheet.textContent += splitVendorRules(css);
|
|
17405
17405
|
return;
|
|
17406
17406
|
}
|
|
17407
17407
|
preflighted = true;
|
|
@@ -17533,12 +17533,12 @@ function GenUISurface({ code, streaming = false, preserveState = true, onError,
|
|
|
17533
17533
|
});
|
|
17534
17534
|
});
|
|
17535
17535
|
import_react4.useEffect(() => {
|
|
17536
|
-
const
|
|
17537
|
-
if (
|
|
17536
|
+
const host = hostRef.current;
|
|
17537
|
+
if (host === null)
|
|
17538
17538
|
return;
|
|
17539
17539
|
let disposed = false;
|
|
17540
17540
|
let attached = null;
|
|
17541
|
-
GenUIRenderer.create(
|
|
17541
|
+
GenUIRenderer.create(host, {
|
|
17542
17542
|
compiler: compiler(),
|
|
17543
17543
|
importmap: { imports: localImports() },
|
|
17544
17544
|
preserveStateOnUpdate: preserveStateRef.current,
|
|
@@ -17551,8 +17551,8 @@ function GenUISurface({ code, streaming = false, preserveState = true, onError,
|
|
|
17551
17551
|
strandedRef.current = { error, phase };
|
|
17552
17552
|
dispatchError(action, {
|
|
17553
17553
|
attempts: () => retriesRef.current,
|
|
17554
|
-
setAttempts: (
|
|
17555
|
-
retriesRef.current =
|
|
17554
|
+
setAttempts: (n) => {
|
|
17555
|
+
retriesRef.current = n;
|
|
17556
17556
|
},
|
|
17557
17557
|
schedule: (ms) => void retryTimers.current.add(setTimeout(() => retryRef.current(), ms)),
|
|
17558
17558
|
report: () => onErrorRef.current?.(error, phase)
|
|
@@ -17680,9 +17680,9 @@ ${fence}`);
|
|
|
17680
17680
|
var TOOL_CALL_MARKUP = /\n?(?:<\/(?:antml:|||DSML||)?(?:parameter|invoke|tool_calls)>\s*)+$/;
|
|
17681
17681
|
var CODE_LINE = /^(import|export|const|function|type|interface|let|\/\/)\b/;
|
|
17682
17682
|
var FENCE_META = /^[\w-]+=/;
|
|
17683
|
-
function parseUi4aSegments(
|
|
17683
|
+
function parseUi4aSegments(text) {
|
|
17684
17684
|
const segments = [];
|
|
17685
|
-
let rest =
|
|
17685
|
+
let rest = text;
|
|
17686
17686
|
while (true) {
|
|
17687
17687
|
const open = FENCE.exec(rest);
|
|
17688
17688
|
if (open === null)
|
|
@@ -17759,8 +17759,8 @@ var dropPreview = (claim) => {
|
|
|
17759
17759
|
};
|
|
17760
17760
|
var DRAWS = new Set(["SVG", "CANVAS", "IMG", "VIDEO", "IFRAME", "PICTURE"]);
|
|
17761
17761
|
var BOUNDARY_ERROR = /^ERROR(:|$)/;
|
|
17762
|
-
var isPaintedText = (
|
|
17763
|
-
const trimmed =
|
|
17762
|
+
var isPaintedText = (text) => {
|
|
17763
|
+
const trimmed = text.trim();
|
|
17764
17764
|
return trimmed !== "" && !BOUNDARY_ERROR.test(trimmed);
|
|
17765
17765
|
};
|
|
17766
17766
|
var hasPainted = (mount) => {
|
|
@@ -17790,9 +17790,9 @@ var isLastSegment = (segments, code) => {
|
|
|
17790
17790
|
return last !== undefined && (sameCode(last.code, code) || last.code.startsWith(code));
|
|
17791
17791
|
};
|
|
17792
17792
|
var NEAR_VIEWPORT = "100% 0px";
|
|
17793
|
-
function claimInlineFences({ segments, render, scope
|
|
17793
|
+
function claimInlineFences({ segments, render, t, subscribeLocale, scope }) {
|
|
17794
17794
|
const claims = new Map;
|
|
17795
|
-
const root =
|
|
17795
|
+
const root = scope ?? document.body;
|
|
17796
17796
|
const parked = new Set;
|
|
17797
17797
|
const woken = new Set;
|
|
17798
17798
|
const nearby = typeof IntersectionObserver === "undefined" ? null : new IntersectionObserver((entries) => {
|
|
@@ -17905,12 +17905,17 @@ function claimInlineFences({ segments, render, scope: scope2 }) {
|
|
|
17905
17905
|
claim.code = code;
|
|
17906
17906
|
claim.complete = complete;
|
|
17907
17907
|
claim.root.render(render({ code, streaming: !complete, last: () => isLastSegment(segments(), code) }));
|
|
17908
|
-
claim.preview?.root.render(import_react5.createElement(import_dsh_client_ui_primitives.CodeBlock, { code, lang: "tsx" }));
|
|
17908
|
+
claim.preview?.root.render(import_react5.createElement(import_dsh_client_ui_primitives.CodeBlock, { code, lang: "tsx", copyLabel: t("copy"), copiedLabel: t("copied") }));
|
|
17909
17909
|
}
|
|
17910
17910
|
};
|
|
17911
17911
|
const stop = observeTranscript(sweep);
|
|
17912
|
+
const stopLocale = subscribeLocale(() => {
|
|
17913
|
+
for (const claim of claims.values())
|
|
17914
|
+
claim.preview?.root.render(import_react5.createElement(import_dsh_client_ui_primitives.CodeBlock, { code: claim.code, lang: "tsx", copyLabel: t("copy"), copiedLabel: t("copied") }));
|
|
17915
|
+
});
|
|
17912
17916
|
return () => {
|
|
17913
17917
|
stop();
|
|
17918
|
+
stopLocale();
|
|
17914
17919
|
nearby?.disconnect();
|
|
17915
17920
|
parked.clear();
|
|
17916
17921
|
woken.clear();
|
|
@@ -17993,14 +17998,14 @@ async function readCanvasChild(cwd, id, specifier, from) {
|
|
|
17993
17998
|
var SPECIFIER = /(\bfrom\s*|\bimport\s*\(\s*)["'](\.[^"']*)["']/;
|
|
17994
17999
|
var SPECIFIER_ALL = new RegExp(SPECIFIER, "g");
|
|
17995
18000
|
var importsSibling = (code) => SPECIFIER.test(code);
|
|
17996
|
-
async function inlineSubPages(code, entry,
|
|
18001
|
+
async function inlineSubPages(code, entry, read, compile, urls) {
|
|
17997
18002
|
const sources = new Map;
|
|
17998
18003
|
const missing = new Set;
|
|
17999
18004
|
const specifiersIn = (source) => new Set([...source.matchAll(SPECIFIER_ALL)].map((match) => match[2]));
|
|
18000
18005
|
let frontier = [...specifiersIn(code)].map((specifier) => ({ specifier, from: entry }));
|
|
18001
18006
|
const entryTargets = new Map;
|
|
18002
18007
|
while (frontier.length > 0) {
|
|
18003
|
-
const bodies = await Promise.all(frontier.map(async (want) => [want, await
|
|
18008
|
+
const bodies = await Promise.all(frontier.map(async (want) => [want, await read(want.specifier, want.from)]));
|
|
18004
18009
|
const next = [];
|
|
18005
18010
|
for (const [want, found] of bodies) {
|
|
18006
18011
|
const targets = want.from === entry ? entryTargets : sources.get(want.from)?.specifiers;
|
|
@@ -18031,7 +18036,7 @@ async function inlineSubPages(code, entry, read2, compile, urls2) {
|
|
|
18031
18036
|
for (const [filename, compiled] of built) {
|
|
18032
18037
|
const url = URL.createObjectURL(new Blob([compiled], { type: "text/javascript" }));
|
|
18033
18038
|
urlFor.set(filename, url);
|
|
18034
|
-
|
|
18039
|
+
urls.push(url);
|
|
18035
18040
|
progress = true;
|
|
18036
18041
|
}
|
|
18037
18042
|
}
|
|
@@ -18072,16 +18077,16 @@ function useSubPages(cwd, canvas) {
|
|
|
18072
18077
|
return;
|
|
18073
18078
|
const key = `${id}:${code.length}`;
|
|
18074
18079
|
let live = true;
|
|
18075
|
-
const
|
|
18080
|
+
const urls = [];
|
|
18076
18081
|
const compile = async (filename, source) => (await compiler().compile(source, { filename })).code;
|
|
18077
|
-
inlineSubPages(code, canvasPath(id), (specifier, from) => readCanvasChild(cwd, id, specifier, from), compile,
|
|
18082
|
+
inlineSubPages(code, canvasPath(id), (specifier, from) => readCanvasChild(cwd, id, specifier, from), compile, urls).then((next) => {
|
|
18078
18083
|
if (!live)
|
|
18079
|
-
return void revokeAll(
|
|
18084
|
+
return void revokeAll(urls);
|
|
18080
18085
|
setResolved({ key, code: next });
|
|
18081
18086
|
});
|
|
18082
18087
|
return () => {
|
|
18083
18088
|
live = false;
|
|
18084
|
-
revokeAll(
|
|
18089
|
+
revokeAll(urls);
|
|
18085
18090
|
};
|
|
18086
18091
|
}, [cwd, id, code, streaming]);
|
|
18087
18092
|
if (id === undefined || code === undefined)
|
|
@@ -18089,9 +18094,9 @@ function useSubPages(cwd, canvas) {
|
|
|
18089
18094
|
return resolved !== null && resolved.key === `${id}:${code.length}` ? resolved.code : code;
|
|
18090
18095
|
}
|
|
18091
18096
|
var needsResolve = (code, streaming) => !streaming && importsSibling(code);
|
|
18092
|
-
var revokeAll = (
|
|
18093
|
-
while (
|
|
18094
|
-
URL.revokeObjectURL(
|
|
18097
|
+
var revokeAll = (urls) => {
|
|
18098
|
+
while (urls.length > 0)
|
|
18099
|
+
URL.revokeObjectURL(urls.pop());
|
|
18095
18100
|
};
|
|
18096
18101
|
var MIN_WIDTH = 320;
|
|
18097
18102
|
var MAX_WIDTH = 720;
|
|
@@ -18101,15 +18106,15 @@ var otherCanvases = (canvases, offerable) => offerable.filter((id) => !canvases.
|
|
|
18101
18106
|
var widthForPointer = (clientX, viewportWidth) => Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, viewportWidth - clientX));
|
|
18102
18107
|
function useResize(initial) {
|
|
18103
18108
|
const [width, setWidth] = import_react7.useState(initial);
|
|
18104
|
-
const
|
|
18109
|
+
const frame = import_react7.useRef(0);
|
|
18105
18110
|
const start = (event) => {
|
|
18106
18111
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
18107
18112
|
event.currentTarget.setAttribute("data-dragging", "");
|
|
18108
18113
|
const move = (moveEvent) => {
|
|
18109
|
-
if (
|
|
18114
|
+
if (frame.current !== 0)
|
|
18110
18115
|
return;
|
|
18111
|
-
|
|
18112
|
-
|
|
18116
|
+
frame.current = requestAnimationFrame(() => {
|
|
18117
|
+
frame.current = 0;
|
|
18113
18118
|
setWidth(widthForPointer(moveEvent.clientX, window.innerWidth));
|
|
18114
18119
|
});
|
|
18115
18120
|
};
|
|
@@ -18117,9 +18122,9 @@ function useResize(initial) {
|
|
|
18117
18122
|
window.removeEventListener("pointermove", move);
|
|
18118
18123
|
window.removeEventListener("pointerup", stop);
|
|
18119
18124
|
document.querySelector("[data-dragging]")?.removeAttribute("data-dragging");
|
|
18120
|
-
if (
|
|
18121
|
-
cancelAnimationFrame(
|
|
18122
|
-
|
|
18125
|
+
if (frame.current !== 0)
|
|
18126
|
+
cancelAnimationFrame(frame.current);
|
|
18127
|
+
frame.current = 0;
|
|
18123
18128
|
};
|
|
18124
18129
|
window.addEventListener("pointermove", move);
|
|
18125
18130
|
window.addEventListener("pointerup", stop);
|
|
@@ -18672,37 +18677,37 @@ function whenFrameReady(onFound) {
|
|
|
18672
18677
|
onFound(found);
|
|
18673
18678
|
return () => {};
|
|
18674
18679
|
}
|
|
18675
|
-
const
|
|
18676
|
-
const
|
|
18677
|
-
if (
|
|
18680
|
+
const observer = new MutationObserver(() => {
|
|
18681
|
+
const frame = document.querySelector(FRAME);
|
|
18682
|
+
if (frame === null)
|
|
18678
18683
|
return;
|
|
18679
|
-
|
|
18684
|
+
observer.disconnect();
|
|
18680
18685
|
window.clearTimeout(timer);
|
|
18681
|
-
onFound(
|
|
18686
|
+
onFound(frame);
|
|
18682
18687
|
});
|
|
18683
|
-
|
|
18688
|
+
observer.observe(document.body, { subtree: true, childList: true });
|
|
18684
18689
|
const timer = window.setTimeout(() => {
|
|
18685
|
-
|
|
18690
|
+
observer.disconnect();
|
|
18686
18691
|
console.warn(`[dsh-generative-ui] no AppFrame matched ${FRAME} — canvases cannot mount. The host's layout markup likely changed.`);
|
|
18687
18692
|
}, 15000);
|
|
18688
18693
|
return () => {
|
|
18689
|
-
|
|
18694
|
+
observer.disconnect();
|
|
18690
18695
|
window.clearTimeout(timer);
|
|
18691
18696
|
};
|
|
18692
18697
|
}
|
|
18693
|
-
function createColumn(
|
|
18698
|
+
function createColumn(frame) {
|
|
18694
18699
|
const element = document.createElement("div");
|
|
18695
18700
|
element.setAttribute("data-dgu-canvas-column", "");
|
|
18696
18701
|
document.body.append(element);
|
|
18697
|
-
const previousPadding =
|
|
18702
|
+
const previousPadding = frame.style.paddingRight;
|
|
18698
18703
|
const setWidth = (width) => {
|
|
18699
|
-
|
|
18704
|
+
frame.style.paddingRight = width === 0 ? previousPadding : `${width}px`;
|
|
18700
18705
|
};
|
|
18701
18706
|
return {
|
|
18702
18707
|
element,
|
|
18703
18708
|
setWidth,
|
|
18704
18709
|
remove: () => {
|
|
18705
|
-
|
|
18710
|
+
frame.style.paddingRight = previousPadding;
|
|
18706
18711
|
element.remove();
|
|
18707
18712
|
}
|
|
18708
18713
|
};
|
|
@@ -18761,23 +18766,23 @@ function mountCanvasHost({ calls, cwd, sessionId, onCardError, onCardRendered })
|
|
|
18761
18766
|
});
|
|
18762
18767
|
}
|
|
18763
18768
|
const canvases = collected.canvases.filter((canvas) => !hidden.has(canvas.id)).map((canvas) => {
|
|
18764
|
-
const
|
|
18765
|
-
if (
|
|
18769
|
+
const version = collected.stale.get(canvas.id);
|
|
18770
|
+
if (version === undefined)
|
|
18766
18771
|
return canvas;
|
|
18767
|
-
const
|
|
18768
|
-
if (
|
|
18769
|
-
return
|
|
18772
|
+
const cached = fromFile.get(canvas.id);
|
|
18773
|
+
if (cached?.version === version)
|
|
18774
|
+
return cached.code === undefined ? canvas : { ...canvas, code: cached.code };
|
|
18770
18775
|
if (workspace !== undefined) {
|
|
18771
|
-
fromFile.set(canvas.id, { version
|
|
18776
|
+
fromFile.set(canvas.id, { version });
|
|
18772
18777
|
readCanvasFile(workspace, canvas.id).then((code) => {
|
|
18773
18778
|
if (code === null)
|
|
18774
18779
|
return;
|
|
18775
|
-
fromFile.set(canvas.id, { version
|
|
18780
|
+
fromFile.set(canvas.id, { version, code });
|
|
18776
18781
|
signature = null;
|
|
18777
18782
|
scheduleSweep();
|
|
18778
18783
|
});
|
|
18779
18784
|
}
|
|
18780
|
-
return
|
|
18785
|
+
return cached?.code === undefined ? canvas : { ...canvas, code: cached.code };
|
|
18781
18786
|
});
|
|
18782
18787
|
for (const id of opened.get(session) ?? EMPTY) {
|
|
18783
18788
|
if (hidden.has(id) || canvases.some((canvas) => canvas.id === id))
|
|
@@ -18841,7 +18846,7 @@ function mountCanvasHost({ calls, cwd, sessionId, onCardError, onCardRendered })
|
|
|
18841
18846
|
}
|
|
18842
18847
|
|
|
18843
18848
|
// src/client/index.ts
|
|
18844
|
-
var inject = ["sessions"];
|
|
18849
|
+
var inject = ["sessions", "locale"];
|
|
18845
18850
|
function apply(ctx) {
|
|
18846
18851
|
warmCompiler();
|
|
18847
18852
|
const segmentsOf = perNode((node) => `${node.anchorSeq}:${textOf(node).length}`, (node) => parseUi4aSegments(textOf(node)));
|
|
@@ -18849,7 +18854,7 @@ function apply(ctx) {
|
|
|
18849
18854
|
const callsOf = perNode((node) => `${node.anchorSeq}:${callsKeyOf(node)}`, (node) => node.kind === "tool-call" ? toolCallsOf(node.data) : []);
|
|
18850
18855
|
const calls = () => {
|
|
18851
18856
|
const nodes = chatNodes(ctx);
|
|
18852
|
-
return callsOf(nodes).map((
|
|
18857
|
+
return callsOf(nodes).map((calls, index) => ({ calls, seq: nodes[index]?.anchorSeq ?? 0 })).toSorted((a, b) => a.seq - b.seq).flatMap((entry) => entry.calls);
|
|
18853
18858
|
};
|
|
18854
18859
|
const cwd = () => {
|
|
18855
18860
|
const list = ctx.sessions.list.getSnapshot();
|
|
@@ -18868,13 +18873,13 @@ function apply(ctx) {
|
|
|
18868
18873
|
const release = registerUi4aHost({
|
|
18869
18874
|
cwd,
|
|
18870
18875
|
sessionId,
|
|
18871
|
-
send: (
|
|
18876
|
+
send: (text) => {
|
|
18872
18877
|
const id = currentSession();
|
|
18873
18878
|
const session = id === undefined ? undefined : scoped.sessions.scope(id);
|
|
18874
18879
|
if (session === undefined)
|
|
18875
18880
|
return void console.error("[dsh-generative-ui] $dsh/chat: no session to send into");
|
|
18876
18881
|
session.inject(["conversation"], (addressed) => {
|
|
18877
|
-
addressed.conversation.send(
|
|
18882
|
+
addressed.conversation.send(text).catch((error) => console.error("[dsh-generative-ui] $dsh/chat send failed", error));
|
|
18878
18883
|
});
|
|
18879
18884
|
}
|
|
18880
18885
|
});
|
|
@@ -18896,11 +18901,11 @@ function apply(ctx) {
|
|
|
18896
18901
|
};
|
|
18897
18902
|
let showCanvas = null;
|
|
18898
18903
|
ctx.effect(() => {
|
|
18899
|
-
const
|
|
18900
|
-
showCanvas =
|
|
18904
|
+
const host = mountCanvasHost({ calls, cwd, sessionId, onCardError: (message, phase) => reportCardError(sendToModel, message, phase), onCardRendered: cardRendered });
|
|
18905
|
+
showCanvas = host.show;
|
|
18901
18906
|
return () => {
|
|
18902
18907
|
showCanvas = null;
|
|
18903
|
-
|
|
18908
|
+
host.dispose();
|
|
18904
18909
|
};
|
|
18905
18910
|
}, "dsh-generative-ui: canvas column");
|
|
18906
18911
|
ctx.inject(["workspaces"], (scoped) => {
|
|
@@ -18922,6 +18927,8 @@ function apply(ctx) {
|
|
|
18922
18927
|
});
|
|
18923
18928
|
ctx.effect(() => claimInlineFences({
|
|
18924
18929
|
segments,
|
|
18930
|
+
t: ctx.locale.bind("common"),
|
|
18931
|
+
subscribeLocale: (refresh) => ctx.locale.subscribe(refresh),
|
|
18925
18932
|
render: ({ code, streaming, last }) => import_react9.createElement(GenUISurface, { code, streaming, onError: (error, phase) => reportCardError(sendToModel, error.message, phase, last), onRendered: (restored) => cardRendered(restored, last) })
|
|
18926
18933
|
}), "dsh-generative-ui: inline fences");
|
|
18927
18934
|
}
|
|
@@ -18929,11 +18936,11 @@ function textOf(node) {
|
|
|
18929
18936
|
const blocks = node.data?.blocks;
|
|
18930
18937
|
if (blocks === undefined)
|
|
18931
18938
|
return "";
|
|
18932
|
-
let
|
|
18939
|
+
let text = "";
|
|
18933
18940
|
for (const block of blocks)
|
|
18934
18941
|
if (block.kind === "text" && block.text !== undefined)
|
|
18935
|
-
|
|
18936
|
-
return
|
|
18942
|
+
text += block.text;
|
|
18943
|
+
return text;
|
|
18937
18944
|
}
|
|
18938
18945
|
function callsKeyOf(node) {
|
|
18939
18946
|
const parts = [];
|
|
@@ -18950,5 +18957,5 @@ function callsKeyOf(node) {
|
|
|
18950
18957
|
|
|
18951
18958
|
return module.exports; } });
|
|
18952
18959
|
|
|
18953
|
-
//# debugId=
|
|
18960
|
+
//# debugId=29F4BEE313CA37F064756E2164756E21
|
|
18954
18961
|
//# sourceMappingURL=client.js.map
|