@threadlabs/looma 0.43.0 → 0.43.2
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/components/ui-card/ui-card.html +6 -6
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.js +3 -0
- package/components/ui-editor-slash-menu/ui-editor-slash-menu.js +4 -0
- package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +1 -0
- package/components/ui-site-header/ui-site-header.html +1 -1
- package/dist/index.js +1 -1
- package/docs/README.md +2 -2
- package/docs/card.html +2 -6
- package/docs/card.js +7 -37
- package/docs/catalog.json +217 -13
- package/docs/catalog.mjs +1 -1
- package/docs/customizer-render.mjs +7 -6
- package/docs/customizer.js +2 -7
- package/docs/documentation.css +3 -7
- package/docs/examples/ui-button/examples/08-loading.behavior.js +1 -1
- package/docs/examples/ui-checkbox/examples/02-checked-indeterminate-and-disabled.behavior.js +1 -1
- package/docs/examples/ui-editor-mention-menu/examples/00-preview.behavior.js +1 -0
- package/docs/examples/ui-editor-slash-menu/examples/00-preview.behavior.js +81 -0
- package/docs/examples/ui-editor-table-overlay/examples/00-preview.behavior.js +24 -0
- package/docs/examples/ui-search-shell/examples/00-preview.behavior.js +14 -0
- package/docs/examples/ui-search-shell/examples/02-label-dismissible-status-and-footer.behavior.js +7 -7
- package/docs/examples/ui-toast/examples/01-authored.behavior.js +2 -2
- package/docs/index.d.ts +1 -1
- package/docs/local-server.mjs +2 -5
- package/docs/pastoral.svg +54 -0
- package/docs/portrait.svg +15 -0
- package/docs/render.mjs +33 -3
- package/docs/site.mjs +22 -54
- package/package.json +1 -1
- package/styles/ui-card.css +6 -6
- package/styles/ui-site-header.css +1 -1
- package/vanilla/UiEditorTableOverlay.js +50 -36
- package/vue/UiCard.vue +6 -6
- package/vue/UiEditorTableOverlay.d.ts +11 -1
- package/vue/UiEditorTableOverlay.vue +98 -63
- package/vue/UiSiteHeader.vue +1 -1
- package/vue/chunks/UiCard.js +1 -1
- package/vue/chunks/UiEditorTableOverlay.js +41 -13
- package/vue/chunks/UiSiteHeader.js +1 -1
- package/vue/components.css +55 -54
- package/docs/preview.js +0 -22
package/docs/site.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { cp, mkdir, readFile, readdir, realpath, rename, rm, symlink, unlink, writeFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
6
|
import { discoverComponents, escapeHtml, mergeCatalogs, readCatalog, readJson } from './catalog.mjs';
|
|
7
|
-
import { cardMarkup, componentPath, exampleKey,
|
|
7
|
+
import { cardMarkup, componentPath, exampleKey, previewTag, scopedExampleMarkup, exampleResources, referencePage } from './render.mjs';
|
|
8
8
|
import { defaultRecipe, themeCSS } from './theme.mjs';
|
|
9
9
|
import { customizerResource } from './customizer-render.mjs';
|
|
10
10
|
import { catalogResource } from './catalog-view.mjs';
|
|
11
11
|
import { cacheDirectory, rejectSymlink, withBuildLock } from './workspace.mjs';
|
|
12
|
+
import { googleFontURL } from './fonts.mjs';
|
|
12
13
|
|
|
13
14
|
const own = name => fileURLToPath(new URL(name, import.meta.url));
|
|
14
15
|
/** Resolve import-only optional tooling peers in the consumer's ESM package scope. */
|
|
@@ -84,7 +85,6 @@ export async function prepareDocumentation({ root, config = {}, catalog }) {
|
|
|
84
85
|
await cp(own('card.js'), path.join(generated, 'card.js'));
|
|
85
86
|
await writeFile(path.join(generated, 'catalog-view.html'), catalogResource(combined.groups));
|
|
86
87
|
await cp(own('catalog-view.js'), path.join(generated, 'catalog-view.js'));
|
|
87
|
-
await cp(own('preview.js'), path.join(generated, 'preview.js'));
|
|
88
88
|
for (const file of ['reference.html', 'reference.js']) await cp(own(file), path.join(generated, file));
|
|
89
89
|
for (const file of ['customizer.js', 'theme.mjs', 'theme-session.mjs', 'value-editors.mjs', 'palette.mjs', 'fonts.mjs']) await cp(own(file), path.join(generated, file));
|
|
90
90
|
const write = async (file, source) => { await mkdir(path.dirname(file), { recursive: true }); await writeFile(file, source); };
|
|
@@ -106,16 +106,10 @@ export async function prepareDocumentation({ root, config = {}, catalog }) {
|
|
|
106
106
|
const file = path.join(previews, key + '.html');
|
|
107
107
|
const tags = [...new Set([...example.markup.matchAll(/<([a-z][\w]*-[\w-]+)\b/g)].map(match => match[1]))];
|
|
108
108
|
const links = tags.filter(tag => resourceByTag.has(tag)).map(tag => `<link rel="component" href="${escapeHtml(resourceByTag.get(tag).resource)}">`).join('\n');
|
|
109
|
-
// Navigation specimens name destinations supplied by their host application. Give those
|
|
110
|
-
// fragments local stand-ins inside the isolated stage; keep real documentation links checked.
|
|
111
|
-
const declaredIds = new Set([...example.markup.matchAll(/\sid=["']([^"']+)["']/g)].map(match => match[1]));
|
|
112
|
-
const destinations = [...new Set([...example.markup.matchAll(/\bhref=["']#([^"']+)["']/g)].map(match => match[1]))].filter(id => !declaredIds.has(id));
|
|
113
|
-
const anchors = destinations.map(id => `<span id="${escapeHtml(id)}" hidden></span>`).join('');
|
|
114
109
|
const setup = path.join(previews, key + '.js');
|
|
115
|
-
|
|
116
|
-
await write(
|
|
117
|
-
|
|
118
|
-
examples.push({ ...example, file, component: component.id, path: base + previewPath(example).slice(1) });
|
|
110
|
+
if (example.behavior) await write(setup, `import setupExample from ${JSON.stringify(example.behavior)};\nexport function connect(host) { return setupExample(host.element); }\n`);
|
|
111
|
+
await write(file, `${links}\n<template component="${previewTag(example)}"${example.behavior ? ` module="./${key}.js"` : ''}><defs><prop name="namespace" type="string" default="${key}">A unique namespace for this example's IDs and control relationships.</prop></defs><div><div data-preview="${escapeHtml(example.id)}"${component.group === 'layout' ? ' data-preview-layout' : ''}>${scopedExampleMarkup(example, base)}</div></div></template>\n`);
|
|
112
|
+
examples.push({ ...example, file, component: component.id, path: base + componentPath(component).slice(1) });
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
115
|
const gallery = combined.groups.map(group => {
|
|
@@ -123,7 +117,7 @@ export async function prepareDocumentation({ root, config = {}, catalog }) {
|
|
|
123
117
|
// A standalone opening tag makes this a Markdown HTML block, keeping native card wrappers inside Grid.
|
|
124
118
|
return components.length ? `<section data-catalog-group="${escapeHtml(group.id)}">\n\n## ${escapeHtml(group.label)}\n\n<ui-grid columns="3" min="sm">\n${components.map(component => `<div data-category="${escapeHtml(component.group)}" data-catalog-search="${escapeHtml(`${component.tag} ${component.title} ${component.description}`)}">${cardMarkup(component.examples[0], base, component)}</div>`).join('\n')}\n</ui-grid>\n\n</section>` : '';
|
|
125
119
|
}).join('\n\n');
|
|
126
|
-
await write(path.join(content, 'components/index.md'), `---\ntitle: Components\n---\n\n# Components\n\nExplore the live examples that also power your theme customizer.\n\n<link rel="component" href="${relativeHref(path.join(content, 'components/index.md'), card)}">\n<link rel="component" href="@threadlabs/looma/components/ui-grid/ui-grid.html">\n<link rel="component" href="${relativeHref(path.join(content, 'components/index.md'), path.join(generated, 'catalog-view.html'))}">\n\n<looma-catalog>\n\n${gallery}\n\n</looma-catalog>\n`);
|
|
120
|
+
await write(path.join(content, 'components/index.md'), `---\ntitle: Components\n---\n\n# Components\n\nExplore the live examples that also power your theme customizer.\n\n<link rel="component" href="${relativeHref(path.join(content, 'components/index.md'), card)}">\n${exampleResources(combined.components.filter(component => !component.navigationParent).map(component => component.examples[0]), combined)}\n<link rel="component" href="@threadlabs/looma/components/ui-grid/ui-grid.html">\n<link rel="component" href="${relativeHref(path.join(content, 'components/index.md'), path.join(generated, 'catalog-view.html'))}">\n\n<looma-catalog>\n\n${gallery}\n\n</looma-catalog>\n`);
|
|
127
121
|
await write(path.join(content, 'index.md'), `---\ntitle: ${JSON.stringify(config.title ?? 'Your design system')}\n---\n\n# ${config.title ?? 'Your design system'}\n\nWeave your design system from Looma and your own HTML Next components.\n\n[Explore components](/components/) · [Customize your theme](/customize/)\n`);
|
|
128
122
|
if (combined.components.some(component => component.group === 'editor')) await write(path.join(content, 'editor.md'), `---\ntitle: Editor\nsidebar: false\n---\n\n# Editor\n\nWriting tools and editor components, separate from the general component reference.\n\n${combined.components.filter(component => component.group === 'editor' && !component.navigationParent).map(component => `- [${component.title}](${componentPath(component)})`).join('\n')}\n`);
|
|
129
123
|
await write(path.join(content, 'design-system.md'), await readFile(own('README.md'), 'utf8'));
|
|
@@ -141,6 +135,9 @@ export async function prepareDocumentation({ root, config = {}, catalog }) {
|
|
|
141
135
|
await mkdir(path.dirname(target), { recursive: true }); await cp(source, target);
|
|
142
136
|
}
|
|
143
137
|
}
|
|
138
|
+
await write(path.join(generated, 'example-behaviors.js'), examples.filter(example => example.behavior).map((example, index) => `import setup${index} from ${JSON.stringify(example.behavior)};`).join('\n') + `\nexport const exampleBehaviors = {${examples.filter(example => example.behavior).map((example, index) => `${JSON.stringify(example.id)}: setup${index}`).join(',')}};\n`);
|
|
139
|
+
const choice = exampleResources(examples, combined) + `\n<template component="looma-preview-choice"><defs><prop name="identity" type="string" default="">The authored example to render.</prop><prop name="namespace" type="string" default="selected">Unique ID namespace within this page.</prop></defs><div>${examples.map(example => `<div $if="${escapeHtml(`$identity = ${JSON.stringify(example.id)}`)}" data-preview="${escapeHtml(example.id)}"${example.stretch || combined.components.find(component => component.id === example.component)?.group === 'layout' ? ' data-preview-layout' : ''}>${scopedExampleMarkup(example, base)}</div>`).join('')}</div></template>`;
|
|
140
|
+
await write(path.join(generated, 'preview-choice.html'), choice);
|
|
144
141
|
const customizer = path.join(generated, 'customizer.html');
|
|
145
142
|
await write(customizer, customizerResource({ catalog: combined, config, base }, config.recipe));
|
|
146
143
|
const customizerPage = path.join(content, 'customize.md');
|
|
@@ -169,9 +166,8 @@ async function themeBootstrap(site) {
|
|
|
169
166
|
export function documentationPlugin(site) {
|
|
170
167
|
return {
|
|
171
168
|
name: 'looma-design-system',
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
config: () => ({ pages: [{ dir: path.relative(site.root, site.previews), prefix: '/_looma/preview/', layout: false }], css: [own('documentation.css')] }),
|
|
169
|
+
generate: async () => ({ '/_looma/pastoral.svg': await readFile(own('pastoral.svg'), 'utf8'), '/_looma/portrait.svg': await readFile(own('portrait.svg'), 'utf8'), '/_looma/theme-system.css': await readFile(fileURLToPath(import.meta.resolve('@threadlabs/looma/theme-system.css')), 'utf8') }),
|
|
170
|
+
config: () => ({ css: [own('documentation.css')] }),
|
|
175
171
|
};
|
|
176
172
|
}
|
|
177
173
|
|
|
@@ -180,15 +176,21 @@ export async function documentationOptions(site) {
|
|
|
180
176
|
const styles = ['tokens.css', 'theme-light.css', 'theme-dark.css', 'theme-system.css'].map(file => fileURLToPath(import.meta.resolve(`@threadlabs/looma/${file}`)));
|
|
181
177
|
const options = siteOptions({ root: site.root, contentDir: path.relative(site.root, site.content), title: site.config.title ?? 'Your design system', headerNotice: 'Custom theme', base: site.base, outDir: site.config.outDir ?? 'site', ...(site.config.origin ? { origin: site.config.origin } : {}), ...(site.config.logo ? { logo: site.config.logo } : {}), ...(site.config.nav ? { nav: site.config.nav } : {}) }, { plugins: [documentationPlugin(site)], css: styles, redirects: site.redirects });
|
|
182
178
|
const savedTheme = path.join(site.generated, 'saved-theme.css');
|
|
183
|
-
|
|
179
|
+
const recipe = site.config.recipe ?? defaultRecipe();
|
|
180
|
+
const overrides = await Promise.all((site.config.overrides ?? []).map(file => readFile(path.resolve(site.root, file), 'utf8')));
|
|
181
|
+
const localFonts = new Set(overrides.flatMap(css => [...css.matchAll(/@font-face\s*\{[^}]*font-family:\s*['"]([^'"]+)['"]/g)].map(match => match[1])));
|
|
182
|
+
const remoteFonts = Object.fromEntries(Object.entries(recipe.fonts ?? {}).filter(([, family]) => !localFonts.has(family)));
|
|
183
|
+
const imported = googleFontURL(recipe.fonts), remaining = googleFontURL(remoteFonts);
|
|
184
|
+
// A supplied face already serves the same family; avoid another render-blocking stylesheet.
|
|
185
|
+
const savedCSS = (site.config.themeCSSContents ?? themeCSS(recipe)).replace(`@import url("${imported}");`, remaining ? `@import url("${remaining}");` : '');
|
|
186
|
+
await writeFile(savedTheme, savedCSS);
|
|
184
187
|
const themeStyles = [savedTheme, ...await portableThemeStyles(site)];
|
|
185
188
|
return { ...options, plugins: [...options.plugins, { name: 'looma-saved-theme', config: () => ({ css: themeStyles }) },
|
|
186
189
|
// Markupress supplies its head script in its own config hook; compose after it.
|
|
187
190
|
{ name: 'looma-browser-theme', config: async current => ({ headScript: [current.headScript, await themeBootstrap(site)].filter(Boolean).join('\n;\n') }) }] };
|
|
188
191
|
}
|
|
189
192
|
|
|
190
|
-
/**
|
|
191
|
-
* Bundle those font files into theme CSS for both the local server and static output. */
|
|
193
|
+
/** Bundle project theme styles once, shared by the page and every inline example. */
|
|
192
194
|
async function portableThemeStyles(site) {
|
|
193
195
|
const overrides = site.config.overrides ?? [];
|
|
194
196
|
if (!overrides.length) return [];
|
|
@@ -197,7 +199,6 @@ async function portableThemeStyles(site) {
|
|
|
197
199
|
await writeFile(entry, overrides.map(file => `@import ${JSON.stringify(path.resolve(site.root, file))};`).join('\n'));
|
|
198
200
|
const bundled = await build({ root: site.root, base: './', configFile: false, logLevel: 'silent',
|
|
199
201
|
build: { write: false, minify: false, cssMinify: false,
|
|
200
|
-
assetsInlineLimit: file => /\.(woff2?|ttf|otf)$/i.test(file),
|
|
201
202
|
rollupOptions: { input: entry, output: { assetFileNames: 'theme-assets/[name]-[hash][extname]' } } } });
|
|
202
203
|
const styles = [];
|
|
203
204
|
for (const output of (Array.isArray(bundled) ? bundled[0] : bundled).output) {
|
|
@@ -210,7 +211,7 @@ async function portableThemeStyles(site) {
|
|
|
210
211
|
return styles;
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
/** Build
|
|
214
|
+
/** Build references and examples together through MarkupKit. */
|
|
214
215
|
export async function buildDocumentation({ root = process.cwd(), config = {}, catalog } = {}) {
|
|
215
216
|
return withBuildLock(root, async () => {
|
|
216
217
|
const site = await prepareDocumentation({ root, config, catalog });
|
|
@@ -219,36 +220,3 @@ export async function buildDocumentation({ root = process.cwd(), config = {}, ca
|
|
|
219
220
|
return { ...built, site };
|
|
220
221
|
});
|
|
221
222
|
}
|
|
222
|
-
|
|
223
|
-
async function isolatePreviewScripts(site, { outDir }) {
|
|
224
|
-
const { build } = await tool('vite', site.root);
|
|
225
|
-
// Preview entries and outputs are independent. Keep compiler memory bounded
|
|
226
|
-
// and retain the build lock until every in-flight bundle has settled.
|
|
227
|
-
const remaining = [...site.examples];
|
|
228
|
-
const results = await Promise.allSettled(Array.from({ length: Math.min(2, remaining.length) }, async () => {
|
|
229
|
-
try {
|
|
230
|
-
for (let example; (example = remaining.pop());) {
|
|
231
|
-
const htmlFile = path.join(outDir, '_looma/preview', exampleKey(example.id), 'index.html');
|
|
232
|
-
let html = await readFile(htmlFile, 'utf8');
|
|
233
|
-
const scripts = [...html.matchAll(/<script\b[^>]*type="module"[^>]*src="([^"]+)"[^>]*><\/script>/g)];
|
|
234
|
-
if (!scripts.length) throw new Error(`No browser module found for isolated preview ${example.id}.`);
|
|
235
|
-
for (const [tag, url] of scripts) {
|
|
236
|
-
const input = path.join(outDir, url.slice(site.base.length));
|
|
237
|
-
const bundle = await build({ configFile: false, logLevel: 'silent', build: { write: false, minify: true, lib: { entry: input, name: 'LoomaPreview', formats: ['iife'] }, rollupOptions: { output: { codeSplitting: false } } } });
|
|
238
|
-
const code = (Array.isArray(bundle) ? bundle[0] : bundle).output.find(output => output.type === 'chunk').code;
|
|
239
|
-
// A sandbox has an opaque origin: Safari cannot authorize this runtime via 'self'.
|
|
240
|
-
// Hash the exact inline bytes and run after the preview DOM, preserving isolation.
|
|
241
|
-
const script = code.replace(/<\/script/gi, '<\\/script');
|
|
242
|
-
const hash = createHash('sha256').update(script).digest('base64');
|
|
243
|
-
if (!/<meta\b[^>]*http-equiv="Content-Security-Policy"[^>]*content="[^"]*\bscript-src\b/.test(html)) throw new Error(`Missing script policy for isolated preview ${example.id}.`);
|
|
244
|
-
html = html.replace(/(<meta\b[^>]*http-equiv="Content-Security-Policy"[^>]*content="[^"]*\bscript-src)\b/, `$1 'sha256-${hash}'`);
|
|
245
|
-
html = html.replace(tag, '').replace('</body>', () => `<script>${script}</script></body>`);
|
|
246
|
-
}
|
|
247
|
-
html = html.replace(/<link\b[^>]*rel="modulepreload"[^>]*>/g, '');
|
|
248
|
-
await writeFile(htmlFile, html);
|
|
249
|
-
}
|
|
250
|
-
} catch (error) { remaining.length = 0; throw error; }
|
|
251
|
-
}));
|
|
252
|
-
const failed = results.find(result => result.status === 'rejected');
|
|
253
|
-
if (failed) throw failed.reason;
|
|
254
|
-
}
|
package/package.json
CHANGED
package/styles/ui-card.css
CHANGED
|
@@ -161,16 +161,16 @@
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
:scope:where([data-component~="ui-card"])[data-ui-card-state~="size=sm"] {
|
|
164
|
-
inline-size: min(22rem, calc(100vw - var(--ui-space-2) * 2));
|
|
165
|
-
max-inline-size: min(22rem, calc(100vw - var(--ui-space-2) * 2));
|
|
164
|
+
inline-size: min(22rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
165
|
+
max-inline-size: min(22rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
166
166
|
}
|
|
167
167
|
:scope:where([data-component~="ui-card"])[data-ui-card-state~="size=md"] {
|
|
168
|
-
inline-size: min(28rem, calc(100vw - var(--ui-space-2) * 2));
|
|
169
|
-
max-inline-size: min(28rem, calc(100vw - var(--ui-space-2) * 2));
|
|
168
|
+
inline-size: min(28rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
169
|
+
max-inline-size: min(28rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
170
170
|
}
|
|
171
171
|
:scope:where([data-component~="ui-card"])[data-ui-card-state~="size=lg"] {
|
|
172
|
-
inline-size: min(36rem, calc(100vw - var(--ui-space-2) * 2));
|
|
173
|
-
max-inline-size: min(36rem, calc(100vw - var(--ui-space-2) * 2));
|
|
172
|
+
inline-size: min(36rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
173
|
+
max-inline-size: min(36rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
text-decoration: none;
|
|
130
130
|
}
|
|
131
131
|
.navigation > :where([data-slotted], [data-slotted] *):is(a):is(:hover, [aria-current="page"], [aria-current="true"]) {
|
|
132
|
-
color: var(--ui-
|
|
132
|
+
color: var(--ui-link-color);
|
|
133
133
|
}
|
|
134
134
|
.brand > :where([data-slotted], [data-slotted] *):is(a):focus-visible, .navigation > :where([data-slotted], [data-slotted] *):is(a):focus-visible {
|
|
135
135
|
outline: var(--ui-focus-width) solid var(--ui-focus-ring);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// Generated by HTML Next 1.0.0-alpha.69 for Vanilla DOM. Do not edit.
|
|
2
|
-
import { attachGeneratedController, buildTemplate, checkReference, clearRegion, KeyedList, NONCONFORMING, readDeclared, readMember, toAttribute, toText, trackContainer, truthy, visitSelected, writeAttribute, dispatchDeclared, detailCheck, formatOf, keywordFormat, acceptProps, manageProps, generatedInputs, checkBoolean, checkInteger, checkList, checkNumber, checkObject, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
|
|
2
|
+
import { attachGeneratedController, buildTemplate, checkReference, clearRegion, KeyedList, NONCONFORMING, readDeclared, readMember, toAttribute, toText, trackContainer, truthy, visitSelected, writeAttribute, dispatchDeclared, detailCheck, dispose, formatOf, keywordFormat, acceptProps, manageProps, generatedInputs, project, fillSlot, checkBoolean, checkInteger, checkList, checkNumber, checkObject, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
|
|
3
3
|
import * as controller from "../components/ui-editor-table-overlay/ui-editor-table-overlay.js";
|
|
4
4
|
import "../styles/ui-editor-table-overlay.css";
|
|
5
5
|
|
|
6
|
-
const T0 = ["",[],"\n ",["div",["class","rows"],"\n ",2,"\n "],"\n ",["div",["class","cols"],"\n ",2,"\n "],"\n ",1,"\n ",1,"\n ",["span",["class","drop-indicator","data-drop-indicator","","hidden","","aria-hidden","true"]],"\n "];
|
|
7
|
-
const T1 = ["
|
|
8
|
-
const T2 = ["div",["class","control
|
|
9
|
-
const T3 = ["",[
|
|
10
|
-
const T4 = ["button",["type","button","class","
|
|
11
|
-
|
|
6
|
+
const T0 = ["",[],"\n ",4,"\n ",["div",["class","rows"],"\n ",2,"\n "],"\n ",["div",["class","cols"],"\n ",2,"\n "],"\n ",1,"\n ",1,"\n ",["span",["class","drop-indicator","data-drop-indicator","","hidden","","aria-hidden","true"]],"\n "];
|
|
7
|
+
const T1 = ["",[]];
|
|
8
|
+
const T2 = ["div",["class","control row"],"\n ",["span",["class","line","aria-hidden","true"]],"\n ",["span",["class","guide","data-ui-guide","","aria-hidden","true"]],"\n ",["button",["type","button","class","handle"],"\n ",["ui-icon",["name","plus"]],"\n ",["span",["class","tooltip","role","tooltip"],0],"\n "],"\n "];
|
|
9
|
+
const T3 = ["div",["class","control col"],"\n ",["span",["class","line","aria-hidden","true"]],"\n ",["span",["class","guide","data-ui-guide","","aria-hidden","true"]],"\n ",["button",["type","button","class","handle"],"\n ",["ui-icon",["name","plus"]],"\n ",["span",["class","tooltip","role","tooltip"],0],"\n "],"\n "];
|
|
10
|
+
const T4 = ["",[],"\n ",["button",["type","button","class","selector row","data-action","select-row","title","Drag row to reorder; click for actions","aria-label","Row actions"],"\n ",["span",["class","glyph"],["ui-icon",["name","grip-vertical"]]],"\n "],"\n ",["button",["type","button","class","selector column","data-action","select-column","title","Drag column to reorder; click for actions","aria-label","Column actions"],"\n ",["span",["class","glyph"],["ui-icon",["name","grip-horizontal"]]],"\n "],"\n "];
|
|
11
|
+
const T5 = ["button",["type","button","class","cell-menu","data-action","open-cell-menu","title","Cell actions","aria-label","Cell actions"],"\n ",["ui-icon",["name","chevron-down"]],"\n "];
|
|
12
|
+
let P0, P1, P2, P3, P4, P5;
|
|
12
13
|
const E = new Map();
|
|
13
14
|
const S = { n: ["rows","cols","hovered","active","activeKey"], t: [["l",["o",["key","s","index","i","offset","s","affordance",["p",formatOf(keywordFormat)],"action",["p",formatOf(keywordFormat)],"label","s"]]],["l",["o",["key","s","index","i","offset","s","affordance",["p",formatOf(keywordFormat)],"action",["p",formatOf(keywordFormat)],"label","s"]]],["o",["left","n","top","n","width","n","height","n","rowIndex","i","columnIndex","i","rowOffset","s","columnOffset","s"]],["o",["left","n","top","n","width","n","height","n","rowIndex","i","columnIndex","i","menuLeft","s","menuTop","s"]],"s"], f: import.meta.url, g: "ui-editor-table-overlay", d: { "add-row-before": [detailCheck(checkObject([["boundaryIndex", checkInteger, false]], false)), true, true, false], "add-row-after": [detailCheck(checkObject([["boundaryIndex", checkInteger, false]], false)), true, true, false], "add-column-before": [detailCheck(checkObject([["boundaryIndex", checkInteger, false]], false)), true, true, false], "add-column-after": [detailCheck(checkObject([["boundaryIndex", checkInteger, false]], false)), true, true, false], "select-row": [detailCheck(checkObject([["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false]], false)), true, true, false], "select-column": [detailCheck(checkObject([["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false]], false)), true, true, false], "reorder-row": [detailCheck(checkObject([["fromIndex", checkInteger, false], ["toIndex", checkInteger, false]], false)), true, true, false], "reorder-column": [detailCheck(checkObject([["fromIndex", checkInteger, false], ["toIndex", checkInteger, false]], false)), true, true, false], "open-cell-menu": [detailCheck(checkObject([["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false], ["anchor", checkObject([["left", checkNumber, false], ["top", checkNumber, false], ["right", checkNumber, false], ["bottom", checkNumber, false]], false), false]], false)), true, true, false], "open-row-menu": [detailCheck(checkObject([["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false], ["anchor", checkObject([["left", checkNumber, false], ["top", checkNumber, false], ["right", checkNumber, false], ["bottom", checkNumber, false]], false), false]], false)), true, true, false], "open-column-menu": [detailCheck(checkObject([["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false], ["anchor", checkObject([["left", checkNumber, false], ["top", checkNumber, false], ["right", checkNumber, false], ["bottom", checkNumber, false]], false), false]], false)), true, true, false] }, x: dispatchDeclared, a: (host, I) => C(host, I), b: generatedInputs, i: [[], [], null, null, ""] };
|
|
14
15
|
const D = { g: "ui-editor-table-overlay", props: { "geometry": { "required":false, c: checkObject([["rowBoundaries", checkList(checkNumber), false], ["columnBoundaries", checkList(checkNumber), false], ["activeCell", checkObject([["left", checkNumber, false], ["top", checkNumber, false], ["width", checkNumber, false], ["height", checkNumber, false], ["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false]], false), true], ["hoveredCell", checkObject([["left", checkNumber, false], ["top", checkNumber, false], ["width", checkNumber, false], ["height", checkNumber, false], ["rowIndex", checkInteger, false], ["columnIndex", checkInteger, false]], false), true]], false), j: 1, m: ["o",["rowBoundaries",["l","n"],"columnBoundaries",["l","n"],"activeCell",["o",["left","n","top","n","width","n","height","n","rowIndex","i","columnIndex","i"]],"hoveredCell",["o",["left","n","top","n","width","n","height","n","rowIndex","i","columnIndex","i"]]]] }, "open": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" } } };
|
|
@@ -27,15 +28,23 @@ export function createUiEditorTableOverlay(options = {}, html) {
|
|
|
27
28
|
const v = [[], [], null, null, "", null, null];
|
|
28
29
|
const B = acceptProps(element, D, S.n, v, componentProps, [], html);
|
|
29
30
|
let s4 = v[4];
|
|
30
|
-
const m1 = (
|
|
31
|
+
const m1 = (d) => {
|
|
31
32
|
const n = (P1 ??= buildTemplate(T1)).cloneNode(true);
|
|
33
|
+
const r = { n };
|
|
34
|
+
p1(r, -1, d);
|
|
35
|
+
return r;
|
|
36
|
+
};
|
|
37
|
+
const p1 = (r, c, d) => {
|
|
38
|
+
};
|
|
39
|
+
const m2 = (o, j, l) => {
|
|
40
|
+
const n = (P2 ??= buildTemplate(T2)).cloneNode(true);
|
|
32
41
|
const t0 = n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;
|
|
33
42
|
const t1 = t0.firstChild.nextSibling.nextSibling.nextSibling.firstChild;
|
|
34
43
|
const r = { k: undefined, i: o, n, x: 0, y: 0, a1: t0, a2: t1, w: 0, v0: false, v1: undefined, v2: null, v3: null, v4: null, v5: null, v6: null, v7: "" };
|
|
35
|
-
|
|
44
|
+
p2(r, -1, E);
|
|
36
45
|
return r;
|
|
37
46
|
};
|
|
38
|
-
const
|
|
47
|
+
const p2 = (r, c, d) => {
|
|
39
48
|
const o = r.i;
|
|
40
49
|
if (c & 1073741824) r.w = 0;
|
|
41
50
|
if (c & 1073741840) {
|
|
@@ -66,15 +75,15 @@ export function createUiEditorTableOverlay(options = {}, html) {
|
|
|
66
75
|
if (s7 !== r.v7) r.a2.data = r.v7 = s7;
|
|
67
76
|
}
|
|
68
77
|
};
|
|
69
|
-
const
|
|
70
|
-
const n = (
|
|
78
|
+
const m3 = (o, j, l) => {
|
|
79
|
+
const n = (P3 ??= buildTemplate(T3)).cloneNode(true);
|
|
71
80
|
const t0 = n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;
|
|
72
81
|
const t1 = t0.firstChild.nextSibling.nextSibling.nextSibling.firstChild;
|
|
73
82
|
const r = { k: undefined, i: o, n, x: 0, y: 0, a1: t0, a2: t1, w: 0, v0: false, v1: undefined, v2: null, v3: null, v4: null, v5: null, v6: null, v7: "" };
|
|
74
|
-
|
|
83
|
+
p3(r, -1, E);
|
|
75
84
|
return r;
|
|
76
85
|
};
|
|
77
|
-
const
|
|
86
|
+
const p3 = (r, c, d) => {
|
|
78
87
|
const o = r.i;
|
|
79
88
|
if (c & 1073741824) r.w = 0;
|
|
80
89
|
if (c & 1073741840) {
|
|
@@ -105,15 +114,15 @@ export function createUiEditorTableOverlay(options = {}, html) {
|
|
|
105
114
|
if (s7 !== r.v7) r.a2.data = r.v7 = s7;
|
|
106
115
|
}
|
|
107
116
|
};
|
|
108
|
-
const
|
|
109
|
-
const n = (
|
|
117
|
+
const m4 = (d) => {
|
|
118
|
+
const n = (P4 ??= buildTemplate(T4)).cloneNode(true);
|
|
110
119
|
const t0 = n.firstChild.nextSibling;
|
|
111
120
|
const t1 = t0.nextSibling.nextSibling;
|
|
112
121
|
const r = { n, a0: t0, a1: t1, v0: undefined, v1: null, v2: null, v3: undefined, v4: null, v5: null };
|
|
113
|
-
|
|
122
|
+
p4(r, -1, d);
|
|
114
123
|
return r;
|
|
115
124
|
};
|
|
116
|
-
const
|
|
125
|
+
const p4 = (r, c, d) => {
|
|
117
126
|
if (c & 1073741828) {
|
|
118
127
|
const x0 = (checkReference(S, readDeclared(v[2], ["rowOffset"]), "s", "expression:$hovered.rowOffset:hovered.rowOffset", "Reference `hovered.rowOffset` must satisfy string.") ? readMember(v[2], "rowOffset") : NONCONFORMING);
|
|
119
128
|
if (x0 !== NONCONFORMING) {
|
|
@@ -145,13 +154,13 @@ export function createUiEditorTableOverlay(options = {}, html) {
|
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
};
|
|
148
|
-
const
|
|
149
|
-
const n = (
|
|
157
|
+
const m5 = (d) => {
|
|
158
|
+
const n = (P5 ??= buildTemplate(T5)).cloneNode(true);
|
|
150
159
|
const r = { n, v0: undefined, v1: undefined, v2: null, v3: null };
|
|
151
|
-
|
|
160
|
+
p5(r, -1, d);
|
|
152
161
|
return r;
|
|
153
162
|
};
|
|
154
|
-
const
|
|
163
|
+
const p5 = (r, c, d) => {
|
|
155
164
|
if (c & 1073741832) {
|
|
156
165
|
const x0 = (checkReference(S, readDeclared(v[3], ["menuLeft"]), "s", "expression:$active.menuLeft:active.menuLeft", "Reference `active.menuLeft` must satisfy string.") ? readMember(v[3], "menuLeft") : NONCONFORMING);
|
|
157
166
|
if (x0 !== NONCONFORMING) {
|
|
@@ -181,28 +190,33 @@ export function createUiEditorTableOverlay(options = {}, html) {
|
|
|
181
190
|
const s0 = toAttribute(x0, "hidden");
|
|
182
191
|
if (s0 !== r.v0) writeAttribute(r.n, "hidden", r.v0 = s0);
|
|
183
192
|
}
|
|
184
|
-
if (c & 1073741825) r.
|
|
185
|
-
if (c !== -1 && c & 16) visitSelected(r.L0.m, s4, v[4], p1, c);
|
|
186
|
-
if (c & 1073741826) r.L1.update(v[1], d, c);
|
|
193
|
+
if (c & 1073741825) r.L1.update(v[0], d, c);
|
|
187
194
|
if (c !== -1 && c & 16) visitSelected(r.L1.m, s4, v[4], p2, c);
|
|
188
|
-
if (c &
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} else if (r.b2 !== undefined) p3(r.b2, c, d);
|
|
192
|
-
if (c & 1073741832 && !(truthy(v[3])) !== !r.b3) {
|
|
195
|
+
if (c & 1073741826) r.L2.update(v[1], d, c);
|
|
196
|
+
if (c !== -1 && c & 16) visitSelected(r.L2.m, s4, v[4], p3, c);
|
|
197
|
+
if (c & 1073741828 && !(truthy(v[2])) !== !r.b3) {
|
|
193
198
|
if (r.b3) { r.b3 = undefined; clearRegion(r.a4, r.e3); }
|
|
194
199
|
else { r.b3 = m4(d); r.e3.before(r.b3.n); }
|
|
195
200
|
} else if (r.b3 !== undefined) p4(r.b3, c, d);
|
|
201
|
+
if (c & 1073741832 && !(truthy(v[3])) !== !r.b4) {
|
|
202
|
+
if (r.b4) { r.b4 = undefined; clearRegion(r.a5, r.e4); }
|
|
203
|
+
else { r.b4 = m5(d); r.e4.before(r.b4.n); }
|
|
204
|
+
} else if (r.b4 !== undefined) p5(r.b4, c, d);
|
|
205
|
+
if (r.f0 === undefined) { r.f0 = 1; const at = fillSlot(r.a1, r.e0, "", J, false, undefined, d);
|
|
206
|
+
if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m1(d); at.before(r.b0.n); } }
|
|
207
|
+
else if (r.b0 !== undefined) p1(r.b0, c, d);
|
|
196
208
|
s4 = v[4];
|
|
197
209
|
};
|
|
198
210
|
const t0 = element.firstChild.nextSibling;
|
|
199
|
-
const t1 = t0.
|
|
200
|
-
const t2 =
|
|
201
|
-
const t3 =
|
|
202
|
-
const t4 =
|
|
203
|
-
const t5 =
|
|
204
|
-
const
|
|
211
|
+
const t1 = t0.nextSibling.nextSibling.nextSibling;
|
|
212
|
+
const t2 = t1.firstChild.nextSibling;
|
|
213
|
+
const t3 = t1.nextSibling.nextSibling;
|
|
214
|
+
const t4 = t3.firstChild.nextSibling;
|
|
215
|
+
const t5 = t3.nextSibling.nextSibling;
|
|
216
|
+
const t6 = t5.nextSibling.nextSibling.nextSibling;
|
|
217
|
+
const R = { n: element, v0: undefined, a1: t0, e0: t0.nextSibling, b0: undefined, f0: undefined, L1: new KeyedList(t2, t2.nextSibling, m2, p2, (o) => readMember(o, "key"), "control"), L2: new KeyedList(t4, t4.nextSibling, m3, p3, (o) => readMember(o, "key"), "control"), a4: t5, e3: t5.nextSibling, b3: undefined, a5: t6, e4: t6.nextSibling, b4: undefined };
|
|
205
218
|
const I = { B };
|
|
219
|
+
const J = project(I, children, slots);
|
|
206
220
|
I.R = new Set();
|
|
207
221
|
attachGeneratedController(element, S, v, (c, d) => { ((c, d) => p0(R, c, d))(c, d); for (const f of I.R) f(c, d); }, undefined, undefined, I);
|
|
208
222
|
manageProps(I);
|
package/vue/UiCard.vue
CHANGED
|
@@ -470,16 +470,16 @@ const hostState = computed(() =>
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
:global(:scope[data-ui-card-state~="size=sm"]:where([data-hn-ui-card])) {
|
|
473
|
-
inline-size: min(22rem, calc(100vw - var(--ui-space-2) * 2));
|
|
474
|
-
max-inline-size: min(22rem, calc(100vw - var(--ui-space-2) * 2));
|
|
473
|
+
inline-size: min(22rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
474
|
+
max-inline-size: min(22rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
475
475
|
}
|
|
476
476
|
:global(:scope[data-ui-card-state~="size=md"]:where([data-hn-ui-card])) {
|
|
477
|
-
inline-size: min(28rem, calc(100vw - var(--ui-space-2) * 2));
|
|
478
|
-
max-inline-size: min(28rem, calc(100vw - var(--ui-space-2) * 2));
|
|
477
|
+
inline-size: min(28rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
478
|
+
max-inline-size: min(28rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
479
479
|
}
|
|
480
480
|
:global(:scope[data-ui-card-state~="size=lg"]:where([data-hn-ui-card])) {
|
|
481
|
-
inline-size: min(36rem, calc(100vw - var(--ui-space-2) * 2));
|
|
482
|
-
max-inline-size: min(36rem, calc(100vw - var(--ui-space-2) * 2));
|
|
481
|
+
inline-size: min(36rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
482
|
+
max-inline-size: min(36rem, 100%, calc(100vw - var(--ui-space-2) * 2));
|
|
483
483
|
}
|
|
484
484
|
:global(:scope[hidden]:where([data-hn-ui-card])) {
|
|
485
485
|
display: none !important;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
2
|
import { type InputBindings } from './props.js';
|
|
3
|
-
declare
|
|
3
|
+
declare var __VLS_1: {};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
default?: (props: typeof __VLS_1) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
8
|
geometry: {
|
|
5
9
|
type: PropType<{
|
|
6
10
|
readonly rowBoundaries: readonly (number)[];
|
|
@@ -177,5 +181,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
177
181
|
};
|
|
178
182
|
}>) => any) | undefined;
|
|
179
183
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
184
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
180
185
|
declare const _default: typeof __VLS_export;
|
|
181
186
|
export default _default;
|
|
187
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
188
|
+
new (): {
|
|
189
|
+
$slots: S;
|
|
190
|
+
};
|
|
191
|
+
};
|