anentrypoint-design 0.0.353 → 0.0.355
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/247420.css +43 -0
- package/dist/247420.js +17 -17
- package/package.json +6 -1
- package/src/components/overlay-primitives.js +34 -0
- package/src/components/shell.js +1 -0
- package/src/components.js +1 -1
- package/src/kits/flatspace-theme/html-utils.js +62 -0
- package/src/kits/flatspace-theme/index.js +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anentrypoint-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.355",
|
|
4
4
|
"description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/247420.js",
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
"default": "./src/lint.js"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json",
|
|
33
|
+
"./kits/flatspace-theme": {
|
|
34
|
+
"import": "./src/kits/flatspace-theme/index.js",
|
|
35
|
+
"default": "./src/kits/flatspace-theme/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./kits/flatspace-theme/html-utils.js": "./src/kits/flatspace-theme/html-utils.js",
|
|
33
38
|
"./kits/os": {
|
|
34
39
|
"import": "./src/kits/os/index.js",
|
|
35
40
|
"default": "./src/kits/os/index.js"
|
|
@@ -315,6 +315,40 @@ export function PermissionMenu({ trigger, categories = [], approved = [], onTogg
|
|
|
315
315
|
: h('button', { type: 'button', class: 'ov-perm-trigger', ref: refFn }, child || 'Permissions');
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
// ApprovalPrompt — an inline, in-thread tool-permission card (as opposed to
|
|
319
|
+
// PermissionMenu's settings-style dropdown): shows the tool name + an
|
|
320
|
+
// optional args preview, an optional free-text note the user can attach to
|
|
321
|
+
// their decision (auto-focused, since the note is usually the primary
|
|
322
|
+
// reason to open this card at all), and up to four resolution actions
|
|
323
|
+
// (once/session/all/deny). Mirrors docstudio's chat-approval-prompts.js
|
|
324
|
+
// buildApprovalPrompt shape. The note textarea is entirely optional -
|
|
325
|
+
// omitting `onDecision`'s use of the note arg keeps existing simpler
|
|
326
|
+
// once/deny-only call sites unaffected.
|
|
327
|
+
export function ApprovalPrompt({ toolName, categoryLabel, argsPreview, onDecision, autoFocusNote = true } = {}) {
|
|
328
|
+
let noteEl = null;
|
|
329
|
+
const noteRef = (el) => {
|
|
330
|
+
if (!el || noteEl === el) return;
|
|
331
|
+
noteEl = el;
|
|
332
|
+
if (autoFocusNote) queueMicrotask(() => noteEl && noteEl.focus());
|
|
333
|
+
};
|
|
334
|
+
const decide = (kind) => { if (onDecision) onDecision(kind, (noteEl && noteEl.value || '').trim()); };
|
|
335
|
+
return h('div', { class: 'ov-approval', role: 'group', 'aria-label': toolName ? `Permission requested: ${toolName}` : 'Permission requested' },
|
|
336
|
+
h('div', { class: 'ov-approval-head' },
|
|
337
|
+
h('span', { class: 'ov-approval-icon' }, Icon('lock', { size: 16 })),
|
|
338
|
+
h('strong', { class: 'ov-approval-tool' }, toolName || ''),
|
|
339
|
+
categoryLabel ? h('span', { class: 'ov-approval-cat' }, '- ' + categoryLabel) : null),
|
|
340
|
+
argsPreview ? h('pre', { class: 'ov-approval-args' }, argsPreview) : null,
|
|
341
|
+
h('textarea', {
|
|
342
|
+
class: 'ov-approval-note', ref: noteRef,
|
|
343
|
+
placeholder: 'Add instructions for the assistant (optional)...',
|
|
344
|
+
}),
|
|
345
|
+
h('div', { class: 'ov-approval-actions' },
|
|
346
|
+
h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-primary', onclick: () => decide('once') }, 'Allow once'),
|
|
347
|
+
h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-soft', onclick: () => decide('session') }, 'Allow for session'),
|
|
348
|
+
h('button', { type: 'button', class: 'ov-approval-btn', onclick: () => decide('all') }, 'Allow all'),
|
|
349
|
+
h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-deny', onclick: () => decide('deny') }, 'Deny')));
|
|
350
|
+
}
|
|
351
|
+
|
|
318
352
|
// Clamp a fixed-position box to the viewport given desired top-left coords.
|
|
319
353
|
function _clampToViewport(x, y, w, h, margin = CLAMP_MARGIN) {
|
|
320
354
|
const vw = (typeof window !== 'undefined' ? window.innerWidth : 1024);
|
package/src/components/shell.js
CHANGED
|
@@ -143,6 +143,7 @@ export function Glyph({ children, color, size = 'base', label } = {}) {
|
|
|
143
143
|
// Monochrome inline-SVG icons (stroke=currentColor) so chrome reads as one
|
|
144
144
|
// coherent line-icon set instead of multicolor OS emoji. 16px box, 1.6 stroke.
|
|
145
145
|
export const ICON_PATHS = {
|
|
146
|
+
lock: '<rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/>',
|
|
146
147
|
mic: '<path d="M12 3a3 3 0 0 0-3 3v5a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/>',
|
|
147
148
|
'mic-off': '<path d="M9 9v2a3 3 0 0 0 4.5 2.6M15 11V6a3 3 0 0 0-5.9-.8"/><path d="M5 11a7 7 0 0 0 11.5 5.4M12 18v3"/><path d="m4 4 16 16"/>',
|
|
148
149
|
speaker: '<path d="M11 5 6 9H3v6h3l5 4z"/><path d="M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13"/>',
|
package/src/components.js
CHANGED
|
@@ -90,7 +90,7 @@ export {
|
|
|
90
90
|
export {
|
|
91
91
|
Tooltip, Popover, Dropdown, useLongPress, useFloating,
|
|
92
92
|
CommandPalette, EmojiPicker, BootOverlay, SettingsPopover,
|
|
93
|
-
AuthModal, VideoLightbox, PermissionMenu
|
|
93
|
+
AuthModal, VideoLightbox, PermissionMenu, ApprovalPrompt
|
|
94
94
|
} from './components/overlay-primitives.js';
|
|
95
95
|
|
|
96
96
|
export {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Shared HTML/JSON escaping + raw-HTML article extraction utilities for
|
|
2
|
+
// flatspace `theme.mjs` renderers (rs-codeinsight, rs-plugkit, gm, and any
|
|
3
|
+
// future flatspace site consuming the AnEntrypoint design system).
|
|
4
|
+
//
|
|
5
|
+
// escapeHtml/escapeJson are used by every known theme.mjs verbatim (byte-
|
|
6
|
+
// identical across rs-codeinsight and rs-plugkit prior to this extraction).
|
|
7
|
+
// extractArticle/rewriteLegacyLinks are OPT-IN: only sites with
|
|
8
|
+
// layout:'article' pages sourced from raw pre-existing HTML docs (gm's
|
|
9
|
+
// docs/*.html papers) need them. A single-page or YAML-only site never calls
|
|
10
|
+
// them, so importing this module carries no cost for sites that don't.
|
|
11
|
+
|
|
12
|
+
export const escapeHtml = (s) => String(s ?? '')
|
|
13
|
+
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
14
|
+
.replace(/"/g, '"').replace(/'/g, ''');
|
|
15
|
+
|
|
16
|
+
export const escapeJson = (obj) => JSON.stringify(obj)
|
|
17
|
+
.replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
18
|
+
.replace(new RegExp('\\u2028', 'g'), '\\u2028').replace(new RegExp('\\u2029', 'g'), '\\u2029');
|
|
19
|
+
|
|
20
|
+
// Strips <header>/<footer> chrome and the <html>/<head>/<body> wrapper from a
|
|
21
|
+
// raw standalone HTML document, returning just the body's inner content for
|
|
22
|
+
// re-hosting inside a flatspace-rendered article shell. Opt-in: only called
|
|
23
|
+
// by sites with layout:'article' pages whose `source` field points at a raw
|
|
24
|
+
// pre-existing .html file (gm's docs/paper.html etc).
|
|
25
|
+
export function extractArticle(html) {
|
|
26
|
+
const bodyOpen = html.search(/<body[^>]*>/i);
|
|
27
|
+
if (bodyOpen < 0) return html;
|
|
28
|
+
const bodyStart = html.indexOf('>', bodyOpen) + 1;
|
|
29
|
+
const bodyEnd = html.lastIndexOf('</body>');
|
|
30
|
+
let body = html.slice(bodyStart, bodyEnd >= 0 ? bodyEnd : html.length);
|
|
31
|
+
body = body.replace(/<header[^>]*>[\s\S]*?<\/header>/gi, '');
|
|
32
|
+
body = body.replace(/<footer\b[^>]*>[\s\S]*?<\/footer>/gi, '');
|
|
33
|
+
return body.trim();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Rewrites legacy same-site relative .html links (paper.html, distribution.html,
|
|
37
|
+
// etc) found inside extracted article HTML into flatspace's route paths
|
|
38
|
+
// (/paper/, /distribution/, ...), given the caller's own slug->path map.
|
|
39
|
+
// Opt-in, same scope as extractArticle: only needed when article HTML
|
|
40
|
+
// predates the flatspace multi-page routing and still uses .html-relative
|
|
41
|
+
// hrefs. `slugToPath` defaults to gm's known page set but callers with a
|
|
42
|
+
// different page inventory pass their own map.
|
|
43
|
+
const DEFAULT_SLUGS = ['index', 'paper', 'distribution', 'made-with', 'stats', 'crates', 'skills'];
|
|
44
|
+
const DEFAULT_SLUG_TO_PATH = {
|
|
45
|
+
index: '/', paper: '/paper/', distribution: '/distribution/',
|
|
46
|
+
'made-with': '/made-with/', stats: '/stats/', crates: '/crates/', skills: '/skills/',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function rewriteLegacyLinks(html, basePath, opts = {}) {
|
|
50
|
+
const slugs = opts.slugs || DEFAULT_SLUGS;
|
|
51
|
+
const slugToPath = opts.slugToPath || DEFAULT_SLUG_TO_PATH;
|
|
52
|
+
return html.replace(/href="([^"]+)"/g, (full, hrefRaw) => {
|
|
53
|
+
const href = hrefRaw.trim();
|
|
54
|
+
if (/^(https?:)?\/\//i.test(href) || href.startsWith('#') || href.startsWith('mailto:') || href.startsWith('/')) return full;
|
|
55
|
+
let path = href, hash = '';
|
|
56
|
+
const hi = path.indexOf('#');
|
|
57
|
+
if (hi >= 0) { hash = path.slice(hi); path = path.slice(0, hi); }
|
|
58
|
+
path = path.replace(/^\.\//, '').replace(/\.html$/, '').replace(/\/$/, '');
|
|
59
|
+
if (slugs.includes(path)) return `href="${basePath}${slugToPath[path]}${hash}"`;
|
|
60
|
+
return full;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Public entry point for the flatspace-theme kit. Re-exports the shared
|
|
2
|
+
// escaping + opt-in article-extraction utilities every known flatspace
|
|
3
|
+
// theme.mjs (rs-codeinsight, rs-plugkit, gm) needs. Each site's own
|
|
4
|
+
// page-composition logic (component layout, data contract) stays local to
|
|
5
|
+
// its own site/theme.mjs -- that part legitimately differs per site (single-
|
|
6
|
+
// page Hero/Features/Quickstart vs gm's multi-page article/landing split)
|
|
7
|
+
// and is not force-unified here.
|
|
8
|
+
export { escapeHtml, escapeJson, extractArticle, rewriteLegacyLinks } from './html-utils.js';
|
|
9
|
+
|
|
10
|
+
// Canonical unpkg URLs every theme.mjs's importmap/<link> points at, kept in
|
|
11
|
+
// one place so a future SDK CDN path change is a single-file edit instead of
|
|
12
|
+
// a 3-repo grep-and-replace.
|
|
13
|
+
export const SDK_CSS_URL = 'https://unpkg.com/anentrypoint-design@latest/dist/247420.css';
|
|
14
|
+
export const SDK_JS_URL = 'https://unpkg.com/anentrypoint-design@latest/dist/247420.js';
|