tosijs-ui 1.15.5 → 1.16.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/CHANGELOG.md +165 -0
- package/NOTICE +28 -0
- package/bin/caddy-install.ts +4 -4
- package/bin/format.ts +96 -0
- package/bin/release-notes.ts +24 -4
- package/dist/ab-test.d.ts +6 -6
- package/dist/ab-test.js +5 -6
- package/dist/babylon-3d.d.ts +8 -8
- package/dist/babylon-3d.js +15 -16
- package/dist/bodymovin-player.d.ts +7 -6
- package/dist/bodymovin-player.js +5 -6
- package/dist/carousel.d.ts +12 -11
- package/dist/carousel.js +10 -11
- package/dist/code-editor.d.ts +6 -6
- package/dist/code-editor.js +5 -6
- package/dist/crud.d.ts +9 -9
- package/dist/crud.js +8 -9
- package/dist/data-table.d.ts +19 -18
- package/dist/data-table.js +17 -18
- package/dist/diff.d.ts +9 -9
- package/dist/diff.js +15 -16
- package/dist/doc-system/css-var-editor.d.ts +6 -6
- package/dist/doc-system/css-var-editor.js +5 -6
- package/dist/doc-system/doc-system.d.ts +13 -12
- package/dist/doc-system/doc-system.js +19 -20
- package/dist/doc-system/example-policy.d.ts +43 -3
- package/dist/doc-system/example-policy.js +89 -8
- package/dist/doc-system/highlight.d.ts +5 -1
- package/dist/doc-system/highlight.js +11 -14
- package/dist/doc-system/release-notes.d.ts +15 -0
- package/dist/doc-system/release-notes.js +30 -0
- package/dist/doc-system/render.js +10 -1
- package/dist/doc-system/site/check-examples.js +8 -12
- package/dist/doc-system/site/epub.js +6 -5
- package/dist/doc-system/site/generate-site.d.ts +7 -7
- package/dist/doc-system/site/generate-site.js +3 -1
- package/dist/doc-system/site/host-preset.d.ts +2 -2
- package/dist/doc-system/site/host-preset.js +2 -2
- package/dist/doc-system/site/index.d.ts +1 -0
- package/dist/doc-system/site/index.js +3 -0
- package/dist/doc-system/site/orchestrator.js +17 -5
- package/dist/editable-rect.d.ts +6 -7
- package/dist/editable-rect.js +5 -6
- package/dist/filter-builder.d.ts +6 -6
- package/dist/filter-builder.js +6 -7
- package/dist/float.d.ts +8 -7
- package/dist/float.js +6 -7
- package/dist/form.d.ts +17 -16
- package/dist/form.js +15 -16
- package/dist/highlight-block.d.ts +6 -6
- package/dist/highlight-block.js +5 -6
- package/dist/icons.d.ts +9 -9
- package/dist/icons.js +8 -9
- package/dist/iife.js +101 -101
- package/dist/iife.js.map +58 -54
- package/dist/index-iife.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layout.d.ts +22 -21
- package/dist/layout.js +18 -21
- package/dist/live-example/component.d.ts +14 -10
- package/dist/live-example/component.js +158 -26
- package/dist/live-example/dialects.d.ts +66 -0
- package/dist/live-example/dialects.js +89 -0
- package/dist/live-example/error-location.js +2 -1
- package/dist/live-example/index.d.ts +2 -0
- package/dist/live-example/index.js +2 -0
- package/dist/live-example/insert-examples.js +51 -21
- package/dist/live-example/save-to-source.js +4 -5
- package/dist/localize.d.ts +8 -9
- package/dist/localize.js +7 -9
- package/dist/mapbox.d.ts +9 -8
- package/dist/mapbox.js +7 -8
- package/dist/markdown-viewer.d.ts +9 -12
- package/dist/markdown-viewer.js +62 -42
- package/dist/menu.d.ts +11 -11
- package/dist/menu.js +16 -17
- package/dist/month.d.ts +16 -16
- package/dist/month.js +19 -20
- package/dist/password-strength.d.ts +7 -7
- package/dist/password-strength.js +6 -7
- package/dist/pocket-bar.d.ts +7 -7
- package/dist/pocket-bar.js +6 -7
- package/dist/rating.d.ts +18 -17
- package/dist/rating.js +16 -17
- package/dist/rich-text.d.ts +7 -7
- package/dist/rich-text.js +6 -7
- package/dist/router.d.ts +6 -5
- package/dist/router.js +4 -5
- package/dist/schema-form.d.ts +5 -5
- package/dist/schema-form.js +4 -5
- package/dist/search-field.d.ts +74 -0
- package/dist/search-field.js +742 -0
- package/dist/segmented.d.ts +12 -12
- package/dist/segmented.js +10 -11
- package/dist/select.d.ts +13 -13
- package/dist/select.js +17 -18
- package/dist/side-nav.d.ts +9 -9
- package/dist/side-nav.js +16 -17
- package/dist/size-break.d.ts +7 -6
- package/dist/size-break.js +5 -6
- package/dist/tab-selector.d.ts +6 -6
- package/dist/tab-selector.js +4 -5
- package/dist/tag-colors.d.ts +8 -0
- package/dist/tag-colors.js +25 -0
- package/dist/tag-list.d.ts +11 -72
- package/dist/tag-list.js +15 -99
- package/dist/tag.d.ts +63 -0
- package/dist/tag.js +77 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +4 -2
- package/package.json +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,170 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.16.1
|
|
4
|
+
|
|
5
|
+
A patch: everything here is additive. Two features, a search field that suggests refinements
|
|
6
|
+
and pluggable live-example dialects, and nothing that changes how existing code behaves.
|
|
7
|
+
`dist/iife.js` grows by 2.9 kB gzip (469.9 → 472.8 kB), which is both features going through
|
|
8
|
+
the batteries-included bundle; the ESM path pays only for what it imports.
|
|
9
|
+
|
|
10
|
+
### `<tosi-search-field>`: a search box that suggests refinements (snowfox, virta #2459)
|
|
11
|
+
|
|
12
|
+
A new component in the spirit of Finder's search field. As you type, it lists **hints** from
|
|
13
|
+
rules you supply: type `doc` and it can offer *name contains "doc"* or *Word documents*.
|
|
14
|
+
Picking one turns it into a **tag** in the query and consumes the text, and you can keep
|
|
15
|
+
typing. `value` is `{ tags, text }`.
|
|
16
|
+
|
|
17
|
+
- A tag is `{ caption, background?, color?, …your data }`, with chips coloured like
|
|
18
|
+
`<tosi-tag-list>`'s.
|
|
19
|
+
- It fires `change` when the tags change, and `action` on Enter when no hint is highlighted.
|
|
20
|
+
- It is a real combobox: focus stays in the field, ↓/↑ move through the hints, Escape closes
|
|
21
|
+
them, and Backspace in an empty field removes the last tag. The hints close only for a
|
|
22
|
+
scroll that moves the field itself, so a table re-filtering on every keystroke (which
|
|
23
|
+
scrolls it) doesn't close them the instant they open, and scrolling past the end of the list
|
|
24
|
+
doesn't scroll the page.
|
|
25
|
+
- A clear (✕) button, shown when there's anything to clear, removes the tags and the text
|
|
26
|
+
(also `clear()`).
|
|
27
|
+
- **As a filter:** give each tag a `test(item)` and the field a `textTest(item, text)`, and
|
|
28
|
+
`field.filter` is an array filter to hand straight to `<tosi-table>.filter`. The docs filter
|
|
29
|
+
the 3,655-row emoji table this way. `hints` and `textTest` can be passed to the element
|
|
30
|
+
creator like any other property; `textTest` defaults to `null`, because tosijs sets a creator
|
|
31
|
+
prop as a property only when its default is not `undefined` (otherwise it was stored as an
|
|
32
|
+
attribute, a stringified function). `filter` returns the same function until the query
|
|
33
|
+
changes, so a table's filter memo holds.
|
|
34
|
+
- Importing it on its own (`tosijs-ui/search-field`) costs 25.5 kB gzip: `<tosi-tag>` moved
|
|
35
|
+
into its own module (still exported from `tag-list`), so it no longer pulls in the menu
|
|
36
|
+
system.
|
|
37
|
+
|
|
38
|
+
### Pluggable dialects for live examples (#184)
|
|
39
|
+
|
|
40
|
+
Live examples can now be written in languages tosijs-ui doesn't know about. `registerDialect`
|
|
41
|
+
from `tosijs-ui/live-example` adds one, and a fence in that language becomes a live example
|
|
42
|
+
like `js`, `tjs` and `ts`: it groups with `html`/`css`/`test` blocks, honours `:static` and the
|
|
43
|
+
site's example policy, and saves back to source. `js`, `tjs` and `ts` are now built-in entries
|
|
44
|
+
of the same registry.
|
|
45
|
+
|
|
46
|
+
A dialect either **transforms** its source to JavaScript that the example runs as usual, or
|
|
47
|
+
**runs** it itself — given the example's preview, its options, the page's modules, an
|
|
48
|
+
`AbortSignal` for when the example re-runs, and `report()` for showing a result. Registering
|
|
49
|
+
over a built-in (`registerDialect('tjs', { transform })`) swaps in your own tjs-lang build.
|
|
50
|
+
This is what tjs-lang asked for to move AJS into doc pages; see the live-example page, "Adding
|
|
51
|
+
a dialect".
|
|
52
|
+
|
|
53
|
+
If your dialect's name is also a syntax-highlighting grammar, call `registerLiveLanguage` from
|
|
54
|
+
`tosijs-ui/site` in your site config too: the build-time highlighter never sees page
|
|
55
|
+
registrations, and would otherwise tokenize the source the example reads.
|
|
56
|
+
|
|
57
|
+
A replaced built-in is what runs in the browser, in dev and on the deployed site alike: the
|
|
58
|
+
build pre-transpiles `tjs` examples with the installed tjs-lang (so readers don't load the
|
|
59
|
+
transpiler), and the page skips that pre-transpiled code once the site registers its own `tjs`.
|
|
60
|
+
The build-time example check still transpiles `tjs` fences with the installed tjs-lang, so an
|
|
61
|
+
override that accepts newer syntax can fail that check; `checkExamples: false` is the escape
|
|
62
|
+
until the site config can say `tjs` is overridden.
|
|
63
|
+
|
|
64
|
+
Fence languages are case-sensitive, as they were in 1.16.0: ```` ```JS ```` is not a live
|
|
65
|
+
example. One visible difference: 1.16.0 also left such a fence unhighlighted, and it is now
|
|
66
|
+
highlighted as ordinary static code, on the page and in the ePub.
|
|
67
|
+
|
|
68
|
+
**Fence options.** Any fence can carry a JSON object after its language,
|
|
69
|
+
`` ```tjs {"runTests": "report"} ``, passed to its dialect as `options`. Malformed options are
|
|
70
|
+
reported in the console with the example they belong to.
|
|
71
|
+
|
|
72
|
+
Two more copies of "which languages run" were found while doing this, a hard-coded selector in
|
|
73
|
+
`insertExamples` and a private fence parser in the example checker, which would have read
|
|
74
|
+
`{"debug":true}` as the mode `true`. Both now use the shared rule.
|
|
75
|
+
|
|
76
|
+
## 1.16.0
|
|
77
|
+
|
|
78
|
+
### `<tosi-md>` sanitizes by default (#179)
|
|
79
|
+
|
|
80
|
+
**Breaking, as announced by 1.15.3's console warning.** A `<tosi-md>` with no `sanitize`
|
|
81
|
+
attribute now strips executable content, where it used to render raw HTML from the markdown.
|
|
82
|
+
Markdown from anyone other than you (issue bodies, comments, API data) could otherwise run
|
|
83
|
+
script in your page: tosijs-virta's review read a login token out of `localStorage` that way.
|
|
84
|
+
|
|
85
|
+
If your markdown deliberately embeds HTML that sanitizing removes (`script`, `style`, `iframe`,
|
|
86
|
+
`form`, event-handler attributes, `javascript:` or `data:` links, and a few more), set
|
|
87
|
+
`sanitize="off"` on that element, and only for markdown you control. Ordinary markdown, links
|
|
88
|
+
and inputs render exactly as before; custom elements do not (see the next paragraph). Only the exact value `off`
|
|
89
|
+
opts out; anything else, a typo included, sanitizes. The once-per-page warning is gone.
|
|
90
|
+
|
|
91
|
+
**Custom elements are unwrapped when sanitizing** (their sanitized content is kept, the element
|
|
92
|
+
is not): a component is code, and some render raw HTML or run code of their own, so untrusted
|
|
93
|
+
markdown must not be able to instantiate them. The pre-release review showed a nested
|
|
94
|
+
`<tosi-md sanitize="off">` escaping the sanitizer. Allow trusted display components by name
|
|
95
|
+
with the new `allowed-elements` attribute (space- or comma-separated), e.g.
|
|
96
|
+
`<tosi-md allowed-elements="tosi-icon tosi-tag">`, or the `allowedElements` property; changing it
|
|
97
|
+
re-renders. `tosi-md`, `tosi-example` and `tosi-doc-system` are never allowed, because they render
|
|
98
|
+
raw HTML or run code.
|
|
99
|
+
|
|
100
|
+
### ESM doc sites no longer load their entry bundle twice (#191)
|
|
101
|
+
|
|
102
|
+
A doc site built with `bundleEntry` loaded its entry as `hydrate.js?v=<hash>`, while its
|
|
103
|
+
code-split chunks import the entry back as `../hydrate.js`. Those are different URLs, so the
|
|
104
|
+
browser created **two module instances of the entry** on every page: everything in it ran twice,
|
|
105
|
+
and a module that patches a prototype in a shared chunk threw on the second pass (Babylon's
|
|
106
|
+
`Cannot redefine property: onBeforeViewRenderObservable`, which also broke its shaders). Reported
|
|
107
|
+
with a clean before/after measurement by tosijs-3d-ensemble.
|
|
108
|
+
|
|
109
|
+
The entry is now built as **`hydrate-<hash>.js`** and loaded with no query string, so the page
|
|
110
|
+
and every chunk name one URL, and a rebuild still busts caches. **Rebuild your site to pick it
|
|
111
|
+
up.** Anything that refers to `hydrate.js` by name must follow the rename: CSP or SRI entries,
|
|
112
|
+
`<link rel="modulepreload">`, host cache rules, service workers, smoke checks.
|
|
113
|
+
|
|
114
|
+
### Prettier never touches markdown, and `tosijs-format` (#187)
|
|
115
|
+
|
|
116
|
+
Markdown is authored prose, and in this stack the product: all Prettier did to it was escape
|
|
117
|
+
literal characters, pad tables and rewrite bullets and emphasis (`*n*` → `_n_`). tosijs-ui has
|
|
118
|
+
ignored it since 1.14.0, but the rule never reached the other repos. **The fix belongs in your
|
|
119
|
+
Prettier config**, where every entry point reads it (editors' format-on-save, lint-staged, a bare
|
|
120
|
+
`prettier --write`):
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
"overrides": [
|
|
124
|
+
{ "files": ["*.md", "*.markdown", "*.mdx"], "options": { "requirePragma": true } }
|
|
125
|
+
]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**New `tosijs-format` bin**, a convenience on top: `eslint --fix` (when the project has an
|
|
129
|
+
`eslint.config.*`; its `ignores` decide the scope) then `prettier --write .`, excluding markdown on
|
|
130
|
+
the command line too. `tosijs-format --check` checks instead and exits 1 on anything unformatted or
|
|
131
|
+
any lint error, for CI. It uses your project's own Prettier and ESLint.
|
|
132
|
+
|
|
133
|
+
tosijs-ui's own CI now lints through it, which found 32 unused `Component` / `WebComponent`
|
|
134
|
+
imports left by this release's tosijs 1.10 migration (fixed before release; the migration had
|
|
135
|
+
passed every lane because nothing ran ESLint).
|
|
136
|
+
|
|
137
|
+
### `tosijs-release-notes --check` reads only the section being released
|
|
138
|
+
|
|
139
|
+
It matched annotations against the whole CHANGELOG, so wording from OLDER releases could count a
|
|
140
|
+
new bullet as written up: this release's #191 fix had no entry and the gate still said "all
|
|
141
|
+
accounted for". It now reads only the section for the version being released and fails when that
|
|
142
|
+
section is missing. **Heading formats it recognises:** `## 1.16.0`, `## v1.16.0`, and Keep a
|
|
143
|
+
Changelog's `## [1.16.0]` / `## [v1.16.0]`, each with any suffix (a date, "(unreleased)"). The
|
|
144
|
+
section lookup is exported as `changelogSection`. If your gate goes red after upgrading, check
|
|
145
|
+
that the section heading names the exact version. When `package.json` still names the version that
|
|
146
|
+
is already tagged, it now says so ("bump the version before running --check") instead of
|
|
147
|
+
reporting every new bullet as unwritten.
|
|
148
|
+
|
|
149
|
+
### tosijs 1.10: components are typed from their attributes
|
|
150
|
+
|
|
151
|
+
**Breaking, type-level only: the tosijs peer floor is now `^1.10.3`.** 1.10.0 removed
|
|
152
|
+
`Component`'s `[key: string]: any` index signature (tosijs#36), and 1.10.1 fixed the declaration
|
|
153
|
+
emit (TS2742, tosijs#38) that had blocked this adoption since 2026-09-04. Every component declares its
|
|
154
|
+
attributes with tosijs's `withAttributes()`, so a component instance is typed from its attribute
|
|
155
|
+
values: `tosiRating().max` is a `number`, a misspelt property is a type error, and so is
|
|
156
|
+
assigning the wrong type. On tosijs 1.9 TypeScript did not know `max` existed at all, because
|
|
157
|
+
`Component` carried an any-index signature that tosijs 1.10 removed (tosijs#36). Nothing changes
|
|
158
|
+
at runtime. Element-creator *arguments* are not typed by this. See
|
|
159
|
+
[Migrating](/migrating/) for your own components.
|
|
160
|
+
|
|
161
|
+
### The CDN bundle updates tosijs-schema and grows 2.8kB
|
|
162
|
+
|
|
163
|
+
`dist/iife.js` (the single-`<script>` bundle) inlines tosijs-schema as the `<tosi-schema-form>`
|
|
164
|
+
validator; it moves from 1.8.0 to 1.10.2. It also carries tosijs 1.10 and the CodeMirror updates:
|
|
165
|
+
**+2.8kB gzip (+0.6%, 466,942 → 469,753 bytes)**. The ESM build is unaffected (tosijs-schema is an
|
|
166
|
+
optional peer there). `NOTICE` now attributes tosijs-schema and tosijs-kilpi, both bundled.
|
|
167
|
+
|
|
3
168
|
## 1.15.5
|
|
4
169
|
|
|
5
170
|
### `<tosi-select>` options can have keyboard shortcuts (#188)
|
package/NOTICE
CHANGED
|
@@ -71,6 +71,34 @@ Feather. The full permission notice is reproduced in `src/icons.ts` and on
|
|
|
71
71
|
the icons documentation page.
|
|
72
72
|
--------------------------------------------------------------------------
|
|
73
73
|
|
|
74
|
+
--------------------------------------------------------------------------
|
|
75
|
+
tosijs-kilpi — https://www.npmjs.com/package/tosijs-kilpi
|
|
76
|
+
Apache License 2.0. Bundled into `dist/iife.js` (the sanitizer behind
|
|
77
|
+
<tosi-md>). Reproduced from the tosijs-kilpi package's own NOTICE:
|
|
78
|
+
|
|
79
|
+
kilpi
|
|
80
|
+
Copyright 2026 Tonio Loewald
|
|
81
|
+
|
|
82
|
+
This product includes software developed as part of DOMPurify.
|
|
83
|
+
|
|
84
|
+
test/dompurify-fixtures.mjs is vendored verbatim from DOMPurify
|
|
85
|
+
(https://github.com/cure53/DOMPurify), test/fixtures/expect.mjs
|
|
86
|
+
Copyright (c) 2015 Mario Heiderich
|
|
87
|
+
Licensed under (MPL-2.0 OR Apache-2.0); used here under Apache-2.0.
|
|
88
|
+
|
|
89
|
+
That file is DOMPurify's published XSS payload corpus, used as kilpi's
|
|
90
|
+
verification gate. No DOMPurify source code is included or distributed in the
|
|
91
|
+
published package — the corpus is a test fixture only, and is not part of the
|
|
92
|
+
npm tarball.
|
|
93
|
+
--------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
--------------------------------------------------------------------------
|
|
96
|
+
tosijs-schema — https://github.com/tonioloewald/tosijs-schema
|
|
97
|
+
MIT. Bundled into `dist/iife.js`, which wires it in as the <tosi-schema-form>
|
|
98
|
+
validator for CDN users. The ESM build does not bundle it (it is an optional
|
|
99
|
+
peer there).
|
|
100
|
+
--------------------------------------------------------------------------
|
|
101
|
+
|
|
74
102
|
--------------------------------------------------------------------------
|
|
75
103
|
CodeMirror — https://codemirror.net/
|
|
76
104
|
Copyright (c) by Marijn Haverbeke and others. MIT.
|
package/bin/caddy-install.ts
CHANGED
|
@@ -121,9 +121,9 @@ set -a; . /etc/caddy/preview.env; set +a
|
|
|
121
121
|
: "\${ACME_EMAIL:?set ACME_EMAIL in /etc/caddy/preview.env}"
|
|
122
122
|
: "\${PREVIEW_DOMAIN:?set PREVIEW_DOMAIN in /etc/caddy/preview.env}"
|
|
123
123
|
|
|
124
|
-
sed -e "s|__PREVIEW_TOKEN__
|
|
125
|
-
-e "s|{{ACME_EMAIL}}
|
|
126
|
-
-e "s|{{PREVIEW_DOMAIN}}
|
|
124
|
+
sed -e "s|__PREVIEW_TOKEN__|$PREVIEW_TOKEN|g" \\
|
|
125
|
+
-e "s|{{ACME_EMAIL}}|$ACME_EMAIL|g" \\
|
|
126
|
+
-e "s|{{PREVIEW_DOMAIN}}|$PREVIEW_DOMAIN|g" \\
|
|
127
127
|
/etc/caddy/Caddyfile.tpl > /etc/caddy/Caddyfile.new
|
|
128
128
|
|
|
129
129
|
if grep -qE '\\{\\{|__PREVIEW_TOKEN__' /etc/caddy/Caddyfile.new; then
|
|
@@ -150,7 +150,7 @@ else
|
|
|
150
150
|
echo "--- would change /etc/caddy/Caddyfile (token redacted) ---"
|
|
151
151
|
if [ -f /etc/caddy/Caddyfile ]; then
|
|
152
152
|
diff -u /etc/caddy/Caddyfile /etc/caddy/Caddyfile.new \\
|
|
153
|
-
| sed "s
|
|
153
|
+
| sed "s|$PREVIEW_TOKEN|***REDACTED***|g" || true
|
|
154
154
|
else
|
|
155
155
|
echo "(no existing /etc/caddy/Caddyfile — this would create it)"
|
|
156
156
|
fi
|
package/bin/format.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/*
|
|
3
|
+
tosijs-format — the house format step, shipped as a command (#187).
|
|
4
|
+
|
|
5
|
+
tosijs-format eslint --fix, then prettier --write (markdown excluded)
|
|
6
|
+
tosijs-format --check eslint, then prettier --check (markdown excluded); exit 1 on any finding
|
|
7
|
+
|
|
8
|
+
**Prettier never touches markdown** in this stack. The rule itself lives in the Prettier
|
|
9
|
+
CONFIG, where every entry point reads it (editors, lint-staged, a bare `prettier --write`):
|
|
10
|
+
|
|
11
|
+
"overrides": [{ "files": ["*.md", "*.markdown", "*.mdx"], "options": { "requirePragma": true } }]
|
|
12
|
+
|
|
13
|
+
This command is a convenience on top: the house sequence in one step, excluding markdown on the
|
|
14
|
+
command line as well, so it holds even in a repo whose config hasn't got the override yet.
|
|
15
|
+
(1.16.0 first shipped this believing a v2 config could not exclude markdown; the pre-release
|
|
16
|
+
review showed `requirePragma` does, verified on 2.8.8 including editors' `--stdin-filepath`.)
|
|
17
|
+
|
|
18
|
+
Why markdown is excluded: markdown here is the PRODUCT (docs, a book, llms.txt). With
|
|
19
|
+
`proseWrap: preserve`, all Prettier did to it was escape literal characters, pad tables and
|
|
20
|
+
rewrite bullets and emphasis in authored prose.
|
|
21
|
+
|
|
22
|
+
ESLint runs only when the project has a flat config (`eslint.config.*`), over `.`, so the
|
|
23
|
+
project's own `ignores` decide the scope. Both tools come from the PROJECT's node_modules: this
|
|
24
|
+
is a formatting step, not a formatter, and the project pins the versions. Any step that fails
|
|
25
|
+
fails the command.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { existsSync, readdirSync } from 'fs'
|
|
29
|
+
import { join } from 'path'
|
|
30
|
+
import { parseArgv } from './resolve-site-config.ts'
|
|
31
|
+
|
|
32
|
+
const { has } = parseArgv(process.argv.slice(2), {
|
|
33
|
+
bin: 'tosijs-format',
|
|
34
|
+
summary: 'the house format step: eslint, then prettier (never markdown)',
|
|
35
|
+
flags: ['check'],
|
|
36
|
+
usage:
|
|
37
|
+
` tosijs-format eslint --fix ., then prettier --write . (markdown excluded)\n` +
|
|
38
|
+
` tosijs-format --check check only: exit 1 on anything unformatted or any lint error\n\n` +
|
|
39
|
+
`Uses the project's own prettier and eslint (node_modules/.bin). ESLint runs only when the\n` +
|
|
40
|
+
`project has an eslint.config.* file.`,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const check = has('check')
|
|
44
|
+
const root = process.cwd()
|
|
45
|
+
const bin = (name: string) => join(root, 'node_modules', '.bin', name)
|
|
46
|
+
|
|
47
|
+
function run(argv: string[]): number {
|
|
48
|
+
const r = Bun.spawnSync(argv, {
|
|
49
|
+
cwd: root,
|
|
50
|
+
stdout: 'inherit',
|
|
51
|
+
stderr: 'inherit',
|
|
52
|
+
})
|
|
53
|
+
return r.exitCode ?? 1
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!existsSync(bin('prettier'))) {
|
|
57
|
+
console.error(
|
|
58
|
+
'🛑 tosijs-format: prettier is not installed in this project (bun add -d prettier)'
|
|
59
|
+
)
|
|
60
|
+
process.exit(1)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let failed = false
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
ESLint FIRST, then Prettier: `eslint --fix` rewrites code, and its output is not always what
|
|
67
|
+
Prettier would write, so running it second left files that `--check` then flagged (seen on the
|
|
68
|
+
first run of this command in tosijs-ui).
|
|
69
|
+
*/
|
|
70
|
+
const hasEslintConfig = readdirSync(root).some((f) =>
|
|
71
|
+
/^eslint\.config\.[cm]?[jt]s$/.test(f)
|
|
72
|
+
)
|
|
73
|
+
if (hasEslintConfig) {
|
|
74
|
+
if (!existsSync(bin('eslint'))) {
|
|
75
|
+
console.error(
|
|
76
|
+
'🛑 tosijs-format: eslint.config found but eslint is not installed (bun add -d eslint)'
|
|
77
|
+
)
|
|
78
|
+
failed = true
|
|
79
|
+
} else if (run([bin('eslint'), '.', ...(check ? [] : ['--fix'])]) !== 0) {
|
|
80
|
+
failed = true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// The exclusion is the point of this command: prettier never touches markdown.
|
|
85
|
+
if (
|
|
86
|
+
run([
|
|
87
|
+
bin('prettier'),
|
|
88
|
+
check ? '--check' : '--write',
|
|
89
|
+
'.',
|
|
90
|
+
'!**/*.{md,markdown,mdx}',
|
|
91
|
+
]) !== 0
|
|
92
|
+
) {
|
|
93
|
+
failed = true
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
process.exit(failed ? 1 : 0)
|
package/bin/release-notes.ts
CHANGED
|
@@ -67,6 +67,8 @@ import {
|
|
|
67
67
|
collect,
|
|
68
68
|
renderSection,
|
|
69
69
|
uncovered,
|
|
70
|
+
changelogSection,
|
|
71
|
+
alreadyTagged,
|
|
70
72
|
classifyBump,
|
|
71
73
|
bumpConcerns,
|
|
72
74
|
unsupportedClaims,
|
|
@@ -102,9 +104,25 @@ const total = records.flatMap((r) => r.bullets)
|
|
|
102
104
|
const publishable = total.filter((b) => b.tag !== 'note')
|
|
103
105
|
|
|
104
106
|
if (has('check')) {
|
|
105
|
-
const
|
|
107
|
+
const fullChangelog = await Bun.file('CHANGELOG.md')
|
|
106
108
|
.text()
|
|
107
109
|
.catch(() => '')
|
|
110
|
+
// Only the section being released counts: older prose must not cover a new bullet (B2).
|
|
111
|
+
const changelog = changelogSection(fullChangelog, version)
|
|
112
|
+
// An un-bumped version checks the section that was already RELEASED, and every new bullet
|
|
113
|
+
// then looks unwritten. Say that, instead of asking for prose that already exists.
|
|
114
|
+
if (alreadyTagged(since, version)) {
|
|
115
|
+
console.error(
|
|
116
|
+
`\n🛑 package.json is ${version}, which is already tagged ${since}. Bump the version ` +
|
|
117
|
+
`before running --check (or pass --version=X.Y.Z).`
|
|
118
|
+
)
|
|
119
|
+
process.exit(1)
|
|
120
|
+
}
|
|
121
|
+
if (!changelog && publishable.length) {
|
|
122
|
+
console.error(
|
|
123
|
+
`\n🛑 CHANGELOG.md has no \`## ${version}\` section to check against.`
|
|
124
|
+
)
|
|
125
|
+
}
|
|
108
126
|
const missed = uncovered(records, changelog)
|
|
109
127
|
const unsupported = unsupportedClaims(records)
|
|
110
128
|
let bad = 0
|
|
@@ -114,7 +132,7 @@ if (has('check')) {
|
|
|
114
132
|
console.error(
|
|
115
133
|
`\n🛑 ${missed.length} annotation(s) since ${
|
|
116
134
|
since || 'the start'
|
|
117
|
-
} are not mentioned in CHANGELOG.md:\n`
|
|
135
|
+
} are not mentioned in the \`## ${version}\` section of CHANGELOG.md:\n`
|
|
118
136
|
)
|
|
119
137
|
for (const b of missed)
|
|
120
138
|
console.error(` [${b.tag}] ${b.text} (${b.sha.slice(0, 8)})`)
|
|
@@ -146,7 +164,9 @@ if (has('check')) {
|
|
|
146
164
|
|
|
147
165
|
So this keys on the diff and the annotations rather than on what the release was called.
|
|
148
166
|
*/
|
|
149
|
-
|
|
167
|
+
// Named apart from the outer `version` (the --version flag): shadowing it put the CHANGELOG
|
|
168
|
+
// section lookup above in the temporal dead zone.
|
|
169
|
+
const pkgVersion = (await Bun.file('package.json').json()).version as string
|
|
150
170
|
const changedPaths = since
|
|
151
171
|
? (await $`git diff --name-only ${since}...HEAD`.nothrow().quiet().text())
|
|
152
172
|
.split('\n')
|
|
@@ -154,7 +174,7 @@ if (has('check')) {
|
|
|
154
174
|
: []
|
|
155
175
|
const concerns = since
|
|
156
176
|
? bumpConcerns({
|
|
157
|
-
bump: classifyBump(since,
|
|
177
|
+
bump: classifyBump(since, pkgVersion),
|
|
158
178
|
bullets: total,
|
|
159
179
|
changedPaths,
|
|
160
180
|
})
|
package/dist/ab-test.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const AbTest_base: import("tosijs").WithAttributes<{
|
|
2
|
+
condition: string;
|
|
3
|
+
not: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare class AbTest extends AbTest_base {
|
|
3
6
|
static preferredTagName: string;
|
|
4
7
|
static set conditions(context: {
|
|
5
8
|
[key: string]: any;
|
|
6
9
|
});
|
|
7
|
-
static initAttributes: {
|
|
8
|
-
condition: string;
|
|
9
|
-
not: boolean;
|
|
10
|
-
};
|
|
11
10
|
static instances: Set<AbTest>;
|
|
12
11
|
connectedCallback(): void;
|
|
13
12
|
disconnectedCallback(): void;
|
|
14
13
|
render(): void;
|
|
15
14
|
}
|
|
16
15
|
export declare const abTest: import("tosijs").ElementCreator<AbTest>;
|
|
16
|
+
export {};
|
package/dist/ab-test.js
CHANGED
|
@@ -76,9 +76,12 @@ randomize()
|
|
|
76
76
|
- `not` reverses the condition (so `<tosi-ab not condition="foo">` will be visible if `conditions.foo` is `false`)
|
|
77
77
|
*/
|
|
78
78
|
/*{ "parent": "Helper Libraries" }*/
|
|
79
|
-
import {
|
|
79
|
+
import { withAttributes } from 'tosijs';
|
|
80
80
|
const abTestConditions = {};
|
|
81
|
-
export class AbTest extends
|
|
81
|
+
export class AbTest extends withAttributes({
|
|
82
|
+
condition: '',
|
|
83
|
+
not: false,
|
|
84
|
+
}) {
|
|
82
85
|
static preferredTagName = 'tosi-ab';
|
|
83
86
|
static set conditions(context) {
|
|
84
87
|
Object.assign(abTestConditions, context);
|
|
@@ -86,10 +89,6 @@ export class AbTest extends Component {
|
|
|
86
89
|
abTest.queueRender();
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
|
-
static initAttributes = {
|
|
90
|
-
condition: '',
|
|
91
|
-
not: false,
|
|
92
|
-
};
|
|
93
92
|
static instances = new Set();
|
|
94
93
|
connectedCallback() {
|
|
95
94
|
super.connectedCallback();
|
package/dist/babylon-3d.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementCreator } from 'tosijs';
|
|
2
2
|
type B3dCallback = ((element: B3d, BABYLON: any) => void) | ((element: B3d, BABYLON: any) => Promise<void>);
|
|
3
3
|
interface B3dUIOptions {
|
|
4
4
|
snippetId?: string;
|
|
@@ -7,6 +7,12 @@ interface B3dUIOptions {
|
|
|
7
7
|
size?: number;
|
|
8
8
|
}
|
|
9
9
|
type MeshProcessCallback = (meshes: any[]) => void;
|
|
10
|
+
declare const B3d_base: import("tosijs").WithAttributes<{
|
|
11
|
+
src: string;
|
|
12
|
+
clearColor: string;
|
|
13
|
+
fov: number;
|
|
14
|
+
heroLight: boolean;
|
|
15
|
+
}>;
|
|
10
16
|
/**
|
|
11
17
|
* @deprecated Use [`tosijs-3d`](https://www.npmjs.com/package/tosijs-3d) instead.
|
|
12
18
|
*
|
|
@@ -17,14 +23,8 @@ type MeshProcessCallback = (meshes: any[]) => void;
|
|
|
17
23
|
*
|
|
18
24
|
* Still exported and still works. It will be removed in a future major.
|
|
19
25
|
*/
|
|
20
|
-
export declare class B3d extends
|
|
26
|
+
export declare class B3d extends B3d_base {
|
|
21
27
|
static preferredTagName: string;
|
|
22
|
-
static initAttributes: {
|
|
23
|
-
src: string;
|
|
24
|
-
clearColor: string;
|
|
25
|
-
fov: number;
|
|
26
|
-
heroLight: boolean;
|
|
27
|
-
};
|
|
28
28
|
babylonReady: Promise<any>;
|
|
29
29
|
BABYLON?: any;
|
|
30
30
|
static shadowStyleSpec: {
|
package/dist/babylon-3d.js
CHANGED
|
@@ -221,7 +221,7 @@ be used to load `.glb` files. Setting `src` calls this for you on connect.
|
|
|
221
221
|
`<tosi-3d>.loadUI(options: B3dUIOptions)` loads babylonjs guis, which you can create programmatically or using the [babylonjs gui tool](https://gui.babylonjs.com/).
|
|
222
222
|
*/
|
|
223
223
|
/*{ "parent": "Components" }*/
|
|
224
|
-
import {
|
|
224
|
+
import { elements, withAttributes } from 'tosijs';
|
|
225
225
|
import { scriptTag } from './via-tag.js';
|
|
226
226
|
import { icons, svg2DataUrl } from './icons.js';
|
|
227
227
|
const noop = () => {
|
|
@@ -277,24 +277,23 @@ const warnDeprecated = () => {
|
|
|
277
277
|
*
|
|
278
278
|
* Still exported and still works. It will be removed in a future major.
|
|
279
279
|
*/
|
|
280
|
-
export class B3d extends
|
|
280
|
+
export class B3d extends withAttributes({
|
|
281
|
+
// `src` (a .glb URL) makes <tosi-3d> work like <img>: the scene loads on connect.
|
|
282
|
+
src: '',
|
|
283
|
+
// scene background: a css hex color, or `transparent` to composite the 3D
|
|
284
|
+
// over the page (e.g. themed narrative pages). Empty = Babylon default.
|
|
285
|
+
clearColor: '',
|
|
286
|
+
// field-of-view MULTIPLIER on the camera's natural lens. 1 = unchanged,
|
|
287
|
+
// <1 = longer lens / less perspective distortion, >1 = wider. Author-friendly:
|
|
288
|
+
// no need to know Babylon's default fov in radians.
|
|
289
|
+
fov: 1,
|
|
290
|
+
// add a directional key light (front-upper-left) for a product-photography
|
|
291
|
+
// look, on top of the soft hemispheric fill.
|
|
292
|
+
heroLight: false,
|
|
293
|
+
}) {
|
|
281
294
|
static preferredTagName = 'tosi-3d';
|
|
282
295
|
// Declarative config so a scene can be assembled purely in HTML (no JS):
|
|
283
296
|
// <tosi-3d src="/model.glb" hero-light fov="0.5" clear-color="transparent">
|
|
284
|
-
static initAttributes = {
|
|
285
|
-
// `src` (a .glb URL) makes <tosi-3d> work like <img>: the scene loads on connect.
|
|
286
|
-
src: '',
|
|
287
|
-
// scene background: a css hex color, or `transparent` to composite the 3D
|
|
288
|
-
// over the page (e.g. themed narrative pages). Empty = Babylon default.
|
|
289
|
-
clearColor: '',
|
|
290
|
-
// field-of-view MULTIPLIER on the camera's natural lens. 1 = unchanged,
|
|
291
|
-
// <1 = longer lens / less perspective distortion, >1 = wider. Author-friendly:
|
|
292
|
-
// no need to know Babylon's default fov in radians.
|
|
293
|
-
fov: 1,
|
|
294
|
-
// add a directional key light (front-upper-left) for a product-photography
|
|
295
|
-
// look, on top of the soft hemispheric fill.
|
|
296
|
-
heroLight: false,
|
|
297
|
-
};
|
|
298
297
|
babylonReady;
|
|
299
298
|
BABYLON;
|
|
300
299
|
static shadowStyleSpec = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementCreator } from 'tosijs';
|
|
2
2
|
export interface LottieConfig {
|
|
3
3
|
container?: HTMLElement | ShadowRoot;
|
|
4
4
|
renderer: 'svg' | 'canvas' | 'html';
|
|
@@ -8,12 +8,12 @@ export interface LottieConfig {
|
|
|
8
8
|
path?: string;
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
declare const BodymovinPlayer_base: import("tosijs").WithAttributes<{
|
|
12
|
+
src: string;
|
|
13
|
+
json: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare class BodymovinPlayer extends BodymovinPlayer_base {
|
|
12
16
|
static preferredTagName: string;
|
|
13
|
-
static initAttributes: {
|
|
14
|
-
src: string;
|
|
15
|
-
json: string;
|
|
16
|
-
};
|
|
17
17
|
content: null;
|
|
18
18
|
config: LottieConfig;
|
|
19
19
|
static bodymovinAvailable?: Promise<any>;
|
|
@@ -33,3 +33,4 @@ export declare class BodymovinPlayer extends WebComponent {
|
|
|
33
33
|
render(): void;
|
|
34
34
|
}
|
|
35
35
|
export declare const bodymovinPlayer: ElementCreator<BodymovinPlayer>;
|
|
36
|
+
export {};
|
package/dist/bodymovin-player.js
CHANGED
|
@@ -102,14 +102,13 @@ And of course just access the element's `animation` property to [use the bodymov
|
|
|
102
102
|
Also see the [documentation for advanced interactions](https://lottiefiles.github.io/lottie-docs/advanced_interactions/)
|
|
103
103
|
*/
|
|
104
104
|
/*{ "parent": "Components" }*/
|
|
105
|
-
import {
|
|
105
|
+
import { withAttributes } from 'tosijs';
|
|
106
106
|
import { scriptTag } from './via-tag.js';
|
|
107
|
-
export class BodymovinPlayer extends
|
|
107
|
+
export class BodymovinPlayer extends withAttributes({
|
|
108
|
+
src: '',
|
|
109
|
+
json: '',
|
|
110
|
+
}) {
|
|
108
111
|
static preferredTagName = 'tosi-lottie';
|
|
109
|
-
static initAttributes = {
|
|
110
|
-
src: '',
|
|
111
|
-
json: '',
|
|
112
|
-
};
|
|
113
112
|
content = null;
|
|
114
113
|
config = {
|
|
115
114
|
renderer: 'svg',
|
package/dist/carousel.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ElementCreator } from 'tosijs';
|
|
2
|
+
declare const TosiCarousel_base: import("tosijs").WithAttributes<{
|
|
3
|
+
dots: boolean;
|
|
4
|
+
arrows: boolean;
|
|
5
|
+
maxVisibleItems: number;
|
|
6
|
+
snapDuration: number;
|
|
7
|
+
snapDelay: number;
|
|
8
|
+
loop: boolean;
|
|
9
|
+
auto: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare class TosiCarousel extends TosiCarousel_base {
|
|
3
12
|
static preferredTagName: string;
|
|
4
|
-
static initAttributes: {
|
|
5
|
-
dots: boolean;
|
|
6
|
-
arrows: boolean;
|
|
7
|
-
maxVisibleItems: number;
|
|
8
|
-
snapDuration: number;
|
|
9
|
-
snapDelay: number;
|
|
10
|
-
loop: boolean;
|
|
11
|
-
auto: number;
|
|
12
|
-
};
|
|
13
13
|
private lastAutoAdvance;
|
|
14
14
|
private interval?;
|
|
15
15
|
private autoAdvance;
|
|
@@ -133,3 +133,4 @@ export declare const XinCarousel: typeof TosiCarousel;
|
|
|
133
133
|
export declare const tosiCarousel: ElementCreator<TosiCarousel>;
|
|
134
134
|
/** @deprecated Use tosiCarousel instead */
|
|
135
135
|
export declare const xinCarousel: ElementCreator<TosiCarousel>;
|
|
136
|
+
export {};
|
package/dist/carousel.js
CHANGED
|
@@ -56,20 +56,19 @@ This is a minimalist carousel component that supports the usual stuff.
|
|
|
56
56
|
<tosi-css-var-editor element-selector="tosi-carousel"></tosi-css-var-editor>
|
|
57
57
|
*/
|
|
58
58
|
/*{ "parent": "Components" }*/
|
|
59
|
-
import {
|
|
59
|
+
import { elements, vars, withAttributes } from 'tosijs';
|
|
60
60
|
import { icons } from './icons.js';
|
|
61
61
|
const { button, slot, div } = elements;
|
|
62
|
-
export class TosiCarousel extends
|
|
62
|
+
export class TosiCarousel extends withAttributes({
|
|
63
|
+
dots: false,
|
|
64
|
+
arrows: false,
|
|
65
|
+
maxVisibleItems: 1,
|
|
66
|
+
snapDuration: 0.25,
|
|
67
|
+
snapDelay: 0.1,
|
|
68
|
+
loop: false,
|
|
69
|
+
auto: 0,
|
|
70
|
+
}) {
|
|
63
71
|
static preferredTagName = 'tosi-carousel';
|
|
64
|
-
static initAttributes = {
|
|
65
|
-
dots: false,
|
|
66
|
-
arrows: false,
|
|
67
|
-
maxVisibleItems: 1,
|
|
68
|
-
snapDuration: 0.25,
|
|
69
|
-
snapDelay: 0.1,
|
|
70
|
-
loop: false,
|
|
71
|
-
auto: 0,
|
|
72
|
-
};
|
|
73
72
|
lastAutoAdvance = Date.now();
|
|
74
73
|
interval;
|
|
75
74
|
autoAdvance = () => {
|
package/dist/code-editor.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementCreator, PartsMap } from 'tosijs';
|
|
2
2
|
import type { CmHandle, TjsAutocompleteConfig } from './code-editor-cm.js';
|
|
3
3
|
export type { TjsAutocompleteConfig } from './code-editor-cm.js';
|
|
4
4
|
interface CodeEditorParts extends PartsMap {
|
|
5
5
|
host: HTMLDivElement;
|
|
6
6
|
diffHost: HTMLDivElement;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const CodeEditor_base: import("tosijs").WithAttributes<{
|
|
9
|
+
mode: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class CodeEditor extends CodeEditor_base<CodeEditorParts> {
|
|
9
13
|
static preferredTagName: string;
|
|
10
14
|
private source;
|
|
11
15
|
private _handle;
|
|
@@ -34,10 +38,6 @@ export declare class CodeEditor extends WebComponent<CodeEditorParts> {
|
|
|
34
38
|
diffOriginalLabel: string;
|
|
35
39
|
diffModifiedLabel: string;
|
|
36
40
|
showDiff(on: boolean): void;
|
|
37
|
-
static initAttributes: {
|
|
38
|
-
mode: string;
|
|
39
|
-
disabled: boolean;
|
|
40
|
-
};
|
|
41
41
|
role: string;
|
|
42
42
|
/**
|
|
43
43
|
* The underlying CodeMirror `EditorView` (undefined until loaded).
|