@adia-ai/web-modules 0.8.42 → 0.8.44
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/CHANGELOG.md +21 -0
- package/chat/chat-shell/css/chat-shell.bespoke.css +5 -5
- package/chat/chat-sidebar/chat-sidebar.d.ts +4 -0
- package/chat/chat-sidebar/chat-sidebar.js +7 -24
- package/dist/chat/chat-shell.min.css +1 -1
- package/dist/chat/chat-shell.min.js +1 -1
- package/dist/editor/editor-shell.min.js +1 -1
- package/dist/everything.min.js +134 -131
- package/dist/shell/admin-shell.min.css +1 -1
- package/dist/shell/admin-shell.min.js +1 -1
- package/dist/simple/simple-shell.min.js +1 -1
- package/dist/web-modules.min.css +1 -1
- package/dist/web-modules.sheet.js +1 -1
- package/editor/editor-sidebar/editor-sidebar.js +4 -4
- package/form/form-popover/form-popover.css +1 -1
- package/package.json +6 -6
- package/shell/admin-command/admin-command.d.ts +5 -0
- package/shell/admin-shell/admin-shell.js +3 -3
- package/shell/admin-shell/css/admin-shell.bespoke.css +5 -5
- package/shell/admin-shell/css/admin-shell.helpers.css +5 -7
- package/shell/admin-shell/css/admin-shell.sidebar.css +5 -5
- package/shell/admin-sidebar/admin-sidebar.d.ts +4 -0
- package/shell/admin-sidebar/admin-sidebar.js +8 -25
- package/simple/simple-shell/simple-shell.d.ts +2 -0
- package/theme/theme-panel/theme-panel.d.ts +31 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog — @adia-ai/web-modules
|
|
2
2
|
|
|
3
|
+
## [0.8.44] — 2026-08-20
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Restored kebab-case props silently dropped from `.d.ts` (gh#1686, `dts-codegen.mjs` fix — see repo-root CHANGELOG).** Props on `admin-command`, `admin-sidebar`, `chat-sidebar`, `simple-shell`, and `theme-panel` are restored to their `.d.ts` files. No runtime behavior change — these props already worked at runtime; only the shipped TypeScript surface was affected.
|
|
7
|
+
|
|
8
|
+
### Maintenance
|
|
9
|
+
- **`dist/` bundles rebuilt** in this cut's window (5 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
10
|
+
|
|
11
|
+
## [0.8.43] — 2026-08-18
|
|
12
|
+
|
|
13
|
+
### Breaking
|
|
14
|
+
- W3 rename cut: `[data-resize]` and `[data-grid]` old-name reads and CSS dual-selects removed from admin/chat/editor sidebars and shell styles — use `[data-sidebar-resize]` / `[data-layout-grid]` (gh#1562, #1622; migration: MIGRATION GUIDE "Shipped in 0.8.43").
|
|
15
|
+
- editor-shell demos/docs migrated `pane-ui side=` → `edge=` (gh#1617, #1626).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- form-popover open-state caret rotation selector never matched the slotted trailing icon — compound attribute selector per the select-ui precedent (gh#1603, #1613).
|
|
19
|
+
|
|
20
|
+
### Maintenance
|
|
21
|
+
- **`dashboard/` touched in this release window** (1 file(s), e.g. `dashboard-layout/dashboard-layout.examples.html`) — carried by the entries above.
|
|
22
|
+
- **`dist/` bundles rebuilt** in this cut's window (5 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
23
|
+
|
|
3
24
|
## [0.8.42] — 2026-08-17
|
|
4
25
|
|
|
5
26
|
### Added
|
|
@@ -152,7 +152,7 @@ chat-sidebar[slot="trailing"] {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/* Resize handle */
|
|
155
|
-
:is(chat-sidebar[slot="leading"], chat-sidebar[slot="trailing"]) >
|
|
155
|
+
:is(chat-sidebar[slot="leading"], chat-sidebar[slot="trailing"]) > [data-sidebar-resize] {
|
|
156
156
|
position: absolute;
|
|
157
157
|
top: 0;
|
|
158
158
|
bottom: 0;
|
|
@@ -162,10 +162,10 @@ chat-sidebar[slot="trailing"] {
|
|
|
162
162
|
user-select: none;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
chat-sidebar[slot="leading"] >
|
|
166
|
-
chat-sidebar[slot="trailing"] >
|
|
165
|
+
chat-sidebar[slot="leading"] > [data-sidebar-resize] { right: -3px; }
|
|
166
|
+
chat-sidebar[slot="trailing"] > [data-sidebar-resize] { left: -3px; }
|
|
167
167
|
|
|
168
|
-
:is(chat-sidebar[slot="leading"], chat-sidebar[slot="trailing"]) >
|
|
168
|
+
:is(chat-sidebar[slot="leading"], chat-sidebar[slot="trailing"]) > [data-sidebar-resize]:hover {
|
|
169
169
|
background: var(--md-sys-color-primary);
|
|
170
170
|
opacity: 0.5;
|
|
171
171
|
}
|
|
@@ -174,7 +174,7 @@ chat-sidebar[resizing] {
|
|
|
174
174
|
transition: none;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
chat-sidebar[resizing] >
|
|
177
|
+
chat-sidebar[resizing] > [data-sidebar-resize] {
|
|
178
178
|
background: var(--md-sys-color-primary);
|
|
179
179
|
opacity: 0.8;
|
|
180
180
|
}
|
|
@@ -46,6 +46,10 @@ duplicating threshold math.
|
|
|
46
46
|
.toggle() / .collapse() / .expand() public methods.
|
|
47
47
|
*/
|
|
48
48
|
collapsible: boolean;
|
|
49
|
+
/** Optional override for the snap-floor width. Defaults to reading
|
|
50
|
+
CSS min-width via getComputedStyle.
|
|
51
|
+
*/
|
|
52
|
+
minWidth: string;
|
|
49
53
|
/** Identifier for localStorage namespacing. Defaults to slot value
|
|
50
54
|
("leading" or "trailing"). Override when running multiple sidebars
|
|
51
55
|
with the same slot.
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
* sidebar-resize — bubbles. detail: { name, width }
|
|
31
31
|
*
|
|
32
32
|
* The drag handle is conventional: a child `[data-sidebar-resize]` element
|
|
33
|
-
* (
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* (its deprecated pre-0.9.0 name was cut at the rename-wave W3, gh#1562:
|
|
34
|
+
* docs/ops/plan/plan-090-rename-wave.md). Authors may provide a custom one,
|
|
35
|
+
* or omit (no resize affordance).
|
|
36
36
|
*
|
|
37
37
|
* Backwards compat: <chat-shell> still recognizes the legacy
|
|
38
38
|
* `<aside data-sidebar="leading">` shape via :is() selector. New
|
|
@@ -57,11 +57,6 @@ class ChatSidebar extends UIElement {
|
|
|
57
57
|
|
|
58
58
|
static template = () => null;
|
|
59
59
|
|
|
60
|
-
// Rename-wave compat (docs/ops/plan/plan-090-rename-wave.md W1): one-shot
|
|
61
|
-
// deprecation warn per element when the legacy `[data-resize]` name is the
|
|
62
|
-
// one that resolved the handle.
|
|
63
|
-
static #warnedOldResizeName = new WeakSet();
|
|
64
|
-
|
|
65
60
|
// The width the sidebar had before being collapsed — used for restore.
|
|
66
61
|
// Map keyed by sidebar name allows multiple sidebars on one host.
|
|
67
62
|
#previousExpandedWidth = '';
|
|
@@ -156,22 +151,10 @@ class ChatSidebar extends UIElement {
|
|
|
156
151
|
// ── Resize drag handle ──
|
|
157
152
|
|
|
158
153
|
#setupResizeHandle() {
|
|
159
|
-
// Rename-wave
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
if (!handle) {
|
|
164
|
-
handle = this.querySelector(':scope > [data-resize]');
|
|
165
|
-
if (handle && !ChatSidebar.#warnedOldResizeName.has(this)) {
|
|
166
|
-
ChatSidebar.#warnedOldResizeName.add(this);
|
|
167
|
-
// eslint-disable-next-line no-console
|
|
168
|
-
console.warn(
|
|
169
|
-
'[chat-sidebar] `[data-resize]` is deprecated and removed in ' +
|
|
170
|
-
'0.9.0 — rename the drag-handle child to `[data-sidebar-resize]`.',
|
|
171
|
-
this,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
154
|
+
// Rename-wave cut (plan-090 W3, gh#1562): `[data-sidebar-resize]` is the
|
|
155
|
+
// only recognized handle name — its deprecated pre-0.9.0 dual-read was
|
|
156
|
+
// removed at the cut.
|
|
157
|
+
const handle = this.querySelector(':scope > [data-sidebar-resize]');
|
|
175
158
|
if (!handle) return;
|
|
176
159
|
|
|
177
160
|
const slot = this.getAttribute('slot');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:where(chat-shell){--chat-bg:var(--a-canvas-0);--chat-border:unset;--chat-radius:unset;--chat-header-height:var(--a-chrome-app-header-height);--chat-header-px:var(--a-space-4);--chat-header-gap:var(--a-space-2);--chat-header-border:1px solid var(--md-sys-color-neutral-outline-variant);--chat-messages-px:var(--a-space-4);--chat-messages-py:var(--a-space-4);--chat-messages-gap:var(--a-space-3);--chat-message-max-width:85%;--chat-user-bg:var(--md-sys-color-primary);--chat-user-fg:var(--md-sys-color-primary-on-primary);--chat-user-radius:var(--a-radius-md);--chat-user-tail-radius:var(--a-radius-sm);--chat-user-px:var(--a-space-3);--chat-user-py:var(--a-space-1);--chat-assistant-bg:var(--a-canvas-2);--chat-assistant-fg:var(--md-sys-color-neutral-on-surface);--chat-assistant-radius:var(--a-radius-lg);--chat-assistant-tail-radius:var(--a-radius-sm);--chat-assistant-px:var(--a-space-3);--chat-assistant-py:var(--a-space-1);--chat-avatar-size:1.75rem;--chat-avatar-bg:var(--chat-assistant-bg);--chat-avatar-fg:var(--chat-assistant-fg);--chat-avatar-font:var(--a-ui-sm);--chat-avatar-weight:var(--a-weight-semibold);--chat-cursor-width:2px;--chat-cursor-color:currentColor;--chat-cursor-speed:.8s;--chat-footer-px:var(--a-space-3);--chat-footer-py:var(--a-space-3);--chat-actions-gap:var(--a-space-1);--chat-code-bg:var(--md-sys-color-neutral-container-low);--chat-code-radius:var(--a-radius-md);--chat-font-size:var(--a-ui-size);--chat-line-height:var(--a-font-leading-relaxed);--chat-weight-semibold:var(--a-weight-semibold);--chat-header-name-font:var(--a-ui-lg);--chat-header-status-font:var(--a-ui-md);--chat-header-status-fg:var(--a-fg-muted);--chat-error-gap:var(--a-space-2);--chat-error-fg:var(--a-danger-strong);--chat-error-font:var(--a-ui-sm);--chat-actions-duration:var(--a-duration-fast);--chat-actions-easing:var(--a-easing);--chat-avatar-radius:var(--a-radius-full);--chat-thinking-fg:var(--a-fg-muted);--chat-code-inline-radius:var(--a-radius-sm);--chat-code-inline-family:var(--a-font-family-code);--chat-code-block-px:var(--a-space-3);--chat-code-block-my:var(--a-space-2);--chat-code-block-font:var(--a-ui-sm)}chat-shell{box-sizing:border-box;border:var(--chat-border);border-radius:var(--chat-radius);background:var(--chat-bg);flex-direction:column;height:100%;display:flex;overflow:hidden}chat-shell>header{align-items:center;gap:var(--chat-header-gap);min-height:var(--chat-header-height);padding:0 var(--chat-header-px);border-bottom:var(--chat-header-border);flex-shrink:0;display:flex}chat-shell>header [data-chat-name]{font-weight:var(--chat-weight-semibold);font-size:var(--chat-header-name-font)}chat-shell>header chat-status{font-size:var(--chat-header-status-font);color:var(--chat-header-status-fg);margin-inline-start:auto}chat-shell>chat-thread,chat-shell>section{padding:var(--chat-messages-py) var(--chat-messages-px);gap:var(--chat-messages-gap);flex-direction:column;flex:1;min-height:0;display:flex;overflow-y:auto}chat-shell>footer{padding:var(--chat-footer-py) var(--chat-footer-px);flex-shrink:0;align-items:center;display:flex}chat-shell>footer chat-input-ui{flex:1}chat-shell [data-role]{gap:var(--chat-header-gap);max-width:var(--chat-message-max-width);align-items:flex-end;display:flex}chat-shell [data-role=user]{flex-direction:row-reverse;align-self:flex-end}chat-shell [data-role=assistant]{align-self:flex-start}chat-shell [data-role] [data-avatar]{width:var(--chat-avatar-size);height:var(--chat-avatar-size);border-radius:var(--chat-avatar-radius);background:var(--chat-avatar-bg);color:var(--chat-avatar-fg);font-size:var(--chat-avatar-font);font-weight:var(--chat-avatar-weight);flex-shrink:0;justify-content:center;align-items:center;display:flex}chat-shell [data-role] [data-bubble]{padding:var(--chat-assistant-py) var(--chat-assistant-px);border-radius:var(--chat-assistant-radius);font-size:var(--chat-font-size);line-height:var(--chat-line-height);white-space:pre-wrap;word-break:break-word}chat-shell [data-role] [data-bubble]>:first-child{margin-block-start:0}chat-shell [data-role] [data-bubble]>:last-child{margin-block-end:0}chat-shell [data-role=user] [data-bubble]{background:var(--chat-user-bg);color:var(--chat-user-fg);padding:var(--chat-user-py) var(--chat-user-px);border-radius:var(--chat-user-radius);border-bottom-right-radius:var(--chat-user-tail-radius)}chat-shell [data-role=assistant] [data-bubble]{background:var(--chat-assistant-bg);color:var(--chat-assistant-fg);border-bottom-left-radius:var(--chat-assistant-tail-radius)}chat-shell [data-role]:has([data-bubble][data-surface]),chat-shell [data-role]:has([data-bubble]>[data-surface-root]){max-width:none}chat-shell [data-role=error]{align-self:center;align-items:center;gap:var(--chat-error-gap);max-width:none;color:var(--chat-error-fg);font-size:var(--chat-error-font);display:flex}chat-shell [data-role] [data-actions]{gap:var(--chat-actions-gap);opacity:0;transition:opacity var(--chat-actions-duration) var(--chat-actions-easing);display:flex}chat-shell [data-role]:hover [data-actions]{opacity:1}chat-shell [data-cursor]{width:var(--chat-cursor-width);background:var(--chat-cursor-color);vertical-align:text-bottom;height:1em;animation:chat-shell-blink var(--chat-cursor-speed) step-end infinite;margin-inline-start:1px;display:inline-block}@keyframes chat-shell-blink{50%{opacity:0}}@media (prefers-reduced-motion:reduce){chat-shell [data-cursor]{opacity:.7;animation:none}}chat-shell [data-role=assistant][data-thinking] [data-bubble]{color:var(--chat-thinking-fg)}chat-shell [data-bubble] [data-content]{white-space:normal}chat-shell [data-bubble] [data-content] p{margin:0 0 .5em}chat-shell [data-bubble] [data-content] p:last-child{margin-bottom:0}chat-shell [data-bubble] [data-content] strong{font-weight:var(--chat-weight-semibold)}chat-shell [data-bubble] [data-content] code{background:var(--chat-code-bg);border-radius:var(--chat-code-inline-radius);font-family:var(--chat-code-inline-family);padding:.1em .15em;font-size:.875em}chat-shell [data-bubble] [data-content] pre{background:var(--chat-code-bg);border-radius:var(--chat-code-radius);padding:var(--chat-code-block-px);margin:var(--chat-code-block-my) 0;font-size:var(--chat-code-block-font);line-height:1.5;overflow-x:auto}chat-shell [data-bubble] [data-content] pre code{font-size:inherit;background:0 0;border-radius:0;padding:0}chat-shell [data-bubble] [data-content] ul,chat-shell [data-bubble] [data-content] ol{margin:.25em 0;padding-inline-start:1.25em}chat-shell [data-bubble] [data-content] li{margin-bottom:.15em}chat-shell [data-bubble] [data-content] a{color:inherit;text-underline-offset:2px;text-decoration:underline}chat-shell [data-bubble] [data-content] h1,chat-shell [data-bubble] [data-content] h2,chat-shell [data-bubble] [data-content] h3,chat-shell [data-bubble] [data-content] h4{font-weight:var(--chat-weight-semibold);margin:.75em 0 .25em}chat-shell [data-bubble] [data-content] h1:first-child,chat-shell [data-bubble] [data-content] h2:first-child,chat-shell [data-bubble] [data-content] h3:first-child{margin-top:0}chat-shell chat-empty{margin:auto}chat-shell[streaming] chat-empty,chat-shell:has([data-role]) chat-empty{display:none}chat-shell>chat-header,chat-sidebar>chat-header[slot=header],chat-sidebar>chat-header:first-child{align-items:center;gap:var(--chat-header-gap,var(--a-space-2));padding:0 var(--chat-header-px,var(--a-space-3));height:var(--chat-header-height,var(--a-size-lg));font-size:var(--chat-header-font,var(--a-ui-size));border-bottom:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-shrink:0;display:flex}chat-header>[slot=name]{font-weight:var(--a-weight-medium,500);color:var(--md-sys-color-neutral-on-surface)}chat-header>[slot=status]{margin-inline-start:var(--a-space-2)}chat-header>[slot=action]:first-of-type{margin-inline-start:auto}chat-header>[slot=action-leading]{margin-inline-end:var(--a-space-2)}chat-status{align-items:center;gap:var(--a-space-1);font-size:var(--a-ui-sm);color:var(--a-fg-muted);display:inline-flex}chat-shell>chat-thread{overscroll-behavior:contain;gap:var(--chat-message-gap,var(--a-space-3));min-height:0;padding:var(--chat-thread-py,var(--a-space-4)) var(--chat-thread-px,var(--a-space-4));background:var(--chat-thread-bg,var(--md-sys-color-neutral-background));flex-direction:column;flex:1;display:flex;overflow-y:auto}chat-thread:not([empty])>chat-empty{display:none}chat-thread[empty]>chat-empty{padding:var(--a-space-6);flex:1;justify-content:center;align-items:center;display:flex}chat-shell>chat-composer{align-items:stretch;gap:var(--a-space-2);padding:var(--chat-composer-py,var(--a-space-3)) var(--chat-composer-px,var(--a-space-3));border-top:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-shrink:0;display:flex}chat-composer>[slot=leading],chat-composer>[slot=attach],chat-composer>[slot=trailing]{align-items:center;gap:var(--a-space-1);flex-shrink:0;display:inline-flex}chat-composer>:is(chat-input-ui,input-ui,textarea-ui){flex:1;min-width:0}chat-composer[disabled]{opacity:.6;pointer-events:none}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing]){min-width:var(--chat-sidebar-min-width,48px);max-width:var(--chat-sidebar-max-width,480px);min-height:0;font-size:var(--chat-sidebar-font,var(--a-ui-size));transition:width var(--chat-duration,var(--a-duration,.2s)) var(--chat-easing,var(--a-easing,ease));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-direction:column;flex-shrink:0;display:flex;position:relative;container:sidebar/inline-size}chat-sidebar[slot=leading]{width:var(--chat-sidebar-width-leading,240px);border-right:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant))}chat-sidebar[slot=trailing]{width:var(--chat-sidebar-width-trailing,320px);border-left:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant))}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing])>:is([data-resize],[data-sidebar-resize]){cursor:col-resize;z-index:1;-webkit-user-select:none;user-select:none;width:6px;position:absolute;top:0;bottom:0}chat-sidebar[slot=leading]>:is([data-resize],[data-sidebar-resize]){right:-3px}chat-sidebar[slot=trailing]>:is([data-resize],[data-sidebar-resize]){left:-3px}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing])>:is([data-resize],[data-sidebar-resize]):hover{background:var(--md-sys-color-primary);opacity:.5}chat-sidebar[resizing]{transition:none}chat-sidebar[resizing]>:is([data-resize],[data-sidebar-resize]){background:var(--md-sys-color-primary);opacity:.8}chat-shell:has(>chat-sidebar){flex-direction:row;display:flex}chat-shell:has(>chat-sidebar)>:not(chat-sidebar){display:contents}
|
|
1
|
+
:where(chat-shell){--chat-bg:var(--a-canvas-0);--chat-border:unset;--chat-radius:unset;--chat-header-height:var(--a-chrome-app-header-height);--chat-header-px:var(--a-space-4);--chat-header-gap:var(--a-space-2);--chat-header-border:1px solid var(--md-sys-color-neutral-outline-variant);--chat-messages-px:var(--a-space-4);--chat-messages-py:var(--a-space-4);--chat-messages-gap:var(--a-space-3);--chat-message-max-width:85%;--chat-user-bg:var(--md-sys-color-primary);--chat-user-fg:var(--md-sys-color-primary-on-primary);--chat-user-radius:var(--a-radius-md);--chat-user-tail-radius:var(--a-radius-sm);--chat-user-px:var(--a-space-3);--chat-user-py:var(--a-space-1);--chat-assistant-bg:var(--a-canvas-2);--chat-assistant-fg:var(--md-sys-color-neutral-on-surface);--chat-assistant-radius:var(--a-radius-lg);--chat-assistant-tail-radius:var(--a-radius-sm);--chat-assistant-px:var(--a-space-3);--chat-assistant-py:var(--a-space-1);--chat-avatar-size:1.75rem;--chat-avatar-bg:var(--chat-assistant-bg);--chat-avatar-fg:var(--chat-assistant-fg);--chat-avatar-font:var(--a-ui-sm);--chat-avatar-weight:var(--a-weight-semibold);--chat-cursor-width:2px;--chat-cursor-color:currentColor;--chat-cursor-speed:.8s;--chat-footer-px:var(--a-space-3);--chat-footer-py:var(--a-space-3);--chat-actions-gap:var(--a-space-1);--chat-code-bg:var(--md-sys-color-neutral-container-low);--chat-code-radius:var(--a-radius-md);--chat-font-size:var(--a-ui-size);--chat-line-height:var(--a-font-leading-relaxed);--chat-weight-semibold:var(--a-weight-semibold);--chat-header-name-font:var(--a-ui-lg);--chat-header-status-font:var(--a-ui-md);--chat-header-status-fg:var(--a-fg-muted);--chat-error-gap:var(--a-space-2);--chat-error-fg:var(--a-danger-strong);--chat-error-font:var(--a-ui-sm);--chat-actions-duration:var(--a-duration-fast);--chat-actions-easing:var(--a-easing);--chat-avatar-radius:var(--a-radius-full);--chat-thinking-fg:var(--a-fg-muted);--chat-code-inline-radius:var(--a-radius-sm);--chat-code-inline-family:var(--a-font-family-code);--chat-code-block-px:var(--a-space-3);--chat-code-block-my:var(--a-space-2);--chat-code-block-font:var(--a-ui-sm)}chat-shell{box-sizing:border-box;border:var(--chat-border);border-radius:var(--chat-radius);background:var(--chat-bg);flex-direction:column;height:100%;display:flex;overflow:hidden}chat-shell>header{align-items:center;gap:var(--chat-header-gap);min-height:var(--chat-header-height);padding:0 var(--chat-header-px);border-bottom:var(--chat-header-border);flex-shrink:0;display:flex}chat-shell>header [data-chat-name]{font-weight:var(--chat-weight-semibold);font-size:var(--chat-header-name-font)}chat-shell>header chat-status{font-size:var(--chat-header-status-font);color:var(--chat-header-status-fg);margin-inline-start:auto}chat-shell>chat-thread,chat-shell>section{padding:var(--chat-messages-py) var(--chat-messages-px);gap:var(--chat-messages-gap);flex-direction:column;flex:1;min-height:0;display:flex;overflow-y:auto}chat-shell>footer{padding:var(--chat-footer-py) var(--chat-footer-px);flex-shrink:0;align-items:center;display:flex}chat-shell>footer chat-input-ui{flex:1}chat-shell [data-role]{gap:var(--chat-header-gap);max-width:var(--chat-message-max-width);align-items:flex-end;display:flex}chat-shell [data-role=user]{flex-direction:row-reverse;align-self:flex-end}chat-shell [data-role=assistant]{align-self:flex-start}chat-shell [data-role] [data-avatar]{width:var(--chat-avatar-size);height:var(--chat-avatar-size);border-radius:var(--chat-avatar-radius);background:var(--chat-avatar-bg);color:var(--chat-avatar-fg);font-size:var(--chat-avatar-font);font-weight:var(--chat-avatar-weight);flex-shrink:0;justify-content:center;align-items:center;display:flex}chat-shell [data-role] [data-bubble]{padding:var(--chat-assistant-py) var(--chat-assistant-px);border-radius:var(--chat-assistant-radius);font-size:var(--chat-font-size);line-height:var(--chat-line-height);white-space:pre-wrap;word-break:break-word}chat-shell [data-role] [data-bubble]>:first-child{margin-block-start:0}chat-shell [data-role] [data-bubble]>:last-child{margin-block-end:0}chat-shell [data-role=user] [data-bubble]{background:var(--chat-user-bg);color:var(--chat-user-fg);padding:var(--chat-user-py) var(--chat-user-px);border-radius:var(--chat-user-radius);border-bottom-right-radius:var(--chat-user-tail-radius)}chat-shell [data-role=assistant] [data-bubble]{background:var(--chat-assistant-bg);color:var(--chat-assistant-fg);border-bottom-left-radius:var(--chat-assistant-tail-radius)}chat-shell [data-role]:has([data-bubble][data-surface]),chat-shell [data-role]:has([data-bubble]>[data-surface-root]){max-width:none}chat-shell [data-role=error]{align-self:center;align-items:center;gap:var(--chat-error-gap);max-width:none;color:var(--chat-error-fg);font-size:var(--chat-error-font);display:flex}chat-shell [data-role] [data-actions]{gap:var(--chat-actions-gap);opacity:0;transition:opacity var(--chat-actions-duration) var(--chat-actions-easing);display:flex}chat-shell [data-role]:hover [data-actions]{opacity:1}chat-shell [data-cursor]{width:var(--chat-cursor-width);background:var(--chat-cursor-color);vertical-align:text-bottom;height:1em;animation:chat-shell-blink var(--chat-cursor-speed) step-end infinite;margin-inline-start:1px;display:inline-block}@keyframes chat-shell-blink{50%{opacity:0}}@media (prefers-reduced-motion:reduce){chat-shell [data-cursor]{opacity:.7;animation:none}}chat-shell [data-role=assistant][data-thinking] [data-bubble]{color:var(--chat-thinking-fg)}chat-shell [data-bubble] [data-content]{white-space:normal}chat-shell [data-bubble] [data-content] p{margin:0 0 .5em}chat-shell [data-bubble] [data-content] p:last-child{margin-bottom:0}chat-shell [data-bubble] [data-content] strong{font-weight:var(--chat-weight-semibold)}chat-shell [data-bubble] [data-content] code{background:var(--chat-code-bg);border-radius:var(--chat-code-inline-radius);font-family:var(--chat-code-inline-family);padding:.1em .15em;font-size:.875em}chat-shell [data-bubble] [data-content] pre{background:var(--chat-code-bg);border-radius:var(--chat-code-radius);padding:var(--chat-code-block-px);margin:var(--chat-code-block-my) 0;font-size:var(--chat-code-block-font);line-height:1.5;overflow-x:auto}chat-shell [data-bubble] [data-content] pre code{font-size:inherit;background:0 0;border-radius:0;padding:0}chat-shell [data-bubble] [data-content] ul,chat-shell [data-bubble] [data-content] ol{margin:.25em 0;padding-inline-start:1.25em}chat-shell [data-bubble] [data-content] li{margin-bottom:.15em}chat-shell [data-bubble] [data-content] a{color:inherit;text-underline-offset:2px;text-decoration:underline}chat-shell [data-bubble] [data-content] h1,chat-shell [data-bubble] [data-content] h2,chat-shell [data-bubble] [data-content] h3,chat-shell [data-bubble] [data-content] h4{font-weight:var(--chat-weight-semibold);margin:.75em 0 .25em}chat-shell [data-bubble] [data-content] h1:first-child,chat-shell [data-bubble] [data-content] h2:first-child,chat-shell [data-bubble] [data-content] h3:first-child{margin-top:0}chat-shell chat-empty{margin:auto}chat-shell[streaming] chat-empty,chat-shell:has([data-role]) chat-empty{display:none}chat-shell>chat-header,chat-sidebar>chat-header[slot=header],chat-sidebar>chat-header:first-child{align-items:center;gap:var(--chat-header-gap,var(--a-space-2));padding:0 var(--chat-header-px,var(--a-space-3));height:var(--chat-header-height,var(--a-size-lg));font-size:var(--chat-header-font,var(--a-ui-size));border-bottom:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-shrink:0;display:flex}chat-header>[slot=name]{font-weight:var(--a-weight-medium,500);color:var(--md-sys-color-neutral-on-surface)}chat-header>[slot=status]{margin-inline-start:var(--a-space-2)}chat-header>[slot=action]:first-of-type{margin-inline-start:auto}chat-header>[slot=action-leading]{margin-inline-end:var(--a-space-2)}chat-status{align-items:center;gap:var(--a-space-1);font-size:var(--a-ui-sm);color:var(--a-fg-muted);display:inline-flex}chat-shell>chat-thread{overscroll-behavior:contain;gap:var(--chat-message-gap,var(--a-space-3));min-height:0;padding:var(--chat-thread-py,var(--a-space-4)) var(--chat-thread-px,var(--a-space-4));background:var(--chat-thread-bg,var(--md-sys-color-neutral-background));flex-direction:column;flex:1;display:flex;overflow-y:auto}chat-thread:not([empty])>chat-empty{display:none}chat-thread[empty]>chat-empty{padding:var(--a-space-6);flex:1;justify-content:center;align-items:center;display:flex}chat-shell>chat-composer{align-items:stretch;gap:var(--a-space-2);padding:var(--chat-composer-py,var(--a-space-3)) var(--chat-composer-px,var(--a-space-3));border-top:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-shrink:0;display:flex}chat-composer>[slot=leading],chat-composer>[slot=attach],chat-composer>[slot=trailing]{align-items:center;gap:var(--a-space-1);flex-shrink:0;display:inline-flex}chat-composer>:is(chat-input-ui,input-ui,textarea-ui){flex:1;min-width:0}chat-composer[disabled]{opacity:.6;pointer-events:none}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing]){min-width:var(--chat-sidebar-min-width,48px);max-width:var(--chat-sidebar-max-width,480px);min-height:0;font-size:var(--chat-sidebar-font,var(--a-ui-size));transition:width var(--chat-duration,var(--a-duration,.2s)) var(--chat-easing,var(--a-easing,ease));background:var(--chat-bg,var(--md-sys-color-neutral-background));flex-direction:column;flex-shrink:0;display:flex;position:relative;container:sidebar/inline-size}chat-sidebar[slot=leading]{width:var(--chat-sidebar-width-leading,240px);border-right:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant))}chat-sidebar[slot=trailing]{width:var(--chat-sidebar-width-trailing,320px);border-left:var(--chat-border,1px solid var(--md-sys-color-neutral-outline-variant))}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing])>[data-sidebar-resize]{cursor:col-resize;z-index:1;-webkit-user-select:none;user-select:none;width:6px;position:absolute;top:0;bottom:0}chat-sidebar[slot=leading]>[data-sidebar-resize]{right:-3px}chat-sidebar[slot=trailing]>[data-sidebar-resize]{left:-3px}:is(chat-sidebar[slot=leading],chat-sidebar[slot=trailing])>[data-sidebar-resize]:hover{background:var(--md-sys-color-primary);opacity:.5}chat-sidebar[resizing]{transition:none}chat-sidebar[resizing]>[data-sidebar-resize]{background:var(--md-sys-color-primary);opacity:.8}chat-shell:has(>chat-sidebar){flex-direction:row;display:flex}chat-shell:has(>chat-sidebar)>:not(chat-sidebar){display:contents}
|
|
@@ -38,7 +38,7 @@ var VS=Object.defineProperty;var ee=(i,e,t)=>()=>{if(t)throw t[0];try{return i&&
|
|
|
38
38
|
`+c+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let l=+o[1],a=s.name;a[0]==="@"?(r.removeAttribute(a),t[l]={t:"e",n:r,name:a.slice(1),c:void 0,_fx:null}):a[0]==="."?(r.removeAttribute(a),t[l]={t:"p",n:r,name:Wu(r,a.slice(1)),c:void 0,_fx:null,_resolved:!1}):a[0]==="?"?(r.removeAttribute(a),console.warn(`[template] Lit-style boolean attribute "${a}=" is not supported.
|
|
39
39
|
Element: <${r.tagName.toLowerCase()}>
|
|
40
40
|
Use .${a.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
|
|
41
|
-
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function as(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function Bl(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Iu=i=>i!=null&&typeof i=="object"&&i.strings,Nu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function ql(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(Bl(i));else if(Iu(e))ln(e,Bl(i));else if(Array.isArray(e)){let t=Bl(i);t.replaceChildren();for(let n of e)if(Iu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),ln(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(Dl(e))i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Wu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Nu(i.c)&&i.n.removeEventListener(i.name,i.c),Nu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function FS(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Yl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=xi(()=>ql(n,r())));continue}if(o){n._fx||(n._fx=xi(()=>ql(n,r.value)));continue}ql(n,r)}}function HS(i,e,t){return{_directive:!0,_commit(n){let r=n[an]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);ln(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),ln(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&as(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[an]=s}}}var In=new Map;function KS(i,e){return e===`data-${i}`||e.startsWith(`data-${i}-`)}function Gu(i,e){return i===e||i.startsWith(`${e}-`)||e.startsWith(`${i}-`)}function JS(i){let e=[i.name,...i.prefixes||[]],t=[...i.attributes||[],...i.config||[]].filter(n=>!e.some(r=>KS(r,n)));if(t.length>0)throw new Error(`Trait "${i.name}" declares attribute(s) outside its owned data-* namespace: ${t.join(", ")}. A trait owns "data-${i.name}" / "data-${i.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function e1(i){let e=i.prefixes||[];for(let[t,n]of In){if(t===i.name)continue;let r=n.schema,s=[r.name,...r.prefixes||[]];for(let o of e)for(let l of s)if(Gu(o,l))throw new Error(`Trait "${i.name}"'s registered prefix "${o}" overlaps trait "${r.name}"'s owned namespace ("${l}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let o of r.prefixes||[])if(Gu(o,i.name))throw new Error(`Trait "${i.name}"'s name overlaps trait "${r.name}"'s registered prefix "${o}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var Uu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function dT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Uu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Uu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);JS(i),e1(i);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[]),prefixes:Object.freeze(i.prefixes||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,In.set(i.name,t),t}function Fu(i){return In.get(i)||null}function OT(i){return In.get(i)?.schema||null}function pT(){return[...In.keys()]}var Il=Symbol(),Nn=Symbol();function t1(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=Object.prototype.hasOwnProperty.call(i,t),l=o?i[t]:void 0;o&&delete i[t];let a=on(n.default??void 0);i[Il].set(t,a),Object.defineProperty(i,t,{get(){return a.value},set(h){let c=a.peek();Object.is(c,h)||(i[Nn].set(t,c),a.value=h,n.reflect&&n1(i,r,h,s))},configurable:!0}),o&&(a.value=l)}}var i1=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function n1(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var Hu=(i,e)=>e===Boolean?i!==null:e===Number?i===null?null:+i:i;function r1(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e||!("adoptedStyleSheets"in document))return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var hn=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=on(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():i1,t1(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),r1(e),Ku(e),os(()=>{for(let[t,n]of Object.entries(e.properties)){let r=n.attribute??t.toLowerCase();this.hasAttribute(r)?this[t]=Hu(this.getAttribute(r),n.type??String):n.reflect&&n.type===Boolean&&this[t]===!0&&this.setAttribute(r,"")}}),os(()=>this.connected()),this.#t.push(xi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&ln(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&as(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:on,computed:Vl,effect:xi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Fu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=Hu(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=on(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[an]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[an]=o}connected(){}render(){}disconnected(){}updated(e){}};var s1={"&":"&","<":"<",">":">",'"':"""},Ju=i=>i.replace(/[&<>"]/g,e=>s1[e]);function Nl(i){let e=i.split(`
|
|
41
|
+
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function as(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function Bl(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Iu=i=>i!=null&&typeof i=="object"&&i.strings,Nu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function ql(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(Bl(i));else if(Iu(e))ln(e,Bl(i));else if(Array.isArray(e)){let t=Bl(i);t.replaceChildren();for(let n of e)if(Iu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),ln(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(Dl(e))i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Wu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Nu(i.c)&&i.n.removeEventListener(i.name,i.c),Nu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function FS(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Yl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=xi(()=>ql(n,r())));continue}if(o){n._fx||(n._fx=xi(()=>ql(n,r.value)));continue}ql(n,r)}}function HS(i,e,t){return{_directive:!0,_commit(n){let r=n[an]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);ln(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),ln(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&as(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[an]=s}}}var In=new Map;function KS(i,e){return e===`data-${i}`||e.startsWith(`data-${i}-`)}function Gu(i,e){return i===e||i.startsWith(`${e}-`)||e.startsWith(`${i}-`)}function JS(i){let e=[i.name,...i.prefixes||[]],t=[...i.attributes||[],...i.config||[]].filter(n=>!e.some(r=>KS(r,n)));if(t.length>0)throw new Error(`Trait "${i.name}" declares attribute(s) outside its owned data-* namespace: ${t.join(", ")}. A trait owns "data-${i.name}" / "data-${i.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function e1(i){let e=i.prefixes||[];for(let[t,n]of In){if(t===i.name)continue;let r=n.schema,s=[r.name,...r.prefixes||[]];for(let o of e)for(let l of s)if(Gu(o,l))throw new Error(`Trait "${i.name}"'s registered prefix "${o}" overlaps trait "${r.name}"'s owned namespace ("${l}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let o of r.prefixes||[])if(Gu(o,i.name))throw new Error(`Trait "${i.name}"'s name overlaps trait "${r.name}"'s registered prefix "${o}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var Uu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function dT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Uu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Uu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);JS(i),e1(i);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[]),prefixes:Object.freeze(i.prefixes||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,In.set(i.name,t),t}function Fu(i){return In.get(i)||null}function OT(i){return In.get(i)?.schema||null}function pT(){return[...In.keys()]}var Il=Symbol(),Nn=Symbol();function t1(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=Object.prototype.hasOwnProperty.call(i,t),l=o?i[t]:void 0;o&&delete i[t];let a=on(n.default??void 0);i[Il].set(t,a),Object.defineProperty(i,t,{get(){return a.value},set(h){let c=a.peek();Object.is(c,h)||(i[Nn].set(t,c),a.value=h,n.reflect&&n1(i,r,h,s))},configurable:!0}),o&&(a.value=l)}}var i1=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function n1(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var Hu=(i,e)=>e===Boolean?i!==null&&i!=="false":e===Number?i===null?null:+i:i;function r1(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e||!("adoptedStyleSheets"in document))return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var hn=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=on(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():i1,t1(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),r1(e),Ku(e),os(()=>{for(let[t,n]of Object.entries(e.properties)){let r=n.attribute??t.toLowerCase();this.hasAttribute(r)?this[t]=Hu(this.getAttribute(r),n.type??String):n.reflect&&n.type===Boolean&&this[t]===!0&&this.setAttribute(r,"")}}),os(()=>this.connected()),this.#t.push(xi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&ln(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&as(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:on,computed:Vl,effect:xi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Fu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=Hu(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=on(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[an]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[an]=o}connected(){}render(){}disconnected(){}updated(e){}};var s1={"&":"&","<":"<",">":">",'"':"""},Ju=i=>i.replace(/[&<>"]/g,e=>s1[e]);function Nl(i){let e=i.split(`
|
|
42
42
|
`),t=[],n=0;for(;n<e.length;){let r=e[n],s=r.match(/^```(\w*)/);if(s){let a=s[1],h=[];for(n++;n<e.length&&!e[n].startsWith("```");)h.push(Ju(e[n])),n++;n++;let c=h.join(`
|
|
43
43
|
`);t.push(a?`<code-ui language="${a}">${c}</code-ui>`:`<pre><code>${c}</code></pre>`);continue}if(!r.trim()){n++;continue}let o=r.match(/^(#{1,6})\s+(.+)/);if(o){let a=o[1].length;t.push(`<h${a}>${hs(o[2])}</h${a}>`),n++;continue}if(/^[-*]\s/.test(r)){let a=[];for(;n<e.length&&/^[-*]\s/.test(e[n]);)a.push(`<li>${hs(e[n].replace(/^[-*]\s/,""))}</li>`),n++;t.push(`<ul>${a.join("")}</ul>`);continue}if(/^\d+\.\s/.test(r)){let a=[];for(;n<e.length&&/^\d+\.\s/.test(e[n]);)a.push(`<li>${hs(e[n].replace(/^\d+\.\s/,""))}</li>`),n++;t.push(`<ol>${a.join("")}</ol>`);continue}let l=[];for(;n<e.length&&e[n].trim()&&!/^```|^#{1,6}\s|^[-*]\s|^\d+\.\s/.test(e[n]);)l.push(e[n]),n++;t.push(`<p>${hs(l.join(" "))}</p>`)}return t.join(`
|
|
44
44
|
`)}var o1=i=>`\0CODE${i}\0`,l1=/\0CODE(\d+)\0/g;function hs(i){let e=Ju(i),t=[],n=e.replace(/`([^`]+)`/g,(r,s)=>{let o=t.length;return t.push(s),o1(o)});return n=n.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/_(.+?)_/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),n=n.replace(l1,(r,s)=>`<code>${t[Number(s)]}</code>`),n}var eT=new Set(["json","html","javascript","js","css","markdown","md","yaml","yml"]),tT={js:"javascript",md:"markdown",yml:"yaml"};function Lu(i){if(!i)return"";let e=String(i).toLowerCase();return tT[e]??e}var ts=class i extends hn{static formAssociated=!0;static properties={language:{type:String,default:"",reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},text:{type:String,default:"",reflect:!0},lineNumbers:{type:Boolean,default:!1,reflect:!0,attribute:"line-numbers"},editable:{type:Boolean,default:!1,reflect:!0},bare:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"",reflect:!0},name:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#r=null;#e=null;#i=0;#o=!1;#n=null;#l="";#s=null;#a=()=>this.#b();connected(){this.#i+=1,!this.inline&&!this.querySelector(":scope > pre")&&this.#h(),this.#t=this.querySelector(':scope > header [slot="copy"]'),this.#t&&this.#t.addEventListener("click",this.#a);let e=Lu(this.language),t=this.hasAttribute("data-line-states")||e==="diff";!this.inline&&!t&&(eT.has(e)||this.editable)&&this.#f()}disconnected(){this.#i+=1,this.#r!=null&&(clearTimeout(this.#r),this.#r=null),this.#t&&(this.#t.removeEventListener("click",this.#a),this.#t=null),this.#e&&(this.#e.destroy(),this.#e=null)}#h(){let e=this.querySelector(":scope > template"),t=this.text?this.text.trim():e?i.#c(e.innerHTML):(this.textContent||"").trim();if(this.textContent="",!this.bare){let a=document.createElement("header"),h=document.createElement("span");h.setAttribute("slot","label"),h.textContent=this.language||"code",a.appendChild(h);let c=document.createElement("div");c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("slot","copy"),c.textContent="Copy",a.appendChild(c),this.appendChild(a)}let n=document.createElement("pre"),r=document.createElement("code"),s=Lu(this.language),o=this.getAttribute("data-line-states");if(o!=null||s==="diff"){r.setAttribute("data-line-state-mode",""),this.lineNumbers&&r.setAttribute("data-line-numbers","");let a=o?.split(",").map(c=>c.trim())??null;t.split(`
|
|
@@ -7,4 +7,4 @@ function me(e,t){customElements.define(e,t)}function R(e,t){return customElement
|
|
|
7
7
|
`+u+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let c=+a[1],s=i.name;s[0]==="@"?(o.removeAttribute(s),n[c]={t:"e",n:o,name:s.slice(1),c:void 0,_fx:null}):s[0]==="."?(o.removeAttribute(s),n[c]={t:"p",n:o,name:W(o,s.slice(1)),c:void 0,_fx:null,_resolved:!1}):s[0]==="?"?(o.removeAttribute(s),console.warn(`[template] Lit-style boolean attribute "${s}=" is not supported.
|
|
8
8
|
Element: <${o.tagName.toLowerCase()}>
|
|
9
9
|
Use .${s.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
|
|
10
|
-
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:o,name:s,c:void 0,_fx:null}}return n}function T(e){for(let t of e)t&&t._fx&&(t._fx(),t._fx=null)}function j(e){if(e.n.nodeType===1&&e.n[k])return e.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[k]=!0,e.n.replaceWith(t),e.n=t,t}var V=e=>e!=null&&typeof e=="object"&&e.strings,z=e=>typeof e=="function"||e!=null&&typeof e.handleEvent=="function";function L(e,t){if(t!==e.c){if(e.t==="n")if(t!=null&&t._directive)t._commit(j(e));else if(V(t))g(t,j(e));else if(Array.isArray(t)){let n=j(e);n.replaceChildren();for(let r of t)if(V(r)){let o=document.createElement("span");o.style.display="contents",o.setAttribute("role","presentation"),n.appendChild(o),g(r,o)}else n.appendChild(document.createTextNode(r??""))}else if(M(t))e.n.replaceWith(t),e.n=t;else if(e.n[k]){let n=document.createTextNode(t??"");e.n.replaceWith(n),e.n=n}else e.n.textContent=t??"";else if(e.t==="a")t==null||t===!1?e.n.removeAttribute(e.name):e.n.setAttribute(e.name,t===!0?"":t);else if(e.t==="p"){if(!e._resolved){let n=W(e.n,e.name);n!==e.name&&(e.name=n),e._resolved=!0}e.n[e.name]=t}else e.t==="e"&&(z(e.c)&&e.n.removeEventListener(e.name,e.c),z(t)&&e.n.addEventListener(e.name,t));e.c=t}}function se(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(!r)continue;let o=t[n],i=r.t!=="e"&&typeof o=="function",a=!i&&r.t!=="e"&&v(o);if(r._fx&&!i&&!a&&(r._fx(),r._fx=null),i){r._fx||(r._fx=p(()=>L(r,o())));continue}if(a){r._fx||(r._fx=p(()=>L(r,o.value)));continue}L(r,o)}}function ae(e,t,n){return{_directive:!0,_commit(r){let o=r[y]||new Map,i=new Map,a=[];for(let s=0;s<e.length;s++){let l=t(e[s],s);if(i.has(l))continue;a.push(l);let u=n(e[s],s);if(o.has(l)){let d=o.get(l);g(u,d),i.set(l,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),i.set(l,d)}}for(let[s,l]of o)i.has(s)||(l._i&&T(l._i.p),l.remove());let c=null;for(let s=a.length-1;s>=0;s--){let l=i.get(a[s]);(l.nextSibling!==c||l.parentNode!==r)&&r.insertBefore(l,c),c=l}r[y]=i}}}var x=new Map;function le(e,t){return t===`data-${e}`||t.startsWith(`data-${e}-`)}function U(e,t){return e===t||e.startsWith(`${t}-`)||t.startsWith(`${e}-`)}function ce(e){let t=[e.name,...e.prefixes||[]],n=[...e.attributes||[],...e.config||[]].filter(r=>!t.some(o=>le(o,r)));if(n.length>0)throw new Error(`Trait "${e.name}" declares attribute(s) outside its owned data-* namespace: ${n.join(", ")}. A trait owns "data-${e.name}" / "data-${e.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function ue(e){let t=e.prefixes||[];for(let[n,r]of x){if(n===e.name)continue;let o=r.schema,i=[o.name,...o.prefixes||[]];for(let a of t)for(let c of i)if(U(a,c))throw new Error(`Trait "${e.name}"'s registered prefix "${a}" overlaps trait "${o.name}"'s owned namespace ("${c}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let a of o.prefixes||[])if(U(a,e.name))throw new Error(`Trait "${e.name}"'s name overlaps trait "${o.name}"'s registered prefix "${a}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var G=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function _e(e){if(!e.name)throw new Error("Trait requires a name");if(!e.setup)throw new Error(`Trait "${e.name}" requires a setup function`);if(!e.category)throw new Error(`Trait "${e.name}" requires a category`);if(!G.has(e.category))throw new Error(`Trait "${e.name}" has unknown category "${e.category}". Known: ${[...G].join(", ")}`);if(!e.description)throw new Error(`Trait "${e.name}" requires a description`);ce(e),ue(e);let t=Object.freeze({name:e.name,category:e.category,description:e.description,attributes:Object.freeze(e.attributes||[]),events:Object.freeze(e.events||[]),config:Object.freeze(e.config||[]),prefixes:Object.freeze(e.prefixes||[])});function n(){let r=null;return{schema:t,connect(o,i){r=e.setup({host:o,...i||{}})},disconnect(o){r&&(r(),r=null);for(let i of t.attributes)o.hasAttribute(i)&&(console.warn(`Trait "${t.name}": attribute "${i}" still present after disconnect`),o.removeAttribute(i))}}}return n.schema=t,x.set(e.name,n),n}function K(e){return x.get(e)||null}function Ne(e){return x.get(e)?.schema||null}function Te(){return[...x.keys()]}var P=Symbol(),w=Symbol();function fe(e,t){e[w]=new Map,e[P]=new Map;for(let[n,r]of Object.entries(t)){let o=r.attribute??n.toLowerCase(),i=r.type??String,a=Object.prototype.hasOwnProperty.call(e,n),c=a?e[n]:void 0;a&&delete e[n];let s=m(r.default??void 0);e[P].set(n,s),Object.defineProperty(e,n,{get(){return s.value},set(l){let u=s.peek();Object.is(u,l)||(e[w].set(n,u),s.value=l,r.reflect&&he(e,o,l,i))},configurable:!0}),a&&(s.value=c)}}var de=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function he(e,t,n,r){r===Boolean?n?e.setAttribute(t,""):e.removeAttribute(t):n==null?e.removeAttribute(t):e.setAttribute(t,String(n))}var J=(e,t)=>t===Boolean?e!==null:t===Number?e===null?null:+e:e;function pe(e){if(Object.hasOwn(e,"_sa"))return;e._sa=!0;let t=e.styles;if(!t||!("adoptedStyleSheets"in document))return;let n=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(r=>!document.adoptedStyleSheets.includes(r))]}function X(e){if(Object.hasOwn(e,"_pp"))return;e._pp={};let t=e.parts;if(t)for(let[n,r]of Object.entries(t)){let o=document.createElement("template");o.innerHTML=r,e._pp[n]=o.content.firstElementChild}}var C=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([n,r])=>r.attribute??n.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#o=[];#e=[];#n=[];#r=null;#i=null;#t=null;#a=m(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():de,fe(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),pe(t),X(t),_(()=>{for(let[n,r]of Object.entries(t.properties)){let o=r.attribute??n.toLowerCase();this.hasAttribute(o)?this[n]=J(this.getAttribute(o),r.type??String):r.reflect&&r.type===Boolean&&this[n]===!0&&this.setAttribute(o,"")}}),_(()=>this.connected()),this.#o.push(p(()=>{for(let r of this[P].values())r.value;this.#a.value;let n=t.template(this);if(n&&g(n,this),this.render(),this[w].size){let r=new Map(this[w]);this[w].clear(),this.updated(r)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of t.traits)this.#s(n);this.#c(),this.#r&&this.#l()}disconnectedCallback(){this._i&&T(this._i.p);for(let t of this.#o)t();this.#o.length=0;for(let t of this.#n)t.value=void 0;this.#n.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.disconnected()}#l(){let t=this.#r;t.connect?.(this),this.#i=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#r}set controller(t){this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.#r=t,t&&this.isConnected&&this.#l()}#s(t,{declarative:n=!1}={}){this.#t.add(t);let r=t();r.connect(this,{host:this,signal:m,computed:$,effect:p}),n&&(r._declarative=!0),this.#e.push(r)}addTrait(t){return this.#t||(this.#t=new Set),this.#t.has(t)?this:(this.#s(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let n of t.split(/\s+/).filter(Boolean)){let r=K(n);if(!r){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(r)||this.#s(r,{declarative:!0})}}#f(){if(!this.#t)return;let t=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let r of this.#t)if(r.schema?.name&&n.schema?.name===r.schema.name){this.#t.delete(r);break}}else t.push(n);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,n,r){if(t==="traits"){this.isConnected&&this.#f();return}for(let[o,i]of Object.entries(this.constructor.properties))if((i.attribute??o.toLowerCase())===t){this[o]=J(r,i.type??String);break}}static template=()=>null;static create(t={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let r=document.createElement(n);for(let[o,i]of Object.entries(t))r[o]=i;return r}signal(t){let n=m(t);return this.#n.push(n),n}ensure(t){for(let i of this.children)if(i.getAttribute("slot")===t)return i;let n=this.#u(t);if(n)return n;X(this.constructor);let r=this.constructor._pp?.[t];if(!r)return null;let o=r.cloneNode(!0);return o._uiPart=!0,this.appendChild(o),o}drop(t){for(let r of this.children)if(r.getAttribute("slot")===t){r.remove();return}let n=this.#u(t);n&&n.remove()}#u(t){for(let n of this.querySelectorAll(`[slot="${t}"]`)){let r=n.parentElement,o=!0;for(;r&&r!==this;){if(r.localName.includes("-")){o=!1;break}r=r.parentElement}if(o&&r===this)return n}return null}reconcile(t,n,r,o){let i=t[y]||new Map,a=new Map,c=[];for(let l=0;l<n.length;l++){let u=n[l],d=r(u,l);if(a.has(d))continue;let S=i.get(d);S?o(u,l,S):S=o(u,l,null),a.set(d,S),c.push(d)}for(let[l,u]of i)a.has(l)||u.remove();let s=null;for(let l=c.length-1;l>=0;l--){let u=a.get(c[l]);(u.nextSibling!==s||u.parentNode!==t)&&t.insertBefore(u,s),s=u}t[y]=a}connected(){}render(){}disconnected(){}updated(t){}};var O=class extends C{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#o=null;#e=null;#n=null;connected(){this.#o=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#r(),this.#n=t=>{let n=t?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#o?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#o.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#r(){for(let t of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(t.getAttribute("data-options"));t.options=n}catch{}}};R("editor-shell",O);export{O as EditorShell};
|
|
10
|
+
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:o,name:s,c:void 0,_fx:null}}return n}function T(e){for(let t of e)t&&t._fx&&(t._fx(),t._fx=null)}function j(e){if(e.n.nodeType===1&&e.n[k])return e.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[k]=!0,e.n.replaceWith(t),e.n=t,t}var V=e=>e!=null&&typeof e=="object"&&e.strings,z=e=>typeof e=="function"||e!=null&&typeof e.handleEvent=="function";function L(e,t){if(t!==e.c){if(e.t==="n")if(t!=null&&t._directive)t._commit(j(e));else if(V(t))g(t,j(e));else if(Array.isArray(t)){let n=j(e);n.replaceChildren();for(let r of t)if(V(r)){let o=document.createElement("span");o.style.display="contents",o.setAttribute("role","presentation"),n.appendChild(o),g(r,o)}else n.appendChild(document.createTextNode(r??""))}else if(M(t))e.n.replaceWith(t),e.n=t;else if(e.n[k]){let n=document.createTextNode(t??"");e.n.replaceWith(n),e.n=n}else e.n.textContent=t??"";else if(e.t==="a")t==null||t===!1?e.n.removeAttribute(e.name):e.n.setAttribute(e.name,t===!0?"":t);else if(e.t==="p"){if(!e._resolved){let n=W(e.n,e.name);n!==e.name&&(e.name=n),e._resolved=!0}e.n[e.name]=t}else e.t==="e"&&(z(e.c)&&e.n.removeEventListener(e.name,e.c),z(t)&&e.n.addEventListener(e.name,t));e.c=t}}function se(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(!r)continue;let o=t[n],i=r.t!=="e"&&typeof o=="function",a=!i&&r.t!=="e"&&v(o);if(r._fx&&!i&&!a&&(r._fx(),r._fx=null),i){r._fx||(r._fx=p(()=>L(r,o())));continue}if(a){r._fx||(r._fx=p(()=>L(r,o.value)));continue}L(r,o)}}function ae(e,t,n){return{_directive:!0,_commit(r){let o=r[y]||new Map,i=new Map,a=[];for(let s=0;s<e.length;s++){let l=t(e[s],s);if(i.has(l))continue;a.push(l);let u=n(e[s],s);if(o.has(l)){let d=o.get(l);g(u,d),i.set(l,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),i.set(l,d)}}for(let[s,l]of o)i.has(s)||(l._i&&T(l._i.p),l.remove());let c=null;for(let s=a.length-1;s>=0;s--){let l=i.get(a[s]);(l.nextSibling!==c||l.parentNode!==r)&&r.insertBefore(l,c),c=l}r[y]=i}}}var x=new Map;function le(e,t){return t===`data-${e}`||t.startsWith(`data-${e}-`)}function U(e,t){return e===t||e.startsWith(`${t}-`)||t.startsWith(`${e}-`)}function ce(e){let t=[e.name,...e.prefixes||[]],n=[...e.attributes||[],...e.config||[]].filter(r=>!t.some(o=>le(o,r)));if(n.length>0)throw new Error(`Trait "${e.name}" declares attribute(s) outside its owned data-* namespace: ${n.join(", ")}. A trait owns "data-${e.name}" / "data-${e.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function ue(e){let t=e.prefixes||[];for(let[n,r]of x){if(n===e.name)continue;let o=r.schema,i=[o.name,...o.prefixes||[]];for(let a of t)for(let c of i)if(U(a,c))throw new Error(`Trait "${e.name}"'s registered prefix "${a}" overlaps trait "${o.name}"'s owned namespace ("${c}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let a of o.prefixes||[])if(U(a,e.name))throw new Error(`Trait "${e.name}"'s name overlaps trait "${o.name}"'s registered prefix "${a}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var G=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function _e(e){if(!e.name)throw new Error("Trait requires a name");if(!e.setup)throw new Error(`Trait "${e.name}" requires a setup function`);if(!e.category)throw new Error(`Trait "${e.name}" requires a category`);if(!G.has(e.category))throw new Error(`Trait "${e.name}" has unknown category "${e.category}". Known: ${[...G].join(", ")}`);if(!e.description)throw new Error(`Trait "${e.name}" requires a description`);ce(e),ue(e);let t=Object.freeze({name:e.name,category:e.category,description:e.description,attributes:Object.freeze(e.attributes||[]),events:Object.freeze(e.events||[]),config:Object.freeze(e.config||[]),prefixes:Object.freeze(e.prefixes||[])});function n(){let r=null;return{schema:t,connect(o,i){r=e.setup({host:o,...i||{}})},disconnect(o){r&&(r(),r=null);for(let i of t.attributes)o.hasAttribute(i)&&(console.warn(`Trait "${t.name}": attribute "${i}" still present after disconnect`),o.removeAttribute(i))}}}return n.schema=t,x.set(e.name,n),n}function K(e){return x.get(e)||null}function Ne(e){return x.get(e)?.schema||null}function Te(){return[...x.keys()]}var P=Symbol(),w=Symbol();function fe(e,t){e[w]=new Map,e[P]=new Map;for(let[n,r]of Object.entries(t)){let o=r.attribute??n.toLowerCase(),i=r.type??String,a=Object.prototype.hasOwnProperty.call(e,n),c=a?e[n]:void 0;a&&delete e[n];let s=m(r.default??void 0);e[P].set(n,s),Object.defineProperty(e,n,{get(){return s.value},set(l){let u=s.peek();Object.is(u,l)||(e[w].set(n,u),s.value=l,r.reflect&&he(e,o,l,i))},configurable:!0}),a&&(s.value=c)}}var de=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function he(e,t,n,r){r===Boolean?n?e.setAttribute(t,""):e.removeAttribute(t):n==null?e.removeAttribute(t):e.setAttribute(t,String(n))}var J=(e,t)=>t===Boolean?e!==null&&e!=="false":t===Number?e===null?null:+e:e;function pe(e){if(Object.hasOwn(e,"_sa"))return;e._sa=!0;let t=e.styles;if(!t||!("adoptedStyleSheets"in document))return;let n=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(r=>!document.adoptedStyleSheets.includes(r))]}function X(e){if(Object.hasOwn(e,"_pp"))return;e._pp={};let t=e.parts;if(t)for(let[n,r]of Object.entries(t)){let o=document.createElement("template");o.innerHTML=r,e._pp[n]=o.content.firstElementChild}}var C=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([n,r])=>r.attribute??n.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#o=[];#e=[];#n=[];#r=null;#i=null;#t=null;#a=m(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():de,fe(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),pe(t),X(t),_(()=>{for(let[n,r]of Object.entries(t.properties)){let o=r.attribute??n.toLowerCase();this.hasAttribute(o)?this[n]=J(this.getAttribute(o),r.type??String):r.reflect&&r.type===Boolean&&this[n]===!0&&this.setAttribute(o,"")}}),_(()=>this.connected()),this.#o.push(p(()=>{for(let r of this[P].values())r.value;this.#a.value;let n=t.template(this);if(n&&g(n,this),this.render(),this[w].size){let r=new Map(this[w]);this[w].clear(),this.updated(r)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of t.traits)this.#s(n);this.#c(),this.#r&&this.#l()}disconnectedCallback(){this._i&&T(this._i.p);for(let t of this.#o)t();this.#o.length=0;for(let t of this.#n)t.value=void 0;this.#n.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.disconnected()}#l(){let t=this.#r;t.connect?.(this),this.#i=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#r}set controller(t){this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.#r=t,t&&this.isConnected&&this.#l()}#s(t,{declarative:n=!1}={}){this.#t.add(t);let r=t();r.connect(this,{host:this,signal:m,computed:$,effect:p}),n&&(r._declarative=!0),this.#e.push(r)}addTrait(t){return this.#t||(this.#t=new Set),this.#t.has(t)?this:(this.#s(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let n of t.split(/\s+/).filter(Boolean)){let r=K(n);if(!r){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(r)||this.#s(r,{declarative:!0})}}#f(){if(!this.#t)return;let t=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let r of this.#t)if(r.schema?.name&&n.schema?.name===r.schema.name){this.#t.delete(r);break}}else t.push(n);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,n,r){if(t==="traits"){this.isConnected&&this.#f();return}for(let[o,i]of Object.entries(this.constructor.properties))if((i.attribute??o.toLowerCase())===t){this[o]=J(r,i.type??String);break}}static template=()=>null;static create(t={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let r=document.createElement(n);for(let[o,i]of Object.entries(t))r[o]=i;return r}signal(t){let n=m(t);return this.#n.push(n),n}ensure(t){for(let i of this.children)if(i.getAttribute("slot")===t)return i;let n=this.#u(t);if(n)return n;X(this.constructor);let r=this.constructor._pp?.[t];if(!r)return null;let o=r.cloneNode(!0);return o._uiPart=!0,this.appendChild(o),o}drop(t){for(let r of this.children)if(r.getAttribute("slot")===t){r.remove();return}let n=this.#u(t);n&&n.remove()}#u(t){for(let n of this.querySelectorAll(`[slot="${t}"]`)){let r=n.parentElement,o=!0;for(;r&&r!==this;){if(r.localName.includes("-")){o=!1;break}r=r.parentElement}if(o&&r===this)return n}return null}reconcile(t,n,r,o){let i=t[y]||new Map,a=new Map,c=[];for(let l=0;l<n.length;l++){let u=n[l],d=r(u,l);if(a.has(d))continue;let S=i.get(d);S?o(u,l,S):S=o(u,l,null),a.set(d,S),c.push(d)}for(let[l,u]of i)a.has(l)||u.remove();let s=null;for(let l=c.length-1;l>=0;l--){let u=a.get(c[l]);(u.nextSibling!==s||u.parentNode!==t)&&t.insertBefore(u,s),s=u}t[y]=a}connected(){}render(){}disconnected(){}updated(t){}};var O=class extends C{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#o=null;#e=null;#n=null;connected(){this.#o=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#r(),this.#n=t=>{let n=t?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#o?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#o.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#r(){for(let t of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(t.getAttribute("data-options"));t.options=n}catch{}}};R("editor-shell",O);export{O as EditorShell};
|