@ai-ecoverse/slicc-spectrum 0.0.0 → 1.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/LICENSE +191 -0
- package/README.md +173 -5
- package/dist/chunk-24WRGUXG.js +168 -0
- package/dist/chunk-24WRGUXG.js.map +7 -0
- package/dist/chunk-364Y2XOJ.js +28 -0
- package/dist/chunk-364Y2XOJ.js.map +7 -0
- package/dist/chunk-4RGMMAR4.js +18 -0
- package/dist/chunk-4RGMMAR4.js.map +7 -0
- package/dist/chunk-5OVGH7HO.js +28 -0
- package/dist/chunk-5OVGH7HO.js.map +7 -0
- package/dist/chunk-6A6NIESE.js +9 -0
- package/dist/chunk-6A6NIESE.js.map +7 -0
- package/dist/chunk-EN3XGF2M.js +26 -0
- package/dist/chunk-EN3XGF2M.js.map +7 -0
- package/dist/chunk-ER3HU7OE.js +22 -0
- package/dist/chunk-ER3HU7OE.js.map +7 -0
- package/dist/chunk-FN3Y2AYJ.js +17 -0
- package/dist/chunk-FN3Y2AYJ.js.map +7 -0
- package/dist/chunk-H5WU2XYY.js +8 -0
- package/dist/chunk-H5WU2XYY.js.map +7 -0
- package/dist/chunk-HBUX7E54.js +234 -0
- package/dist/chunk-HBUX7E54.js.map +7 -0
- package/dist/chunk-IBQ4O4NO.js +13 -0
- package/dist/chunk-IBQ4O4NO.js.map +7 -0
- package/dist/chunk-J45KH7MF.js +180 -0
- package/dist/chunk-J45KH7MF.js.map +7 -0
- package/dist/chunk-JASEW37G.js +411 -0
- package/dist/chunk-JASEW37G.js.map +7 -0
- package/dist/chunk-MR7SU4GJ.js +59 -0
- package/dist/chunk-MR7SU4GJ.js.map +7 -0
- package/dist/chunk-MTF6JFSL.js +1093 -0
- package/dist/chunk-MTF6JFSL.js.map +7 -0
- package/dist/chunk-Q4AC2O6Z.js +13 -0
- package/dist/chunk-Q4AC2O6Z.js.map +7 -0
- package/dist/chunk-SZ33GAVH.js +2638 -0
- package/dist/chunk-SZ33GAVH.js.map +7 -0
- package/dist/chunk-T5NHW4KC.js +23 -0
- package/dist/chunk-T5NHW4KC.js.map +7 -0
- package/dist/chunk-T5QFSUYQ.js +8 -0
- package/dist/chunk-T5QFSUYQ.js.map +7 -0
- package/dist/chunk-TS7SL372.js +687 -0
- package/dist/chunk-TS7SL372.js.map +7 -0
- package/dist/chunk-Y4Z7K443.js +64 -0
- package/dist/chunk-Y4Z7K443.js.map +7 -0
- package/dist/chunk-ZMBN6APP.js +11 -0
- package/dist/chunk-ZMBN6APP.js.map +7 -0
- package/dist/chunk-ZTPYBVZL.js +181 -0
- package/dist/chunk-ZTPYBVZL.js.map +7 -0
- package/dist/fonts/source-code-pro-latin-400-normal.woff2 +0 -0
- package/dist/fonts/source-code-pro-latin-600-normal.woff2 +0 -0
- package/dist/slicc-dummy.js +1393 -0
- package/dist/slicc-dummy.js.map +7 -0
- package/dist/slicc-terminal.js +5377 -0
- package/dist/slicc-terminal.js.map +7 -0
- package/dist/slicc-ui.js +22441 -0
- package/dist/slicc-ui.js.map +7 -0
- package/dist/types/app/agents.d.ts +11 -0
- package/dist/types/app/app.d.ts +40 -0
- package/dist/types/app/base.d.ts +27 -0
- package/dist/types/app/chat.d.ts +23 -0
- package/dist/types/app/fonts.d.ts +3 -0
- package/dist/types/app/markdown.d.ts +24 -0
- package/dist/types/app/panels.d.ts +31 -0
- package/dist/types/app/spectrum.d.ts +19 -0
- package/dist/types/backend.d.ts +19 -0
- package/dist/types/components/dock.d.ts +24 -0
- package/dist/types/components/sheets.d.ts +1 -0
- package/dist/types/dummy/agent.d.ts +14 -0
- package/dist/types/dummy/browser.d.ts +15 -0
- package/dist/types/dummy/clock.d.ts +5 -0
- package/dist/types/dummy/files.d.ts +14 -0
- package/dist/types/dummy/fixtures.d.ts +11 -0
- package/dist/types/dummy/index.d.ts +6 -0
- package/dist/types/dummy/script.d.ts +23 -0
- package/dist/types/dummy/settings.d.ts +13 -0
- package/dist/types/dummy/shell.d.ts +16 -0
- package/dist/types/dummy/terminals.d.ts +15 -0
- package/dist/types/dummy.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/kernel-backend.d.ts +24 -0
- package/dist/types/model/emitter.d.ts +9 -0
- package/dist/types/model/types.d.ts +183 -0
- package/dist/types/slicc-terminal.d.ts +23 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/ui.d.ts +15 -0
- package/dist/wterm.wasm +0 -0
- package/package.json +78 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives, including
|
|
56
|
+
but not limited to communication on electronic mailing lists, source
|
|
57
|
+
code control systems, and issue tracking systems that are managed by,
|
|
58
|
+
or on behalf of, the Licensor for the purpose of discussing and
|
|
59
|
+
improving the Work, but excluding communication that is conspicuously
|
|
60
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
61
|
+
"Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 ai-ecoverse
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,9 +1,177 @@
|
|
|
1
|
-
#
|
|
1
|
+
# slicc-spectrum
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Web components for SLICC: `<slicc-terminal>`, and SLICC's app UI on [Spectrum Web Components](https://opensource.adobe.com/spectrum-web-components/) (see [UI](#ui)). `<slicc-terminal>` is a terminal built on [wterm](https://github.com/vercel-labs/wterm) (`@wterm/dom` 0.5.4, Zig/WASM VT core) that talks to [`@ai-ecoverse/slicc-kernel`](https://github.com/ai-ecoverse/slicc-kernel) through a small backend interface. It is a standards custom element with no framework and no shadow root, so it can move to a shared web-components repo unchanged.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```html
|
|
6
|
+
<slicc-terminal></slicc-terminal>
|
|
7
|
+
<script type="module">
|
|
8
|
+
import './dist/slicc-terminal.js';
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
const terminal = document.querySelector('slicc-terminal');
|
|
11
|
+
terminal.backend = myBackend;
|
|
12
|
+
await terminal.ready;
|
|
13
|
+
terminal.focus();
|
|
14
|
+
</script>
|
|
15
|
+
```
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
## Element
|
|
18
|
+
|
|
19
|
+
| | |
|
|
20
|
+
| :--- | :--- |
|
|
21
|
+
| `backend` | A `TerminalBackend`. Setting it closes the current session and opens a new one. |
|
|
22
|
+
| `cols`, `rows` attributes | Fixed grid size. Without either, the grid fits the element and follows its size. |
|
|
23
|
+
| `ready` | Promise that resolves with the element once wterm has mounted and the session is open. Rejects if either fails. Setting `backend` or removing the element replaces it with a fresh promise, and anyone still waiting on the old one gets the new outcome. |
|
|
24
|
+
| `cols`, `rows` properties | Current grid size. |
|
|
25
|
+
| `resize(cols, rows)` | Sets both attributes and resizes once. |
|
|
26
|
+
| `fit()` | Removes both attributes and fits the grid to the element. |
|
|
27
|
+
| `send(data)` | Sends a string or bytes to the backend, as if typed. |
|
|
28
|
+
| `write(data)` | Writes a string or bytes to the screen without involving the backend. |
|
|
29
|
+
| `signal(name)` | Sends `SIGINT`, `SIGTSTP`, `SIGQUIT` or `SIGHUP` to the backend. |
|
|
30
|
+
| `readText()` | Resolves with the text of the scrollback and the screen. |
|
|
31
|
+
| `focus()` | Focuses the terminal input. |
|
|
32
|
+
|
|
33
|
+
Events, all `CustomEvent`s with the payload in `detail`: `ready` `{cols, rows}`, `resize` `{cols, rows}`, `exit` `{status}`, `title` `{title}`, `bell` `{count}`, `error` `{error}`.
|
|
34
|
+
|
|
35
|
+
Removing the element closes the session and destroys the screen. Adding it again mounts a fresh screen and opens a new session on the same backend.
|
|
36
|
+
|
|
37
|
+
## Backend interface
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
interface TerminalBackend {
|
|
41
|
+
open(sink: TerminalSink, size: { cols: number; rows: number }): TerminalSession | Promise<TerminalSession>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface TerminalSink {
|
|
45
|
+
output(data: Uint8Array): void;
|
|
46
|
+
exit(status: number): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface TerminalSession {
|
|
50
|
+
write(data: Uint8Array): void;
|
|
51
|
+
resize(cols: number, rows: number): void;
|
|
52
|
+
signal?(name: 'SIGINT' | 'SIGTSTP' | 'SIGQUIT' | 'SIGHUP'): void;
|
|
53
|
+
close(): void;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Keystrokes reach `write` as the bytes a terminal would send: UTF-8 text, `\r` for Enter, `0x03` for Ctrl+C, escape sequences for arrows and function keys, and bracketed paste when the application has turned it on. Pasted `\r\n` and `\n` line breaks are sent as `\r`, as xterm.js does, in both plain and bracketed paste. The backend's line discipline turns `0x03`, `0x1a` and `0x1c` into signals, as a real pty does. `signal()` is optional. Without it, `terminal.signal()` writes the matching control byte instead, and `SIGHUP` is dropped. Output may arrive in chunks of any size and split anywhere, including inside UTF-8 sequences and escape sequences. While `open()` is pending, input (keystrokes, `send()` and wterm's automatic replies) is buffered and written in order once the session opens. If that open fails or is superseded, the buffer is dropped.
|
|
58
|
+
|
|
59
|
+
### slicc-kernel
|
|
60
|
+
|
|
61
|
+
`kernelBackend(kernel, { argv, cwd, env })` adapts slicc-kernel's terminal API to the interface above. `argv` defaults to `['bash', '-i']`. It is typed structurally, so this package doesn't depend on slicc-kernel. If the session fails, its error message is printed and `exit` reports status 1.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import { createKernel } from './node_modules/@ai-ecoverse/slicc-kernel/dist/index.js';
|
|
65
|
+
import { kernelBackend } from './dist/slicc-terminal.js';
|
|
66
|
+
|
|
67
|
+
const kernel = await createKernel({ root: await navigator.storage.getDirectory() });
|
|
68
|
+
document.querySelector('slicc-terminal').backend = kernelBackend(kernel, { cwd: '/home' });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Theming
|
|
72
|
+
|
|
73
|
+
The element sets wterm's `--term-*` variables from its own custom properties, so you can set them on the element or on any ancestor.
|
|
74
|
+
|
|
75
|
+
| Property | Default |
|
|
76
|
+
| :--- | :--- |
|
|
77
|
+
| `--slicc-terminal-background` | `#1d1d1d` |
|
|
78
|
+
| `--slicc-terminal-foreground` | `#d4d4d4` |
|
|
79
|
+
| `--slicc-terminal-cursor` | `#aeafad` |
|
|
80
|
+
| `--slicc-terminal-color-0` … `--slicc-terminal-color-15` | wterm's palette |
|
|
81
|
+
| `--slicc-terminal-font-family` | `"Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace` |
|
|
82
|
+
| `--slicc-terminal-font-size` | `14px` |
|
|
83
|
+
| `--slicc-terminal-line-height` | `1.2` |
|
|
84
|
+
| `--slicc-terminal-padding` | `8px` |
|
|
85
|
+
| `--slicc-terminal-height` | `360px` (ignored when `rows` is set) |
|
|
86
|
+
| `--slicc-terminal-border-radius` | `4px` |
|
|
87
|
+
|
|
88
|
+
The stylesheet (wterm's plus the theme) is constructed once per document and adopted into the document or shadow root the element is connected to. That includes iframes the element is moved into.
|
|
89
|
+
|
|
90
|
+
## Distribution
|
|
91
|
+
|
|
92
|
+
`npm run build` writes `dist/slicc-terminal.js` (one ESM bundle with no bare imports), its source map and `dist/wterm.wasm`. The bundle loads the WASM with `new URL('./wterm.wasm', import.meta.url)`, so `dist/` works from any path, including from OPFS through the slicc-bios service worker. wterm's base64-inlined copy of the WASM is left out of the bundle. TypeScript declarations go to `dist/types/`, and the package's `types` export points at them. Set `SliccTerminal.wasmUrl` before the first element connects to load it from elsewhere.
|
|
93
|
+
|
|
94
|
+
## wterm notes
|
|
95
|
+
|
|
96
|
+
Things found while building this against wterm 0.5.4, recorded here, not pushed upstream:
|
|
97
|
+
|
|
98
|
+
- The Zig core maps 24-bit colours (`38;2;r;g;b`) to the nearest of the 256 palette colours, and the DOM renderer draws the 6×6×6 cube in steps of 51 rather than xterm's 0/95/135/175/215/255. `@wterm/ghostty` is the full-VT alternative.
|
|
99
|
+
- wterm sends pasted text with its `\n` line breaks unchanged, whereas xterm.js turns them into `\r`. The element does that conversion itself.
|
|
100
|
+
- `@wterm/core` always ships the WASM inlined as base64 behind a dynamic import. A build without it, or an explicit entry point that takes a URL, would save the bundler plugin.
|
|
101
|
+
- wterm reads focus and selection from `ownerDocument` (`activeElement`, `getSelection()`), so selection and copy don't work inside a shadow root that wterm itself owns. That's why the element renders in light DOM. It still works when the element is placed inside someone else's shadow root.
|
|
102
|
+
|
|
103
|
+
## UI
|
|
104
|
+
|
|
105
|
+
`dist/slicc-ui.js` is SLICC's app shell on Spectrum Web Components 1.12 with the Spectrum 2 theme (`<sp-theme system="spectrum-two">`), in light and dark. It runs against a typed model, not against the kernel, the agent or the browser directly, and is not wired to any of them yet. `dist/slicc-dummy.js` provides a dummy model that streams replies and tool calls with timers.
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<slicc-app></slicc-app>
|
|
109
|
+
<script type="module">
|
|
110
|
+
import { createDummyModel } from './dist/slicc-dummy.js';
|
|
111
|
+
import './dist/slicc-ui.js';
|
|
112
|
+
|
|
113
|
+
document.querySelector('slicc-app').model = createDummyModel({ storage: localStorage });
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`npm start` serves it at `/ui/`. `?fonts=<url>` loads Adobe Clean from another folder (see [Fonts](#fonts)).
|
|
118
|
+
|
|
119
|
+
### Layouts and rails
|
|
120
|
+
|
|
121
|
+
The layout follows the width of `<slicc-app>`, which it reflects as its `screen` attribute: `phone` (under 640 px) has one column, `tablet` (under 1200 px) two, `desktop` three, like SLICC v6. Each screen class starts with few panels open and saves its own layout (`slicc-ui.layout.<screen>`). Every surface has a home side, left, center or right. Closed panels wait as icons in the left and right rails (on a phone, in one bar at the bottom); one click puts a panel back on its side, next to its neighbours.
|
|
122
|
+
|
|
123
|
+
### Fonts
|
|
124
|
+
|
|
125
|
+
Text is Adobe Clean and code Spectrum's Source Code Pro. Source Code Pro (OFL) is in `dist/fonts/`, same origin. Adobe Clean can't ship in a public package, so `<slicc-app>` loads it from `fontBase` (`AdobeClean-{Regular,Medium,Bold,ExtraBold}.otf`), which defaults to `/fonts/` on the current origin. Every `*.sliccy.ai` host passes it through to v6, and `npm start` proxies it from `seven.sliccy.ai`. Where it 404s, text falls back to the system font stack. `?delay=` sets the dummy's tick in milliseconds (default 30) and `?color=light|dark|system` the theme.
|
|
126
|
+
|
|
127
|
+
### Elements
|
|
128
|
+
|
|
129
|
+
| Element | |
|
|
130
|
+
| :--- | :--- |
|
|
131
|
+
| `<slicc-app>` | The shell: header with the agent picker, the View menu and the theme switch, rails, a `<slicc-dock>`, and a status bar. Saves the dock layout per screen class to `storage` (default `localStorage`) under `layoutKey`. |
|
|
132
|
+
| `<slicc-dock>` | Generic. [dockview-core](https://dockview.dev/) 8 with a theme mapped to Spectrum tokens, in its own shadow root. Panels come from `factories` (`name → (params) => HTMLElement`). `open`, `close`, `has`, `content`, `focusPanel`, `cycleGroup`, `cycleTab`, `toJSON`, `restore`, `clear`, and the full `api`. Tabs have a context menu (close, close others, float, maximize). Events: `layout-change`, `active-panel-change`, `panel-close`. |
|
|
133
|
+
| `<slicc-agents>` | Cones with their scoops, status, context fill and unread count. Selecting one makes it the active agent. |
|
|
134
|
+
| `<slicc-chat>` | The active agent's conversation: Markdown, thinking, tool calls (collapsible, with input and output), events such as webhooks, schedules, scoops, compaction and errors, and a composer that streams and stops. |
|
|
135
|
+
|
|
136
|
+
Keys: <kbd>Alt</kbd>+<kbd>1</kbd>… opens and focuses a panel, <kbd>F6</kbd> and <kbd>Shift</kbd>+<kbd>F6</kbd> move between groups, <kbd>Ctrl</kbd>+<kbd>]</kbd> and <kbd>Ctrl</kbd>+<kbd>[</kbd> between tabs, <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> switches the theme. In the agents list, arrows, <kbd>Home</kbd>, <kbd>End</kbd>, <kbd>Enter</kbd> and <kbd>Space</kbd>. In the composer, <kbd>Enter</kbd> sends, <kbd>Shift</kbd>+<kbd>Enter</kbd> adds a line and <kbd>Esc</kbd> stops a reply.
|
|
137
|
+
|
|
138
|
+
### Model
|
|
139
|
+
|
|
140
|
+
`SliccModel` (`src/model/types.ts`) has one port per future backend, so adapters can replace the dummy without UI changes. Every port is subscribable with `on(type, listener)`, which returns an unsubscribe function.
|
|
141
|
+
|
|
142
|
+
| Port | Later backed by | |
|
|
143
|
+
| :--- | :--- | :--- |
|
|
144
|
+
| `agent` | `@ai-ecoverse/slicc-agent` | Cones and scoops, the active agent, conversations, `send` and `stop`. Assistant messages stream: the same message is re-emitted as its parts grow and its tool calls go from `running` to `done`. |
|
|
145
|
+
| `files` | slicc-kernel's OPFS | `list`, `read`, `write`, `remove`, and pending changes with their before and after text (`accept`, `revert`). |
|
|
146
|
+
| `terminals` | slicc-kernel's terminal API | Terminal sessions; `backend(id)` returns a `TerminalBackend` for `<slicc-terminal>`. |
|
|
147
|
+
| `browser` | `@ai-ecoverse/slicc-cdp` | Tabs, the active tab, `open`, `navigate`, `close`, `screenshot`. |
|
|
148
|
+
| `settings` | local storage | Theme, model, thinking level, composer and diff preferences, the models on offer, and accounts. |
|
|
149
|
+
|
|
150
|
+
The dummy's fixtures are invented: a small forecast API called harbor, with cones, scoops, a conversation per agent, pending changes, browser tabs and accounts. Its replies are scripted by keyword (tests, fix or add, open or docs, files, anything else), and their tool calls act on the other ports: an edit writes a file and shows up as a change, a browse opens a tab.
|
|
151
|
+
|
|
152
|
+
### Distribution
|
|
153
|
+
|
|
154
|
+
The UI is ESM with code splitting: `slicc-ui.js`, `slicc-dummy.js` and `chunk-*.js` next to them in `dist/`, with no bare imports, so the folder can be served as plain files from OPFS. dockview's ESM build has no CSS; the build takes it from dockview's UMD bundle. Types are in `dist/types/ui.d.ts` and `dist/types/dummy.d.ts`, exported as `@ai-ecoverse/slicc-spectrum/ui` and `/dummy`.
|
|
155
|
+
|
|
156
|
+
### dockview notes
|
|
157
|
+
|
|
158
|
+
- Keyboard navigation (`keyboardNavigation`) needs dockview-enterprise, so `<slicc-dock>` implements <kbd>F6</kbd> and <kbd>Ctrl</kbd>+<kbd>]</kbd>/<kbd>[</kbd> itself.
|
|
159
|
+
- A floating group with a border (`--dv-floating-border`, which dockview's own light theme sets) grows by twice the border width on every save and restore. The theme draws the edge with a box shadow instead.
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
npm install
|
|
165
|
+
npm run lint
|
|
166
|
+
npm test
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`npm test` builds `dist/` and runs the integration tests in headless Chromium over raw CDP, through the [harness from slicc-shared-web](https://github.com/ai-ecoverse/slicc-shared-web#integration-test-harness), against a fake backend (`test/integration/page/fake-backend.js`). It writes V8 coverage to `coverage/` and CPU profiles, screenshots and console logs to `artifacts/`. The test page is served cross-origin isolated (COOP/COEP), as slicc-kernel requires. `test/integration/kernel.test.mjs` runs `bash -i` end to end on `@ai-ecoverse/slicc-kernel` (a pinned dev dependency), with `@ai-ecoverse/wasm-bash` and `@ai-ecoverse/wasm-coreutils` installed into OPFS by the page (`/kernel.html`). `npm start` serves the test page on port 8080, and the UI at `/ui/`. `test/integration/ui.test.mjs` covers the shell, the layout (moving, closing, floating, reopening and reloading), streaming a reply with a tool call, stopping it, switching themes and the keyboard, and saves screenshots to `artifacts/ui/`.
|
|
170
|
+
|
|
171
|
+
The Biome, TypeScript, lefthook, Renovate and CI configuration comes from [slicc-shared-web](https://github.com/ai-ecoverse/slicc-shared-web), which also provides the `slicc-lint-comments`, `slicc-no-unit-tests` and `slicc-diff-cover` commands used by `npm run lint` and the pre-commit hook.
|
|
172
|
+
|
|
173
|
+
Unit tests live in `test/unit/`, which is gitignored. The pre-commit hook runs them in Node against happy-dom under monocart and fails the commit unless the staged lines in `src/` are fully covered (`slicc-diff-cover`, which runs `diff-cover --fail-under 100` and needs [uv](https://docs.astral.sh/uv/)).
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
Apache-2.0
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS
|
|
3
|
+
} from "./chunk-Q4AC2O6Z.js";
|
|
4
|
+
|
|
5
|
+
// node_modules/focus-visible/dist/focus-visible.js
|
|
6
|
+
var require_focus_visible = __commonJS({
|
|
7
|
+
"node_modules/focus-visible/dist/focus-visible.js"(exports, module) {
|
|
8
|
+
(function(global, factory) {
|
|
9
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory() : typeof define === "function" && define.amd ? define(factory) : factory();
|
|
10
|
+
})(exports, (function() {
|
|
11
|
+
"use strict";
|
|
12
|
+
function applyFocusVisiblePolyfill(scope) {
|
|
13
|
+
var hadKeyboardEvent = true;
|
|
14
|
+
var hadFocusVisibleRecently = false;
|
|
15
|
+
var hadFocusVisibleRecentlyTimeout = null;
|
|
16
|
+
var inputTypesAllowlist = {
|
|
17
|
+
text: true,
|
|
18
|
+
search: true,
|
|
19
|
+
url: true,
|
|
20
|
+
tel: true,
|
|
21
|
+
email: true,
|
|
22
|
+
password: true,
|
|
23
|
+
number: true,
|
|
24
|
+
date: true,
|
|
25
|
+
month: true,
|
|
26
|
+
week: true,
|
|
27
|
+
time: true,
|
|
28
|
+
datetime: true,
|
|
29
|
+
"datetime-local": true
|
|
30
|
+
};
|
|
31
|
+
function isValidFocusTarget(el) {
|
|
32
|
+
if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
function focusTriggersKeyboardModality(el) {
|
|
38
|
+
var type = el.type;
|
|
39
|
+
var tagName = el.tagName;
|
|
40
|
+
if (tagName === "INPUT" && inputTypesAllowlist[type] && !el.readOnly) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (tagName === "TEXTAREA" && !el.readOnly) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (el.isContentEditable) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
function addFocusVisibleClass(el) {
|
|
52
|
+
if (el.classList.contains("focus-visible")) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
el.classList.add("focus-visible");
|
|
56
|
+
el.setAttribute("data-focus-visible-added", "");
|
|
57
|
+
}
|
|
58
|
+
function removeFocusVisibleClass(el) {
|
|
59
|
+
if (!el.hasAttribute("data-focus-visible-added")) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
el.classList.remove("focus-visible");
|
|
63
|
+
el.removeAttribute("data-focus-visible-added");
|
|
64
|
+
}
|
|
65
|
+
function onKeyDown(e) {
|
|
66
|
+
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (isValidFocusTarget(scope.activeElement)) {
|
|
70
|
+
addFocusVisibleClass(scope.activeElement);
|
|
71
|
+
}
|
|
72
|
+
hadKeyboardEvent = true;
|
|
73
|
+
}
|
|
74
|
+
function onPointerDown(e) {
|
|
75
|
+
hadKeyboardEvent = false;
|
|
76
|
+
}
|
|
77
|
+
function onFocus(e) {
|
|
78
|
+
if (!isValidFocusTarget(e.target)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
|
|
82
|
+
addFocusVisibleClass(e.target);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function onBlur(e) {
|
|
86
|
+
if (!isValidFocusTarget(e.target)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) {
|
|
90
|
+
hadFocusVisibleRecently = true;
|
|
91
|
+
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
|
92
|
+
hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
|
|
93
|
+
hadFocusVisibleRecently = false;
|
|
94
|
+
}, 100);
|
|
95
|
+
removeFocusVisibleClass(e.target);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function onVisibilityChange(e) {
|
|
99
|
+
if (document.visibilityState === "hidden") {
|
|
100
|
+
if (hadFocusVisibleRecently) {
|
|
101
|
+
hadKeyboardEvent = true;
|
|
102
|
+
}
|
|
103
|
+
addInitialPointerMoveListeners();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function addInitialPointerMoveListeners() {
|
|
107
|
+
document.addEventListener("mousemove", onInitialPointerMove);
|
|
108
|
+
document.addEventListener("mousedown", onInitialPointerMove);
|
|
109
|
+
document.addEventListener("mouseup", onInitialPointerMove);
|
|
110
|
+
document.addEventListener("pointermove", onInitialPointerMove);
|
|
111
|
+
document.addEventListener("pointerdown", onInitialPointerMove);
|
|
112
|
+
document.addEventListener("pointerup", onInitialPointerMove);
|
|
113
|
+
document.addEventListener("touchmove", onInitialPointerMove);
|
|
114
|
+
document.addEventListener("touchstart", onInitialPointerMove);
|
|
115
|
+
document.addEventListener("touchend", onInitialPointerMove);
|
|
116
|
+
}
|
|
117
|
+
function removeInitialPointerMoveListeners() {
|
|
118
|
+
document.removeEventListener("mousemove", onInitialPointerMove);
|
|
119
|
+
document.removeEventListener("mousedown", onInitialPointerMove);
|
|
120
|
+
document.removeEventListener("mouseup", onInitialPointerMove);
|
|
121
|
+
document.removeEventListener("pointermove", onInitialPointerMove);
|
|
122
|
+
document.removeEventListener("pointerdown", onInitialPointerMove);
|
|
123
|
+
document.removeEventListener("pointerup", onInitialPointerMove);
|
|
124
|
+
document.removeEventListener("touchmove", onInitialPointerMove);
|
|
125
|
+
document.removeEventListener("touchstart", onInitialPointerMove);
|
|
126
|
+
document.removeEventListener("touchend", onInitialPointerMove);
|
|
127
|
+
}
|
|
128
|
+
function onInitialPointerMove(e) {
|
|
129
|
+
if (e.target.nodeName && e.target.nodeName.toLowerCase() === "html") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
hadKeyboardEvent = false;
|
|
133
|
+
removeInitialPointerMoveListeners();
|
|
134
|
+
}
|
|
135
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
136
|
+
document.addEventListener("mousedown", onPointerDown, true);
|
|
137
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
138
|
+
document.addEventListener("touchstart", onPointerDown, true);
|
|
139
|
+
document.addEventListener("visibilitychange", onVisibilityChange, true);
|
|
140
|
+
addInitialPointerMoveListeners();
|
|
141
|
+
scope.addEventListener("focus", onFocus, true);
|
|
142
|
+
scope.addEventListener("blur", onBlur, true);
|
|
143
|
+
if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
|
|
144
|
+
scope.host.setAttribute("data-js-focus-visible", "");
|
|
145
|
+
} else if (scope.nodeType === Node.DOCUMENT_NODE) {
|
|
146
|
+
document.documentElement.classList.add("js-focus-visible");
|
|
147
|
+
document.documentElement.setAttribute("data-js-focus-visible", "");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
151
|
+
window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
|
|
152
|
+
var event;
|
|
153
|
+
try {
|
|
154
|
+
event = new CustomEvent("focus-visible-polyfill-ready");
|
|
155
|
+
} catch (error) {
|
|
156
|
+
event = document.createEvent("CustomEvent");
|
|
157
|
+
event.initCustomEvent("focus-visible-polyfill-ready", false, false, {});
|
|
158
|
+
}
|
|
159
|
+
window.dispatchEvent(event);
|
|
160
|
+
}
|
|
161
|
+
if (typeof document !== "undefined") {
|
|
162
|
+
applyFocusVisiblePolyfill(document);
|
|
163
|
+
}
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export default require_focus_visible();
|
|
168
|
+
//# sourceMappingURL=chunk-24WRGUXG.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/focus-visible/dist/focus-visible.js"],
|
|
4
|
+
"sourcesContent": ["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (factory());\n}(this, (function () { 'use strict';\n\n /**\n * Applies the :focus-visible polyfill at the given scope.\n * A scope in this case is either the top-level Document or a Shadow Root.\n *\n * @param {(Document|ShadowRoot)} scope\n * @see https://github.com/WICG/focus-visible\n */\n function applyFocusVisiblePolyfill(scope) {\n var hadKeyboardEvent = true;\n var hadFocusVisibleRecently = false;\n var hadFocusVisibleRecentlyTimeout = null;\n\n var inputTypesAllowlist = {\n text: true,\n search: true,\n url: true,\n tel: true,\n email: true,\n password: true,\n number: true,\n date: true,\n month: true,\n week: true,\n time: true,\n datetime: true,\n 'datetime-local': true\n };\n\n /**\n * Helper function for legacy browsers and iframes which sometimes focus\n * elements like document, body, and non-interactive SVG.\n * @param {Element} el\n */\n function isValidFocusTarget(el) {\n if (\n el &&\n el !== document &&\n el.nodeName !== 'HTML' &&\n el.nodeName !== 'BODY' &&\n 'classList' in el &&\n 'contains' in el.classList\n ) {\n return true;\n }\n return false;\n }\n\n /**\n * Computes whether the given element should automatically trigger the\n * `focus-visible` class being added, i.e. whether it should always match\n * `:focus-visible` when focused.\n * @param {Element} el\n * @return {boolean}\n */\n function focusTriggersKeyboardModality(el) {\n var type = el.type;\n var tagName = el.tagName;\n\n if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {\n return true;\n }\n\n if (tagName === 'TEXTAREA' && !el.readOnly) {\n return true;\n }\n\n if (el.isContentEditable) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Add the `focus-visible` class to the given element if it was not added by\n * the author.\n * @param {Element} el\n */\n function addFocusVisibleClass(el) {\n if (el.classList.contains('focus-visible')) {\n return;\n }\n el.classList.add('focus-visible');\n el.setAttribute('data-focus-visible-added', '');\n }\n\n /**\n * Remove the `focus-visible` class from the given element if it was not\n * originally added by the author.\n * @param {Element} el\n */\n function removeFocusVisibleClass(el) {\n if (!el.hasAttribute('data-focus-visible-added')) {\n return;\n }\n el.classList.remove('focus-visible');\n el.removeAttribute('data-focus-visible-added');\n }\n\n /**\n * If the most recent user interaction was via the keyboard;\n * and the key press did not include a meta, alt/option, or control key;\n * then the modality is keyboard. Otherwise, the modality is not keyboard.\n * Apply `focus-visible` to any current active element and keep track\n * of our keyboard modality state with `hadKeyboardEvent`.\n * @param {KeyboardEvent} e\n */\n function onKeyDown(e) {\n if (e.metaKey || e.altKey || e.ctrlKey) {\n return;\n }\n\n if (isValidFocusTarget(scope.activeElement)) {\n addFocusVisibleClass(scope.activeElement);\n }\n\n hadKeyboardEvent = true;\n }\n\n /**\n * If at any point a user clicks with a pointing device, ensure that we change\n * the modality away from keyboard.\n * This avoids the situation where a user presses a key on an already focused\n * element, and then clicks on a different element, focusing it with a\n * pointing device, while we still think we're in keyboard modality.\n * @param {Event} e\n */\n function onPointerDown(e) {\n hadKeyboardEvent = false;\n }\n\n /**\n * On `focus`, add the `focus-visible` class to the target if:\n * - the target received focus as a result of keyboard navigation, or\n * - the event target is an element that will likely require interaction\n * via the keyboard (e.g. a text box)\n * @param {Event} e\n */\n function onFocus(e) {\n // Prevent IE from focusing the document or HTML element.\n if (!isValidFocusTarget(e.target)) {\n return;\n }\n\n if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {\n addFocusVisibleClass(e.target);\n }\n }\n\n /**\n * On `blur`, remove the `focus-visible` class from the target.\n * @param {Event} e\n */\n function onBlur(e) {\n if (!isValidFocusTarget(e.target)) {\n return;\n }\n\n if (\n e.target.classList.contains('focus-visible') ||\n e.target.hasAttribute('data-focus-visible-added')\n ) {\n // To detect a tab/window switch, we look for a blur event followed\n // rapidly by a visibility change.\n // If we don't see a visibility change within 100ms, it's probably a\n // regular focus change.\n hadFocusVisibleRecently = true;\n window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {\n hadFocusVisibleRecently = false;\n }, 100);\n removeFocusVisibleClass(e.target);\n }\n }\n\n /**\n * If the user changes tabs, keep track of whether or not the previously\n * focused element had .focus-visible.\n * @param {Event} e\n */\n function onVisibilityChange(e) {\n if (document.visibilityState === 'hidden') {\n // If the tab becomes active again, the browser will handle calling focus\n // on the element (Safari actually calls it twice).\n // If this tab change caused a blur on an element with focus-visible,\n // re-apply the class when the user switches back to the tab.\n if (hadFocusVisibleRecently) {\n hadKeyboardEvent = true;\n }\n addInitialPointerMoveListeners();\n }\n }\n\n /**\n * Add a group of listeners to detect usage of any pointing devices.\n * These listeners will be added when the polyfill first loads, and anytime\n * the window is blurred, so that they are active when the window regains\n * focus.\n */\n function addInitialPointerMoveListeners() {\n document.addEventListener('mousemove', onInitialPointerMove);\n document.addEventListener('mousedown', onInitialPointerMove);\n document.addEventListener('mouseup', onInitialPointerMove);\n document.addEventListener('pointermove', onInitialPointerMove);\n document.addEventListener('pointerdown', onInitialPointerMove);\n document.addEventListener('pointerup', onInitialPointerMove);\n document.addEventListener('touchmove', onInitialPointerMove);\n document.addEventListener('touchstart', onInitialPointerMove);\n document.addEventListener('touchend', onInitialPointerMove);\n }\n\n function removeInitialPointerMoveListeners() {\n document.removeEventListener('mousemove', onInitialPointerMove);\n document.removeEventListener('mousedown', onInitialPointerMove);\n document.removeEventListener('mouseup', onInitialPointerMove);\n document.removeEventListener('pointermove', onInitialPointerMove);\n document.removeEventListener('pointerdown', onInitialPointerMove);\n document.removeEventListener('pointerup', onInitialPointerMove);\n document.removeEventListener('touchmove', onInitialPointerMove);\n document.removeEventListener('touchstart', onInitialPointerMove);\n document.removeEventListener('touchend', onInitialPointerMove);\n }\n\n /**\n * When the polfyill first loads, assume the user is in keyboard modality.\n * If any event is received from a pointing device (e.g. mouse, pointer,\n * touch), turn off keyboard modality.\n * This accounts for situations where focus enters the page from the URL bar.\n * @param {Event} e\n */\n function onInitialPointerMove(e) {\n // Work around a Safari quirk that fires a mousemove on <html> whenever the\n // window blurs, even if you're tabbing out of the page. \u00AF\\_(\u30C4)_/\u00AF\n if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') {\n return;\n }\n\n hadKeyboardEvent = false;\n removeInitialPointerMoveListeners();\n }\n\n // For some kinds of state, we are interested in changes at the global scope\n // only. For example, global pointer input, global key presses and global\n // visibility change should affect the state at every scope:\n document.addEventListener('keydown', onKeyDown, true);\n document.addEventListener('mousedown', onPointerDown, true);\n document.addEventListener('pointerdown', onPointerDown, true);\n document.addEventListener('touchstart', onPointerDown, true);\n document.addEventListener('visibilitychange', onVisibilityChange, true);\n\n addInitialPointerMoveListeners();\n\n // For focus and blur, we specifically care about state changes in the local\n // scope. This is because focus / blur events that originate from within a\n // shadow root are not re-dispatched from the host element if it was already\n // the active element in its own scope:\n scope.addEventListener('focus', onFocus, true);\n scope.addEventListener('blur', onBlur, true);\n\n // We detect that a node is a ShadowRoot by ensuring that it is a\n // DocumentFragment and also has a host property. This check covers native\n // implementation and polyfill implementation transparently. If we only cared\n // about the native implementation, we could just check if the scope was\n // an instance of a ShadowRoot.\n if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {\n // Since a ShadowRoot is a special kind of DocumentFragment, it does not\n // have a root element to add a class to. So, we add this attribute to the\n // host element instead:\n scope.host.setAttribute('data-js-focus-visible', '');\n } else if (scope.nodeType === Node.DOCUMENT_NODE) {\n document.documentElement.classList.add('js-focus-visible');\n document.documentElement.setAttribute('data-js-focus-visible', '');\n }\n }\n\n // It is important to wrap all references to global window and document in\n // these checks to support server-side rendering use cases\n // @see https://github.com/WICG/focus-visible/issues/199\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n // Make the polyfill helper globally available. This can be used as a signal\n // to interested libraries that wish to coordinate with the polyfill for e.g.,\n // applying the polyfill to a shadow root:\n window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;\n\n // Notify interested libraries of the polyfill's presence, in case the\n // polyfill was loaded lazily:\n var event;\n\n try {\n event = new CustomEvent('focus-visible-polyfill-ready');\n } catch (error) {\n // IE11 does not support using CustomEvent as a constructor directly:\n event = document.createEvent('CustomEvent');\n event.initCustomEvent('focus-visible-polyfill-ready', false, false, {});\n }\n\n window.dispatchEvent(event);\n }\n\n if (typeof document !== 'undefined') {\n // Apply the polyfill to the global document, so that no JavaScript\n // coordination is required to use the polyfill in the top-level document:\n applyFocusVisiblePolyfill(document);\n }\n\n})));\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA;AAAA;AAAA,KAAC,SAAU,QAA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E,eAAO,4BAA4B;AAInC,YAAI;AAEJ,YAAI;AACF,kBAAQ,IAAI,YAAY,8BAA8B;AAAA,QACxD,SAAS,OAAO;AAEd,kBAAQ,SAAS,YAAY,aAAa;AAC1C,gBAAM,gBAAgB,gCAAgC,OAAO,OAAO,CAAC,CAAC;AAAA,QACxE;AAEA,eAAO,cAAc,KAAK;AAAA,MAC5B;AAEA,UAAI,OAAO,aAAa,aAAa;AAGnC,kCAA0B,QAAQ;AAAA,MACpC;AAAA,IAEF,EAAE;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
e
|
|
3
|
+
} from "./chunk-TS7SL372.js";
|
|
4
|
+
|
|
5
|
+
// node_modules/@lit/reactive-element/decorators/query-assigned-elements.js
|
|
6
|
+
function o(o2) {
|
|
7
|
+
return (e2, n) => {
|
|
8
|
+
const { slot: r, selector: s } = o2 ?? {}, c = "slot" + (r ? `[name=${r}]` : ":not([name])");
|
|
9
|
+
return e(e2, n, { get() {
|
|
10
|
+
const t = this.renderRoot?.querySelector(c), e3 = t?.assignedElements(o2) ?? [];
|
|
11
|
+
return void 0 === s ? e3 : e3.filter((t2) => t2.matches(s));
|
|
12
|
+
} });
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
o
|
|
18
|
+
};
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
22
|
+
(**
|
|
23
|
+
* @license
|
|
24
|
+
* Copyright 2021 Google LLC
|
|
25
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
26
|
+
*)
|
|
27
|
+
*/
|
|
28
|
+
//# sourceMappingURL=chunk-364Y2XOJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/@lit/reactive-element/src/decorators/query-assigned-elements.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport type {ReactiveElement} from '../reactive-element.js';\nimport type {QueryAssignedNodesOptions} from './query-assigned-nodes.js';\nimport {desc, type Interface} from './base.js';\n\nexport type QueryAssignedElementsDecorator = {\n // legacy\n (\n proto: Interface<ReactiveElement>,\n name: PropertyKey,\n descriptor?: PropertyDescriptor\n // Note TypeScript requires the return type to be `void|any`\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): void | any;\n\n // standard\n <C extends Interface<ReactiveElement>, V extends Array<Element>>(\n value: ClassAccessorDecoratorTarget<C, V>,\n context: ClassAccessorDecoratorContext<C, V>\n ): ClassAccessorDecoratorResult<C, V>;\n};\n\n/**\n * Options for the {@linkcode queryAssignedElements} decorator. Extends the\n * options that can be passed into\n * [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n */\nexport interface QueryAssignedElementsOptions\n extends QueryAssignedNodesOptions {\n /**\n * CSS selector used to filter the elements returned. For example, a selector\n * of `\".item\"` will only include elements with the `item` class.\n */\n selector?: string;\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedElements` of the given `slot`. Provides a declarative\n * way to use\n * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n *\n * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedElements({ slot: 'list' })\n * listItems!: Array<HTMLElement>;\n * @queryAssignedElements()\n * unnamedSlotEls!: Array<HTMLElement>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * <slot></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note, the type of this property should be annotated as `Array<HTMLElement>`.\n *\n * @category Decorator\n */\nexport function queryAssignedElements(\n options?: QueryAssignedElementsOptions\n): QueryAssignedElementsDecorator {\n return (<V extends Array<Element>>(\n obj: object,\n name: PropertyKey | ClassAccessorDecoratorContext<unknown, unknown>\n ) => {\n const {slot, selector} = options ?? {};\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n return desc(obj, name, {\n get(this: ReactiveElement): V {\n const slotEl =\n this.renderRoot?.querySelector<HTMLSlotElement>(slotSelector);\n const elements = slotEl?.assignedElements(options) ?? [];\n return (\n selector === undefined\n ? elements\n : elements.filter((node) => node.matches(selector))\n ) as V;\n },\n });\n }) as QueryAssignedElementsDecorator;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AA6EM,SAAUA,EACdC,IAAAA;AAEA,SAAA,CACEC,IACAC,MAAAA;AAEA,UAAA,EAAMC,MAACA,GAAIC,UAAEA,EAAAA,IAAYJ,MAAW,CAAA,GAC9BK,IAAe,UAAOF,IAAO,SAASA,CAAAA,MAAU;AACtD,WAAOG,EAAKL,IAAKC,GAAM,EACrB,MAAAK;AACE,YAAMC,IACJC,KAAKC,YAAYC,cAA+BN,CAAAA,GAC5CO,KAAWJ,GAAQK,iBAAiBb,EAAAA,KAAY,CAAA;AACtD,aAAA,WACEI,IACIQ,KACAA,GAASE,OAAQC,CAAAA,OAASA,GAAKC,QAAQZ,CAAAA,CAAAA;IAE/C,EAAA,CAAA;EAEH;AACH;",
|
|
6
|
+
"names": ["queryAssignedElements", "options", "obj", "name", "slot", "selector", "slotSelector", "desc", "get", "slotEl", "this", "renderRoot", "querySelector", "elements", "assignedElements", "filter", "node", "matches"]
|
|
7
|
+
}
|