pith-ui 0.0.0-stage → 0.1.0
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/AI.md +67 -0
- package/API.md +3281 -0
- package/LICENSE +661 -0
- package/README.md +80 -2
- package/dist/composer.d.ts +38 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +114 -0
- package/dist/composer.js.map +1 -0
- package/dist/content/conversation-reader.d.ts +19 -0
- package/dist/content/conversation-reader.d.ts.map +1 -0
- package/dist/content/conversation-reader.js +280 -0
- package/dist/content/conversation-reader.js.map +1 -0
- package/dist/content/conversation-view.d.ts +48 -0
- package/dist/content/conversation-view.d.ts.map +1 -0
- package/dist/content/conversation-view.js +107 -0
- package/dist/content/conversation-view.js.map +1 -0
- package/dist/content/image-viewer.d.ts +23 -0
- package/dist/content/image-viewer.d.ts.map +1 -0
- package/dist/content/image-viewer.js +101 -0
- package/dist/content/image-viewer.js.map +1 -0
- package/dist/content/markdown.d.ts +12 -0
- package/dist/content/markdown.d.ts.map +1 -0
- package/dist/content/markdown.js +68 -0
- package/dist/content/markdown.js.map +1 -0
- package/dist/content/paged-preview.d.ts +15 -0
- package/dist/content/paged-preview.d.ts.map +1 -0
- package/dist/content/paged-preview.js +105 -0
- package/dist/content/paged-preview.js.map +1 -0
- package/dist/content/views.d.ts +9 -0
- package/dist/content/views.d.ts.map +1 -0
- package/dist/content/views.js +53 -0
- package/dist/content/views.js.map +1 -0
- package/dist/content/welcome.d.ts +18 -0
- package/dist/content/welcome.d.ts.map +1 -0
- package/dist/content/welcome.js +45 -0
- package/dist/content/welcome.js.map +1 -0
- package/dist/core.d.ts +36 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +44 -0
- package/dist/core.js.map +1 -0
- package/dist/dom.d.ts +14 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +69 -0
- package/dist/dom.js.map +1 -0
- package/dist/files/panels.d.ts +95 -0
- package/dist/files/panels.d.ts.map +1 -0
- package/dist/files/panels.js +245 -0
- package/dist/files/panels.js.map +1 -0
- package/dist/files/systems.d.ts +91 -0
- package/dist/files/systems.d.ts.map +1 -0
- package/dist/files/systems.js +256 -0
- package/dist/files/systems.js.map +1 -0
- package/dist/forms/actions.d.ts +27 -0
- package/dist/forms/actions.d.ts.map +1 -0
- package/dist/forms/actions.js +19 -0
- package/dist/forms/actions.js.map +1 -0
- package/dist/forms/custom-connection.d.ts +61 -0
- package/dist/forms/custom-connection.d.ts.map +1 -0
- package/dist/forms/custom-connection.js +65 -0
- package/dist/forms/custom-connection.js.map +1 -0
- package/dist/forms/dialog-frame.d.ts +39 -0
- package/dist/forms/dialog-frame.d.ts.map +1 -0
- package/dist/forms/dialog-frame.js +75 -0
- package/dist/forms/dialog-frame.js.map +1 -0
- package/dist/forms/history.d.ts +16 -0
- package/dist/forms/history.d.ts.map +1 -0
- package/dist/forms/history.js +21 -0
- package/dist/forms/history.js.map +1 -0
- package/dist/forms/identity.d.ts +4 -0
- package/dist/forms/identity.d.ts.map +1 -0
- package/dist/forms/identity.js +21 -0
- package/dist/forms/identity.js.map +1 -0
- package/dist/forms/model-editor.d.ts +35 -0
- package/dist/forms/model-editor.d.ts.map +1 -0
- package/dist/forms/model-editor.js +78 -0
- package/dist/forms/model-editor.js.map +1 -0
- package/dist/forms/panels.d.ts +57 -0
- package/dist/forms/panels.d.ts.map +1 -0
- package/dist/forms/panels.js +224 -0
- package/dist/forms/panels.js.map +1 -0
- package/dist/forms/provider-login.d.ts +22 -0
- package/dist/forms/provider-login.d.ts.map +1 -0
- package/dist/forms/provider-login.js +114 -0
- package/dist/forms/provider-login.js.map +1 -0
- package/dist/forms/resource-editor.d.ts +23 -0
- package/dist/forms/resource-editor.d.ts.map +1 -0
- package/dist/forms/resource-editor.js +24 -0
- package/dist/forms/resource-editor.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation/context-menu.d.ts +25 -0
- package/dist/navigation/context-menu.d.ts.map +1 -0
- package/dist/navigation/context-menu.js +67 -0
- package/dist/navigation/context-menu.js.map +1 -0
- package/dist/navigation/navigation.d.ts +57 -0
- package/dist/navigation/navigation.d.ts.map +1 -0
- package/dist/navigation/navigation.js +185 -0
- package/dist/navigation/navigation.js.map +1 -0
- package/dist/primitives.d.ts +307 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +741 -0
- package/dist/primitives.js.map +1 -0
- package/dist/styles.css +849 -0
- package/dist/tasks/approval.d.ts +25 -0
- package/dist/tasks/approval.d.ts.map +1 -0
- package/dist/tasks/approval.js +61 -0
- package/dist/tasks/approval.js.map +1 -0
- package/dist/tasks/permission.d.ts +35 -0
- package/dist/tasks/permission.d.ts.map +1 -0
- package/dist/tasks/permission.js +67 -0
- package/dist/tasks/permission.js.map +1 -0
- package/dist/tasks/runtime.d.ts +31 -0
- package/dist/tasks/runtime.d.ts.map +1 -0
- package/dist/tasks/runtime.js +34 -0
- package/dist/tasks/runtime.js.map +1 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +6 -0
- package/dist/theme.js.map +1 -0
- package/dist/workspace.d.ts +38 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +183 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +27 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmC,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,SAAS,QAAQ,CAAC,IAAiB,EAAE,MAAc;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,KAA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K,CAAC,SAAS,KAAK,SAAS;gBAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;YACzF,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;gBAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC;YAClG,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC;QACzD,CAAC,EAAE,OAAO,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["import { Generation, type UIBlock, type ActionResult } from './core.js';\nimport { icon } from './dom.js';\n\nexport interface ComposerViewState { placeholder?: string; disabled?: boolean; readOnly?: boolean; action?: 'send' | 'queue' | 'stop'; actionDisabled?: boolean; }\nexport interface ComposerViewOptions { prefix?: string; onSubmit?: (text: string) => void | ActionResult | Promise<void | ActionResult>; onStop?: () => void | ActionResult | Promise<void | ActionResult>; onInput?: (text: string) => void; }\nlet sequence = 0;\nfunction identify(root: HTMLElement, prefix: string): void {\n if (!prefix) return;\n const attributes = ['id', 'for', 'aria-labelledby', 'aria-describedby', 'aria-controls', 'data-close'];\n for (const node of [root, ...root.querySelectorAll<HTMLElement>('*')]) for (const attribute of attributes) {\n const value = node.getAttribute(attribute); if (value) node.setAttribute(attribute, value.split(' ').map(part => prefix + part).join(' '));\n }\n}\nexport function createComposerView(options: ComposerViewOptions = {}) {\n const holder = document.createElement('div'); holder.innerHTML = `<form id=\"composer-form\" class=\"pui-composer\">\n <div id=\"draft-images\" class=\"pui-draft-images\" aria-label=\"Image attachments\" hidden></div>\n <input id=\"image-picker\" type=\"file\" accept=\"image/png,image/jpeg,image/gif,image/webp\" multiple hidden />\n <textarea id=\"composer-input\" rows=\"1\" placeholder=\"Ask Pith to help with your work…\" aria-label=\"Message Pith\"></textarea>\n <div class=\"pui-composer-toolbar\">\n <div class=\"pui-composer-context\">\n <button id=\"attach-images\" type=\"button\" class=\"pui-quiet-icon pui-attach-images\" data-action=\"attach-images\" aria-label=\"Attach images\" title=\"Attach images\">${icon('image')}</button>\n <label class=\"pui-permission-control\" id=\"permission-control\">${icon('shield')}<span class=\"pui-sr-only\">Conversation permissions</span><select id=\"permission-mode\" aria-describedby=\"permission-description\"><option value=\"ask\">Ask before changes</option><option value=\"workspace-write\">Allow workspace changes</option><option value=\"full-access\">Full access</option></select>${icon('down')}</label>\n </div>\n <div class=\"pui-composer-actions\"><button id=\"composer-model\" type=\"button\" class=\"pui-composer-model\" data-action=\"model\" data-idle-action data-global-idle aria-label=\"Choose model\">Choose model</button><label class=\"pui-composer-thinking\"><span class=\"pui-sr-only\">Thinking effort</span><select id=\"composer-thinking\" aria-label=\"Thinking effort\"></select></label><button id=\"send-button\" class=\"pui-send-button\" type=\"submit\" aria-label=\"Send message\">${icon('arrow')}</button></div>\n </div>\n </form>`;\n const element = holder.firstElementChild as HTMLFormElement;\n const input = element.querySelector<HTMLTextAreaElement>('textarea')!;\n const action = element.querySelector<HTMLButtonElement>('[type=\"submit\"]')!;\n identify(element, options.prefix ?? 'pui-composer-' + ++sequence + '-');\n const generation = new Generation();\n let pending = false, last: ComposerViewState = {}, lastAction = 'send';\n const error = document.createElement('div'); error.className = 'pui-form-error'; error.setAttribute('role','alert'); error.hidden = true; element.insertBefore(error, element.firstChild);\n const resize = () => { input.style.height = 'auto'; input.style.height = Math.min(input.scrollHeight, 180) + 'px'; };\n const update = (state: ComposerViewState) => {\n last = state;\n if (state.placeholder !== undefined) input.placeholder = state.placeholder;\n input.disabled = !!state.disabled; input.readOnly = !!state.readOnly;\n if (state.action && state.action !== lastAction) { lastAction = state.action; action.type = state.action === 'stop' ? 'button' : 'submit'; action.innerHTML = icon(state.action === 'stop' ? 'stop' : 'arrow'); action.classList.toggle('pui-is-stop', state.action === 'stop'); action.setAttribute('aria-label', state.action === 'stop' ? 'Stop agent' : state.action === 'queue' ? 'Queue message' : 'Send message'); }\n action.disabled = !!(state.actionDisabled || state.disabled || pending);\n };\n const onInput = () => { resize(); options.onInput?.(input.value); };\n const run = async (callback: (() => void | ActionResult | Promise<void | ActionResult>) | undefined) => {\n if (!callback || pending || action.disabled || input.disabled || input.readOnly) return;\n const seq = generation.next(); pending = true; error.hidden = true; error.textContent = ''; update(last);\n try {\n const result = await callback();\n if (generation.current(seq) && result && !result.ok) { error.textContent = result.error; error.hidden = false; }\n } catch (reason) {\n if (generation.current(seq)) { error.textContent = reason instanceof Error ? reason.message : String(reason); error.hidden = false; }\n } finally { if (generation.current(seq)) { pending = false; update(last); } }\n };\n const submit = (event: SubmitEvent) => { if (options.onSubmit) { event.preventDefault(); const text = input.value; void run(() => options.onSubmit!(text)); } };\n const stop = () => { if (action.type === 'button') void run(options.onStop); };\n const keydown = (event: KeyboardEvent) => {\n if (options.onSubmit && event.key === 'Enter' && !event.shiftKey && !event.isComposing && action.type === 'submit') { event.preventDefault(); element.requestSubmit(); }\n };\n input.addEventListener('input', onInput); input.addEventListener('keydown', keydown); element.addEventListener('submit', submit); action.addEventListener('click', stop);\n return { element, input, update, getValue: () => input.value,\n reset(value: string) { generation.invalidate(); pending = false; error.hidden = true; error.textContent = ''; input.value = value; update(last); resize(); }, focus: () => input.focus(), resize,\n destroy() { generation.destroy(); input.removeEventListener('input', onInput); input.removeEventListener('keydown', keydown); element.removeEventListener('submit', submit); action.removeEventListener('click', stop); element.remove(); } };\n\n}\n\nexport interface WorkspaceShellOptions { brand: Node; prefix?: string; }\nexport interface WorkspaceShellState { workspace?: string; conversation?: string; reconnecting?: boolean; }\nexport function createWorkspaceShell(options: WorkspaceShellOptions): UIBlock<WorkspaceShellState> & { composer: ReturnType<typeof createComposerView>; part<T extends HTMLElement = HTMLElement>(name: string): T } {\n const element = document.createElement('div'); element.className = 'pui-app';\n element.innerHTML = `\n <aside class=\"pui-sidebar\" id=\"sidebar\">\n <div class=\"pui-brand\"><span data-brand-slot></span></div>\n <div class=\"pui-sidebar-section-label\">WORKSPACES <button class=\"pui-quiet-icon\" data-action=\"workspace\" aria-label=\"Manage workspaces\">${icon('plus')}</button></div>\n <label class=\"pui-history-search\">${icon('search')}<span class=\"pui-sr-only\">Search conversation titles</span><input id=\"history-search\" type=\"search\" placeholder=\"Search conversations\" autocomplete=\"off\" /></label>\n <nav id=\"history-list\" class=\"pui-history-list\" aria-label=\"Workspaces and conversations\"></nav>\n <div class=\"pui-sidebar-bottom\">\n <button class=\"pui-settings-button\" data-action=\"resources\">${icon('file')}<span>Workspace resources</span></button>\n <button class=\"pui-settings-button\" data-action=\"connections\">${icon('plug')}<span>Connections</span></button>\n <button class=\"pui-settings-button\" data-action=\"settings\">${icon('settings')}<span>Settings</span></button>\n <div id=\"connection-status\" class=\"pui-local-status\" role=\"status\" hidden><span class=\"pui-status-dot pui-reconnecting\" aria-hidden=\"true\"></span><span>Reconnecting…</span></div>\n </div>\n </aside>\n <div id=\"conversation-menu\" class=\"pui-sidebar-conversation-menu\" role=\"menu\" hidden></div>\n <div class=\"pui-sidebar-scrim\" id=\"sidebar-scrim\"></div>\n <main class=\"pui-main\">\n <header class=\"pui-topbar\">\n <button class=\"pui-quiet-icon pui-mobile-menu\" data-action=\"menu\" aria-label=\"Open sidebar\">${icon('menu')}</button>\n <div class=\"pui-breadcrumb\">${icon('folder')}<span id=\"workspace-label\">No workspace</span>${icon('chevron', 'pui-breadcrumb-chevron')}<span class=\"pui-breadcrumb-current\" id=\"conversation-label\">New conversation</span></div>\n <div class=\"pui-conversation-actions\"><button class=\"pui-quiet-icon pui-compact-action\" data-sdk=\"compact\" data-sdk-idle title=\"Compress context by summarizing older messages\" aria-label=\"Compress context\">${icon('compress')}<span>Compact</span></button><div id=\"artifacts-control\" class=\"pui-artifacts-control\" hidden><button id=\"artifacts-toggle\" type=\"button\" class=\"pui-quiet-icon pui-artifacts-toggle\" aria-label=\"Conversation files\" title=\"Conversation files\" aria-expanded=\"false\" aria-controls=\"artifacts\">${icon('file')}<span id=\"artifacts-count\" class=\"pui-artifacts-count\" aria-hidden=\"true\"></span></button><section id=\"artifacts\" class=\"pui-artifacts-panel\" aria-labelledby=\"artifacts-title\" tabindex=\"-1\" hidden></section></div></div>\n </header>\n <section id=\"conversation-find\" class=\"pui-conversation-find\" aria-label=\"Find in conversation\" hidden>\n <input type=\"search\" aria-label=\"Find in this conversation\" placeholder=\"Find in this conversation\" autocomplete=\"off\" />\n <span data-find-count role=\"status\" aria-live=\"polite\"></span>\n <button type=\"button\" class=\"pui-quiet-icon pui-find-previous\" data-find-previous aria-label=\"Previous match\" title=\"Previous match (Shift+Enter)\">${icon('down')}</button>\n <button type=\"button\" class=\"pui-quiet-icon\" data-find-next aria-label=\"Next match\" title=\"Next match (Enter)\">${icon('down')}</button>\n <button type=\"button\" class=\"pui-quiet-icon\" data-find-close aria-label=\"Close search\" title=\"Close (Esc)\">${icon('close')}</button>\n </section>\n <div class=\"pui-conversation-region\"><section id=\"chat-scroll\" class=\"pui-chat-scroll\" aria-label=\"Conversation\" tabindex=\"-1\">\n <div id=\"welcome\" class=\"pui-welcome\"></div>\n <div id=\"messages\" class=\"pui-messages\" aria-live=\"polite\" aria-relevant=\"additions text\"></div>\n </section><button id=\"back-to-latest\" type=\"button\" class=\"pui-secondary-button pui-back-to-latest\" hidden>${icon('down')}<span>Back to latest</span></button></div>\n <div class=\"pui-composer-region\">\n <div class=\"pui-composer-panels\">\n <div id=\"approval\" class=\"pui-approval-region\"></div>\n <div id=\"workspace-busy\" class=\"pui-workspace-busy\" hidden></div><div id=\"inline-error\" class=\"pui-inline-error\" role=\"alert\" hidden></div>\n <section id=\"task-failure\" class=\"pui-task-failure\" role=\"status\" hidden></section>\n <details id=\"run-status\" class=\"pui-run-status\" hidden><summary id=\"run-status-summary\"></summary><div id=\"run-status-details\"><div id=\"runtime-values\"></div><details id=\"cost-requests\" class=\"pui-cost-requests\" hidden><summary>Request breakdown</summary><div id=\"cost-ledger\"></div></details></div></details>\n <section id=\"queued-messages\" class=\"pui-queued-messages\" aria-label=\"Pending messages\" aria-live=\"polite\" hidden></section>\n </div>\n <div data-composer-slot></div>\n <p id=\"image-guidance\" class=\"pui-composer-note pui-image-guidance\" hidden></p>\n <p class=\"pui-composer-note\" id=\"permission-description\">Pith can read workspace files. Changes and commands require your approval.</p>\n </div>\n </main>\n <section id=\"completion-notices\" class=\"pui-completion-notices\" aria-label=\"Completed tasks\" aria-live=\"polite\"></section>\n <span id=\"copy-status\" class=\"pui-sr-only\" role=\"status\" aria-live=\"polite\"></span>\n <dialog id=\"model-dialog\" class=\"pui-modal pui-model-modal\" aria-labelledby=\"model-title\"><div id=\"model-content\"></div></dialog>\n <dialog id=\"settings-dialog\" class=\"pui-modal\" aria-labelledby=\"settings-title\"><div id=\"settings-content\"></div></dialog>\n <dialog id=\"workspace-dialog\" class=\"pui-modal\" aria-labelledby=\"workspace-title\"><div id=\"workspace-content\"></div></dialog>\n <dialog id=\"permissions-dialog\" class=\"pui-modal pui-permission-modal\" aria-labelledby=\"full-access-title\"><div id=\"permissions-content\"></div></dialog>\n <dialog id=\"delete-dialog\" class=\"pui-modal\" aria-labelledby=\"delete-title\"><div id=\"delete-content\"></div></dialog>\n <dialog id=\"rename-dialog\" class=\"pui-modal\" aria-labelledby=\"rename-title\"><div id=\"rename-content\"></div></dialog>\n <dialog id=\"queue-edit-dialog\" class=\"pui-modal\" aria-labelledby=\"queue-edit-title\"><div id=\"queue-edit-content\"></div></dialog>\n <dialog id=\"message-edit-dialog\" class=\"pui-modal\" aria-labelledby=\"message-edit-title\"><div id=\"message-edit-content\"></div></dialog>\n <dialog id=\"resources-dialog\" class=\"pui-modal pui-feature-modal\" aria-labelledby=\"resources-title\"><div id=\"resources-content\"></div></dialog>\n <dialog id=\"connections-dialog\" class=\"pui-modal pui-feature-modal\" aria-labelledby=\"connections-title\"><div id=\"connections-content\"></div></dialog>\n <dialog id=\"preview-dialog\" class=\"pui-modal pui-file-preview-modal\" aria-labelledby=\"preview-title\"><div id=\"preview-content\"></div></dialog>\n <dialog id=\"image-dialog\"></dialog>\n`;\n element.querySelector('[data-brand-slot]')!.replaceWith(options.brand);\n const prefix = options.prefix ?? 'pui-workspace-' + ++sequence + '-';\n const composer = createComposerView({ prefix: '' }); element.querySelector('[data-composer-slot]')!.replaceWith(composer.element);\n identify(element, prefix);\n const part = <T extends HTMLElement = HTMLElement>(name: string) => element.querySelector<T>('[id=\"' + prefix + name + '\"]')!;\n return { element, composer, part, update(state) {\n if (state.workspace !== undefined) part('workspace-label').textContent = state.workspace;\n if (state.conversation !== undefined) part('conversation-label').textContent = state.conversation;\n part('connection-status').hidden = !state.reconnecting;\n }, destroy() { composer.destroy(); element.remove(); } };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pith-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Native TypeScript building blocks with explicit behavior and a human-verifiable component showroom.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "AGPL-3.0-only",
|
|
7
|
+
"repository": { "type": "git", "url": "git+https://github.com/minifish-org/pith-ui.git" },
|
|
8
|
+
"exports": {
|
|
9
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
10
|
+
"./styles.css": "./dist/styles.css"
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"files": ["dist", "README.md", "AI.md", "API.md", "LICENSE"],
|
|
15
|
+
"sideEffects": ["**/*.css"],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"check": "tsc --noEmit",
|
|
18
|
+
"build": "tsc -p tsconfig.build.json && node scripts/build.ts",
|
|
19
|
+
"test": "tsc -p tsconfig.test.json && node --test test-dist/tests/*.test.js",
|
|
20
|
+
"test:browser": "playwright test",
|
|
21
|
+
"dev": "vite --host 127.0.0.1",
|
|
22
|
+
"showroom:build": "vite build",
|
|
23
|
+
"preview": "vite preview --host 127.0.0.1",
|
|
24
|
+
"prepack": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": { "dompurify": "3.4.16", "marked": "16.4.2" },
|
|
27
|
+
"devDependencies": { "@playwright/test": "1.64.0", "@types/node": "^25.0.0", "typescript": "5.9.3", "vite": "7.3.6" },
|
|
28
|
+
"engines": { "node": ">=22.18.0" }
|
|
29
|
+
}
|