anentrypoint-design 0.0.29 → 0.0.31

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 CHANGED
@@ -144,8 +144,49 @@ Primitives: `Brand`, `Chip`, `Btn`, `Glyph`, `Heading`, `Lede`, `Dot`, `Rail`.
144
144
  Chrome: `Topbar`, `Crumb`, `Side`, `Status`, `AppShell`.
145
145
  Surfaces: `Panel`, `Row`, `RowLink`, `Section`, `Install`, `Receipt`, `Changelog`.
146
146
  Pages: `Hero`, `WorksList`, `WritingList`, `Manifesto`, `HomeView`, `ProjectView`.
147
+ Chat: `Chat`, `ChatMessage`, `ChatComposer`, `AICat`, `AICatPortrait`. Helpers: `renderInline`, `fmtBytes`.
148
+ Files: `FileIcon`, `FileRow`, `FileGrid`, `FileToolbar`, `DropZone`, `UploadProgress`, `EmptyState`, `BreadcrumbPath`, `FileViewer` (+ `ConfirmDialog` / `PromptDialog` / `FilePreviewMedia` / `FilePreviewCode` / `FilePreviewText`). Helpers: `fileGlyph`, `fmtFileSize`.
147
149
 
148
- All factories are pure: props in, WebJSX tree out.
150
+ All factories are pure: props in, WebJSX tree out. Component source is split per group under `src/components/<shell|content|chat>.js`; `src/components.js` is a re-export barrel. The 200-line cap applies per module.
151
+
152
+ ## chat / markdown / code-highlight
153
+
154
+ `Chat({ messages, onSend })` renders the bubble timeline; `ChatComposer({ onSend })` is the input row. Block markdown inside messages is sanitized through `renderMarkdown` (`marked@15` + `DOMPurify@3`, lazy-loaded from jsDelivr ESM on first call) and code blocks are highlighted by Prism (lazy-loaded core + per-language scripts via `ensurePrism` / `highlightAllUnder`). Direct `innerHTML` from chat content is forbidden — DOMPurify is the only XSS gate.
155
+
156
+ ```js
157
+ import { components as C } from 'anentrypoint-design';
158
+
159
+ C.Chat({
160
+ messages: [
161
+ { role: 'user', text: 'hello' },
162
+ { role: 'assistant', text: '```js\nconsole.log(1)\n```' }
163
+ ],
164
+ onSend: text => /* push to your store, re-render */ null
165
+ });
166
+ ```
167
+
168
+ ## `<ds-chat>` web component
169
+
170
+ `src/index.js` auto-registers `<ds-chat>` in any browser context. Set `el.messages = [...]` (or pass JSON via the `messages` attribute) and listen for the bubbling, composed `send` event:
171
+
172
+ ```html
173
+ <ds-chat id="c"></ds-chat>
174
+ <script type="module">
175
+ import 'https://unpkg.com/anentrypoint-design@latest/dist/247420.js';
176
+ const el = document.getElementById('c');
177
+ el.messages = [{ role: 'assistant', text: 'gm.' }];
178
+ el.addEventListener('send', e => console.log(e.detail.text));
179
+ </script>
180
+ ```
181
+
182
+ ## ui-kit bootstrap
183
+
184
+ `mountKit({ root, view, screen })` is the single entry point every kit uses — it installs styles, scopes the root, runs the WebJSX render loop, and registers the kit on the `window.__debug` registry. Do not roll your own motion / applyDiff / CDN loop in a kit's `app.js`.
185
+
186
+ ```js
187
+ import { mountKit } from 'anentrypoint-design';
188
+ mountKit({ root: document.getElementById('app'), view: () => myView(), screen: 'aicat' });
189
+ ```
149
190
 
150
191
  ## DeckStage
151
192