kss-modern 1.7.0-beta.2 → 1.7.0-beta.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/dist/node/lib/index.mjs +4 -4
- package/dist/node/lib/pug/worker.mjs +1 -1
- package/dist/node/shared/{kss-modern.BOTbHnCm.mjs → kss-modern.tLBfjOgj.mjs} +25 -2
- package/dist/styleguide-assets/.vite/manifest.json +7 -7
- package/dist/styleguide-assets/{controller-BduQiyRp.js → controller-drB07Xo_.js} +197 -79
- package/dist/styleguide-assets/{explorer-B2UH96jd.js → explorer-BivD2FYm.js} +1 -1
- package/dist/styleguide-assets/{playground-BuO-B-Kx.js → playground-BBMnDZ8b.js} +1 -1
- package/dist/styleguide-assets/{preview-C3WnTlhx.js → preview-BkKvdDnK.js} +1 -1
- package/package.json +1 -1
package/dist/node/lib/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import process from 'node:process';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import { glob } from 'tinyglobby';
|
|
6
|
-
import { l as logger, s as sanitizeSpecialCharacters, P as PUG_ERROR_OVERLAY_TAG, r as requireZod, e as evaluateMixinSchema, c as compileMixinModule, p as pugErrorFile, a as compileMarkup, g as getZodVersion, d as discoverMixins, M as MIXIN_COMPILE_OPTIONS, b as getMixinWrapperSource, f as slugify, I as INSERT_VITE_PUG_TAG_RE, h as PUG_SRC_RE, t as themeClassList, i as ensureStartingSlash, j as sectionSanitizeId, k as stripPugErrorOverlay, m as generateId, n as replaceWrapperContent, o as formatSourceCode, q as htmlToSearchText } from '../shared/kss-modern.
|
|
7
|
-
export { u as createLogger } from '../shared/kss-modern.
|
|
6
|
+
import { l as logger, s as sanitizeSpecialCharacters, P as PUG_ERROR_OVERLAY_TAG, r as requireZod, e as evaluateMixinSchema, c as compileMixinModule, p as pugErrorFile, a as compileMarkup, g as getZodVersion, d as discoverMixins, M as MIXIN_COMPILE_OPTIONS, b as getMixinWrapperSource, f as slugify, I as INSERT_VITE_PUG_TAG_RE, h as PUG_SRC_RE, t as themeClassList, i as ensureStartingSlash, j as sectionSanitizeId, k as stripPugErrorOverlay, m as generateId, n as replaceWrapperContent, o as formatSourceCode, q as htmlToSearchText } from '../shared/kss-modern.tLBfjOgj.mjs';
|
|
7
|
+
export { u as createLogger } from '../shared/kss-modern.tLBfjOgj.mjs';
|
|
8
8
|
import { existsSync, readFileSync } from 'node:fs';
|
|
9
9
|
import fs$1 from 'node:fs/promises';
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
@@ -1810,7 +1810,7 @@ async function generateFullPageFile(data) {
|
|
|
1810
1810
|
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${data.brandColor.dark}">
|
|
1811
1811
|
` : `<meta name="theme-color" content="${data.brandColor}">`}
|
|
1812
1812
|
<script type="module" src="styleguide-assets/fullpage-aWqc0gjm.js"><\/script>
|
|
1813
|
-
${data.playgroundConfig ? '<script type="module" src="styleguide-assets/playground-
|
|
1813
|
+
${data.playgroundConfig ? '<script type="module" src="styleguide-assets/playground-BBMnDZ8b.js"><\/script>' : ""}
|
|
1814
1814
|
${computedStyleTags}
|
|
1815
1815
|
${computedThemeStyleTags}
|
|
1816
1816
|
</head>
|
|
@@ -2921,7 +2921,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
2921
2921
|
//#endregion
|
|
2922
2922
|
;
|
|
2923
2923
|
<\/script>
|
|
2924
|
-
<script type="module" src="styleguide-assets/preview-
|
|
2924
|
+
<script type="module" src="styleguide-assets/preview-BkKvdDnK.js"><\/script>
|
|
2925
2925
|
<link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
|
2926
2926
|
<link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-600-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
|
2927
2927
|
<link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-300-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parentPort } from 'node:worker_threads';
|
|
2
|
-
import { r as requireZod, e as evaluateMixinSchema, c as compileMixinModule, a as compileMarkup, p as pugErrorFile } from '../../shared/kss-modern.
|
|
2
|
+
import { r as requireZod, e as evaluateMixinSchema, c as compileMixinModule, a as compileMarkup, p as pugErrorFile } from '../../shared/kss-modern.tLBfjOgj.mjs';
|
|
3
3
|
import 'node:path';
|
|
4
4
|
import 'pug';
|
|
5
5
|
import 'node:fs';
|
|
@@ -264,6 +264,9 @@ const ARRAY_KEYS = ["type", "items", "minItems", "maxItems", ...ANNOTATION_KEYS]
|
|
|
264
264
|
const LITERAL_UNION_KEYS = ["anyOf", ...ANNOTATION_KEYS];
|
|
265
265
|
const ROOT_KEYS = ["$schema", "type", "properties", "required", "additionalProperties", ...ANNOTATION_KEYS];
|
|
266
266
|
const ENTRY_KEYS = ["type", "properties", "required", "additionalProperties", ...ANNOTATION_KEYS];
|
|
267
|
+
const RECORD_KEYS = ["type", "propertyNames", "additionalProperties", ...ANNOTATION_KEYS];
|
|
268
|
+
const RECORD_KEY_KEYS = ["type", "pattern", "minLength", "maxLength"];
|
|
269
|
+
const RECORD_VALUE_TYPES = ["string", "number", "integer", "boolean"];
|
|
267
270
|
const CHECKED_FORMATS = ["email", "uri"];
|
|
268
271
|
function isObject(value) {
|
|
269
272
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -286,6 +289,24 @@ function checkEntry(schema) {
|
|
|
286
289
|
}
|
|
287
290
|
return errors;
|
|
288
291
|
}
|
|
292
|
+
function isRecord(schema) {
|
|
293
|
+
return !isObject(schema.properties) && isObject(schema.additionalProperties);
|
|
294
|
+
}
|
|
295
|
+
function checkRecord(schema) {
|
|
296
|
+
const errors = checkKeys(schema, RECORD_KEYS);
|
|
297
|
+
const keys = schema.propertyNames;
|
|
298
|
+
if (keys !== void 0 && (!isObject(keys) || keys.type !== "string"))
|
|
299
|
+
errors.push("has keys that are no strings, only z.record(z.string(), \u2026) is supported");
|
|
300
|
+
else if (isObject(keys))
|
|
301
|
+
errors.push(...checkKeys(keys, RECORD_KEY_KEYS).map((error) => `keys ${error}`));
|
|
302
|
+
const values = schema.additionalProperties;
|
|
303
|
+
const types = Array.isArray(values.type) ? values.type : [values.type];
|
|
304
|
+
if (Array.isArray(values.anyOf) || !types.every((type) => RECORD_VALUE_TYPES.includes(String(type))))
|
|
305
|
+
errors.push("has values that are no strings, numbers or booleans, which is not supported");
|
|
306
|
+
else if (!Array.isArray(values.type))
|
|
307
|
+
errors.push(...checkValue(values, "entry-field").map((error) => `values ${error}`));
|
|
308
|
+
return errors;
|
|
309
|
+
}
|
|
289
310
|
function checkValue(schema, position) {
|
|
290
311
|
if (Array.isArray(schema.anyOf)) {
|
|
291
312
|
if (!schema.anyOf.every(isLiteral))
|
|
@@ -293,7 +314,7 @@ function checkValue(schema, position) {
|
|
|
293
314
|
return checkKeys(schema, LITERAL_UNION_KEYS);
|
|
294
315
|
}
|
|
295
316
|
if (Array.isArray(schema.type))
|
|
296
|
-
return [`can be ${schema.type.join(" or ")}; nullable props and unions of types are not supported`];
|
|
317
|
+
return [`can be ${schema.type.join(" or ")}; nullable props and unions of types are not supported (except as record values)`];
|
|
297
318
|
switch (schema.type) {
|
|
298
319
|
case "string": {
|
|
299
320
|
const errors = checkKeys(schema, STRING_KEYS);
|
|
@@ -323,7 +344,9 @@ function checkValue(schema, position) {
|
|
|
323
344
|
return checkEntry(schema);
|
|
324
345
|
if (position === "entry-field")
|
|
325
346
|
return ["is an object, the fields of a list entry must be scalars"];
|
|
326
|
-
|
|
347
|
+
if (isRecord(schema))
|
|
348
|
+
return checkRecord(schema);
|
|
349
|
+
return ["is an object, nested objects are not supported; use an array of objects for a list of entries or z.record() for a map"];
|
|
327
350
|
default:
|
|
328
351
|
return ["has a type the playground cannot edit (e.g. z.any() or z.unknown())"];
|
|
329
352
|
}
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"file": "code-highlight-Fm7cxf-E.js",
|
|
22
22
|
"name": "code-highlight"
|
|
23
23
|
},
|
|
24
|
-
"_controller-
|
|
25
|
-
"file": "controller-
|
|
24
|
+
"_controller-drB07Xo_.js": {
|
|
25
|
+
"file": "controller-drB07Xo_.js",
|
|
26
26
|
"name": "controller",
|
|
27
27
|
"imports": [
|
|
28
28
|
"_utils-DtB-AzJa.js",
|
|
@@ -147,14 +147,14 @@
|
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
149
|
"client/lib/playground/explorer.ts": {
|
|
150
|
-
"file": "explorer-
|
|
150
|
+
"file": "explorer-BivD2FYm.js",
|
|
151
151
|
"name": "explorer",
|
|
152
152
|
"src": "client/lib/playground/explorer.ts",
|
|
153
153
|
"isDynamicEntry": true,
|
|
154
154
|
"imports": [
|
|
155
155
|
"_code-highlight-Fm7cxf-E.js",
|
|
156
156
|
"_utils-DtB-AzJa.js",
|
|
157
|
-
"_controller-
|
|
157
|
+
"_controller-drB07Xo_.js",
|
|
158
158
|
"_alerts-DIQ8TeZB.js"
|
|
159
159
|
]
|
|
160
160
|
},
|
|
@@ -169,13 +169,13 @@
|
|
|
169
169
|
]
|
|
170
170
|
},
|
|
171
171
|
"client/playground.ts": {
|
|
172
|
-
"file": "playground-
|
|
172
|
+
"file": "playground-BBMnDZ8b.js",
|
|
173
173
|
"name": "playground",
|
|
174
174
|
"src": "client/playground.ts",
|
|
175
175
|
"isEntry": true,
|
|
176
176
|
"imports": [
|
|
177
177
|
"_shared-hGcWlnRM.js",
|
|
178
|
-
"_controller-
|
|
178
|
+
"_controller-drB07Xo_.js"
|
|
179
179
|
]
|
|
180
180
|
},
|
|
181
181
|
"client/preview-inline.ts": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"isEntry": true
|
|
186
186
|
},
|
|
187
187
|
"client/preview.ts": {
|
|
188
|
-
"file": "preview-
|
|
188
|
+
"file": "preview-BkKvdDnK.js",
|
|
189
189
|
"name": "preview",
|
|
190
190
|
"src": "client/preview.ts",
|
|
191
191
|
"isEntry": true,
|
|
@@ -64,6 +64,22 @@ function d(e) {
|
|
|
64
64
|
hasDefault: "default" in r,
|
|
65
65
|
hasExample: i.length > 0
|
|
66
66
|
};
|
|
67
|
+
if (r.type === "object" && s(r.additionalProperties)) {
|
|
68
|
+
let e = s(r.propertyNames) ? r.propertyNames : {}, t = r.additionalProperties, n = Array.isArray(t.type) ? t.type.map((e) => ({
|
|
69
|
+
...t,
|
|
70
|
+
type: e
|
|
71
|
+
})) : [t];
|
|
72
|
+
return {
|
|
73
|
+
...a,
|
|
74
|
+
kind: "record",
|
|
75
|
+
record: {
|
|
76
|
+
keyPattern: typeof e.pattern == "string" ? e.pattern : void 0,
|
|
77
|
+
keyMinLength: c(e.minLength),
|
|
78
|
+
keyMaxLength: c(e.maxLength),
|
|
79
|
+
values: n.map(u)
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
67
83
|
if (r.type === "array") {
|
|
68
84
|
let e = s(r.items) ? r.items : {};
|
|
69
85
|
return {
|
|
@@ -101,7 +117,7 @@ function p(e) {
|
|
|
101
117
|
function m(e) {
|
|
102
118
|
if (e.hasDefault) return e.default;
|
|
103
119
|
if (e.hasExample) return e.example;
|
|
104
|
-
if (!e.isOptional) return e.kind === "array" ? [] : f(e);
|
|
120
|
+
if (!e.isOptional) return e.kind === "array" ? [] : e.kind === "record" ? {} : f(e);
|
|
105
121
|
}
|
|
106
122
|
function h(e, t) {
|
|
107
123
|
return Object.fromEntries(e.map((e) => [e.key, t ? t[e.key] : m(e)]));
|
|
@@ -113,7 +129,7 @@ function g(e, t) {
|
|
|
113
129
|
}
|
|
114
130
|
//#endregion
|
|
115
131
|
//#region client/lib/playground/panel.css?inline
|
|
116
|
-
var _ = "@layer settings{:host{--color-surface-primary:var(--styleguide-color-background-highlight,light-dark(#fff,#0a0a0a));--color-surface-sunken:var(--styleguide-color-background,light-dark(#fafafa,#050505));--color-text-primary:var(--styleguide-color-highlight,light-dark(#111827,#fafafa));--color-text-secondary:var(--styleguide-color-regular,light-dark(#666,#a3a3a3));--color-border-default:var(--styleguide-color-border,light-dark(#ebebeb,#1f1f1f));--color-border-focus:var(--styleguide-color-theme-highlight,light-dark(#2463eb,#92c2fc));--color-status-error:light-dark(#ba1c1c,#f87272);--font-mono:ui-monospace, \"Geist Mono\", sfmono-regular, menlo, monospace;--radius-default:.75em;--radius-small:.5em;--duration-fast:.15s;--ease-out:cubic-bezier(.23, 1, .32, 1)}:host([data-standalone]){--color-surface-primary:light-dark(#fff,#0a0a0a);--color-surface-sunken:light-dark(#fafafa,#050505);--color-text-primary:light-dark(#111827,#fafafa);--color-text-secondary:light-dark(#525252,#a3a3a3);--color-border-default:light-dark(#e6e6e6,#262626);--color-border-focus:light-dark(#2463eb,#92c2fc);color-scheme:light dark}:host([data-scheme=light]){color-scheme:light}:host([data-scheme=dark]){color-scheme:dark}}@layer generic{:host{display:block}.c-panel,.c-launcher{color:var(--color-text-secondary);font-size:.875rem;line-height:1.45}:host([data-standalone]) :is(.c-panel,.c-launcher){font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;font-size:13px}*,:before,:after{box-sizing:border-box}:focus-visible{outline:2px solid var(--color-border-focus);outline-offset:2px}[hidden]{display:none!important}}@layer components{.c-panel{border:1px solid var(--color-border-default);border-radius:var(--radius-default);background:var(--color-surface-primary);flex-direction:column;min-block-size:0;max-block-size:100%;display:flex;overflow:hidden}:host([data-standalone]) .c-panel{block-size:100%;box-shadow:0 0 0 1px var(--color-border-default), 0 .5em 2em #0000001f;border-width:0;border-radius:0}:host([data-flush]) .c-panel{border-width:0;border-radius:0}:host([data-flush]) .c-panel__header{display:none}.c-panel__header{border-block-end:1px solid var(--color-border-default);align-items:center;gap:.5em;padding-block:.5em;padding-inline:1em .5em;display:flex}.c-panel__title{min-inline-size:0;color:var(--color-text-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:1em;font-weight:600;line-height:2em;overflow:hidden}.c-panel__body{gap:1em;min-block-size:0;padding:1em;display:grid;overflow-y:auto}.c-panel__message{border-radius:var(--radius-small);color:var(--color-status-error);white-space:pre-wrap;overflow-wrap:anywhere;border:1px solid;margin:0;padding-block:.5em;padding-inline:.75em}.c-panel__footer{border-block-start:1px solid var(--color-border-default);background:var(--color-surface-sunken);justify-content:space-between;align-items:center;gap:.5em;padding-block:.5em;padding-inline:1em;display:flex}.c-panel__call{min-inline-size:0;font-family:var(--font-mono);color:var(--color-text-primary);text-overflow:ellipsis;white-space:nowrap;font-size:.75em;overflow:hidden}.c-field{gap:.25em;display:grid}.c-field__label{font-family:var(--font-mono);color:var(--color-text-primary);font-weight:600}.c-field__type{font-family:var(--font-mono)}.c-field__help,.c-field__error{margin:0;font-size:.75em}.c-field__error{color:var(--color-status-error)}.c-control{border:1px solid var(--color-border-default);border-radius:var(--radius-small);background:var(--color-surface-sunken);inline-size:100%;color:var(--color-text-primary);font:inherit;margin:0;padding-block:.375em;padding-inline:.625em;font-size:max(16px,1em);line-height:1.4;display:block}@media (hover:hover) and (pointer:fine){.c-control{font-size:inherit}}.c-control--select{appearance:none;cursor:pointer;background-image:linear-gradient(45deg,#0000 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,#0000 50%);background-position:calc(100% - .9375em),calc(100% - .625em);background-repeat:no-repeat;background-size:.3125em .3125em;padding-inline-end:2em}.c-control--textarea{resize:vertical;min-block-size:5.5em;font-family:var(--font-mono);font-size:.75em}.c-control[aria-invalid=true]{border-color:var(--color-status-error)}.c-control:disabled,.c-checkbox:disabled{opacity:.5;cursor:not-allowed}.c-checkbox-row{cursor:pointer;align-items:center;gap:.5em;display:inline-flex}.c-checkbox{block-size:1em;inline-size:1em;accent-color:var(--color-border-focus);cursor:pointer;margin:0}.c-button{border:1px solid var(--color-border-default);border-radius:var(--radius-small);background:var(--color-surface-primary);min-block-size:2em;min-inline-size:2em;color:var(--color-text-primary);font:inherit;white-space:nowrap;cursor:pointer;transition-property:border-color,scale;transition-duration:var(--duration-fast);transition-timing-function:var(--ease-out);justify-content:center;align-items:center;gap:.25em;margin:0;padding-block:.25em;padding-inline:.625em;font-size:.875em;display:inline-flex}.c-button:active{scale:.96}@media (hover:hover) and (pointer:fine){.c-button:hover{border-color:var(--color-border-focus)}}.c-button svg{block-size:1em;inline-size:1em}.c-button--icon{min-inline-size:2em;padding-inline:0}.c-button:disabled{opacity:.5;cursor:not-allowed}.c-list-editor{justify-items:start;gap:.5em;display:grid}.c-list{gap:.375em;inline-size:100%;margin:0;padding:0;list-style:none;display:grid}.c-list__item{grid-template-columns:minmax(0,1fr) repeat(3,auto);align-items:center;gap:.25em;display:grid}.c-list__item--entry{align-items:start}.c-entry{border:1px solid var(--color-border-default);border-radius:var(--radius-small);gap:.375em;padding:.5em;display:grid}.c-entry__field{gap:.125em;display:grid}.c-entry__label{font-family:var(--font-mono);color:var(--color-text-primary);font-size:.875em}.c-resize-handle{z-index:1;touch-action:none;background:0 0;border:0;padding:0;position:absolute}.c-resize-handle:after{content:\"\";background:var(--color-text-secondary);opacity:0;transition:opacity var(--duration-fast) var(--ease-out);border-radius:999px;position:absolute}@media (hover:hover) and (pointer:fine){.c-resize-handle:hover:after{opacity:.4}}.c-resize-handle:focus-visible:after{opacity:.6}:host([data-dock=right]) .c-resize-handle{cursor:col-resize;inline-size:.5em;inset-block:0;inset-inline-start:-.25em}:host([data-dock=right]) .c-resize-handle:after{inline-size:2px;inset-block:40%;inset-inline-start:.1875em}:host([data-dock=bottom]) .c-resize-handle{cursor:row-resize;block-size:.5em;inset-block-start:-.25em;inset-inline:0}:host([data-dock=bottom]) .c-resize-handle:after{block-size:2px;inset-block-start:.1875em;inset-inline:40%}.c-launcher{box-shadow:0 .25em 1em #00000029}@media (prefers-reduced-motion:reduce){.c-button,.c-resize-handle:after{transition:none}}}@layer utilities{.u-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}";
|
|
132
|
+
var _ = "@layer settings{:host{--color-surface-primary:var(--styleguide-color-background-highlight,light-dark(#fff,#0a0a0a));--color-surface-sunken:var(--styleguide-color-background,light-dark(#fafafa,#050505));--color-text-primary:var(--styleguide-color-highlight,light-dark(#111827,#fafafa));--color-text-secondary:var(--styleguide-color-regular,light-dark(#666,#a3a3a3));--color-border-default:var(--styleguide-color-border,light-dark(#ebebeb,#1f1f1f));--color-border-focus:var(--styleguide-color-theme-highlight,light-dark(#2463eb,#92c2fc));--color-status-error:light-dark(#ba1c1c,#f87272);--font-mono:ui-monospace, \"Geist Mono\", sfmono-regular, menlo, monospace;--radius-default:.75em;--radius-small:.5em;--duration-fast:.15s;--ease-out:cubic-bezier(.23, 1, .32, 1)}:host([data-standalone]){--color-surface-primary:light-dark(#fff,#0a0a0a);--color-surface-sunken:light-dark(#fafafa,#050505);--color-text-primary:light-dark(#111827,#fafafa);--color-text-secondary:light-dark(#525252,#a3a3a3);--color-border-default:light-dark(#e6e6e6,#262626);--color-border-focus:light-dark(#2463eb,#92c2fc);color-scheme:light dark}:host([data-scheme=light]){color-scheme:light}:host([data-scheme=dark]){color-scheme:dark}}@layer generic{:host{display:block}.c-panel,.c-launcher{color:var(--color-text-secondary);font-size:.875rem;line-height:1.45}:host([data-standalone]) :is(.c-panel,.c-launcher){font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;font-size:13px}*,:before,:after{box-sizing:border-box}:focus-visible{outline:2px solid var(--color-border-focus);outline-offset:2px}[hidden]{display:none!important}}@layer components{.c-panel{border:1px solid var(--color-border-default);border-radius:var(--radius-default);background:var(--color-surface-primary);flex-direction:column;min-block-size:0;max-block-size:100%;display:flex;overflow:hidden}:host([data-standalone]) .c-panel{block-size:100%;box-shadow:0 0 0 1px var(--color-border-default), 0 .5em 2em #0000001f;border-width:0;border-radius:0}:host([data-flush]) .c-panel{border-width:0;border-radius:0}:host([data-flush]) .c-panel__header{display:none}.c-panel__header{border-block-end:1px solid var(--color-border-default);align-items:center;gap:.5em;padding-block:.5em;padding-inline:1em .5em;display:flex}.c-panel__title{min-inline-size:0;color:var(--color-text-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:1em;font-weight:600;line-height:2em;overflow:hidden}.c-panel__body{gap:1em;min-block-size:0;padding:1em;display:grid;overflow-y:auto}.c-panel__message{border-radius:var(--radius-small);color:var(--color-status-error);white-space:pre-wrap;overflow-wrap:anywhere;border:1px solid;margin:0;padding-block:.5em;padding-inline:.75em}.c-panel__footer{border-block-start:1px solid var(--color-border-default);background:var(--color-surface-sunken);justify-content:space-between;align-items:center;gap:.5em;padding-block:.5em;padding-inline:1em;display:flex}.c-panel__call{min-inline-size:0;font-family:var(--font-mono);color:var(--color-text-primary);text-overflow:ellipsis;white-space:nowrap;font-size:.75em;overflow:hidden}.c-field{gap:.25em;display:grid}.c-field__label{font-family:var(--font-mono);color:var(--color-text-primary);font-weight:600}.c-field__type{font-family:var(--font-mono)}.c-field__help,.c-field__error{margin:0;font-size:.75em}.c-field__error{color:var(--color-status-error)}.c-control{border:1px solid var(--color-border-default);border-radius:var(--radius-small);background:var(--color-surface-sunken);inline-size:100%;color:var(--color-text-primary);font:inherit;margin:0;padding-block:.375em;padding-inline:.625em;font-size:max(16px,1em);line-height:1.4;display:block}@media (hover:hover) and (pointer:fine){.c-control{font-size:inherit}}.c-control--select{appearance:none;cursor:pointer;background-image:linear-gradient(45deg,#0000 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,#0000 50%);background-position:calc(100% - .9375em),calc(100% - .625em);background-repeat:no-repeat;background-size:.3125em .3125em;padding-inline-end:2em}.c-control--textarea{resize:vertical;min-block-size:5.5em;font-family:var(--font-mono);font-size:.75em}.c-control[aria-invalid=true]{border-color:var(--color-status-error)}.c-control:disabled,.c-checkbox:disabled{opacity:.5;cursor:not-allowed}.c-checkbox-row{cursor:pointer;align-items:center;gap:.5em;display:inline-flex}.c-checkbox{block-size:1em;inline-size:1em;accent-color:var(--color-border-focus);cursor:pointer;margin:0}.c-button{border:1px solid var(--color-border-default);border-radius:var(--radius-small);background:var(--color-surface-primary);min-block-size:2em;min-inline-size:2em;color:var(--color-text-primary);font:inherit;white-space:nowrap;cursor:pointer;transition-property:border-color,scale;transition-duration:var(--duration-fast);transition-timing-function:var(--ease-out);justify-content:center;align-items:center;gap:.25em;margin:0;padding-block:.25em;padding-inline:.625em;font-size:.875em;display:inline-flex}.c-button:active{scale:.96}@media (hover:hover) and (pointer:fine){.c-button:hover{border-color:var(--color-border-focus)}}.c-button svg{block-size:1em;inline-size:1em}.c-button--icon{min-inline-size:2em;padding-inline:0}.c-button:disabled{opacity:.5;cursor:not-allowed}.c-list-editor{justify-items:start;gap:.5em;display:grid}.c-list{gap:.375em;inline-size:100%;margin:0;padding:0;list-style:none;display:grid}.c-list__item{grid-template-columns:minmax(0,1fr) repeat(3,auto);align-items:center;gap:.25em;display:grid}.c-list__item--entry{align-items:start}.c-list__item--record{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.c-record-value{grid-template-columns:auto minmax(0,1fr);gap:.25em;display:grid}.c-record-value>[hidden]{display:none}.c-entry{border:1px solid var(--color-border-default);border-radius:var(--radius-small);gap:.375em;padding:.5em;display:grid}.c-entry__field{gap:.125em;display:grid}.c-entry__label{font-family:var(--font-mono);color:var(--color-text-primary);font-size:.875em}.c-resize-handle{z-index:1;touch-action:none;background:0 0;border:0;padding:0;position:absolute}.c-resize-handle:after{content:\"\";background:var(--color-text-secondary);opacity:0;transition:opacity var(--duration-fast) var(--ease-out);border-radius:999px;position:absolute}@media (hover:hover) and (pointer:fine){.c-resize-handle:hover:after{opacity:.4}}.c-resize-handle:focus-visible:after{opacity:.6}:host([data-dock=right]) .c-resize-handle{cursor:col-resize;inline-size:.5em;inset-block:0;inset-inline-start:-.25em}:host([data-dock=right]) .c-resize-handle:after{inline-size:2px;inset-block:40%;inset-inline-start:.1875em}:host([data-dock=bottom]) .c-resize-handle{cursor:row-resize;block-size:.5em;inset-block-start:-.25em;inset-inline:0}:host([data-dock=bottom]) .c-resize-handle:after{block-size:2px;inset-block-start:.1875em;inset-inline:40%}.c-launcher{box-shadow:0 .25em 1em #00000029}@media (prefers-reduced-motion:reduce){.c-button,.c-resize-handle:after{transition:none}}}@layer utilities{.u-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}";
|
|
117
133
|
//#endregion
|
|
118
134
|
//#region client/lib/playground/panel.ts
|
|
119
135
|
function v(e, t = {}, n = []) {
|
|
@@ -200,7 +216,31 @@ function w(e, t, n, r, i, a) {
|
|
|
200
216
|
controls: s
|
|
201
217
|
};
|
|
202
218
|
}
|
|
203
|
-
function T(e) {
|
|
219
|
+
function T(e, t, n, r, i) {
|
|
220
|
+
if (e.values.length === 1) {
|
|
221
|
+
let a = S(e.values[0], t, !1, { "aria-label": n }, r, i);
|
|
222
|
+
return {
|
|
223
|
+
element: C(a),
|
|
224
|
+
controls: [a]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
let a = e.values.filter((e) => e.kind !== "boolean"), o = [...a.length < e.values.length ? ["true", "false"] : [], ...a.map((e) => e.kind)], s = typeof t, c = s === "boolean" ? String(t) : a.find((e) => e.kind === "string" ? s === "string" : s === "number")?.kind ?? o[0], l = v("select", {
|
|
228
|
+
class: "c-control c-control--select",
|
|
229
|
+
"aria-label": `${n} type`
|
|
230
|
+
});
|
|
231
|
+
for (let e of o) l.append(v("option", { value: e }, [e]));
|
|
232
|
+
l.value = c;
|
|
233
|
+
let u = new Map(a.map((e) => [e.kind, S(e, c === e.kind ? t : void 0, !1, { "aria-label": n }, r, i)])), d = () => u.forEach((e, t) => e.hidden = l.value !== t);
|
|
234
|
+
return d(), l.addEventListener("change", () => {
|
|
235
|
+
d();
|
|
236
|
+
let e = u.get(l.value);
|
|
237
|
+
e ? e.dispatchEvent(new Event("input")) : r(l.value === "true");
|
|
238
|
+
}, { signal: i }), {
|
|
239
|
+
element: v("span", { class: "c-record-value" }, [l, ...u.values()]),
|
|
240
|
+
controls: [l, ...u.values()]
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function E(e) {
|
|
204
244
|
let { host: t, name: n, isStandalone: r = !1 } = e, i = new AbortController(), { signal: a } = i, o = t.shadowRoot ?? t.attachShadow({ mode: "open" });
|
|
205
245
|
o.replaceChildren(), r && t.setAttribute("data-standalone", "");
|
|
206
246
|
let s = v("style", {}, [_]), c = v("div", { class: "c-panel__header" }, [v("h2", { class: "c-panel__title" }, ["Props ", v("span", { class: "c-field__type" }, [`+${n}`])])]), l = v("p", {
|
|
@@ -227,12 +267,12 @@ function T(e) {
|
|
|
227
267
|
m
|
|
228
268
|
]);
|
|
229
269
|
o.append(s, h);
|
|
230
|
-
let g = e.fields, y = structuredClone(e.values), b = /* @__PURE__ */ new Map(), x = () => e.onChange(structuredClone(y)),
|
|
270
|
+
let g = e.fields, y = structuredClone(e.values), b = /* @__PURE__ */ new Map(), x = () => e.onChange(structuredClone(y)), E = (e, t) => {
|
|
231
271
|
y[e] = t, x();
|
|
232
|
-
},
|
|
272
|
+
}, D = (e, t) => {
|
|
233
273
|
let n = b.get(e);
|
|
234
274
|
n && (n.error.textContent = t ?? "", n.error.hidden = !t, n.controls().forEach((e) => e.setAttribute("aria-invalid", String(!!t))));
|
|
235
|
-
},
|
|
275
|
+
}, O = (e, t, n, r) => {
|
|
236
276
|
let i = v("ol", { class: "c-list" }), o = v("button", {
|
|
237
277
|
class: "c-button",
|
|
238
278
|
type: "button"
|
|
@@ -241,7 +281,7 @@ function T(e) {
|
|
|
241
281
|
role: "group",
|
|
242
282
|
"aria-labelledby": n,
|
|
243
283
|
"aria-describedby": r
|
|
244
|
-
}, [i, o]), c = [], l = new AbortController(), u = () => Array.isArray(y[e.key]) ? y[e.key] : [], d = (t) =>
|
|
284
|
+
}, [i, o]), c = [], l = new AbortController(), u = () => Array.isArray(y[e.key]) ? y[e.key] : [], d = (t) => E(e.key, e.isOptional && t.length === 0 ? void 0 : t), f = (n) => {
|
|
245
285
|
let r = (e, t) => {
|
|
246
286
|
d(e), f(t);
|
|
247
287
|
};
|
|
@@ -297,20 +337,85 @@ function T(e) {
|
|
|
297
337
|
group: s,
|
|
298
338
|
controls: () => [...c, o]
|
|
299
339
|
};
|
|
300
|
-
},
|
|
340
|
+
}, k = (e, t, n) => {
|
|
341
|
+
let r = e.record, i = v("ol", { class: "c-list" }), o = v("button", {
|
|
342
|
+
class: "c-button",
|
|
343
|
+
type: "button"
|
|
344
|
+
}, ["Add entry"]), s = v("div", {
|
|
345
|
+
class: "c-list-editor",
|
|
346
|
+
role: "group",
|
|
347
|
+
"aria-labelledby": t,
|
|
348
|
+
"aria-describedby": n
|
|
349
|
+
}, [i, o]), c = y[e.key], l = Object.entries(typeof c == "object" && c ? c : {}).map(([e, t]) => ({
|
|
350
|
+
key: e,
|
|
351
|
+
value: t
|
|
352
|
+
})), u = [], d = new AbortController(), f = () => {
|
|
353
|
+
let t = Object.fromEntries(l.filter((e) => e.key !== "").map((e) => [e.key, e.value]));
|
|
354
|
+
E(e.key, e.isOptional && Object.keys(t).length === 0 ? void 0 : t);
|
|
355
|
+
}, m = (t) => {
|
|
356
|
+
d.abort(), d = new AbortController(), u = [];
|
|
357
|
+
let n = [];
|
|
358
|
+
i.replaceChildren(...l.map((t, i) => {
|
|
359
|
+
let a = v("input", {
|
|
360
|
+
class: "c-control",
|
|
361
|
+
type: "text",
|
|
362
|
+
autocomplete: "off",
|
|
363
|
+
spellcheck: "false",
|
|
364
|
+
"aria-label": `${e.key} key ${i + 1}`,
|
|
365
|
+
pattern: r.keyPattern
|
|
366
|
+
});
|
|
367
|
+
a.value = t.key, a.addEventListener("input", () => {
|
|
368
|
+
l[i] = {
|
|
369
|
+
...l[i],
|
|
370
|
+
key: a.value
|
|
371
|
+
}, f();
|
|
372
|
+
}, { signal: d.signal });
|
|
373
|
+
let o = T(r, t.value, `${e.key} value ${i + 1}`, (e) => {
|
|
374
|
+
l[i] = {
|
|
375
|
+
...l[i],
|
|
376
|
+
value: e
|
|
377
|
+
}, f();
|
|
378
|
+
}, d.signal), s = v("button", {
|
|
379
|
+
class: "c-button c-button--icon",
|
|
380
|
+
type: "button",
|
|
381
|
+
"aria-label": `Remove entry ${i + 1}`
|
|
382
|
+
}, ["✕"]);
|
|
383
|
+
return s.addEventListener("click", () => {
|
|
384
|
+
l = l.filter((e, t) => t !== i), f(), m(Math.min(i, l.length - 1));
|
|
385
|
+
}, { signal: d.signal }), u.push(a, ...o.controls), n.push(a), v("li", { class: "c-list__item c-list__item--record" }, [
|
|
386
|
+
a,
|
|
387
|
+
o.element,
|
|
388
|
+
s
|
|
389
|
+
]);
|
|
390
|
+
})), t !== void 0 && (n[t] ?? o).focus();
|
|
391
|
+
};
|
|
392
|
+
return o.addEventListener("click", () => {
|
|
393
|
+
let e = r.values.some((e) => e.kind === "boolean");
|
|
394
|
+
l = [...l, {
|
|
395
|
+
key: "",
|
|
396
|
+
value: e ? !0 : p(r.values[0])
|
|
397
|
+
}], m(l.length - 1);
|
|
398
|
+
}, { signal: a }), m(), {
|
|
399
|
+
group: s,
|
|
400
|
+
controls: () => [...u, o]
|
|
401
|
+
};
|
|
402
|
+
}, A = (e, t) => {
|
|
301
403
|
let n = `field-${t}`, r = `${n}-label`, i = `${n}-help`, o = `${n}-error`, s = [e.description ? i : "", o].filter(Boolean).join(" "), c, l;
|
|
302
|
-
if (e.kind === "
|
|
303
|
-
let t =
|
|
404
|
+
if (e.kind === "record") {
|
|
405
|
+
let t = k(e, r, s);
|
|
406
|
+
c = t.group, l = t.controls;
|
|
407
|
+
} else if (e.kind === "array") {
|
|
408
|
+
let t = O(e, n, r, s);
|
|
304
409
|
c = t.group, l = t.controls;
|
|
305
410
|
} else {
|
|
306
411
|
let t = S(e, y[e.key], e.isOptional, {
|
|
307
412
|
id: n,
|
|
308
413
|
"aria-describedby": s,
|
|
309
414
|
"aria-required": String(!e.isOptional)
|
|
310
|
-
}, (t) =>
|
|
415
|
+
}, (t) => E(e.key, t), a);
|
|
311
416
|
c = C(t), l = () => [t];
|
|
312
417
|
}
|
|
313
|
-
let u = e.kind === "array" ? v("span", {
|
|
418
|
+
let u = e.kind === "array" || e.kind === "record" ? v("span", {
|
|
314
419
|
class: "c-field__label",
|
|
315
420
|
id: r
|
|
316
421
|
}, [e.key]) : v("label", {
|
|
@@ -338,14 +443,14 @@ function T(e) {
|
|
|
338
443
|
d,
|
|
339
444
|
f
|
|
340
445
|
]);
|
|
341
|
-
},
|
|
342
|
-
b = /* @__PURE__ */ new Map(), u.replaceChildren(...g.map(
|
|
446
|
+
}, j = () => {
|
|
447
|
+
b = /* @__PURE__ */ new Map(), u.replaceChildren(...g.map(A));
|
|
343
448
|
};
|
|
344
|
-
return
|
|
449
|
+
return j(), u.addEventListener("submit", (e) => e.preventDefault(), { signal: a }), f.addEventListener("click", () => e.onReset(), { signal: a }), {
|
|
345
450
|
shadowRoot: o,
|
|
346
451
|
header: c,
|
|
347
452
|
setFields: (e, t) => {
|
|
348
|
-
g = e, y = structuredClone(t),
|
|
453
|
+
g = e, y = structuredClone(t), j();
|
|
349
454
|
},
|
|
350
455
|
setIssues: (e) => {
|
|
351
456
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
@@ -357,7 +462,7 @@ function T(e) {
|
|
|
357
462
|
let [e, i] = r.path.slice(1), a = `${e === void 0 ? "" : `Entry ${Number(e) + 1}: ${i === void 0 ? "" : `${String(i)}: `}`}${r.message}`;
|
|
358
463
|
t.set(r.key, [...t.get(r.key) ?? [], a]);
|
|
359
464
|
}
|
|
360
|
-
for (let e of b.keys())
|
|
465
|
+
for (let e of b.keys()) D(e, t.get(e)?.join("\n"));
|
|
361
466
|
l.textContent = n.join("\n"), l.hidden = n.length === 0;
|
|
362
467
|
},
|
|
363
468
|
setMessage: (e) => {
|
|
@@ -373,7 +478,7 @@ function T(e) {
|
|
|
373
478
|
}
|
|
374
479
|
//#endregion
|
|
375
480
|
//#region lib/use-id.ts
|
|
376
|
-
function
|
|
481
|
+
function D(t) {
|
|
377
482
|
let n = `id-${e(t)}`, r = 0;
|
|
378
483
|
return (e) => {
|
|
379
484
|
if (e === void 0) return `${n}-${r++}`;
|
|
@@ -383,39 +488,39 @@ function E(t) {
|
|
|
383
488
|
}
|
|
384
489
|
//#endregion
|
|
385
490
|
//#region client/lib/playground/runtime.ts
|
|
386
|
-
async function
|
|
491
|
+
async function O(e, t) {
|
|
387
492
|
let n = await fetch(new URL(e, document.baseURI), { cache: t ? "no-store" : "default" });
|
|
388
493
|
if (!n.ok) throw Error(`Could not load the mixin manifest (${n.status} ${n.statusText})`);
|
|
389
494
|
return n.json();
|
|
390
495
|
}
|
|
391
|
-
var
|
|
392
|
-
function
|
|
496
|
+
var k = /* @__PURE__ */ new Map();
|
|
497
|
+
function A(e) {
|
|
393
498
|
if (!e.module) return Promise.reject(/* @__PURE__ */ Error(`Mixin "${e.name}" has no render module`));
|
|
394
|
-
let t = new URL(e.module, document.baseURI).href, n =
|
|
499
|
+
let t = new URL(e.module, document.baseURI).href, n = k.get(t);
|
|
395
500
|
return n || (n = import(
|
|
396
501
|
/* @vite-ignore */
|
|
397
502
|
t
|
|
398
503
|
).then((t) => {
|
|
399
504
|
if (typeof t.render != "function") throw TypeError(`${e.module} does not export render()`);
|
|
400
505
|
return t.render;
|
|
401
|
-
}),
|
|
506
|
+
}), k.set(t, n)), n;
|
|
402
507
|
}
|
|
403
|
-
function
|
|
508
|
+
function j(e) {
|
|
404
509
|
return typeof e == "object" && !!e && Array.isArray(e.issues);
|
|
405
510
|
}
|
|
406
|
-
function
|
|
511
|
+
function M(e, t, r) {
|
|
407
512
|
try {
|
|
408
513
|
return {
|
|
409
514
|
isValid: !0,
|
|
410
515
|
html: e({
|
|
411
516
|
props: r,
|
|
412
517
|
z: n,
|
|
413
|
-
useId:
|
|
518
|
+
useId: D(`mixin-${t}`),
|
|
414
519
|
modifierClass: ""
|
|
415
520
|
})
|
|
416
521
|
};
|
|
417
522
|
} catch (e) {
|
|
418
|
-
return
|
|
523
|
+
return j(e) ? {
|
|
419
524
|
isValid: !1,
|
|
420
525
|
issues: e.issues.map((e) => {
|
|
421
526
|
let t = e.path.filter((e) => typeof e != "symbol");
|
|
@@ -433,8 +538,8 @@ function j(e, t, r) {
|
|
|
433
538
|
}
|
|
434
539
|
//#endregion
|
|
435
540
|
//#region client/lib/playground/state.ts
|
|
436
|
-
var
|
|
437
|
-
function
|
|
541
|
+
var N = "props";
|
|
542
|
+
function P(e) {
|
|
438
543
|
if (e === null || e === "") return {};
|
|
439
544
|
try {
|
|
440
545
|
let t = JSON.parse(e);
|
|
@@ -443,72 +548,74 @@ function N(e) {
|
|
|
443
548
|
return { error: `\`props\` is not valid JSON: ${e instanceof Error ? e.message : String(e)}` };
|
|
444
549
|
}
|
|
445
550
|
}
|
|
446
|
-
var
|
|
447
|
-
function F(e) {
|
|
448
|
-
return P.test([...e].filter((e) => e.charCodeAt(0) > 32).join(""));
|
|
449
|
-
}
|
|
551
|
+
var F = /^(?:javascript|vbscript|data):/i;
|
|
450
552
|
function I(e) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
553
|
+
return F.test([...e].filter((e) => e.charCodeAt(0) > 32).join(""));
|
|
554
|
+
}
|
|
555
|
+
var L = /^on|[^\w:.-]/i;
|
|
556
|
+
function R(e) {
|
|
557
|
+
if (typeof e == "string") return e.includes("<") || I(e) ? e : void 0;
|
|
558
|
+
if (typeof e == "object" && e) for (let [t, n] of Object.entries(e)) {
|
|
559
|
+
if (!Array.isArray(e) && L.test(t)) return t;
|
|
560
|
+
let r = R(n);
|
|
561
|
+
if (r !== void 0) return r;
|
|
455
562
|
}
|
|
456
563
|
}
|
|
457
|
-
function
|
|
458
|
-
let t =
|
|
459
|
-
return n === void 0 ? t : { error: `The props from the link were not applied: they contain markup
|
|
564
|
+
function z(e) {
|
|
565
|
+
let t = P(new URLSearchParams(e.hash.slice(1)).get(N) ?? e.searchParams.get(N)), n = t.props ? R(Object.values(t.props)) : void 0;
|
|
566
|
+
return n === void 0 ? t : { error: `The props from the link were not applied: they contain markup, a script URL or an attribute name like onclick (${JSON.stringify(n.slice(0, 40))}). Enter such values in the controls instead.` };
|
|
460
567
|
}
|
|
461
|
-
function
|
|
568
|
+
function B(e, t) {
|
|
462
569
|
let n = new URL(e), r = new URLSearchParams(n.hash.slice(1));
|
|
463
|
-
return r.set(
|
|
570
|
+
return r.set(N, JSON.stringify(t)), n.hash = r.toString(), n;
|
|
464
571
|
}
|
|
465
|
-
function
|
|
572
|
+
function V(e, t) {
|
|
466
573
|
let n = new URL(e);
|
|
467
|
-
return n.searchParams.set(
|
|
574
|
+
return n.searchParams.set(N, JSON.stringify(t)), n.hash = "", n;
|
|
468
575
|
}
|
|
469
|
-
var
|
|
470
|
-
function
|
|
576
|
+
var H = /^[A-Z_$][\w$]*$/i;
|
|
577
|
+
function U(e) {
|
|
471
578
|
if (typeof e == "string") return `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'").replaceAll("\n", "\\n")}'`;
|
|
472
|
-
if (Array.isArray(e)) return `[${e.map(
|
|
579
|
+
if (Array.isArray(e)) return `[${e.map(U).join(", ")}]`;
|
|
473
580
|
if (typeof e == "object" && e) {
|
|
474
581
|
let t = Object.entries(e);
|
|
475
|
-
return t.length === 0 ? "{}" : `{ ${t.map(([e, t]) => `${
|
|
582
|
+
return t.length === 0 ? "{}" : `{ ${t.map(([e, t]) => `${H.test(e) ? e : U(e)}: ${U(t)}`).join(", ")} }`;
|
|
476
583
|
}
|
|
477
584
|
return JSON.stringify(e) ?? "undefined";
|
|
478
585
|
}
|
|
479
|
-
function
|
|
586
|
+
function W(e, t) {
|
|
480
587
|
let n = new Map(t.filter((e) => e.hasDefault).map((e) => [e.key, JSON.stringify(e.default)]));
|
|
481
588
|
return Object.fromEntries(Object.entries(e).filter(([e, t]) => n.get(e) !== JSON.stringify(t)));
|
|
482
589
|
}
|
|
483
|
-
function
|
|
484
|
-
let r =
|
|
590
|
+
function G(e, t, n = []) {
|
|
591
|
+
let r = W(t, n);
|
|
485
592
|
for (let e of n) {
|
|
486
593
|
let { items: t } = e;
|
|
487
|
-
t?.kind === "object" && Array.isArray(r[e.key]) && (r[e.key] = r[e.key].map((e) => typeof e == "object" && e ?
|
|
594
|
+
t?.kind === "object" && Array.isArray(r[e.key]) && (r[e.key] = r[e.key].map((e) => typeof e == "object" && e ? W(e, t.fields) : e));
|
|
488
595
|
}
|
|
489
|
-
return `+${e}(${
|
|
596
|
+
return `+${e}(${U(r)})`;
|
|
490
597
|
}
|
|
491
598
|
//#endregion
|
|
492
599
|
//#region client/lib/playground/validate.ts
|
|
493
|
-
var
|
|
494
|
-
function
|
|
600
|
+
var K = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
|
|
601
|
+
function q(e) {
|
|
495
602
|
return typeof e == "string" ? `"${e}"` : String(e);
|
|
496
603
|
}
|
|
497
|
-
function
|
|
604
|
+
function J(e) {
|
|
498
605
|
try {
|
|
499
606
|
return !!new URL(e);
|
|
500
607
|
} catch {
|
|
501
608
|
return !1;
|
|
502
609
|
}
|
|
503
610
|
}
|
|
504
|
-
function
|
|
611
|
+
function Y(e, t) {
|
|
505
612
|
return `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
506
613
|
}
|
|
507
|
-
function
|
|
614
|
+
function X(e, t) {
|
|
508
615
|
switch (e.kind) {
|
|
509
|
-
case "enum": return e.options?.includes(t) ? void 0 : `Must be one of ${(e.options ?? []).map(
|
|
616
|
+
case "enum": return e.options?.includes(t) ? void 0 : `Must be one of ${(e.options ?? []).map(q).join(", ")}`;
|
|
510
617
|
case "boolean": return typeof t == "boolean" ? void 0 : "Must be true or false";
|
|
511
|
-
case "string": return typeof t == "string" ? e.minLength !== void 0 && t.length < e.minLength ? e.minLength === 1 ? "Must not be empty" : `Must be at least ${
|
|
618
|
+
case "string": return typeof t == "string" ? e.minLength !== void 0 && t.length < e.minLength ? e.minLength === 1 ? "Must not be empty" : `Must be at least ${Y(e.minLength, "character")}` : e.maxLength !== void 0 && t.length > e.maxLength ? `Must be at most ${Y(e.maxLength, "character")}` : e.format === "email" && !K.test(t) ? "Must be an email address" : e.format === "uri" && !J(t) ? "Must be a URL" : e.pattern !== void 0 && e.format !== "email" && !new RegExp(e.pattern).test(t) ? `Must match ${e.pattern}` : void 0 : "Must be text";
|
|
512
619
|
case "number":
|
|
513
620
|
case "integer":
|
|
514
621
|
if (typeof t != "number" || Number.isNaN(t)) return "Must be a number";
|
|
@@ -524,46 +631,57 @@ function J(e, t) {
|
|
|
524
631
|
return;
|
|
525
632
|
}
|
|
526
633
|
}
|
|
527
|
-
function
|
|
528
|
-
return typeof t != "object" || !t || Array.isArray(t) ? ["Must be an object"] : e.fields.flatMap((e) =>
|
|
634
|
+
function Z(e, t) {
|
|
635
|
+
return typeof t != "object" || !t || Array.isArray(t) ? ["Must be an object"] : e.fields.flatMap((e) => $(e, t[e.key]).map((t) => `${e.key}: ${t}`));
|
|
529
636
|
}
|
|
530
|
-
function
|
|
637
|
+
function Q(e, t) {
|
|
638
|
+
if (typeof t != "object" || !t || Array.isArray(t)) return ["Must be an object"];
|
|
639
|
+
let n = [];
|
|
640
|
+
for (let [r, i] of Object.entries(t)) {
|
|
641
|
+
e.keyPattern !== void 0 && !new RegExp(e.keyPattern).test(r) ? n.push(`Key "${r}": Must match ${e.keyPattern}`) : e.keyMinLength !== void 0 && r.length < e.keyMinLength ? n.push(`Key "${r}": Must be at least ${Y(e.keyMinLength, "character")}`) : e.keyMaxLength !== void 0 && r.length > e.keyMaxLength && n.push(`Key "${r}": Must be at most ${Y(e.keyMaxLength, "character")}`);
|
|
642
|
+
let t = e.values.map((e) => X(e, i));
|
|
643
|
+
t.every((e) => e !== void 0) && n.push(`"${r}": ${e.values.length === 1 ? t[0] : `Must be ${e.values.map((e) => e.kind).join(" or ")}`}`);
|
|
644
|
+
}
|
|
645
|
+
return n;
|
|
646
|
+
}
|
|
647
|
+
function $(e, t) {
|
|
531
648
|
if (t === void 0) return e.isOptional ? [] : ["Required"];
|
|
649
|
+
if (e.kind === "record") return e.record ? Q(e.record, t) : [];
|
|
532
650
|
if (e.kind !== "array") {
|
|
533
|
-
let n =
|
|
651
|
+
let n = X(e, t);
|
|
534
652
|
return n ? [n] : [];
|
|
535
653
|
}
|
|
536
654
|
if (!Array.isArray(t)) return ["Must be a list"];
|
|
537
655
|
let n = [];
|
|
538
|
-
e.minItems !== void 0 && t.length < e.minItems && n.push(`Needs at least ${
|
|
656
|
+
e.minItems !== void 0 && t.length < e.minItems && n.push(`Needs at least ${Y(e.minItems, "entry").replace("entrys", "entries")}`), e.maxItems !== void 0 && t.length > e.maxItems && n.push(`Allows at most ${Y(e.maxItems, "entry").replace("entrys", "entries")}`);
|
|
539
657
|
let { items: r } = e;
|
|
540
658
|
return t.forEach((e, t) => {
|
|
541
659
|
if (!r) return;
|
|
542
|
-
let i = r.kind === "object" ?
|
|
660
|
+
let i = r.kind === "object" ? Z(r, e) : [X(r, e)].filter((e) => e !== void 0);
|
|
543
661
|
n.push(...i.map((e) => `Entry ${t + 1}: ${e}`));
|
|
544
662
|
}), n;
|
|
545
663
|
}
|
|
546
|
-
function
|
|
664
|
+
function ee(e, t) {
|
|
547
665
|
let n = /* @__PURE__ */ new Map();
|
|
548
666
|
for (let r of e) {
|
|
549
|
-
let e =
|
|
667
|
+
let e = $(r, t[r.key]);
|
|
550
668
|
e.length > 0 && n.set(r.key, e);
|
|
551
669
|
}
|
|
552
670
|
return n;
|
|
553
671
|
}
|
|
554
672
|
//#endregion
|
|
555
673
|
//#region client/lib/playground/controller.ts
|
|
556
|
-
var
|
|
557
|
-
async function
|
|
558
|
-
let i = (await
|
|
674
|
+
var te = 1e3;
|
|
675
|
+
async function ne(e, n, r = {}) {
|
|
676
|
+
let i = (await O(e.manifestUrl, e.isDevelopment)).mixins.find((t) => t.id === e.id);
|
|
559
677
|
if (!i || !i.hasSchema) throw Error(`Mixin "${e.name}" has no playground in ${e.manifestUrl}`);
|
|
560
|
-
let a = d(i.jsonSchema), o = h(a, r.props), s = i.module ? await
|
|
678
|
+
let a = d(i.jsonSchema), o = h(a, r.props), s = i.module ? await A(i) : void 0, c, l = () => g(a, o), u = () => G(i.name, l(), a), f = () => {
|
|
561
679
|
let e = l();
|
|
562
680
|
if (c?.setPugCall(u()), !s) {
|
|
563
681
|
c?.setMessage(i.error?.message ?? "The mixin has not compiled yet.");
|
|
564
682
|
return;
|
|
565
683
|
}
|
|
566
|
-
let t =
|
|
684
|
+
let t = ee(a, o);
|
|
567
685
|
if (t.size > 0) {
|
|
568
686
|
let r = [...t].flatMap(([e, t]) => t.map((t) => ({
|
|
569
687
|
key: e,
|
|
@@ -576,14 +694,14 @@ async function $(e, n, r = {}) {
|
|
|
576
694
|
}, e);
|
|
577
695
|
return;
|
|
578
696
|
}
|
|
579
|
-
let r =
|
|
697
|
+
let r = M(s, i.id, e);
|
|
580
698
|
if (r.isValid) {
|
|
581
699
|
c?.setIssues([]), n.onRender(r.html, e);
|
|
582
700
|
return;
|
|
583
701
|
}
|
|
584
702
|
"issues" in r ? c?.setIssues(r.issues) : (c?.setIssues([]), c?.setMessage(r.error)), n.onInvalid?.(r, e);
|
|
585
703
|
};
|
|
586
|
-
if (n.panelHost && (c =
|
|
704
|
+
if (n.panelHost && (c = E({
|
|
587
705
|
host: n.panelHost,
|
|
588
706
|
name: i.name,
|
|
589
707
|
fields: a,
|
|
@@ -613,7 +731,7 @@ async function $(e, n, r = {}) {
|
|
|
613
731
|
if (!r) {
|
|
614
732
|
r = !0;
|
|
615
733
|
try {
|
|
616
|
-
let t = (await
|
|
734
|
+
let t = (await O(e.manifestUrl, !0)).mixins.find((t) => t.id === e.id);
|
|
617
735
|
if (!t || !t.hasSchema) return;
|
|
618
736
|
let r = i;
|
|
619
737
|
i = t;
|
|
@@ -623,14 +741,14 @@ async function $(e, n, r = {}) {
|
|
|
623
741
|
let e = l(), n = h(a);
|
|
624
742
|
o = Object.fromEntries(a.map((t) => [t.key, t.key in e ? e[t.key] : n[t.key]])), c?.setFields(a, o);
|
|
625
743
|
}
|
|
626
|
-
JSON.stringify(t.error) !== JSON.stringify(r.error) && n.onCompileError?.(t.error), t.module !== r.module && t.module && (s = await
|
|
744
|
+
JSON.stringify(t.error) !== JSON.stringify(r.error) && n.onCompileError?.(t.error), t.module !== r.module && t.module && (s = await A(t)), (t.module !== r.module || u) && f();
|
|
627
745
|
} catch (e) {
|
|
628
746
|
console.warn("[kss-modern] Could not check the mixin manifest for updates", e);
|
|
629
747
|
} finally {
|
|
630
748
|
r = !1;
|
|
631
749
|
}
|
|
632
750
|
}
|
|
633
|
-
},
|
|
751
|
+
}, te), document.visibilityState === "visible" && p.start(), document.addEventListener("visibilitychange", () => {
|
|
634
752
|
document.visibilityState === "visible" ? p.resume() : p.pause();
|
|
635
753
|
}, { signal: m.signal });
|
|
636
754
|
}
|
|
@@ -650,4 +768,4 @@ async function $(e, n, r = {}) {
|
|
|
650
768
|
};
|
|
651
769
|
}
|
|
652
770
|
//#endregion
|
|
653
|
-
export {
|
|
771
|
+
export { O as a, o as c, V as i, i as l, z as n, v as o, B as r, a as s, ne as t, r as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./code-highlight-Fm7cxf-E.js";
|
|
2
2
|
import { n as t } from "./utils-DtB-AzJa.js";
|
|
3
|
-
import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./controller-
|
|
3
|
+
import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./controller-drB07Xo_.js";
|
|
4
4
|
import { t as l } from "./alerts-DIQ8TeZB.js";
|
|
5
5
|
//#region client/lib/playground/format-html.ts
|
|
6
6
|
var u = /* @__PURE__ */ new Set([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./shared-hGcWlnRM.js";
|
|
2
|
-
import { c as t, i as n, l as r, n as i, o as a, r as o, t as s } from "./controller-
|
|
2
|
+
import { c as t, i as n, l as r, n as i, o as a, r as o, t as s } from "./controller-drB07Xo_.js";
|
|
3
3
|
//#region client/playground.ts
|
|
4
4
|
var c = "kss-modern:playground-panel", l = {
|
|
5
5
|
dock: "right",
|
|
@@ -1139,7 +1139,7 @@ ot && import("./global-theme-select-CdFgPJ0T.js").then(({ default: e }) => e(ot)
|
|
|
1139
1139
|
var st = document.querySelectorAll("[data-section-theme-select]");
|
|
1140
1140
|
st.length > 0 && import("./section-theme-select-CO65kL5N.js").then(({ default: e }) => e(st)).catch(console.error);
|
|
1141
1141
|
var ct = document.querySelector("[data-mixin-explorer]");
|
|
1142
|
-
ct && import("./explorer-
|
|
1142
|
+
ct && import("./explorer-BivD2FYm.js").then(({ default: e }) => e(ct)).catch(console.error);
|
|
1143
1143
|
var lt = document.querySelector(".editor-select");
|
|
1144
1144
|
lt && import("./editor-select-DIZFtqe7.js").then(({ default: e }) => e(lt)).catch(console.error);
|
|
1145
1145
|
//#endregion
|