@serene-pub/ui-preview 0.6.0-pr-1

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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "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
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,17 @@
1
+ Serene Pub SDK
2
+ Copyright (c) 2025-2026 Jody Doolittle
3
+
4
+ This product includes software developed as part of the Serene Pub project
5
+ (https://github.com/doolijb/serene-pub).
6
+
7
+ The Serene Pub SDK is licensed under the Apache License, Version 2.0.
8
+
9
+ Note that the Serene Pub application itself is a separate work, licensed under
10
+ the GNU Affero General Public License v3.0. Building on this SDK does not place
11
+ your extension under the AGPL — that is the reason this SDK is licensed
12
+ permissively.
13
+
14
+ "Serene Pub" and the Serene Pub logo are trademarks of the project owner and are
15
+ not licensed by the Apache License (see Section 6). Their use is governed by the
16
+ project's trademark policy:
17
+ https://github.com/doolijb/serene-pub/blob/main/TRADEMARK.md
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # @serene-pub/ui-preview
2
+
3
+ The surface harness: a SvelteKit dev server that renders the UI surfaces a
4
+ package **announces**, with hot reload.
5
+
6
+ ```sh
7
+ serene-pub ui . # in your package
8
+ serene-pub ui . --open --port 5180
9
+ serene-pub ui . --fixtures ./my-session.json
10
+ ```
11
+
12
+ ## What it loads
13
+
14
+ Whatever your entry module's default export declares — its `defineExtension(…)`
15
+ result:
16
+
17
+ ```ts
18
+ export default defineExtension({
19
+ slug: 'acme.dice',
20
+ name: 'Dice',
21
+ version: '0.1.0',
22
+ surfaces: {
23
+ 'session-view': { entry: 'ui/session.html', title: 'Crawl view' },
24
+ page: { entry: 'ui/index.html', title: 'Dashboard' },
25
+ panels: [{ id: 'tray', entry: 'ui/tray.html', title: 'Dice tray', channels: ['dice'] }]
26
+ },
27
+ components: [component({
28
+ surface: 'core:surface/settings-section@1',
29
+ slug: 'dice-settings',
30
+ label: 'Dice settings',
31
+ framework: 'svelte',
32
+ entry: 'src/ui/Settings.svelte'
33
+ })]
34
+ })
35
+ ```
36
+
37
+ Nothing is discovered by scanning a directory. A surface you see in the harness
38
+ is a surface an instance would be offered — if the two disagree, one of them is
39
+ a bug and this is where you find out.
40
+
41
+ ## What it renders it in
42
+
43
+ **Frame surfaces** mount in `sandbox="allow-scripts"` with no
44
+ `allow-same-origin` — the same opaque-origin sandbox the app uses — and speak
45
+ frame protocol v1 over a `MessageChannel`. Channel scoping is enforced
46
+ host-side: a panel that declares `channels` receives only those lanes. Both
47
+ directions are logged, so "nothing rendered" and "nothing was sent" are
48
+ distinguishable.
49
+
50
+ **Components** mount in the harness's own document through the same ABI core
51
+ uses: a Svelte default export, or a `{ mount, update, destroy }` module.
52
+
53
+ ## Generated controls
54
+
55
+ A component declares its settings in the SDK's settings vocabulary, and the
56
+ harness renders the editor for them — you never write one:
57
+
58
+ ```ts
59
+ component({
60
+ slug: 'tray',
61
+ label: 'Dice tray',
62
+ framework: 'svelte',
63
+ entry: 'src/Tray.svelte',
64
+ settings: {
65
+ sides: { type: 'integer', label: 'Sides', default: 20, min: 2, max: 100 },
66
+ style: { type: 'enum', label: 'Style', of: ['pips', 'numerals'], default: 'pips' },
67
+ bias: { type: 'number', label: 'Bias', group: 'Advanced',
68
+ showIf: { field: 'style', equals: 'numerals' } },
69
+ },
70
+ })
71
+ ```
72
+
73
+ Edits reach the component as `ctx.settings`, the pipe an instance uses, so you
74
+ can build and see it against real values. A page or session-view frame is handed
75
+ no declared values, so it has no settings pane — only fixtures.
76
+
77
+ Grouping, ordering and `showIf` behave exactly as they will in an instance,
78
+ because they come from the SDK's own `formLayout`/`isVisible`.
79
+
80
+ `/controls` is the sandbox: every value type this build ships, its control, its
81
+ declaration, its live value and its validator's verdict — plus the four-way
82
+ registry (factory · validator · control · scaffold) as a table, so a hole is
83
+ visible rather than merely asserted by a test.
84
+
85
+ ## Themes
86
+
87
+ All 24 stock Skeleton themes and a light/dark switch, applied the way the app
88
+ applies them — `data-theme` and `data-mode` on `<html>`. The list is read off
89
+ the installed `@skeletonlabs/skeleton`, so a Skeleton release that adds a theme
90
+ adds it here.
91
+
92
+ Frames are their own documents and inherit nothing, so they get a **token
93
+ stylesheet** instead:
94
+
95
+ ```html
96
+ <link rel="stylesheet" href="/@serene-pub/themes.css">
97
+ ```
98
+
99
+ ```js
100
+ port.onmessage = (e) => {
101
+ if (e.data.t !== 'theme') return
102
+ document.documentElement.dataset.theme = e.data.theme
103
+ document.documentElement.dataset.mode = e.data.mode
104
+ }
105
+ ```
106
+
107
+ Every stock theme's custom properties, served whole — tokens only, no utility
108
+ classes, because your own build owns those. All themes in one document, so a
109
+ theme switch is an attribute flip inside your frame: no reload, no lost state.
110
+
111
+ > Core does not send `{ t: 'theme' }` yet — the harness does, so you can build
112
+ > against it. Keep a sane default.
113
+
114
+ ## What each surface point actually receives
115
+
116
+ Scoped the way core scopes it, read off the three real call sites — so a surface
117
+ cannot be built against data an instance will never send it:
118
+
119
+ | point | receives |
120
+ |---|---|
121
+ | `panel` | `session`, per-lane `channel` posts (never the whole log), `props` |
122
+ | `session-view` | `session`, `messages` |
123
+ | `page` | `init` — and nothing else |
124
+
125
+ Every frame additionally gets the harness-only `theme` message. The stage's
126
+ **"Where this harness is not production"** panel lists that and every other
127
+ divergence in one place; read it once before you rely on anything.
128
+
129
+ Entry paths and panel ids are checked against the grammar an instance actually
130
+ accepts. Core drops a surface that fails it *silently*, so the harness refuses
131
+ to preview one — a surface it showed you there could never exist.
132
+
133
+ ## Two things frames cannot do — here or in production
134
+
135
+ The harness serves frame documents under core's real CSP, so both of these fail
136
+ in the harness exactly as they would after install:
137
+
138
+ - **No inline `<script>`** — `script-src 'self'`. Load your surface from a file.
139
+ - **No `<script type="module">`** — module scripts are always CORS-fetched, and a
140
+ frame is an opaque origin (`Origin: null`) that neither core's plugin-ui route
141
+ nor this harness answers with `Access-Control-Allow-Origin`. Use a classic
142
+ `<script src="…">`; it is not CORS-fetched.
143
+
144
+ ## Hot reload
145
+
146
+ - Editing a **surface** hot-reloads it. A component is always hot — *"components
147
+ render; they do not participate in a run"* (13 §11).
148
+ - Editing a **frame document** reloads that frame, and only that frame.
149
+ - Editing **what the package announces** rebuilds the list: which surfaces exist
150
+ may have changed, so the page reloads.
151
+
152
+ ## What it is not
153
+
154
+ It is not an instance. There is no database, no pipeline run, no install. The
155
+ data your surface sees is fixtures you can edit live — which is the point: a
156
+ surface can only ever render what the host chose to post it, and developing
157
+ against fixtures is what keeps that true.
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@serene-pub/ui-preview",
3
+ "version": "0.6.0-pr-1",
4
+ "description": "The Serene Pub surface harness: a SvelteKit dev server that renders the UI surfaces a package announces — frame panels in a real opaque-origin sandbox, components in the host document — with hot reload. Launched by `serene-pub ui`.",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://github.com/SerenePub/serene-pub-sdk/tree/main/ui-preview#readme",
7
+ "bugs": {
8
+ "url": "https://github.com/SerenePub/serene-pub-sdk/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/SerenePub/serene-pub-sdk.git",
13
+ "directory": "ui-preview"
14
+ },
15
+ "type": "module",
16
+ "engines": {
17
+ "node": ">=24"
18
+ },
19
+ "private": false,
20
+ "files": [
21
+ "src",
22
+ "static",
23
+ "vite",
24
+ "server.js",
25
+ "server.d.ts",
26
+ "svelte.config.js",
27
+ "vite.config.ts",
28
+ "README.md",
29
+ "NOTICE"
30
+ ],
31
+ "exports": {
32
+ "./server": {
33
+ "types": "./server.d.ts",
34
+ "import": "./server.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "scripts": {
39
+ "dev": "vite dev",
40
+ "build": "echo 'dev-only harness — nothing to build'",
41
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
42
+ },
43
+ "dependencies": {
44
+ "@serene-pub/controls": "^0.6.0-pr-1",
45
+ "@skeletonlabs/skeleton": "^5.0.0",
46
+ "@sveltejs/kit": "^2.22.0",
47
+ "@sveltejs/vite-plugin-svelte": "^5.1.0",
48
+ "@tailwindcss/forms": "^0.5.10",
49
+ "@tailwindcss/vite": "^4.0.0",
50
+ "svelte": "^5.56.0",
51
+ "tailwindcss": "^4.0.0",
52
+ "vite": "^6.4.0"
53
+ },
54
+ "peerDependencies": {
55
+ "@serene-pub/sdk": "^0.6.0-pr-1"
56
+ },
57
+ "devDependencies": {
58
+ "@serene-pub/sdk": "0.6.0-pr-1",
59
+ "svelte-check": "^4.0.0",
60
+ "typescript": "~5.9.0"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public",
64
+ "tag": "next"
65
+ }
66
+ }
package/server.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { ViteDevServer } from 'vite'
2
+
3
+ export interface SurfaceHarnessOptions {
4
+ /** The package to preview — where its entry module and UI files live. */
5
+ packageDir: string
6
+ port?: number
7
+ /** `true` binds all interfaces; a string binds that address. */
8
+ host?: boolean | string
9
+ open?: boolean
10
+ /** JSON file replacing the built-in fixtures. */
11
+ fixtures?: string
12
+ }
13
+
14
+ /** Start the surface harness. The caller owns the returned server's lifetime. */
15
+ export function startSurfaceHarness(opts: SurfaceHarnessOptions): Promise<ViteDevServer>
package/server.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Launching the harness. Plain JS on purpose: `serene-pub ui` imports this
3
+ * from Node directly, and a package that needed compiling before it could be
4
+ * started would need a build step in a package whose whole point is not having
5
+ * one.
6
+ *
7
+ * Vite is created programmatically rather than shelled out to, so the CLI owns
8
+ * the process: one Ctrl-C, one exit code, and no orphaned dev server left
9
+ * holding a port after the terminal goes away.
10
+ */
11
+ import { createServer } from 'vite'
12
+ import { dirname, resolve } from 'node:path'
13
+ import { fileURLToPath } from 'node:url'
14
+
15
+ const here = dirname(fileURLToPath(import.meta.url))
16
+
17
+ /**
18
+ * @param {{ packageDir: string, port?: number, host?: boolean|string, open?: boolean, fixtures?: string }} opts
19
+ * @returns {Promise<import('vite').ViteDevServer>}
20
+ */
21
+ export async function startSurfaceHarness(opts) {
22
+ // The config reads these: the harness is one installed copy pointed at
23
+ // whichever package the modder is working on, so the target cannot live in
24
+ // a config file committed to their repo.
25
+ process.env.SERENE_PUB_PACKAGE_DIR = resolve(opts.packageDir)
26
+ if (opts.fixtures) process.env.SERENE_PUB_FIXTURES = resolve(opts.fixtures)
27
+
28
+ // SvelteKit pins Vite's root to `process.cwd()` and says so out loud —
29
+ // passing `root` is not enough. Both paths above are already absolute, so
30
+ // moving the process here costs nothing, and it is what makes the harness
31
+ // runnable from inside the package being previewed.
32
+ process.chdir(here)
33
+
34
+ const server = await createServer({
35
+ root: here,
36
+ configFile: resolve(here, 'vite.config.ts'),
37
+ server: {
38
+ port: opts.port,
39
+ host: opts.host,
40
+ open: opts.open,
41
+ // Fail rather than wander to another port: a harness that silently
42
+ // moved would leave a modder reloading a stale tab.
43
+ strictPort: opts.port !== undefined,
44
+ },
45
+ })
46
+ await server.listen()
47
+ return server
48
+ }
package/src/app.css ADDED
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The harness's stylesheet — and it is the product's, not a tool's.
3
+ *
4
+ * An earlier draft kept this token-free on the argument that SP promises no
5
+ * token compatibility (RESEARCH §7b), so a harness dressed in core's theme
6
+ * would be teaching a contract that does not exist. That was wrong for one
7
+ * concrete reason: **the controls cannot render without it.** Skeleton ships
8
+ * `input`/`select`/`btn`/`checkbox`/`textarea` as Tailwind `@utility`, which
9
+ * means candidate-driven — a rule exists only if the scanner saw the literal
10
+ * class string. Without this layer a generated form is a column of unstyled
11
+ * boxes, which is 10 §6's "no rule at all" failure reproduced inside the very
12
+ * tool built to catch it.
13
+ *
14
+ * So the harness loads exactly what the app loads, in exactly the app's order
15
+ * (`src/app.css` there), and switches theme the way the app switches it:
16
+ * `data-theme="<name>"` and `data-mode="light|dark"` on <html>. Anything the
17
+ * modder sees here is therefore what the shipped Skeleton version does — and
18
+ * when SP moves to a new Skeleton major, this file moves with it and the
19
+ * harness keeps telling the truth.
20
+ */
21
+ @import "tailwindcss";
22
+
23
+ @plugin '@tailwindcss/forms';
24
+
25
+ @import "@skeletonlabs/skeleton";
26
+
27
+ /* Every stock theme, so the picker can offer all of them without a build
28
+ step per theme. Themes come after the base import: they override the
29
+ monochrome defaults in Skeleton's own theme.css. */
30
+ @import "@skeletonlabs/skeleton/themes/catppuccin";
31
+ @import "@skeletonlabs/skeleton/themes/cerberus";
32
+ @import "@skeletonlabs/skeleton/themes/concord";
33
+ @import "@skeletonlabs/skeleton/themes/crimson";
34
+ @import "@skeletonlabs/skeleton/themes/dracula";
35
+ @import "@skeletonlabs/skeleton/themes/fennec";
36
+ @import "@skeletonlabs/skeleton/themes/hamlindigo";
37
+ @import "@skeletonlabs/skeleton/themes/legacy";
38
+ @import "@skeletonlabs/skeleton/themes/mint";
39
+ @import "@skeletonlabs/skeleton/themes/modern";
40
+ @import "@skeletonlabs/skeleton/themes/mona";
41
+ @import "@skeletonlabs/skeleton/themes/nosh";
42
+ @import "@skeletonlabs/skeleton/themes/nouveau";
43
+ @import "@skeletonlabs/skeleton/themes/pine";
44
+ @import "@skeletonlabs/skeleton/themes/reign";
45
+ @import "@skeletonlabs/skeleton/themes/rocket";
46
+ @import "@skeletonlabs/skeleton/themes/rose";
47
+ @import "@skeletonlabs/skeleton/themes/rosepine";
48
+ @import "@skeletonlabs/skeleton/themes/sahara";
49
+ @import "@skeletonlabs/skeleton/themes/seafoam";
50
+ @import "@skeletonlabs/skeleton/themes/terminus";
51
+ @import "@skeletonlabs/skeleton/themes/vintage";
52
+ @import "@skeletonlabs/skeleton/themes/vox";
53
+ @import "@skeletonlabs/skeleton/themes/wintry";
54
+
55
+ /**
56
+ * `data-mode` is not a Skeleton convention — it is the app's, wired by this
57
+ * one line, and Skeleton's base layer turns it into `color-scheme` so every
58
+ * `light-dark()` token resolves. Copied verbatim from the app because a
59
+ * harness whose dark mode worked differently would be a harness that lies
60
+ * about dark mode.
61
+ */
62
+ @custom-variant dark (&:where([data-mode="dark"], [data-mode="dark"] *));
63
+
64
+ /**
65
+ * The scanner's reach, and the reason it is stated twice.
66
+ *
67
+ * `@serene-pub/controls` is raw Svelte source living under node_modules,
68
+ * which Tailwind v4 skips by a hardcoded default — not by .gitignore, so
69
+ * there is no way to opt in except by naming it. Both spellings are here
70
+ * because the package sits in a different place in the two layouts this
71
+ * harness runs in: hoisted to the workspace root when developed inside the
72
+ * SDK repo, and beside ui-preview in a modder's own node_modules. A path
73
+ * that matches nothing costs nothing; a path that is missing costs every
74
+ * control its styling, silently.
75
+ */
76
+ @source "../../node_modules/@serene-pub/controls/src";
77
+ @source "../../controls/src";
78
+
79
+ /**
80
+ * Harness chrome.
81
+ *
82
+ * Four semantic aliases over Skeleton's tokens, because the stage components
83
+ * (`FrameStage`, `ComponentStage`, `Problems`) style borders and dim text in
84
+ * their own scoped CSS and need a name for "a line" and "quieter text". They
85
+ * resolve to theme tokens rather than fixed colours, so switching the theme
86
+ * moves them — which is the point, and which a literal `#2a2f3e` would not do.
87
+ */
88
+ :root {
89
+ --line: var(--color-surface-200);
90
+ --muted: var(--color-surface-600);
91
+ --accent: var(--color-primary-500);
92
+ --panel: var(--color-surface-50);
93
+ }
94
+ [data-mode='dark'] {
95
+ --line: var(--color-surface-800);
96
+ --muted: var(--color-surface-400);
97
+ --panel: var(--color-surface-950);
98
+ }
99
+
100
+ html,
101
+ body {
102
+ height: 100%;
103
+ }
104
+ body {
105
+ margin: 0;
106
+ background: var(--panel);
107
+ color: var(--color-surface-950);
108
+ }
109
+ [data-mode='dark'] body {
110
+ color: var(--color-surface-50);
111
+ }
112
+
113
+ /* Shared by the stage components' scoped CSS. */
114
+ .muted {
115
+ color: var(--muted);
116
+ }
117
+ .problems {
118
+ border: 1px solid var(--color-warning-500);
119
+ border-radius: 8px;
120
+ padding: 0.7rem 0.9rem;
121
+ margin: 0 0 1rem;
122
+ background: color-mix(in srgb, var(--color-warning-500) 12%, transparent);
123
+ font-size: 0.85rem;
124
+ }
125
+ .problems h3 {
126
+ margin: 0 0 0.4rem;
127
+ font-size: 0.8rem;
128
+ letter-spacing: 0.08em;
129
+ text-transform: uppercase;
130
+ color: var(--color-warning-600);
131
+ }
132
+ .problems ul {
133
+ margin: 0;
134
+ padding-inline-start: 1.1rem;
135
+ }
136
+ .problems li {
137
+ white-space: pre-wrap;
138
+ }
139
+ .harness-mono {
140
+ font-family: ui-monospace, "SF Mono", Menlo, monospace;
141
+ }
142
+ .harness-scroll {
143
+ scrollbar-width: thin;
144
+ }