anentrypoint-design 0.0.121 → 0.0.124
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/README.md +253 -253
- package/app-shell.css +931 -594
- package/colors_and_type.css +226 -226
- package/community.css +817 -1222
- package/dist/247420.css +2202 -2084
- package/dist/247420.js +13 -13
- package/package.json +80 -80
- package/src/bootstrap.js +25 -25
- package/src/components/chat.js +199 -199
- package/src/components/community.js +190 -208
- package/src/components/content.js +269 -269
- package/src/components/editor-primitives.js +100 -0
- package/src/components/files-modals.js +107 -107
- package/src/components/files.js +118 -118
- package/src/components/freddie/helpers.js +50 -50
- package/src/components/freddie.js +33 -33
- package/src/components/shell.js +117 -117
- package/src/components/theme-toggle.js +70 -70
- package/src/components.js +59 -57
- package/src/debug.js +30 -30
- package/src/deck-stage.js +21 -21
- package/src/highlight.js +65 -32
- package/src/index.js +86 -86
- package/src/kits/os/about-app.js +52 -52
- package/src/kits/os/app-panes.css +152 -152
- package/src/kits/os/browser-app.js +58 -58
- package/src/kits/os/files-app.js +44 -44
- package/src/kits/os/freddie/helpers.js +59 -59
- package/src/kits/os/freddie/pages-chat.js +143 -143
- package/src/kits/os/freddie/pages-core.js +101 -101
- package/src/kits/os/freddie/pages-os.js +51 -51
- package/src/kits/os/freddie/pages-tools.js +183 -183
- package/src/kits/os/freddie/routes.js +24 -24
- package/src/kits/os/freddie-dashboard.css +51 -51
- package/src/kits/os/freddie-dashboard.js +101 -101
- package/src/kits/os/icons.js +17 -17
- package/src/kits/os/index.js +17 -17
- package/src/kits/os/launcher.css +61 -61
- package/src/kits/os/launcher.js +79 -79
- package/src/kits/os/monitor-app.js +34 -34
- package/src/kits/os/shell.js +214 -214
- package/src/kits/os/terminal-app.js +45 -45
- package/src/kits/os/theme.css +450 -450
- package/src/kits/os/validate.css +19 -19
- package/src/kits/os/validator-app.js +55 -55
- package/src/kits/os/wm.css +115 -115
- package/src/kits/os/wm.js +111 -111
- package/src/markdown.js +39 -39
- package/src/motion.js +35 -35
- package/src/page-html.js +196 -196
- package/src/styles.js +25 -25
- package/src/theme.js +99 -99
- package/src/web-components/ds-chat.js +116 -116
- package/dist/.nojekyll +0 -0
- package/dist/app-shell.css +0 -594
- package/dist/colors_and_type.css +0 -197
- package/dist/favicon.svg +0 -1
- package/dist/index.html +0 -308
- package/dist/preview/buttons.html +0 -28
- package/dist/preview/colors-core.html +0 -45
- package/dist/preview/colors-lore.html +0 -28
- package/dist/preview/colors-semantic.html +0 -34
- package/dist/preview/dateline.html +0 -19
- package/dist/preview/dropzone.html +0 -30
- package/dist/preview/file-grid.html +0 -19
- package/dist/preview/file-row.html +0 -20
- package/dist/preview/file-toolbar.html +0 -40
- package/dist/preview/file-viewer.html +0 -31
- package/dist/preview/header.html +0 -24
- package/dist/preview/icons-unicode.html +0 -26
- package/dist/preview/index-row.html +0 -25
- package/dist/preview/inputs.html +0 -22
- package/dist/preview/manifesto.html +0 -52
- package/dist/preview/motion-default.js +0 -106
- package/dist/preview/rules.html +0 -16
- package/dist/preview/spacing.html +0 -18
- package/dist/preview/stamps-lore.html +0 -20
- package/dist/preview/stamps.html +0 -14
- package/dist/preview/theme-ink.html +0 -15
- package/dist/preview/type-display.html +0 -16
- package/dist/preview/type-mono.html +0 -15
- package/dist/preview/type-prose.html +0 -11
- package/dist/preview/type-scale.html +0 -20
- package/dist/preview/wordmarks.html +0 -28
- package/dist/robots.txt +0 -8
- package/dist/site/content/globals/navigation.yaml +0 -5
- package/dist/site/content/globals/site.yaml +0 -16
- package/dist/site/content/pages/freddie.yaml +0 -88
- package/dist/site/content/pages/home.yaml +0 -190
- package/dist/site/theme.mjs +0 -368
- package/dist/sitemap.xml +0 -31
- package/dist/slides/deck-stage-overlay.js +0 -63
- package/dist/slides/deck-stage-state.js +0 -81
- package/dist/slides/deck-stage-style.js +0 -117
- package/dist/slides/deck-stage.js +0 -159
- package/dist/slides/index.html +0 -276
- package/dist/src/bootstrap.js +0 -25
- package/dist/src/components/chat.js +0 -199
- package/dist/src/components/community.js +0 -167
- package/dist/src/components/content.js +0 -213
- package/dist/src/components/files-modals.js +0 -107
- package/dist/src/components/files.js +0 -118
- package/dist/src/components/freddie/helpers.js +0 -50
- package/dist/src/components/freddie.js +0 -33
- package/dist/src/components/shell.js +0 -117
- package/dist/src/components/theme-toggle.js +0 -70
- package/dist/src/components.js +0 -52
- package/dist/src/debug.js +0 -30
- package/dist/src/deck-stage.js +0 -21
- package/dist/src/highlight.js +0 -32
- package/dist/src/index.js +0 -86
- package/dist/src/kits/os/about-app.js +0 -52
- package/dist/src/kits/os/app-panes.css +0 -152
- package/dist/src/kits/os/browser-app.js +0 -58
- package/dist/src/kits/os/files-app.js +0 -44
- package/dist/src/kits/os/freddie/helpers.js +0 -59
- package/dist/src/kits/os/freddie/pages-chat.js +0 -143
- package/dist/src/kits/os/freddie/pages-core.js +0 -101
- package/dist/src/kits/os/freddie/pages-os.js +0 -51
- package/dist/src/kits/os/freddie/pages-tools.js +0 -183
- package/dist/src/kits/os/freddie/routes.js +0 -24
- package/dist/src/kits/os/freddie-dashboard.css +0 -51
- package/dist/src/kits/os/freddie-dashboard.js +0 -101
- package/dist/src/kits/os/icons.js +0 -17
- package/dist/src/kits/os/index.js +0 -5
- package/dist/src/kits/os/launcher.css +0 -61
- package/dist/src/kits/os/launcher.js +0 -79
- package/dist/src/kits/os/monitor-app.js +0 -34
- package/dist/src/kits/os/shell.js +0 -214
- package/dist/src/kits/os/terminal-app.js +0 -45
- package/dist/src/kits/os/theme.css +0 -412
- package/dist/src/kits/os/validate.css +0 -19
- package/dist/src/kits/os/validator-app.js +0 -55
- package/dist/src/kits/os/wm.css +0 -115
- package/dist/src/kits/os/wm.js +0 -111
- package/dist/src/markdown.js +0 -39
- package/dist/src/motion.js +0 -35
- package/dist/src/page-html.js +0 -196
- package/dist/src/styles.js +0 -25
- package/dist/src/theme.js +0 -99
- package/dist/src/web-components/ds-chat.js +0 -45
- package/dist/ui_kits/aicat/README.md +0 -7
- package/dist/ui_kits/aicat/app.js +0 -156
- package/dist/ui_kits/aicat/index.html +0 -26
- package/dist/ui_kits/aicat/sample-square.png +0 -0
- package/dist/ui_kits/aicat/sample-svg.svg +0 -1
- package/dist/ui_kits/aicat/sample.pdf +0 -32
- package/dist/ui_kits/blog/README.md +0 -3
- package/dist/ui_kits/blog/index.html +0 -90
- package/dist/ui_kits/chat/README.md +0 -5
- package/dist/ui_kits/chat/app.js +0 -110
- package/dist/ui_kits/chat/index.html +0 -26
- package/dist/ui_kits/chat/sample-square.png +0 -0
- package/dist/ui_kits/chat/sample-svg.svg +0 -1
- package/dist/ui_kits/chat/sample.pdf +0 -32
- package/dist/ui_kits/community/app.js +0 -134
- package/dist/ui_kits/community/index.html +0 -24
- package/dist/ui_kits/dashboard/app.js +0 -92
- package/dist/ui_kits/dashboard/index.html +0 -26
- package/dist/ui_kits/docs/README.md +0 -3
- package/dist/ui_kits/docs/index.html +0 -123
- package/dist/ui_kits/error_404/app.js +0 -56
- package/dist/ui_kits/error_404/index.html +0 -26
- package/dist/ui_kits/file_browser/README.md +0 -48
- package/dist/ui_kits/file_browser/app.js +0 -231
- package/dist/ui_kits/file_browser/index.html +0 -33
- package/dist/ui_kits/gallery/app.js +0 -121
- package/dist/ui_kits/gallery/index.html +0 -26
- package/dist/ui_kits/homepage/README.md +0 -7
- package/dist/ui_kits/homepage/app.js +0 -167
- package/dist/ui_kits/homepage/index.html +0 -46
- package/dist/ui_kits/project_page/README.md +0 -3
- package/dist/ui_kits/project_page/app.js +0 -154
- package/dist/ui_kits/project_page/index.html +0 -45
- package/dist/ui_kits/search/app.js +0 -107
- package/dist/ui_kits/search/index.html +0 -26
- package/dist/ui_kits/settings/app.js +0 -133
- package/dist/ui_kits/settings/index.html +0 -26
- package/dist/ui_kits/signin/app.js +0 -115
- package/dist/ui_kits/signin/index.html +0 -26
- package/dist/ui_kits/slide_deck/app.js +0 -174
- package/dist/ui_kits/slide_deck/index.html +0 -26
- package/dist/ui_kits/system_primer/app.js +0 -152
- package/dist/ui_kits/system_primer/index.html +0 -26
- package/dist/ui_kits/terminal/app.js +0 -150
- package/dist/ui_kits/terminal/index.html +0 -26
- package/dist/vendor/webjsx/applyDiff.js +0 -182
- package/dist/vendor/webjsx/attributes.js +0 -154
- package/dist/vendor/webjsx/constants.js +0 -4
- package/dist/vendor/webjsx/createDOMElement.js +0 -52
- package/dist/vendor/webjsx/createElement.js +0 -75
- package/dist/vendor/webjsx/elementTags.js +0 -115
- package/dist/vendor/webjsx/factory.js +0 -6
- package/dist/vendor/webjsx/index.js +0 -6
- package/dist/vendor/webjsx/jsx-dev-runtime.js +0 -2
- package/dist/vendor/webjsx/jsx-runtime.js +0 -30
- package/dist/vendor/webjsx/jsx.js +0 -2
- package/dist/vendor/webjsx/package.json +0 -39
- package/dist/vendor/webjsx/renderSuspension.js +0 -25
- package/dist/vendor/webjsx/types.js +0 -5
- package/dist/vendor/webjsx/utils.js +0 -84
- package/src/components/overlays.js +0 -151
package/src/markdown.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
// Markdown — lazy-loads marked + DOMPurify on first call. Stub-safe:
|
|
2
|
-
// if loading fails, we fall back to a simple escape-and-linebreak pass so
|
|
3
|
-
// the chat doesn't go blank.
|
|
4
|
-
|
|
5
|
-
let _ready = null;
|
|
6
|
-
let _marked = null;
|
|
7
|
-
let _purify = null;
|
|
8
|
-
|
|
9
|
-
const MARKED_URL = 'https://cdn.jsdelivr.net/npm/marked@15/+esm';
|
|
10
|
-
const PURIFY_URL = 'https://cdn.jsdelivr.net/npm/dompurify@3/+esm';
|
|
11
|
-
|
|
12
|
-
export async function ensureReady() {
|
|
13
|
-
if (_ready) return _ready;
|
|
14
|
-
_ready = (async () => {
|
|
15
|
-
try {
|
|
16
|
-
const [{ marked }, DOMPurifyMod] = await Promise.all([import(MARKED_URL), import(PURIFY_URL)]);
|
|
17
|
-
_marked = marked;
|
|
18
|
-
_purify = DOMPurifyMod.default || DOMPurifyMod;
|
|
19
|
-
return true;
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.warn('[247420] markdown loader failed:', err);
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
25
|
-
return _ready;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function escapeHtml(s) {
|
|
29
|
-
return String(s).replace(/[&<>"']/g, (c) => ({
|
|
30
|
-
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
31
|
-
})[c]);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function renderMarkdown(src) {
|
|
35
|
-
const ok = await ensureReady();
|
|
36
|
-
if (!ok) return escapeHtml(src).replace(/\n/g, '<br>');
|
|
37
|
-
const raw = _marked.parse(String(src));
|
|
38
|
-
return _purify.sanitize(raw);
|
|
39
|
-
}
|
|
1
|
+
// Markdown — lazy-loads marked + DOMPurify on first call. Stub-safe:
|
|
2
|
+
// if loading fails, we fall back to a simple escape-and-linebreak pass so
|
|
3
|
+
// the chat doesn't go blank.
|
|
4
|
+
|
|
5
|
+
let _ready = null;
|
|
6
|
+
let _marked = null;
|
|
7
|
+
let _purify = null;
|
|
8
|
+
|
|
9
|
+
const MARKED_URL = 'https://cdn.jsdelivr.net/npm/marked@15/+esm';
|
|
10
|
+
const PURIFY_URL = 'https://cdn.jsdelivr.net/npm/dompurify@3/+esm';
|
|
11
|
+
|
|
12
|
+
export async function ensureReady() {
|
|
13
|
+
if (_ready) return _ready;
|
|
14
|
+
_ready = (async () => {
|
|
15
|
+
try {
|
|
16
|
+
const [{ marked }, DOMPurifyMod] = await Promise.all([import(MARKED_URL), import(PURIFY_URL)]);
|
|
17
|
+
_marked = marked;
|
|
18
|
+
_purify = DOMPurifyMod.default || DOMPurifyMod;
|
|
19
|
+
return true;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.warn('[247420] markdown loader failed:', err);
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
return _ready;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function escapeHtml(s) {
|
|
29
|
+
return String(s).replace(/[&<>"']/g, (c) => ({
|
|
30
|
+
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
31
|
+
})[c]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function renderMarkdown(src) {
|
|
35
|
+
const ok = await ensureReady();
|
|
36
|
+
if (!ok) return escapeHtml(src).replace(/\n/g, '<br>');
|
|
37
|
+
const raw = _marked.parse(String(src));
|
|
38
|
+
return _purify.sanitize(raw);
|
|
39
|
+
}
|
package/src/motion.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// Minimal motion — the SDK historically wired animate.css for entry
|
|
2
|
-
// flourishes. We tone this down: no animate.css, just a single GPU-friendly
|
|
3
|
-
// fade-up on first paint. animateTree() walks once and marks rendered nodes
|
|
4
|
-
// so it doesn't re-animate on every applyDiff.
|
|
5
|
-
|
|
6
|
-
export function installMotion() {
|
|
7
|
-
if (typeof document === 'undefined') return;
|
|
8
|
-
if (document.getElementById('ds-247420-motion')) return;
|
|
9
|
-
const style = document.createElement('style');
|
|
10
|
-
style.id = 'ds-247420-motion';
|
|
11
|
-
style.textContent = `
|
|
12
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
13
|
-
.ds-247420 [data-anim="in"] {
|
|
14
|
-
opacity: 0; transform: translateY(8px);
|
|
15
|
-
transition: opacity 320ms cubic-bezier(.2,0,0,1), transform 320ms cubic-bezier(.2,0,0,1);
|
|
16
|
-
}
|
|
17
|
-
.ds-247420 [data-anim="ready"] {
|
|
18
|
-
opacity: 1; transform: translateY(0);
|
|
19
|
-
}
|
|
20
|
-
}`.trim();
|
|
21
|
-
document.head.appendChild(style);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function animateTree(root) {
|
|
25
|
-
if (!root || typeof root.querySelectorAll !== 'function') return;
|
|
26
|
-
// Mark sections / hero / panels for entry.
|
|
27
|
-
const targets = root.querySelectorAll('.ds-hero,.panel,.ds-section,.app-main > *');
|
|
28
|
-
targets.forEach((el, i) => {
|
|
29
|
-
if (el.dataset.anim === 'ready') return;
|
|
30
|
-
el.dataset.anim = 'in';
|
|
31
|
-
// stagger up to 6 elements, then snap the rest in
|
|
32
|
-
const delay = Math.min(i, 6) * 30;
|
|
33
|
-
setTimeout(() => { el.dataset.anim = 'ready'; }, delay);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
1
|
+
// Minimal motion — the SDK historically wired animate.css for entry
|
|
2
|
+
// flourishes. We tone this down: no animate.css, just a single GPU-friendly
|
|
3
|
+
// fade-up on first paint. animateTree() walks once and marks rendered nodes
|
|
4
|
+
// so it doesn't re-animate on every applyDiff.
|
|
5
|
+
|
|
6
|
+
export function installMotion() {
|
|
7
|
+
if (typeof document === 'undefined') return;
|
|
8
|
+
if (document.getElementById('ds-247420-motion')) return;
|
|
9
|
+
const style = document.createElement('style');
|
|
10
|
+
style.id = 'ds-247420-motion';
|
|
11
|
+
style.textContent = `
|
|
12
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
13
|
+
.ds-247420 [data-anim="in"] {
|
|
14
|
+
opacity: 0; transform: translateY(8px);
|
|
15
|
+
transition: opacity 320ms cubic-bezier(.2,0,0,1), transform 320ms cubic-bezier(.2,0,0,1);
|
|
16
|
+
}
|
|
17
|
+
.ds-247420 [data-anim="ready"] {
|
|
18
|
+
opacity: 1; transform: translateY(0);
|
|
19
|
+
}
|
|
20
|
+
}`.trim();
|
|
21
|
+
document.head.appendChild(style);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function animateTree(root) {
|
|
25
|
+
if (!root || typeof root.querySelectorAll !== 'function') return;
|
|
26
|
+
// Mark sections / hero / panels for entry.
|
|
27
|
+
const targets = root.querySelectorAll('.ds-hero,.panel,.ds-section,.app-main > *');
|
|
28
|
+
targets.forEach((el, i) => {
|
|
29
|
+
if (el.dataset.anim === 'ready') return;
|
|
30
|
+
el.dataset.anim = 'in';
|
|
31
|
+
// stagger up to 6 elements, then snap the rest in
|
|
32
|
+
const delay = Math.min(i, 6) * 30;
|
|
33
|
+
setTimeout(() => { el.dataset.anim = 'ready'; }, delay);
|
|
34
|
+
});
|
|
35
|
+
}
|
package/src/page-html.js
CHANGED
|
@@ -1,196 +1,196 @@
|
|
|
1
|
-
// Static-site page HTML renderer. Emits a thin SDK-shell document that mounts
|
|
2
|
-
// the page using the SDK's own kit components (Hero, Section, Panel, Row, etc.)
|
|
3
|
-
// — the kit is the single source of truth for visual design; this file only
|
|
4
|
-
// declares the data shape and the mount entry point.
|
|
5
|
-
//
|
|
6
|
-
// Consumer contract:
|
|
7
|
-
// renderPageHtml({
|
|
8
|
-
// title, slug, siteName,
|
|
9
|
-
// navItems: [[label, href], ...], // hrefs are joined with basePath
|
|
10
|
-
// basePath: '/freddie/', // prefix for relative nav hrefs
|
|
11
|
-
// hero: { heading, body, accent, badges, ctas },
|
|
12
|
-
// sections: [{ id, name, lede, body, features: [{name, desc, benefit}] }, ...],
|
|
13
|
-
// examples: [{ label, desc, href }, ...],
|
|
14
|
-
// body: markdown-string,
|
|
15
|
-
// theme: 'auto' | 'light' | 'ink',
|
|
16
|
-
// cssHref, headExtra,
|
|
17
|
-
// })
|
|
18
|
-
|
|
19
|
-
export function escape(s) {
|
|
20
|
-
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function inlineMd(s) {
|
|
24
|
-
return s
|
|
25
|
-
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
|
26
|
-
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
27
|
-
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function renderMarkdown(md) {
|
|
31
|
-
const lines = String(md || '').split('\n');
|
|
32
|
-
const out = [];
|
|
33
|
-
let inCode = false, inList = false;
|
|
34
|
-
for (const line of lines) {
|
|
35
|
-
if (line.startsWith('```')) { if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; } continue; }
|
|
36
|
-
if (inCode) { out.push(escape(line)); continue; }
|
|
37
|
-
if (line.startsWith('# ')) out.push(`<h1>${escape(line.slice(2))}</h1>`);
|
|
38
|
-
else if (line.startsWith('## ')) out.push(`<h2>${escape(line.slice(3))}</h2>`);
|
|
39
|
-
else if (line.startsWith('### ')) out.push(`<h3>${escape(line.slice(4))}</h3>`);
|
|
40
|
-
else if (line.startsWith('- ')) { if (!inList) { out.push('<ul>'); inList = true; } out.push(`<li>${inlineMd(escape(line.slice(2)))}</li>`); }
|
|
41
|
-
else { if (inList) { out.push('</ul>'); inList = false; } if (line.trim()) out.push(`<p>${inlineMd(escape(line))}</p>`); }
|
|
42
|
-
}
|
|
43
|
-
if (inList) out.push('</ul>');
|
|
44
|
-
if (inCode) out.push('</pre>');
|
|
45
|
-
return out.join('\n');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Join a basePath prefix to a nav href. Absolute URLs and hash links pass
|
|
49
|
-
// through unchanged; leading-slash paths get the prefix.
|
|
50
|
-
function joinHref(basePath, href) {
|
|
51
|
-
if (!href) return '#';
|
|
52
|
-
const h = String(href);
|
|
53
|
-
if (/^([a-z]+:|#|\/\/)/i.test(h)) return h;
|
|
54
|
-
if (!basePath) return h;
|
|
55
|
-
const base = basePath.replace(/\/+$/, '');
|
|
56
|
-
if (h.startsWith('/')) return base + h;
|
|
57
|
-
return base + '/' + h.replace(/^\.?\//, '');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function renderPageHtml({
|
|
61
|
-
title = '247420', slug = 'index', siteName = '247420',
|
|
62
|
-
navItems = [], basePath = '',
|
|
63
|
-
hero, sections, examples, body,
|
|
64
|
-
theme = 'auto', cssHref, headExtra = ''
|
|
65
|
-
} = {}) {
|
|
66
|
-
const cssLink = cssHref
|
|
67
|
-
? `<link rel="stylesheet" href="${cssHref}">`
|
|
68
|
-
: `<link rel="stylesheet" href="https://unpkg.com/anentrypoint-design@latest/dist/247420.css">`;
|
|
69
|
-
|
|
70
|
-
// Resolve nav hrefs server-side against basePath. Client receives final URLs.
|
|
71
|
-
const navResolved = (Array.isArray(navItems) ? navItems : []).map(([label, href]) =>
|
|
72
|
-
[label, joinHref(basePath, href)]
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// Data the client mount needs. Markdown body is parsed server-side into
|
|
76
|
-
// HTML so the client can innerHTML it inside a Section.
|
|
77
|
-
const pageData = {
|
|
78
|
-
title, slug, siteName, navItems: navResolved, theme,
|
|
79
|
-
hero: hero || null,
|
|
80
|
-
sections: Array.isArray(sections) ? sections : [],
|
|
81
|
-
examples: Array.isArray(examples) ? examples : [],
|
|
82
|
-
bodyHtml: body ? renderMarkdown(body) : '',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return `<!doctype html>
|
|
86
|
-
<html lang="en" class="ds-247420" data-theme="${theme}">
|
|
87
|
-
<head>
|
|
88
|
-
<meta charset="utf-8">
|
|
89
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
90
|
-
<title>${escape(title)} — ${escape(siteName)}</title>
|
|
91
|
-
${cssLink}
|
|
92
|
-
<script type="importmap">
|
|
93
|
-
{ "imports": { "anentrypoint-design": "https://unpkg.com/anentrypoint-design@latest/dist/247420.js" } }
|
|
94
|
-
</script>
|
|
95
|
-
<style>
|
|
96
|
-
.app-stage { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 24px }
|
|
97
|
-
.page-body h1 { margin-top: 0 } .page-body h2 { margin-top: 32px } .page-body h3 { margin-top: 24px }
|
|
98
|
-
.page-body pre { margin: 12px 0; background: var(--panel-2); padding: 12px; border-radius: 8px; overflow-x: auto }
|
|
99
|
-
</style>
|
|
100
|
-
<script id="__site__" type="application/json">${JSON.stringify(pageData).replace(/</g, '\\u003c')}</script>
|
|
101
|
-
${headExtra}
|
|
102
|
-
</head>
|
|
103
|
-
<body>
|
|
104
|
-
<div id="app"></div>
|
|
105
|
-
<script type="module">
|
|
106
|
-
import { mount, components as C, h } from 'anentrypoint-design';
|
|
107
|
-
const data = JSON.parse(document.getElementById('__site__').textContent);
|
|
108
|
-
const RAILS = ['rail-green', 'rail-purple', 'rail-mascot', 'rail-sun', 'rail-flame', 'rail-sky'];
|
|
109
|
-
|
|
110
|
-
function heroNode(hero) {
|
|
111
|
-
if (!hero) return null;
|
|
112
|
-
return C.Hero({
|
|
113
|
-
eyebrow: hero.eyebrow,
|
|
114
|
-
title: hero.heading || hero.title || data.title,
|
|
115
|
-
body: hero.body || hero.subheading || '',
|
|
116
|
-
accent: hero.accent,
|
|
117
|
-
badge: Array.isArray(hero.badges) && hero.badges[0] ? hero.badges[0].label : undefined,
|
|
118
|
-
actions: Array.isArray(hero.ctas) ? hero.ctas.map((c, i) => h('a', { key: i, class: i === 0 ? 'btn btn-accent' : 'btn btn-ghost', href: c.href || '#' }, c.label || c.cta || 'go')) : null,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function sectionNode(sec, idx) {
|
|
123
|
-
const rail = RAILS[idx % RAILS.length];
|
|
124
|
-
const features = sec.features || sec.items || [];
|
|
125
|
-
const rows = features.map((f, i) => {
|
|
126
|
-
const kids = [h('span', { key: 't', class: 'title' }, String(f.name || ''))];
|
|
127
|
-
if (f.desc) kids.push(h('div', { key: 'd', class: 'sub', innerHTML: String(f.desc).replace(/\`([^\`]+)\`/g, '<code>$1</code>') }));
|
|
128
|
-
if (f.benefit) kids.push(h('div', { key: 'b', class: 'row-benefit' }, String(f.benefit)));
|
|
129
|
-
return h('div', { key: i, class: 'row ' + rail }, ...kids);
|
|
130
|
-
});
|
|
131
|
-
return C.Section({
|
|
132
|
-
title: sec.name || sec.title || sec.id,
|
|
133
|
-
children: [
|
|
134
|
-
sec.lede ? h('p', { class: 'ds-lede' }, sec.lede) : null,
|
|
135
|
-
...rows,
|
|
136
|
-
sec.body && sec.body.length >= 240 ? h('div', { class: 'page-body', innerHTML: __md(sec.body) }) : null,
|
|
137
|
-
].filter(Boolean),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function examplesNode(examples) {
|
|
142
|
-
if (!examples || !examples.length) return null;
|
|
143
|
-
return C.Section({
|
|
144
|
-
title: 'explore',
|
|
145
|
-
children: examples.map((e, i) => {
|
|
146
|
-
const rail = RAILS[(i + 1) % RAILS.length];
|
|
147
|
-
const kids = [
|
|
148
|
-
h('span', { key: 'c', class: 'code' }, String(i + 1).padStart(2, '0')),
|
|
149
|
-
h('span', { key: 't', class: 'title' }, String(e.label || e.name || e.href || '')),
|
|
150
|
-
];
|
|
151
|
-
if (e.desc) kids.push(h('span', { key: 'm', class: 'meta dim' }, ' — ' + e.desc));
|
|
152
|
-
kids.push(h('span', { key: 'a', class: 'ds-row-arrow' }, '↗'));
|
|
153
|
-
return h('a', { key: i, class: 'row ' + rail, href: e.href || '#' }, ...kids);
|
|
154
|
-
}),
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// minimal client-side markdown renderer matching server-side renderer (idempotent for already-html bodies)
|
|
159
|
-
function __md(md) {
|
|
160
|
-
const lines = String(md || '').split('\\n');
|
|
161
|
-
const out = []; let inCode = false, inList = false;
|
|
162
|
-
const esc = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
163
|
-
const inl = (s) => s.replace(/\`([^\`]+)\`/g, '<code>$1</code>').replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>').replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '<a href="$2">$1</a>');
|
|
164
|
-
for (const line of lines) {
|
|
165
|
-
if (line.startsWith('\`\`\`')) { if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; } continue; }
|
|
166
|
-
if (inCode) { out.push(esc(line)); continue; }
|
|
167
|
-
if (line.startsWith('# ')) out.push('<h1>' + esc(line.slice(2)) + '</h1>');
|
|
168
|
-
else if (line.startsWith('## ')) out.push('<h2>' + esc(line.slice(3)) + '</h2>');
|
|
169
|
-
else if (line.startsWith('### ')) out.push('<h3>' + esc(line.slice(4)) + '</h3>');
|
|
170
|
-
else if (line.startsWith('- ')) { if (!inList) { out.push('<ul>'); inList = true; } out.push('<li>' + inl(esc(line.slice(2))) + '</li>'); }
|
|
171
|
-
else { if (inList) { out.push('</ul>'); inList = false; } if (line.trim()) out.push('<p>' + inl(esc(line)) + '</p>'); }
|
|
172
|
-
}
|
|
173
|
-
if (inList) out.push('</ul>');
|
|
174
|
-
if (inCode) out.push('</pre>');
|
|
175
|
-
return out.join('\\n');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const bodyNode = data.bodyHtml ? C.Section({ children: h('div', { class: 'page-body', innerHTML: data.bodyHtml }) }) : null;
|
|
179
|
-
|
|
180
|
-
const mainChildren = [
|
|
181
|
-
heroNode(data.hero),
|
|
182
|
-
...data.sections.map(sectionNode),
|
|
183
|
-
examplesNode(data.examples),
|
|
184
|
-
bodyNode,
|
|
185
|
-
].filter(Boolean);
|
|
186
|
-
|
|
187
|
-
mount(document.getElementById('app'), () => C.AppShell({
|
|
188
|
-
topbar: C.Topbar({ brand: data.siteName, items: data.navItems, active: data.title }),
|
|
189
|
-
crumb: C.Crumb({ leaf: data.title }),
|
|
190
|
-
main: h('div', { class: 'app-stage' }, ...mainChildren),
|
|
191
|
-
status: C.Status({ left: [data.siteName.toLowerCase(), data.slug], right: ['live'] }),
|
|
192
|
-
}));
|
|
193
|
-
</script>
|
|
194
|
-
</body>
|
|
195
|
-
</html>`;
|
|
196
|
-
}
|
|
1
|
+
// Static-site page HTML renderer. Emits a thin SDK-shell document that mounts
|
|
2
|
+
// the page using the SDK's own kit components (Hero, Section, Panel, Row, etc.)
|
|
3
|
+
// — the kit is the single source of truth for visual design; this file only
|
|
4
|
+
// declares the data shape and the mount entry point.
|
|
5
|
+
//
|
|
6
|
+
// Consumer contract:
|
|
7
|
+
// renderPageHtml({
|
|
8
|
+
// title, slug, siteName,
|
|
9
|
+
// navItems: [[label, href], ...], // hrefs are joined with basePath
|
|
10
|
+
// basePath: '/freddie/', // prefix for relative nav hrefs
|
|
11
|
+
// hero: { heading, body, accent, badges, ctas },
|
|
12
|
+
// sections: [{ id, name, lede, body, features: [{name, desc, benefit}] }, ...],
|
|
13
|
+
// examples: [{ label, desc, href }, ...],
|
|
14
|
+
// body: markdown-string,
|
|
15
|
+
// theme: 'auto' | 'light' | 'ink',
|
|
16
|
+
// cssHref, headExtra,
|
|
17
|
+
// })
|
|
18
|
+
|
|
19
|
+
export function escape(s) {
|
|
20
|
+
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function inlineMd(s) {
|
|
24
|
+
return s
|
|
25
|
+
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
|
26
|
+
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
27
|
+
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function renderMarkdown(md) {
|
|
31
|
+
const lines = String(md || '').split('\n');
|
|
32
|
+
const out = [];
|
|
33
|
+
let inCode = false, inList = false;
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
if (line.startsWith('```')) { if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; } continue; }
|
|
36
|
+
if (inCode) { out.push(escape(line)); continue; }
|
|
37
|
+
if (line.startsWith('# ')) out.push(`<h1>${escape(line.slice(2))}</h1>`);
|
|
38
|
+
else if (line.startsWith('## ')) out.push(`<h2>${escape(line.slice(3))}</h2>`);
|
|
39
|
+
else if (line.startsWith('### ')) out.push(`<h3>${escape(line.slice(4))}</h3>`);
|
|
40
|
+
else if (line.startsWith('- ')) { if (!inList) { out.push('<ul>'); inList = true; } out.push(`<li>${inlineMd(escape(line.slice(2)))}</li>`); }
|
|
41
|
+
else { if (inList) { out.push('</ul>'); inList = false; } if (line.trim()) out.push(`<p>${inlineMd(escape(line))}</p>`); }
|
|
42
|
+
}
|
|
43
|
+
if (inList) out.push('</ul>');
|
|
44
|
+
if (inCode) out.push('</pre>');
|
|
45
|
+
return out.join('\n');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Join a basePath prefix to a nav href. Absolute URLs and hash links pass
|
|
49
|
+
// through unchanged; leading-slash paths get the prefix.
|
|
50
|
+
function joinHref(basePath, href) {
|
|
51
|
+
if (!href) return '#';
|
|
52
|
+
const h = String(href);
|
|
53
|
+
if (/^([a-z]+:|#|\/\/)/i.test(h)) return h;
|
|
54
|
+
if (!basePath) return h;
|
|
55
|
+
const base = basePath.replace(/\/+$/, '');
|
|
56
|
+
if (h.startsWith('/')) return base + h;
|
|
57
|
+
return base + '/' + h.replace(/^\.?\//, '');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function renderPageHtml({
|
|
61
|
+
title = '247420', slug = 'index', siteName = '247420',
|
|
62
|
+
navItems = [], basePath = '',
|
|
63
|
+
hero, sections, examples, body,
|
|
64
|
+
theme = 'auto', cssHref, headExtra = ''
|
|
65
|
+
} = {}) {
|
|
66
|
+
const cssLink = cssHref
|
|
67
|
+
? `<link rel="stylesheet" href="${cssHref}">`
|
|
68
|
+
: `<link rel="stylesheet" href="https://unpkg.com/anentrypoint-design@latest/dist/247420.css">`;
|
|
69
|
+
|
|
70
|
+
// Resolve nav hrefs server-side against basePath. Client receives final URLs.
|
|
71
|
+
const navResolved = (Array.isArray(navItems) ? navItems : []).map(([label, href]) =>
|
|
72
|
+
[label, joinHref(basePath, href)]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// Data the client mount needs. Markdown body is parsed server-side into
|
|
76
|
+
// HTML so the client can innerHTML it inside a Section.
|
|
77
|
+
const pageData = {
|
|
78
|
+
title, slug, siteName, navItems: navResolved, theme,
|
|
79
|
+
hero: hero || null,
|
|
80
|
+
sections: Array.isArray(sections) ? sections : [],
|
|
81
|
+
examples: Array.isArray(examples) ? examples : [],
|
|
82
|
+
bodyHtml: body ? renderMarkdown(body) : '',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return `<!doctype html>
|
|
86
|
+
<html lang="en" class="ds-247420" data-theme="${theme}">
|
|
87
|
+
<head>
|
|
88
|
+
<meta charset="utf-8">
|
|
89
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
90
|
+
<title>${escape(title)} — ${escape(siteName)}</title>
|
|
91
|
+
${cssLink}
|
|
92
|
+
<script type="importmap">
|
|
93
|
+
{ "imports": { "anentrypoint-design": "https://unpkg.com/anentrypoint-design@latest/dist/247420.js" } }
|
|
94
|
+
</script>
|
|
95
|
+
<style>
|
|
96
|
+
.app-stage { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 24px }
|
|
97
|
+
.page-body h1 { margin-top: 0 } .page-body h2 { margin-top: 32px } .page-body h3 { margin-top: 24px }
|
|
98
|
+
.page-body pre { margin: 12px 0; background: var(--panel-2); padding: 12px; border-radius: 8px; overflow-x: auto }
|
|
99
|
+
</style>
|
|
100
|
+
<script id="__site__" type="application/json">${JSON.stringify(pageData).replace(/</g, '\\u003c')}</script>
|
|
101
|
+
${headExtra}
|
|
102
|
+
</head>
|
|
103
|
+
<body>
|
|
104
|
+
<div id="app"></div>
|
|
105
|
+
<script type="module">
|
|
106
|
+
import { mount, components as C, h } from 'anentrypoint-design';
|
|
107
|
+
const data = JSON.parse(document.getElementById('__site__').textContent);
|
|
108
|
+
const RAILS = ['rail-green', 'rail-purple', 'rail-mascot', 'rail-sun', 'rail-flame', 'rail-sky'];
|
|
109
|
+
|
|
110
|
+
function heroNode(hero) {
|
|
111
|
+
if (!hero) return null;
|
|
112
|
+
return C.Hero({
|
|
113
|
+
eyebrow: hero.eyebrow,
|
|
114
|
+
title: hero.heading || hero.title || data.title,
|
|
115
|
+
body: hero.body || hero.subheading || '',
|
|
116
|
+
accent: hero.accent,
|
|
117
|
+
badge: Array.isArray(hero.badges) && hero.badges[0] ? hero.badges[0].label : undefined,
|
|
118
|
+
actions: Array.isArray(hero.ctas) ? hero.ctas.map((c, i) => h('a', { key: i, class: i === 0 ? 'btn btn-accent' : 'btn btn-ghost', href: c.href || '#' }, c.label || c.cta || 'go')) : null,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function sectionNode(sec, idx) {
|
|
123
|
+
const rail = RAILS[idx % RAILS.length];
|
|
124
|
+
const features = sec.features || sec.items || [];
|
|
125
|
+
const rows = features.map((f, i) => {
|
|
126
|
+
const kids = [h('span', { key: 't', class: 'title' }, String(f.name || ''))];
|
|
127
|
+
if (f.desc) kids.push(h('div', { key: 'd', class: 'sub', innerHTML: String(f.desc).replace(/\`([^\`]+)\`/g, '<code>$1</code>') }));
|
|
128
|
+
if (f.benefit) kids.push(h('div', { key: 'b', class: 'row-benefit' }, String(f.benefit)));
|
|
129
|
+
return h('div', { key: i, class: 'row ' + rail }, ...kids);
|
|
130
|
+
});
|
|
131
|
+
return C.Section({
|
|
132
|
+
title: sec.name || sec.title || sec.id,
|
|
133
|
+
children: [
|
|
134
|
+
sec.lede ? h('p', { class: 'ds-lede' }, sec.lede) : null,
|
|
135
|
+
...rows,
|
|
136
|
+
sec.body && sec.body.length >= 240 ? h('div', { class: 'page-body', innerHTML: __md(sec.body) }) : null,
|
|
137
|
+
].filter(Boolean),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function examplesNode(examples) {
|
|
142
|
+
if (!examples || !examples.length) return null;
|
|
143
|
+
return C.Section({
|
|
144
|
+
title: 'explore',
|
|
145
|
+
children: examples.map((e, i) => {
|
|
146
|
+
const rail = RAILS[(i + 1) % RAILS.length];
|
|
147
|
+
const kids = [
|
|
148
|
+
h('span', { key: 'c', class: 'code' }, String(i + 1).padStart(2, '0')),
|
|
149
|
+
h('span', { key: 't', class: 'title' }, String(e.label || e.name || e.href || '')),
|
|
150
|
+
];
|
|
151
|
+
if (e.desc) kids.push(h('span', { key: 'm', class: 'meta dim' }, ' — ' + e.desc));
|
|
152
|
+
kids.push(h('span', { key: 'a', class: 'ds-row-arrow' }, '↗'));
|
|
153
|
+
return h('a', { key: i, class: 'row ' + rail, href: e.href || '#' }, ...kids);
|
|
154
|
+
}),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// minimal client-side markdown renderer matching server-side renderer (idempotent for already-html bodies)
|
|
159
|
+
function __md(md) {
|
|
160
|
+
const lines = String(md || '').split('\\n');
|
|
161
|
+
const out = []; let inCode = false, inList = false;
|
|
162
|
+
const esc = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
163
|
+
const inl = (s) => s.replace(/\`([^\`]+)\`/g, '<code>$1</code>').replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>').replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '<a href="$2">$1</a>');
|
|
164
|
+
for (const line of lines) {
|
|
165
|
+
if (line.startsWith('\`\`\`')) { if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; } continue; }
|
|
166
|
+
if (inCode) { out.push(esc(line)); continue; }
|
|
167
|
+
if (line.startsWith('# ')) out.push('<h1>' + esc(line.slice(2)) + '</h1>');
|
|
168
|
+
else if (line.startsWith('## ')) out.push('<h2>' + esc(line.slice(3)) + '</h2>');
|
|
169
|
+
else if (line.startsWith('### ')) out.push('<h3>' + esc(line.slice(4)) + '</h3>');
|
|
170
|
+
else if (line.startsWith('- ')) { if (!inList) { out.push('<ul>'); inList = true; } out.push('<li>' + inl(esc(line.slice(2))) + '</li>'); }
|
|
171
|
+
else { if (inList) { out.push('</ul>'); inList = false; } if (line.trim()) out.push('<p>' + inl(esc(line)) + '</p>'); }
|
|
172
|
+
}
|
|
173
|
+
if (inList) out.push('</ul>');
|
|
174
|
+
if (inCode) out.push('</pre>');
|
|
175
|
+
return out.join('\\n');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const bodyNode = data.bodyHtml ? C.Section({ children: h('div', { class: 'page-body', innerHTML: data.bodyHtml }) }) : null;
|
|
179
|
+
|
|
180
|
+
const mainChildren = [
|
|
181
|
+
heroNode(data.hero),
|
|
182
|
+
...data.sections.map(sectionNode),
|
|
183
|
+
examplesNode(data.examples),
|
|
184
|
+
bodyNode,
|
|
185
|
+
].filter(Boolean);
|
|
186
|
+
|
|
187
|
+
mount(document.getElementById('app'), () => C.AppShell({
|
|
188
|
+
topbar: C.Topbar({ brand: data.siteName, items: data.navItems, active: data.title }),
|
|
189
|
+
crumb: C.Crumb({ leaf: data.title }),
|
|
190
|
+
main: h('div', { class: 'app-stage' }, ...mainChildren),
|
|
191
|
+
status: C.Status({ left: [data.siteName.toLowerCase(), data.slug], right: ['live'] }),
|
|
192
|
+
}));
|
|
193
|
+
</script>
|
|
194
|
+
</body>
|
|
195
|
+
</html>`;
|
|
196
|
+
}
|
package/src/styles.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
// 247420 design system — styles
|
|
2
|
-
// Loads the prefixed CSS bundle (./247420.css alongside this file) and
|
|
3
|
-
// exposes the scope class consumers add to their wrapping element.
|
|
4
|
-
|
|
5
|
-
export const scope = '.ds-247420';
|
|
6
|
-
|
|
7
|
-
let _cssPromise = null;
|
|
8
|
-
|
|
9
|
-
export function loadCss() {
|
|
10
|
-
if (_cssPromise) return _cssPromise;
|
|
11
|
-
_cssPromise = (async () => {
|
|
12
|
-
// Resolve relative to this module so it works whether loaded from
|
|
13
|
-
// unpkg, jsdelivr, or a local copy.
|
|
14
|
-
const url = new URL('../dist/247420.css', import.meta.url);
|
|
15
|
-
const res = await fetch(url);
|
|
16
|
-
if (!res.ok) throw new Error('247420: failed to load css ' + res.status);
|
|
17
|
-
return await res.text();
|
|
18
|
-
})();
|
|
19
|
-
return _cssPromise;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Back-compat: code that read `css` directly after a `loadCss()` call gets
|
|
23
|
-
// the populated string. New code should `await loadCss()`.
|
|
24
|
-
export let css = '';
|
|
25
|
-
loadCss().then((s) => { css = s; }).catch(() => {});
|
|
1
|
+
// 247420 design system — styles
|
|
2
|
+
// Loads the prefixed CSS bundle (./247420.css alongside this file) and
|
|
3
|
+
// exposes the scope class consumers add to their wrapping element.
|
|
4
|
+
|
|
5
|
+
export const scope = '.ds-247420';
|
|
6
|
+
|
|
7
|
+
let _cssPromise = null;
|
|
8
|
+
|
|
9
|
+
export function loadCss() {
|
|
10
|
+
if (_cssPromise) return _cssPromise;
|
|
11
|
+
_cssPromise = (async () => {
|
|
12
|
+
// Resolve relative to this module so it works whether loaded from
|
|
13
|
+
// unpkg, jsdelivr, or a local copy.
|
|
14
|
+
const url = new URL('../dist/247420.css', import.meta.url);
|
|
15
|
+
const res = await fetch(url);
|
|
16
|
+
if (!res.ok) throw new Error('247420: failed to load css ' + res.status);
|
|
17
|
+
return await res.text();
|
|
18
|
+
})();
|
|
19
|
+
return _cssPromise;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Back-compat: code that read `css` directly after a `loadCss()` call gets
|
|
23
|
+
// the populated string. New code should `await loadCss()`.
|
|
24
|
+
export let css = '';
|
|
25
|
+
loadCss().then((s) => { css = s; }).catch(() => {});
|