@lostgradient/cinder 0.23.0 → 0.24.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/CHANGELOG.md +85 -0
- package/components.json +1 -1
- package/dist/_internal/text-direction-sheet-index.d.ts +69 -0
- package/dist/components/access-gate/index.js +447 -354
- package/dist/components/approval-card/index.js +72 -1
- package/dist/components/autocomplete/index.js +72 -1
- package/dist/components/avatar-group/index.js +72 -1
- package/dist/components/carousel/index.js +73 -1
- package/dist/components/combobox/index.js +72 -1
- package/dist/components/command-menu/index.js +74 -1
- package/dist/components/context-menu/index.js +74 -1
- package/dist/components/date-picker/index.js +72 -1
- package/dist/components/date-range-field/index.js +72 -1
- package/dist/components/dropdown/index.js +74 -1
- package/dist/components/dropdown-menu/index.js +74 -1
- package/dist/components/file-upload/file-upload-list.svelte.d.ts +12 -0
- package/dist/components/file-upload/file-upload-utilities.d.ts +15 -0
- package/dist/components/file-upload/file-upload.css +152 -11
- package/dist/components/file-upload/file-upload.schema.js +39 -5
- package/dist/components/file-upload/file-upload.types.d.ts +33 -5
- package/dist/components/file-upload/index.js +1017 -264
- package/dist/components/hover-card/index.js +72 -1
- package/dist/components/invocation-rule-builder/index.js +72 -1
- package/dist/components/json-schema-editor/index.js +72 -1
- package/dist/components/mega-menu/index.js +73 -1
- package/dist/components/menu-bar/index.js +74 -1
- package/dist/components/multi-select/index.js +72 -1
- package/dist/components/navigation-bar/index.js +72 -1
- package/dist/components/popover/index.js +72 -1
- package/dist/components/portal/index.js +72 -1
- package/dist/components/selection-popover/index.js +72 -1
- package/dist/components/slider/index.js +73 -1
- package/dist/components/speed-dial/index.js +72 -1
- package/dist/components/speed-dial-action/index.js +72 -1
- package/dist/components/statistic/index.js +6 -2
- package/dist/components/statistic-group/index.js +6 -2
- package/dist/components/tooltip/index.js +72 -1
- package/dist/index.js +18936 -18257
- package/dist/server/components/access-gate/index.js +7 -4
- package/dist/server/components/approval-card/index.js +6 -5
- package/dist/server/components/autocomplete/index.js +6 -5
- package/dist/server/components/avatar-group/index.js +6 -5
- package/dist/server/components/carousel/index.js +3 -2
- package/dist/server/components/combobox/index.js +7 -6
- package/dist/server/components/command-menu/index.js +6 -5
- package/dist/server/components/context-menu/index.js +7 -6
- package/dist/server/components/date-picker/index.js +7 -6
- package/dist/server/components/date-range-field/index.js +7 -6
- package/dist/server/components/dropdown/index.js +7 -6
- package/dist/server/components/dropdown-menu/index.js +7 -6
- package/dist/server/components/file-upload/index.js +10 -2
- package/dist/server/components/hover-card/index.js +5 -4
- package/dist/server/components/icons/index.js +17 -11
- package/dist/server/components/invocation-rule-builder/index.js +7 -6
- package/dist/server/components/json-schema-editor/index.js +10 -7
- package/dist/server/components/mega-menu/index.js +4 -3
- package/dist/server/components/menu-bar/index.js +7 -6
- package/dist/server/components/multi-select/index.js +5 -4
- package/dist/server/components/navigation-bar/index.js +5 -4
- package/dist/server/components/popover/index.js +6 -5
- package/dist/server/components/portal/index.js +4 -3
- package/dist/server/components/selection-popover/index.js +5 -4
- package/dist/server/components/slider/index.js +4 -3
- package/dist/server/components/speed-dial/index.js +6 -5
- package/dist/server/components/speed-dial-action/index.js +5 -4
- package/dist/server/components/statistic/index.js +2 -2
- package/dist/server/components/statistic-group/index.js +2 -2
- package/dist/server/components/tooltip/index.js +6 -5
- package/dist/server/index.js +48 -42
- package/dist/server/{index.server-116jzzd0.js → index.server-0d1703dw.js} +1 -1
- package/dist/server/index.server-3cpak389.js +689 -0
- package/dist/server/{index.server-wmeaz6qk.js → index.server-5smw78xz.js} +78 -109
- package/dist/server/{index.server-nwgxhrzg.js → index.server-6vd98s4m.js} +1 -1
- package/dist/server/{index.server-4hvjet4z.js → index.server-7h3nmj3g.js} +7 -5
- package/dist/server/{index.server-3e8n2sry.js → index.server-7vzk6qhf.js} +2 -2
- package/dist/server/{index.server-h6qhx8mw.js → index.server-83fg1k4x.js} +7 -1
- package/dist/server/{index.server-5mz0e28m.js → index.server-8bv9bkm6.js} +1 -1
- package/dist/server/{index.server-59hgwg0n.js → index.server-8xr5tbrn.js} +1 -1
- package/dist/server/{index.server-x5zjwrnb.js → index.server-aphnpg78.js} +2 -2
- package/dist/server/{index.server-9scm7zf9.js → index.server-aywvs10h.js} +1 -1
- package/dist/server/index.server-bfkka7x4.js +2 -0
- package/dist/server/{index.server-2h45p8kd.js → index.server-bjj2hpx1.js} +2 -2
- package/dist/server/{index.server-veqke4sq.js → index.server-bp0vzxby.js} +6 -2
- package/dist/server/{index.server-4w0rydct.js → index.server-bw1wbzzk.js} +1 -1
- package/dist/server/{index.server-w5f4ex0f.js → index.server-c71m0a88.js} +1 -1
- package/dist/server/{index.server-kergq7c5.js → index.server-cmz3t3zw.js} +1 -1
- package/dist/server/{index.server-t2p901p7.js → index.server-cn3tg876.js} +1 -1
- package/dist/server/{index.server-6z6s8qz8.js → index.server-d05m93p4.js} +1 -1
- package/dist/server/{index.server-yr2ndv9a.js → index.server-d7twz1zm.js} +1 -1
- package/dist/server/{index.server-1cnz5ax1.js → index.server-emqv9bz6.js} +1 -1
- package/dist/server/index.server-fvtdyxbc.js +2 -0
- package/dist/server/{index.server-5wmzrvvs.js → index.server-gg4jre7c.js} +1 -1
- package/dist/server/{index.server-t91tbrmn.js → index.server-h76gdmj1.js} +2 -2
- package/dist/server/{index.server-bjw3e1wh.js → index.server-hvp84h1d.js} +1 -1
- package/dist/server/{index.server-7kez94sz.js → index.server-j6wms88v.js} +1 -1
- package/dist/server/{index.server-8t53gqe7.js → index.server-k21nfvxe.js} +2 -2
- package/dist/server/{index.server-6771g0q4.js → index.server-mf4dr1kp.js} +5 -1
- package/dist/server/{index.server-s2dseqdh.js → index.server-p69bvf14.js} +1 -1
- package/dist/server/{index.server-br3khchh.js → index.server-ppw26tpq.js} +1 -1
- package/dist/server/{index.server-151dt1tx.js → index.server-rx9aszk6.js} +1 -1
- package/dist/server/{index.server-q7r53g7z.js → index.server-s4pfz6pb.js} +1 -1
- package/dist/server/index.server-sje2hers.js +97 -0
- package/dist/server/{index.server-drdtprjs.js → index.server-spdds2hk.js} +1 -1
- package/dist/server/index.server-sz6y8xqk.js +2 -0
- package/dist/server/index.server-tkv7aey1.js +35 -0
- package/dist/server/{index.server-8dh2rtnc.js → index.server-vnr1h5g5.js} +1 -1
- package/dist/server/{index.server-rf9pd5mr.js → index.server-w20xg416.js} +1 -1
- package/dist/server/index.server-xvg6mjdw.js +73 -0
- package/dist/server/{index.server-03ndc3td.js → index.server-ye5xkaq2.js} +1 -1
- package/dist/server/{index.server-ejdprw7f.js → index.server-ykvb4rcc.js} +1 -1
- package/dist/server/index.server-yq9evnp4.js +38 -0
- package/dist/server/index.server-yrfah2yz.js +33 -0
- package/dist/server/{index.server-9n2bc545.js → index.server-zbgdfzy6.js} +1 -1
- package/dist/server/{index.server-n6wm89xy.js → index.server-zj0x74bt.js} +1 -1
- package/package.json +1 -1
- package/src/_internal/text-direction-css.ts +6 -0
- package/src/_internal/text-direction-sheet-index.ts +170 -0
- package/src/components/file-upload/file-upload-list.svelte +198 -0
- package/src/components/file-upload/file-upload-utilities.ts +262 -0
- package/src/components/file-upload/file-upload.css +152 -11
- package/src/components/file-upload/file-upload.examples.json +1 -1
- package/src/components/file-upload/file-upload.schema.json +38 -4
- package/src/components/file-upload/file-upload.schema.ts +40 -4
- package/src/components/file-upload/file-upload.svelte +176 -146
- package/src/components/file-upload/file-upload.types.ts +33 -5
- package/src/components/portal/portal.utilities.svelte.ts +8 -0
- package/src/components/statistic/statistic.svelte +37 -1
- package/dist/server/index.server-1qvmrpnx.js +0 -328
- package/dist/server/index.server-4n1mxg74.js +0 -2
- package/dist/server/index.server-7trweg3f.js +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @lostgradient/cinder
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1255](https://github.com/stevekinney/cinder/pull/1255) [`d13d4cd`](https://github.com/stevekinney/cinder/commit/d13d4cd39bea7b3024793ea8996021b2c8eafc68) Thanks [@stevekinney](https://github.com/stevekinney)! - Polish FileUpload with configurable dropzone copy, accept-derived descriptions,
|
|
8
|
+
file-type icons, maximum-file validation, retry actions, and optional focus and
|
|
9
|
+
drag-active border emphasis. Rename `triggerLabel` to `browseLabel`, rename the
|
|
10
|
+
accepted-file callback to `onFilesAccepted`, and make `onFilesChange` report the
|
|
11
|
+
full locally resolved `FileUploadEntry[]` queue.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#1264](https://github.com/stevekinney/cinder/pull/1264) [`b0583e2`](https://github.com/stevekinney/cinder/commit/b0583e2e0a44a3757000167ac4cc4171f5a7473b) Thanks [@stevekinney](https://github.com/stevekinney)! - perf(text-direction): skip stylesheets that declare no `direction` before walking them
|
|
16
|
+
|
|
17
|
+
Every component that resolves text direction — `Dropdown.Menu`, `DropdownMenu`,
|
|
18
|
+
`ContextMenu`, `CommandMenu`, `MegaMenu`, `MenuBar`, `Slider` — walked every CSS
|
|
19
|
+
rule in every stylesheet in the document, per element, per ancestor, per call,
|
|
20
|
+
with no memoization at any layer: `resolveTextDirection` allocates a fresh
|
|
21
|
+
`WeakMap` on each call and `elementDirectionStyleOverride` passes none at all.
|
|
22
|
+
|
|
23
|
+
Measured in a consuming app, a single `Dropdown` mount walked a 179-sheet /
|
|
24
|
+
7651-rule document about 42 times — 7518 `sheet.cssRules` reads plus 44184
|
|
25
|
+
nested reads, ~370ms of blocking main-thread time, 74% of all sampled CPU — to
|
|
26
|
+
answer a question whose answer was `false` for every element, because that app's
|
|
27
|
+
CSS contains no `direction` declarations at all. The cost scaled linearly with
|
|
28
|
+
CPU, so on a loaded machine it delayed first paint of the tab that mounted the
|
|
29
|
+
dropdown past five seconds.
|
|
30
|
+
|
|
31
|
+
`matchesDirectionStyleRule` has exactly one way to return `true`: a style rule
|
|
32
|
+
whose `style.direction` is truthy and whose selector matches. A stylesheet that
|
|
33
|
+
declares `direction` nowhere in its rule tree therefore cannot contribute a
|
|
34
|
+
match, and skipping it is behavior-preserving by construction. A new per-sheet
|
|
35
|
+
index answers that question once and caches it, keyed by stylesheet and
|
|
36
|
+
validated against the sheet's top-level rule count.
|
|
37
|
+
|
|
38
|
+
Only negative results are cached, since a positive one just sends the caller
|
|
39
|
+
down the walk it would have run anyway. Three kinds of sheet opt out of negative
|
|
40
|
+
caching rather than risk a stale skip: constructed stylesheets (no `ownerNode`),
|
|
41
|
+
because `replace()`/`replaceSync()` throw on anything else and so those are
|
|
42
|
+
exactly the sheets whose contents can be swapped without the rule count moving;
|
|
43
|
+
sheets containing `@import`, whose imported sheet can gain rules asynchronously;
|
|
44
|
+
and sheets whose CSSOM is unreadable, which are reported as "declares direction"
|
|
45
|
+
so the caller still runs its own guarded walk.
|
|
46
|
+
|
|
47
|
+
Two mutations on a non-constructed sheet remain invisible to a rule-count key:
|
|
48
|
+
an in-place declaration edit (`rule.style.direction = 'rtl'`), and a
|
|
49
|
+
`deleteRule`/`insertRule` pair between two queries that lands on the same count.
|
|
50
|
+
Both are covered by `invalidatePortalDirection()` — the existing public hook for
|
|
51
|
+
"a CSSOM edit that emits no DOM mutation" — which now clears this index
|
|
52
|
+
unconditionally, including when no portal is currently observing direction.
|
|
53
|
+
|
|
54
|
+
Resolves stevekinney/cinder#1262.
|
|
55
|
+
|
|
56
|
+
## 0.23.1
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- [#1256](https://github.com/stevekinney/cinder/pull/1256) [`61b1bee`](https://github.com/stevekinney/cinder/commit/61b1bee92854ea8cdf9fc0a856d41e922b2c3966) Thanks [@stevekinney](https://github.com/stevekinney)! - fix(statistic): restore the muted text hierarchy for unthemed Statistics
|
|
61
|
+
|
|
62
|
+
`Statistic` resolved its colours through `resolveChartTheme()`, whose
|
|
63
|
+
unthemed defaults are `currentColor` for both `foreground` and `muted`.
|
|
64
|
+
Because the component writes those as **inline** custom properties, the
|
|
65
|
+
`var(--_cinder-chart-*, …)` fallbacks in `statistic.css` could never apply —
|
|
66
|
+
so a `Statistic` rendered without an explicit `theme` painted its label,
|
|
67
|
+
icon, and change description at full text colour, visually identical to the
|
|
68
|
+
value. The label/value hierarchy that `--cinder-text-muted` provided was
|
|
69
|
+
silently lost for every consumer that doesn't pass a chart theme.
|
|
70
|
+
|
|
71
|
+
The chart components absorb the same `currentColor` default with a
|
|
72
|
+
compensating `opacity` on their tick labels. That is the wrong tool here:
|
|
73
|
+
this is body text, which has to clear the 4.5:1 AA floor rather than land
|
|
74
|
+
wherever a multiplier puts it — the same reasoning that moved status text
|
|
75
|
+
off the fill tokens in 0.21.
|
|
76
|
+
|
|
77
|
+
Unthemed `Statistic` now defaults to the contrast-tuned text tokens
|
|
78
|
+
(`--cinder-text` / `--cinder-text-muted`). The substitution is all-or-nothing on
|
|
79
|
+
`theme`'s presence rather than per-field: supplying any theme — including a
|
|
80
|
+
partial one — keeps `resolveChartTheme()`'s `currentColor` inheritance for the
|
|
81
|
+
fields it omits, so `theme={{ foreground: 'white', background: 'black' }}`
|
|
82
|
+
leaves the label inheriting white instead of dropping the application's dark
|
|
83
|
+
muted token onto a black panel. `background` keeps its `transparent` default.
|
|
84
|
+
To make an otherwise-unthemed Statistic follow an ancestor's `color`, ask for
|
|
85
|
+
it explicitly with `theme={{ foreground: 'currentColor', muted: 'currentColor' }}`.
|
|
86
|
+
No API change.
|
|
87
|
+
|
|
3
88
|
## 0.23.0
|
|
4
89
|
|
|
5
90
|
### Minor Changes
|
package/components.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cheap per-stylesheet index of "does this sheet declare `direction`
|
|
3
|
+
* anywhere?", used to skip whole stylesheets before the expensive direction
|
|
4
|
+
* walk in `text-direction-css.ts` ever looks at them.
|
|
5
|
+
*
|
|
6
|
+
* ## Why
|
|
7
|
+
*
|
|
8
|
+
* `matchesDirectionStyleRule` has exactly one way to return `true`: a
|
|
9
|
+
* `CSSStyleRule` whose `style.direction` is truthy AND whose selector matches
|
|
10
|
+
* the element (text-direction-css.ts:127-147). Every other branch is recursion
|
|
11
|
+
* — into `@import`ed sheets, native nesting, `@scope`, and conditional
|
|
12
|
+
* at-rules — that must eventually reach that same check. So a stylesheet that
|
|
13
|
+
* declares `direction` nowhere in its rule tree can never contribute a match,
|
|
14
|
+
* and skipping it is behavior-preserving by construction.
|
|
15
|
+
*
|
|
16
|
+
* That matters because the walk it skips is not cheap. It resolves nested
|
|
17
|
+
* selectors, evaluates `@scope` roots and limits, and runs container-query
|
|
18
|
+
* conditions — per element, per ancestor, per call, with no memoization above
|
|
19
|
+
* this layer (`resolveTextDirection` allocates a fresh `WeakMap` per call, and
|
|
20
|
+
* `elementDirectionStyleOverride` passes none at all). Measured in a real
|
|
21
|
+
* consuming app, one `Dropdown` mount walked a 179-sheet / 7651-rule document
|
|
22
|
+
* about 42 times — 7518 `sheet.cssRules` reads plus 44184 nested reads, ~370ms
|
|
23
|
+
* of blocking main-thread time — to answer a question whose answer was `false`
|
|
24
|
+
* for every element, because that app's CSS contains no `direction`
|
|
25
|
+
* declarations at all. See stevekinney/cinder#1262.
|
|
26
|
+
*
|
|
27
|
+
* The index makes that case cost one `cssRules.length` read per sheet.
|
|
28
|
+
*
|
|
29
|
+
* ## Cache validity
|
|
30
|
+
*
|
|
31
|
+
* Only NEGATIVE results ("declares no direction") are risky to cache — a
|
|
32
|
+
* positive answer sends the caller down its normal walk, which re-reads the
|
|
33
|
+
* CSSOM anyway. Negative entries are keyed by stylesheet object and validated
|
|
34
|
+
* against the sheet's top-level rule count, which changes on any
|
|
35
|
+
* `insertRule`/`deleteRule`. Three cases opt out of negative caching entirely
|
|
36
|
+
* rather than risk a stale skip:
|
|
37
|
+
*
|
|
38
|
+
* - A **constructed** stylesheet (`new CSSStyleSheet()`, i.e. no `ownerNode`).
|
|
39
|
+
* `replace()`/`replaceSync()` throw on any sheet that is not constructed, so
|
|
40
|
+
* constructed sheets are exactly the ones whose whole contents can be swapped
|
|
41
|
+
* without the rule count moving. They are re-scanned on every query.
|
|
42
|
+
* - A sheet containing `@import`, because an imported sheet loads
|
|
43
|
+
* asynchronously and can gain rules without changing its importer's count.
|
|
44
|
+
* - A sheet whose CSSOM is unreadable (cross-origin), which is reported as
|
|
45
|
+
* "declares direction" so the caller falls through to its own guarded walk
|
|
46
|
+
* instead of being silently filtered out.
|
|
47
|
+
*
|
|
48
|
+
* That leaves two mutations a rule-count key cannot observe, both on a
|
|
49
|
+
* non-constructed sheet: an in-place declaration edit
|
|
50
|
+
* (`rule.style.direction = 'rtl'`), and a `deleteRule` + `insertRule` pair
|
|
51
|
+
* between two queries that lands on the same count. Detecting either would mean
|
|
52
|
+
* reading every rule's text on every query, which is the cost this module
|
|
53
|
+
* exists to avoid. Both are covered by `invalidatePortalDirection()`, the
|
|
54
|
+
* library's existing public hook for "a CSSOM edit that emits no DOM
|
|
55
|
+
* mutation", which clears this index; {@link resetDirectionStyleSheetIndex} is
|
|
56
|
+
* the internal entry point it calls.
|
|
57
|
+
*/
|
|
58
|
+
/** Drops every cached entry. Exported for tests and for consumers that edit CSSOM declarations in place. */
|
|
59
|
+
export declare function resetDirectionStyleSheetIndex(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Whether `sheet` declares `direction` on any rule in its tree — including
|
|
62
|
+
* inside nesting, `@scope`, conditional at-rules, and `@import`ed sheets.
|
|
63
|
+
*
|
|
64
|
+
* Permissive on purpose: this is a pre-filter, so anything it cannot read is
|
|
65
|
+
* reported as `true` and left for the caller's full (already guarded) walk. It
|
|
66
|
+
* also ignores whether a conditional rule is currently active, because the
|
|
67
|
+
* caller evaluates that itself.
|
|
68
|
+
*/
|
|
69
|
+
export declare function styleSheetDeclaresDirection(sheet: CSSStyleSheet): boolean;
|