@lostgradient/cinder 0.27.1 → 0.28.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 +41 -0
- package/components.json +1 -1
- package/dist/_internal/code-highlighter-context.d.ts +28 -0
- package/dist/cli/index.js +12 -8
- package/dist/components/approval-card/index.js +4 -4
- package/dist/components/button/button.css +25 -0
- package/dist/components/calendar/calendar.css +14 -0
- package/dist/components/capability-gate/capability-gate.css +5 -0
- package/dist/components/checkbox/checkbox.css +19 -0
- package/dist/components/chip/chip.css +14 -0
- package/dist/components/code-block/code-block.d.svelte.ts +1 -1
- package/dist/components/code-block/code-block.examples.json +1 -1
- package/dist/components/code-block/code-block.schema.js +3 -3
- package/dist/components/code-block/code-block.svelte.d.ts +1 -1
- package/dist/components/code-block/code-block.types.d.ts +14 -12
- package/dist/components/code-block/index.js +2 -2
- package/dist/components/color-picker/color-picker.css +2 -0
- package/dist/components/combobox/combobox.css +9 -1
- package/dist/components/command-palette/command-palette.css +7 -5
- package/dist/components/file-upload/file-upload.css +2 -1
- package/dist/components/guidance-region/index.css +1 -1
- package/dist/components/image/image.examples.json +1 -1
- package/dist/components/input/input.css +20 -6
- package/dist/components/json-schema-editor/index.js +5 -5
- package/dist/components/json-schema-editor/json-view-highlighter.d.ts +14 -0
- package/dist/components/key-value-editor/index.css +1 -1
- package/dist/components/modal-region/index.css +1 -1
- package/dist/components/multi-select/multi-select.css +9 -0
- package/dist/components/pagination/pagination.css +12 -0
- package/dist/components/pin-input/pin-input.css +9 -1
- package/dist/components/radio-group/radio-group.css +16 -0
- package/dist/components/run-step-timeline/index.js +2 -2
- package/dist/components/schema-form/index.js +2 -2
- package/dist/components/schema-form/schema-form.css +9 -0
- package/dist/components/segmented-control/segmented-control.css +3 -3
- package/dist/components/selection-popover/selection-popover.css +7 -1
- package/dist/components/tag-input/tag-input.css +10 -1
- package/dist/components/terminal-frame/index.js +2 -2
- package/dist/components/terminal-frame/terminal-frame.schema.js +2 -2
- package/dist/components/terminal-frame/terminal-frame.types.d.ts +8 -0
- package/dist/components/textarea/textarea.css +1 -1
- package/dist/components/toggle/toggle.css +16 -0
- package/dist/components/tree/tree.examples.json +1 -1
- package/dist/components/virtual-list/index.js +2 -2
- package/dist/components/virtual-list/virtual-list.css +42 -9
- package/dist/highlighters/shiki/default.d.ts +13 -1
- package/dist/highlighters/shiki/default.js +2 -2
- package/dist/highlighters/shiki/index.d.ts +20 -12
- package/dist/highlighters/shiki/index.js +2 -2
- package/dist/index.browser.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -23
- package/dist/scripts/knowledge/index.d.ts +5 -1
- package/dist/server/components/approval-card/index.js +1 -1
- package/dist/server/components/code-block/index.js +1 -1
- package/dist/server/components/color-field/index.js +2 -2
- package/dist/server/components/color-picker/index.js +2 -2
- package/dist/server/components/json-schema-editor/index.js +2 -2
- package/dist/server/components/run-step-timeline/index.js +1 -1
- package/dist/server/components/terminal-frame/index.js +1 -1
- package/dist/server/components/virtual-list/index.js +1 -1
- package/dist/server/github-dark-e7nywpbe.js +3 -0
- package/dist/server/github-light-bqtmm1zq.js +3 -0
- package/dist/server/highlighters/shiki/default.js +2 -2
- package/dist/server/highlighters/shiki/index.js +2 -2
- package/dist/server/index.js +6 -6
- package/dist/server/{index.server-4qyyw4y5.js → index.server-043cfznf.js} +1 -1
- package/dist/server/{index.server-p46tn4eb.js → index.server-09tjs48p.js} +2 -2
- package/dist/server/index.server-0hyvdf74.js +8 -0
- package/dist/server/{index.server-dxgkh9tk.js → index.server-17thvpd3.js} +1 -1
- package/dist/server/index.server-19z6hqd6.js +4 -0
- package/dist/server/index.server-31020qgk.js +3 -0
- package/dist/server/{index.server-w3nqzde5.js → index.server-45wmvjrn.js} +3 -3
- package/dist/server/{index.server-3tkgm2gn.js → index.server-6mb7w5g4.js} +2 -2
- package/dist/server/{index.server-2vxmn7x1.js → index.server-c5yajkkc.js} +4 -4
- package/dist/server/index.server-e6fknxd9.js +4 -0
- package/dist/server/index.server-fev4kwm0.js +4 -0
- package/dist/server/index.server-k4vjk75r.js +4 -0
- package/dist/server/index.server-mjbtd1gs.js +7 -0
- package/dist/server/{index.server-2bfkhzzq.js → index.server-rkp4py5n.js} +2 -2
- package/dist/server/index.server-wdz9tsq4.js +3 -0
- package/dist/server/index.server-zj9909hd.js +4 -0
- package/dist/server/json-68twtta3.js +3 -0
- package/dist/server/tokens/registry.generated.js +1 -1
- package/dist/server/tokens/runtime/index.js +92 -0
- package/dist/styles/check-token-contrast-test-values.d.ts +1 -3
- package/dist/styles/token-contrast-test-readers.d.ts +1 -1
- package/dist/tokens/registry.generated.js +2 -2
- package/dist/tokens/resolved/dark-reduced-motion.json +104 -43
- package/dist/tokens/resolved/dark.json +104 -43
- package/dist/tokens/resolved/light-reduced-motion.json +104 -43
- package/dist/tokens/resolved/light.json +104 -43
- package/dist/tokens/runtime/authoring-catalogue.d.ts +19 -0
- package/dist/tokens/runtime/authoring-catalogue.generated.d.ts +8 -0
- package/dist/tokens/runtime/authoring-palette.d.ts +25 -0
- package/dist/tokens/runtime/authoring-profiles.d.ts +48 -0
- package/dist/tokens/runtime/authoring-provenance.d.ts +31 -0
- package/dist/tokens/runtime/authoring-types.d.ts +182 -0
- package/dist/tokens/runtime/base-corpus.d.ts +29 -0
- package/dist/tokens/runtime/base-corpus.generated.d.ts +8 -0
- package/dist/tokens/runtime/context-order.d.ts +60 -0
- package/dist/tokens/runtime/context-stack.d.ts +11 -0
- package/dist/tokens/runtime/contrast/color-difference.d.ts +16 -0
- package/dist/{styles/color-contrast-utilities.d.ts → tokens/runtime/contrast/color-math.d.ts} +2 -17
- package/dist/tokens/runtime/contrast/color-mix.d.ts +3 -0
- package/dist/tokens/runtime/contrast/css-color.d.ts +29 -0
- package/dist/tokens/runtime/contrast/index.d.ts +7 -0
- package/dist/tokens/runtime/contrast/measure.d.ts +45 -0
- package/dist/tokens/runtime/contrast/pairings.d.ts +36 -0
- package/dist/tokens/runtime/contrast/thresholds.d.ts +47 -0
- package/dist/tokens/runtime/corpus-documents.d.ts +36 -0
- package/dist/tokens/runtime/corpus-validation.d.ts +10 -0
- package/dist/tokens/runtime/corpus.d.ts +35 -0
- package/dist/tokens/runtime/css-configuration.d.ts +1 -0
- package/dist/tokens/runtime/css-stylelint.d.ts +2 -0
- package/dist/tokens/runtime/css-support.d.ts +110 -0
- package/dist/tokens/runtime/evaluate.d.ts +95 -0
- package/dist/tokens/runtime/evaluated-provenance.d.ts +36 -0
- package/dist/tokens/runtime/index.d.ts +38 -0
- package/dist/tokens/runtime/index.js +95 -0
- package/dist/tokens/runtime/package-version.generated.d.ts +9 -0
- package/dist/tokens/runtime/projection.d.ts +32 -0
- package/dist/tokens/runtime/registry.d.ts +125 -0
- package/dist/tokens/runtime/resolve-extends.d.ts +30 -0
- package/dist/tokens/runtime/resolve-references.d.ts +49 -0
- package/dist/tokens/runtime/resolve-shared.d.ts +34 -0
- package/dist/tokens/runtime/resolve.d.ts +44 -0
- package/dist/tokens/runtime/resolver-order.d.ts +89 -0
- package/dist/tokens/runtime/source-digest.d.ts +20 -0
- package/dist/tokens/runtime/stylesheet-skeleton.d.ts +31 -0
- package/dist/tokens/runtime/theme-runtime.test-support.d.ts +24 -0
- package/dist/tokens/runtime/theme-sources.d.ts +46 -0
- package/dist/tokens/runtime/theme-stylesheet.d.ts +31 -0
- package/dist/tokens/runtime/types.d.ts +115 -0
- package/dist/tokens/runtime/validate-resolver.d.ts +31 -0
- package/dist/tokens/runtime/validate-schema.d.ts +22 -0
- package/dist/tokens/runtime/validate-tokens.d.ts +25 -0
- package/dist/tokens/runtime/validate-values.d.ts +33 -0
- package/dist/tokens/runtime/validate.d.ts +3 -0
- package/dist/tokens/runtime/value-color-parse.d.ts +128 -0
- package/dist/tokens/runtime/value-color.d.ts +85 -0
- package/dist/tokens/runtime/value-entry.d.ts +3 -0
- package/dist/tokens/runtime/value-formatters.d.ts +59 -0
- package/dist/tokens/sets/colors.tokens.json +65 -13
- package/dist/tokens/sets/foundation.tokens.json +23 -0
- package/dist/tokens/sets/semantic.tokens.json +136 -30
- package/dist/utilities/highlighter.d.ts +5 -5
- package/dist/utilities/retrying-loader-cache.d.ts +3 -6
- package/package.json +15 -3
- package/src/_internal/code-highlighter-context.ts +41 -0
- package/src/components/button/button.css +25 -0
- package/src/components/calendar/calendar.css +14 -0
- package/src/components/capability-gate/capability-gate.css +5 -0
- package/src/components/checkbox/checkbox.css +19 -0
- package/src/components/chip/chip.css +14 -0
- package/src/components/code-block/code-block.examples.json +1 -1
- package/src/components/code-block/code-block.schema.json +2 -2
- package/src/components/code-block/code-block.schema.ts +2 -2
- package/src/components/code-block/code-block.svelte +15 -19
- package/src/components/code-block/code-block.types.ts +14 -12
- package/src/components/color-picker/color-picker.css +2 -0
- package/src/components/combobox/combobox.css +9 -1
- package/src/components/command-palette/command-palette.css +7 -5
- package/src/components/file-upload/file-upload.css +2 -1
- package/src/components/image/image.examples.json +1 -1
- package/src/components/input/input.css +20 -6
- package/src/components/json-schema-editor/json-view-highlighter.ts +23 -0
- package/src/components/json-schema-editor/json-view.svelte +2 -0
- package/src/components/multi-select/multi-select.css +9 -0
- package/src/components/pagination/pagination.css +12 -0
- package/src/components/pin-input/pin-input.css +9 -1
- package/src/components/radio-group/radio-group.css +16 -0
- package/src/components/schema-form/schema-form.css +9 -0
- package/src/components/segmented-control/segmented-control.css +3 -3
- package/src/components/selection-popover/selection-popover.css +7 -1
- package/src/components/tag-input/tag-input.css +10 -1
- package/src/components/terminal-frame/terminal-frame.schema.json +5 -0
- package/src/components/terminal-frame/terminal-frame.schema.ts +6 -0
- package/src/components/terminal-frame/terminal-frame.svelte +6 -2
- package/src/components/terminal-frame/terminal-frame.types.ts +8 -0
- package/src/components/textarea/textarea.css +1 -1
- package/src/components/toggle/toggle.css +16 -0
- package/src/components/tree/tree.examples.json +1 -1
- package/src/components/virtual-list/virtual-list.css +42 -9
- package/src/components/virtual-list/virtual-list.svelte +54 -20
- package/src/highlighters/shiki/default.ts +13 -1
- package/src/highlighters/shiki/index.ts +20 -12
- package/src/index.ts +5 -0
- package/src/styles/foundation.css +33 -1
- package/src/styles/tokens-base.css +4 -4
- package/src/tokens/registry.generated.json +3 -3
- package/src/tokens/resolved/dark-reduced-motion.json +104 -43
- package/src/tokens/resolved/dark.json +104 -43
- package/src/tokens/resolved/light-reduced-motion.json +104 -43
- package/src/tokens/resolved/light.json +104 -43
- package/src/tokens/runtime/authoring-catalogue.generated.ts +19300 -0
- package/src/tokens/runtime/authoring-catalogue.ts +256 -0
- package/src/tokens/runtime/authoring-palette.ts +100 -0
- package/src/tokens/runtime/authoring-profiles.ts +288 -0
- package/src/tokens/runtime/authoring-provenance.ts +290 -0
- package/src/tokens/runtime/authoring-types.ts +199 -0
- package/src/tokens/runtime/base-corpus.generated.ts +10 -0
- package/src/tokens/runtime/base-corpus.ts +78 -0
- package/src/tokens/runtime/context-order.ts +182 -0
- package/src/tokens/runtime/context-stack.ts +52 -0
- package/src/tokens/runtime/contrast/color-difference.ts +114 -0
- package/src/tokens/runtime/contrast/color-math.ts +89 -0
- package/src/tokens/runtime/contrast/color-mix.ts +20 -0
- package/src/tokens/runtime/contrast/css-color.ts +312 -0
- package/src/tokens/runtime/contrast/index.ts +7 -0
- package/src/tokens/runtime/contrast/measure.ts +185 -0
- package/src/tokens/runtime/contrast/pairings.ts +324 -0
- package/src/tokens/runtime/contrast/thresholds.ts +81 -0
- package/src/tokens/runtime/corpus-documents.ts +289 -0
- package/src/tokens/runtime/corpus-validation.ts +336 -0
- package/src/tokens/runtime/corpus.ts +179 -0
- package/src/tokens/runtime/css-configuration.ts +1 -0
- package/src/tokens/runtime/css-stylelint.ts +15 -0
- package/src/tokens/runtime/css-support.ts +407 -0
- package/src/tokens/runtime/evaluate.ts +262 -0
- package/src/tokens/runtime/evaluated-provenance.ts +116 -0
- package/src/tokens/runtime/format-validator.generated.d.ts +18 -0
- package/src/tokens/runtime/format-validator.generated.js +13029 -0
- package/src/tokens/runtime/index.ts +78 -0
- package/src/tokens/runtime/package-version.generated.ts +9 -0
- package/src/tokens/runtime/projection.ts +65 -0
- package/src/tokens/runtime/registry.ts +365 -0
- package/src/tokens/runtime/resolve-extends.ts +211 -0
- package/src/tokens/runtime/resolve-references.ts +313 -0
- package/src/tokens/runtime/resolve-shared.ts +186 -0
- package/src/tokens/runtime/resolve.ts +246 -0
- package/src/tokens/runtime/resolver-order.ts +326 -0
- package/src/tokens/runtime/resolver-validator.generated.d.ts +18 -0
- package/src/tokens/runtime/resolver-validator.generated.js +15492 -0
- package/src/tokens/runtime/source-digest.ts +49 -0
- package/src/tokens/runtime/stylesheet-skeleton.ts +123 -0
- package/src/tokens/runtime/theme-sources.ts +121 -0
- package/src/tokens/runtime/theme-stylesheet.ts +177 -0
- package/src/tokens/runtime/types.ts +140 -0
- package/src/tokens/runtime/validate-resolver.ts +338 -0
- package/src/tokens/runtime/validate-schema.ts +269 -0
- package/src/tokens/runtime/validate-tokens.ts +181 -0
- package/src/tokens/runtime/validate-values.ts +396 -0
- package/src/tokens/runtime/validate.ts +57 -0
- package/src/tokens/runtime/value-color-parse.ts +309 -0
- package/src/tokens/runtime/value-color.ts +217 -0
- package/src/tokens/runtime/value-entry.ts +52 -0
- package/src/tokens/runtime/value-formatters.ts +414 -0
- package/src/tokens/sets/colors.tokens.json +65 -13
- package/src/tokens/sets/foundation.tokens.json +23 -0
- package/src/tokens/sets/semantic.tokens.json +136 -30
- package/src/utilities/highlighter.ts +5 -5
- package/src/utilities/retrying-loader-cache.ts +3 -6
- package/dist/components/code-block/code-block-default-highlighter.d.ts +0 -40
- package/dist/server/index.server-298z43yn.js +0 -4
- package/dist/server/index.server-3h11wjyh.js +0 -8
- package/dist/server/index.server-a3aerbfr.js +0 -4
- package/dist/server/index.server-kge3zp6n.js +0 -4
- package/dist/server/index.server-syf81nwz.js +0 -6
- package/dist/server/index.server-zs08f5te.js +0 -3
- package/src/components/code-block/code-block-default-highlighter.ts +0 -63
|
@@ -9,6 +9,22 @@
|
|
|
9
9
|
overscroll-behavior: contain;
|
|
10
10
|
-webkit-overflow-scrolling: touch;
|
|
11
11
|
contain: layout paint;
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* A list that owns its scroll container owns its scroll anchor too: the
|
|
15
|
+
* rendered window is positioned from the container's scroll offset, so
|
|
16
|
+
* whatever the browser picks as its own anchor moves only because the
|
|
17
|
+
* component moved it.
|
|
18
|
+
*
|
|
19
|
+
* Native anchoring then fights it. A sticky row leaves flow as its index
|
|
20
|
+
* leaves the window and it pins (`position: absolute`), the rows after it shift
|
|
21
|
+
* up by its size, and the browser pulls the scroll offset back by the same
|
|
22
|
+
* amount to hold its anchor still — so the list scrolls a row backwards by
|
|
23
|
+
* itself, and a keyboard press that had just landed is undone.
|
|
24
|
+
*
|
|
25
|
+
* `windowScroll` gives that back below: there the page scrolls, not the list.
|
|
26
|
+
*/
|
|
27
|
+
overflow-anchor: none;
|
|
12
28
|
}
|
|
13
29
|
|
|
14
30
|
/*
|
|
@@ -29,25 +45,42 @@
|
|
|
29
45
|
* establishes the scroll container that subtree's offsets are positioned
|
|
30
46
|
* within a document sense of "contained," and dropping it here would cost
|
|
31
47
|
* nothing this mode needs.
|
|
48
|
+
*
|
|
49
|
+
* Native anchoring stays available to the page. The document's scroll
|
|
50
|
+
* position is not this component's: when content above the list changes
|
|
51
|
+
* height, the browser's anchor is what keeps the reader on the same rows, and
|
|
52
|
+
* the component's `documentOffset` is only re-measured on a window scroll or
|
|
53
|
+
* resize, so excluding the list's rows from anchor selection could jump the
|
|
54
|
+
* viewport with nothing here to notice. Dynamic sizing still opts out below.
|
|
32
55
|
*/
|
|
33
56
|
.cinder-virtual-list[data-cinder-window-scroll='true'] {
|
|
34
57
|
block-size: auto;
|
|
35
58
|
overflow: visible;
|
|
59
|
+
overflow-anchor: auto;
|
|
36
60
|
}
|
|
37
61
|
|
|
38
62
|
/*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
|
|
63
|
+
* Except with sticky rows. As a window-scrolled list's active header pins on
|
|
64
|
+
* leaving the rendered window, the page's anchoring pulls the window back a row,
|
|
65
|
+
* so a keyboard step that had just landed is undone, and nothing re-issues the
|
|
66
|
+
* press. Measured in Chromium: ten ArrowDown presses advanced nine rows. This
|
|
67
|
+
* combination gives up page anchoring for layout shifts above the list instead,
|
|
68
|
+
* as a `dynamicSize` list already does.
|
|
69
|
+
*/
|
|
70
|
+
.cinder-virtual-list[data-cinder-window-scroll='true'][data-cinder-sticky-rows='true'] {
|
|
71
|
+
overflow-anchor: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Dynamic sizing anchors the viewport itself, in either mode: when a measured
|
|
76
|
+
* row above the fold turns out to differ from its estimate, the component adds
|
|
77
|
+
* that delta to the scroll offset before paint. A browser anchoring natively
|
|
78
|
+
* would apply the same delta on top, over-scrolling by the row's size
|
|
46
79
|
* difference every time an image loads or a line wraps. Only one of the two can
|
|
47
80
|
* own the anchor, and this component owns it.
|
|
48
81
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
82
|
+
* Written after the `windowScroll` rule at the same specificity, so a
|
|
83
|
+
* window-scrolled list with dynamic sizing still opts out.
|
|
51
84
|
*/
|
|
52
85
|
.cinder-virtual-list[data-cinder-dynamic-size='true'] {
|
|
53
86
|
overflow-anchor: none;
|
|
@@ -1672,10 +1672,12 @@ function retirePendingKeyboardIndex() {
|
|
|
1672
1672
|
* genuinely settled at that threshold. Requiring more consecutive stable
|
|
1673
1673
|
* intervals is what tells the two apart.
|
|
1674
1674
|
*
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1675
|
+
* Issues the press's write itself, and waits only when that write animates.
|
|
1676
|
+
* An instant write needs no motion signal: it has arrived when it returns.
|
|
1677
|
+
* An animated one waits in fixed-height mode too — `runScrollToIndex` skips
|
|
1678
|
+
* its own settle-and-retry pass there because fixed rows never need a second
|
|
1679
|
+
* write, but this needs the same motion signal regardless of sizing mode to
|
|
1680
|
+
* know when the destination has stopped being meaningful.
|
|
1679
1681
|
*
|
|
1680
1682
|
* Correct under `windowScroll` with no special case: `waitForScrollSettled`
|
|
1681
1683
|
* reads through `readScrollOffset`, which already resolves to
|
|
@@ -1689,14 +1691,50 @@ async function watchPendingKeyboardIndex(index) {
|
|
|
1689
1691
|
return;
|
|
1690
1692
|
pendingKeyboardIndex = index;
|
|
1691
1693
|
const token = (pendingKeyboardIndexToken += 1);
|
|
1692
|
-
|
|
1693
|
-
//
|
|
1694
|
-
//
|
|
1695
|
-
//
|
|
1696
|
-
|
|
1697
|
-
|
|
1694
|
+
// Through the normal path, which applies the header inset and keeps the settle
|
|
1695
|
+
// loop. An earlier version wrote the offset directly to apply that inset, and in
|
|
1696
|
+
// doing so skipped the loop — so under `dynamicSize` an End or Page jump into rows
|
|
1697
|
+
// whose estimates changed as they mounted stopped wherever the first write
|
|
1698
|
+
// happened to land.
|
|
1699
|
+
scrollToIndex(index, { align: 'start' });
|
|
1700
|
+
// An instant write has already arrived by the time it returns, so the live
|
|
1701
|
+
// position IS the destination and there is nothing left to track: the next press
|
|
1702
|
+
// resolves from it like any other. Waiting out the settle window anyway left the
|
|
1703
|
+
// destination alive past a write this list did not issue — a consumer setting
|
|
1704
|
+
// `scrollTop`, a fragment link — so a press right after one stepped from the
|
|
1705
|
+
// stale row instead of the one the reader was looking at.
|
|
1706
|
+
//
|
|
1707
|
+
// Two writes are not final when they return. An animated one has not moved yet,
|
|
1708
|
+
// and under `dynamicSize` the first write lands on an ESTIMATE that the settle
|
|
1709
|
+
// loop in `runScrollToIndex` goes on correcting as the destination's rows mount
|
|
1710
|
+
// and measure, so the live position can name a different row until it finishes.
|
|
1711
|
+
// Both keep the destination until the scroll settles.
|
|
1712
|
+
if (dynamicSize || isKeyboardScrollAnimated(element)) {
|
|
1713
|
+
await waitForScrollSettled(element, KEYBOARD_DESTINATION_STABLE_INTERVALS);
|
|
1714
|
+
// Superseded by a newer press or an explicit retirement while this was
|
|
1715
|
+
// waiting — either already holds whatever destination is now correct, so
|
|
1716
|
+
// clearing it here would erase one this call does not own.
|
|
1717
|
+
if (isDestroyed || pendingKeyboardIndexToken !== token)
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1698
1720
|
pendingKeyboardIndex = null;
|
|
1699
1721
|
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Whether a keyboard write animates rather than landing at once: the
|
|
1724
|
+
* `smoothScroll` prop for a reader who has not asked for less motion, or a
|
|
1725
|
+
* `scroll-behavior: smooth` on the scrolling box, which the browser applies to
|
|
1726
|
+
* a plain `scrollTop` assignment too. Under `windowScroll` that box is the
|
|
1727
|
+
* document's scrolling element, not this list's container.
|
|
1728
|
+
*/
|
|
1729
|
+
function isKeyboardScrollAnimated(element) {
|
|
1730
|
+
if (smoothScroll && !reducedMotion.current)
|
|
1731
|
+
return true;
|
|
1732
|
+
const scrollingBox = windowScroll
|
|
1733
|
+
? (element.ownerDocument.scrollingElement ?? element.ownerDocument.documentElement)
|
|
1734
|
+
: element;
|
|
1735
|
+
const view = scrollingBox.ownerDocument.defaultView;
|
|
1736
|
+
return view?.getComputedStyle(scrollingBox).scrollBehavior === 'smooth';
|
|
1737
|
+
}
|
|
1700
1738
|
function handleWheel(event) {
|
|
1701
1739
|
handleReaderTakeover();
|
|
1702
1740
|
retirePendingKeyboardIndex();
|
|
@@ -1851,17 +1889,12 @@ function handleKeyDown(event) {
|
|
|
1851
1889
|
return;
|
|
1852
1890
|
}
|
|
1853
1891
|
event.preventDefault();
|
|
1854
|
-
//
|
|
1855
|
-
//
|
|
1856
|
-
//
|
|
1857
|
-
//
|
|
1892
|
+
// Issues the scroll as well as tracking it, because whether the write landed is
|
|
1893
|
+
// read back the moment it returns. The destination is still tracked BEFORE the
|
|
1894
|
+
// write, so a second press landing in the same synchronous turn (impossible from
|
|
1895
|
+
// real input, but not from a test or a scripted key-repeat) already sees the new
|
|
1896
|
+
// destination rather than a one-tick-stale `null`.
|
|
1858
1897
|
void watchPendingKeyboardIndex(target);
|
|
1859
|
-
// Through the normal path, which applies the header inset and keeps the settle
|
|
1860
|
-
// loop. An earlier version wrote the offset directly here to apply that inset, and
|
|
1861
|
-
// in doing so skipped the loop — so under `dynamicSize` an End or Page jump into
|
|
1862
|
-
// rows whose estimates changed as they mounted stopped wherever the first write
|
|
1863
|
-
// happened to land.
|
|
1864
|
-
scrollToIndex(target, { align: 'start' });
|
|
1865
1898
|
}
|
|
1866
1899
|
function maxScrollOffset(totalSize, axisHeight) {
|
|
1867
1900
|
return Math.max(0, totalSize - axisHeight);
|
|
@@ -2208,6 +2241,7 @@ async function runScrollToIndex(index, options) {
|
|
|
2208
2241
|
data-cinder-dynamic-size={dynamicSize ? 'true' : undefined}
|
|
2209
2242
|
data-cinder-orientation={isHorizontal ? 'horizontal' : undefined}
|
|
2210
2243
|
data-cinder-window-scroll={windowScroll ? 'true' : undefined}
|
|
2244
|
+
data-cinder-sticky-rows={stickyIndexes.length > 0 ? 'true' : undefined}
|
|
2211
2245
|
style:--cinder-virtual-list-height={windowScroll ? undefined : height}
|
|
2212
2246
|
onscroll={handleScroll}
|
|
2213
2247
|
onwheel={handleWheel}
|
|
@@ -22,7 +22,19 @@ function getDefaultModuleLoader(): () => Promise<ShikiModule> {
|
|
|
22
22
|
return sharedDefaultModuleLoader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The Shiki adapter with the complete Shiki language and theme registries,
|
|
27
|
+
* exported from the package root as `fullShikiHighlighter`.
|
|
28
|
+
*
|
|
29
|
+
* Every grammar and theme Shiki ships is reachable from here through the
|
|
30
|
+
* `shiki/langs` and `shiki/themes` lookup tables, so a bundler that sees this
|
|
31
|
+
* module emits all of them as lazy chunks. Nothing else in cinder imports it,
|
|
32
|
+
* and `<CodeBlock>` never falls back to it: only an application that chooses
|
|
33
|
+
* automatic highlighting of arbitrary languages pays for the registries. Pass
|
|
34
|
+
* an instance to `setCodeHighlighterContext` (or to a block's `highlighter`
|
|
35
|
+
* prop). An application that knows its languages should prefer
|
|
36
|
+
* `shikiHighlighter` with explicit `languageLoaders` and `themeLoaders`.
|
|
37
|
+
*/
|
|
26
38
|
export function shikiHighlighter(
|
|
27
39
|
options: ShikiHighlighterOptions = {},
|
|
28
40
|
moduleLoader?: Parameters<typeof createShikiHighlighter>[1],
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* First-party Shiki adapter for `<CodeBlock>`.
|
|
3
3
|
*
|
|
4
|
-
* `<CodeBlock>`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `<CodeBlock>` imports no highlighter of its own. Build one here over the
|
|
5
|
+
* grammars and themes your application renders, then publish it for a whole
|
|
6
|
+
* subtree with `setCodeHighlighterContext` (or pass it to one block's
|
|
7
|
+
* `highlighter` prop):
|
|
7
8
|
*
|
|
8
9
|
* ```svelte
|
|
9
10
|
* <script lang="ts">
|
|
10
|
-
* import {
|
|
11
|
-
* import { shikiHighlighter } from '@lostgradient/cinder';
|
|
11
|
+
* import { setCodeHighlighterContext, shikiHighlighter } from '@lostgradient/cinder';
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* setCodeHighlighterContext(
|
|
14
|
+
* shikiHighlighter({
|
|
15
|
+
* theme: 'github-light',
|
|
16
|
+
* languageLoaders: { typescript: () => import('@shikijs/langs/typescript') },
|
|
17
|
+
* themeLoaders: { 'github-light': () => import('@shikijs/themes/github-light') },
|
|
18
|
+
* }),
|
|
19
|
+
* );
|
|
14
20
|
* </script>
|
|
15
|
-
*
|
|
16
|
-
* <CodeBlock {code} language="ts" {highlighter} />
|
|
17
21
|
* ```
|
|
18
22
|
*
|
|
23
|
+
* A consumer bundle then carries exactly the grammars and themes named in
|
|
24
|
+
* those loader maps. `fullShikiHighlighter` (from `./default.ts`) registers
|
|
25
|
+
* every grammar and theme Shiki ships instead, for applications that highlight
|
|
26
|
+
* arbitrary languages.
|
|
27
|
+
*
|
|
19
28
|
* The factory is synchronous. Shiki itself is imported lazily on the first
|
|
20
29
|
* highlight call inside the returned function — consumers that never invoke
|
|
21
30
|
* the highlighter (or that never import this module) ship zero Shiki bytes
|
|
@@ -81,10 +90,9 @@ import { createRetryingLoaderCache } from '../../utilities/retrying-loader-cache
|
|
|
81
90
|
import { stripRootPreTabIndex } from './strip-root-pre-tab-index.ts';
|
|
82
91
|
|
|
83
92
|
/**
|
|
84
|
-
* Re-exported
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* seam can reuse it without a static import edge to this adapter module.
|
|
93
|
+
* Re-exported on the public `@lostgradient/cinder` surface. The canonical
|
|
94
|
+
* implementation lives in `utilities/retrying-loader-cache.ts`, which other
|
|
95
|
+
* cinder modules share without importing this adapter.
|
|
88
96
|
*/
|
|
89
97
|
export { createRetryingLoaderCache };
|
|
90
98
|
|
package/src/index.ts
CHANGED
|
@@ -1127,7 +1127,12 @@ export * from './exports/metadata-schemas.ts';
|
|
|
1127
1127
|
export * from './exports/metadata-variables.ts';
|
|
1128
1128
|
export * from './exports/utilities.ts';
|
|
1129
1129
|
|
|
1130
|
+
export { setCodeHighlighterContext } from './_internal/code-highlighter-context.ts';
|
|
1130
1131
|
export * from './highlighters/shiki/index.ts';
|
|
1132
|
+
// The full-registry adapter keeps its own module so that only a consumer that
|
|
1133
|
+
// imports `fullShikiHighlighter` bundles Shiki's complete grammar and theme
|
|
1134
|
+
// registries. Nothing else in cinder imports `default.ts`.
|
|
1135
|
+
export { shikiHighlighter as fullShikiHighlighter } from './highlighters/shiki/default.ts';
|
|
1131
1136
|
|
|
1132
1137
|
export { default as tokenResolver } from './tokens/cinder.resolver.json' with { type: 'json' };
|
|
1133
1138
|
export { default as tokenIndex } from './tokens/index.json' with { type: 'json' };
|
|
@@ -77,11 +77,30 @@
|
|
|
77
77
|
ring with the standard "transparent outline + two-stop box-shadow" pattern
|
|
78
78
|
reference this variable so the formula lives in exactly one place. Not part
|
|
79
79
|
of the public token surface — do not document, do not export. The leading
|
|
80
|
-
`_` after `--` marks it as private/internal per the Cinder convention.
|
|
80
|
+
`_` after `--` marks it as private/internal per the Cinder convention.
|
|
81
|
+
With `--cinder-ring-offset` at 0px the first stop has no spread and paints
|
|
82
|
+
nothing, so the ring is one tight band on the control edge.
|
|
83
|
+
|
|
84
|
+
Filled controls (a solid accent, danger or status fill on the focused
|
|
85
|
+
element itself) use `--_cinder-focus-ring-filled-shadow` instead: a
|
|
86
|
+
`--cinder-ring-offset-color` gap and then the same 2px ring. Without the gap
|
|
87
|
+
the accent-hued ring sits directly on a same-hue fill and the control reads
|
|
88
|
+
as growing rather than focused; with it, the ring sits on the page colour.
|
|
89
|
+
The gap width `--_cinder-focus-ring-filled-gap` is a private constant, not a
|
|
90
|
+
public token, because no consumer has needed to tune it (COR-1498,
|
|
91
|
+
focus-ring-policy.md). Both formulas resolve their colours here, so they are
|
|
92
|
+
re-declared under [data-theme] below. A component whose filled ring keeps a
|
|
93
|
+
per-state hook colour (an invalid checked Checkbox) writes the two stops
|
|
94
|
+
inline with the gap constant and its hook. */
|
|
81
95
|
:root {
|
|
96
|
+
--_cinder-focus-ring-filled-gap: 2px;
|
|
82
97
|
--_cinder-focus-ring-shadow:
|
|
83
98
|
0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
|
|
84
99
|
0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width)) var(--cinder-ring-color);
|
|
100
|
+
--_cinder-focus-ring-filled-shadow:
|
|
101
|
+
0 0 0 var(--_cinder-focus-ring-filled-gap) var(--cinder-ring-offset-color),
|
|
102
|
+
0 0 0 calc(var(--_cinder-focus-ring-filled-gap) + var(--cinder-ring-width))
|
|
103
|
+
var(--cinder-ring-color);
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
[data-theme='dark'],
|
|
@@ -89,6 +108,10 @@
|
|
|
89
108
|
--_cinder-focus-ring-shadow:
|
|
90
109
|
0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
|
|
91
110
|
0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width)) var(--cinder-ring-color);
|
|
111
|
+
--_cinder-focus-ring-filled-shadow:
|
|
112
|
+
0 0 0 var(--_cinder-focus-ring-filled-gap) var(--cinder-ring-offset-color),
|
|
113
|
+
0 0 0 calc(var(--_cinder-focus-ring-filled-gap) + var(--cinder-ring-width))
|
|
114
|
+
var(--cinder-ring-color);
|
|
92
115
|
}
|
|
93
116
|
|
|
94
117
|
[data-theme='dark']
|
|
@@ -250,6 +273,15 @@
|
|
|
250
273
|
color: inherit;
|
|
251
274
|
}
|
|
252
275
|
|
|
276
|
+
/* A native select keeps the user agent's own fill, which is the dark "button
|
|
277
|
+
* face" gray (#6b6b6b) under a dark color scheme. The rule above hands it the
|
|
278
|
+
* page's light text color, and that pair measures 4.2:1, below WCAG AA. Giving
|
|
279
|
+
* the control the same raised surface the Input family uses keeps the text the
|
|
280
|
+
* page color and puts it on a token-controlled background in both themes. */
|
|
281
|
+
:where(select) {
|
|
282
|
+
background-color: var(--cinder-surface-raised);
|
|
283
|
+
}
|
|
284
|
+
|
|
253
285
|
:where(button) {
|
|
254
286
|
background: none;
|
|
255
287
|
border: none;
|
|
@@ -279,16 +279,16 @@
|
|
|
279
279
|
--cinder-accent-border: color-mix(in oklch, var(--cinder-accent-solid), transparent 60%);
|
|
280
280
|
/* Focus ring stroke width. A floor, not a preference: WCAG 2.4.13 wants an indicator at least as large as a 2px-thick perimeter of the control. */
|
|
281
281
|
--cinder-ring-width: 2px;
|
|
282
|
-
/* Focus ring offset from the control edge. */
|
|
283
|
-
--cinder-ring-offset:
|
|
284
|
-
/*
|
|
282
|
+
/* Focus ring offset from the control edge. Zero: the ring sits directly on the control edge with no offset band, so focus reads as one tight 2px line rather than a 4px double band (COR-1498). Filled controls add a private 2px gap instead; see `ring.offset-color`. Emitted as `0px`, not a bare `0`, because the ring recipes add it to `--cinder-ring-width` inside `calc()`, where a unitless zero is a number and invalidates the sum. */
|
|
283
|
+
--cinder-ring-offset: 0px;
|
|
284
|
+
/* Color of the gap band between a focus ring and the control. Filled controls (a solid accent, danger or status fill on the focused element) paint a 2px gap in this color before the ring, so the accent-hued ring sits on the page instead of on a same-hue fill. Unfilled controls use `ring.offset`, which is zero, so they paint no gap. box-shadow cannot paint a transparent gap, so the band needs a real color; it is pinned to `surface.raised`, where controls overwhelmingly live. */
|
|
285
285
|
--cinder-ring-offset-color: var(--cinder-surface-raised);
|
|
286
286
|
/* Focus ring color, relative to `accent.solid` so a consumer override re-derives the ring hue. Light arm clamps L to 0.55 for 3.56:1 against the widened ramp's darkest surface; `h` tracks the accent hue. */
|
|
287
287
|
--cinder-ring-color: light-dark(
|
|
288
288
|
oklch(from var(--cinder-accent-solid) 0.55 0.16 h),
|
|
289
289
|
oklch(from var(--cinder-accent-solid) 0.7 0.14 h)
|
|
290
290
|
);
|
|
291
|
-
/* Ring color
|
|
291
|
+
/* Ring color used by the FloatingAction primary variant, whose ring sits directly on its accent fill. Light arm is a near-black and dark arm a near-white, both strongly contrasting the page background. Against the fill itself it measures about 3:1 in light mode and about 2.5:1 in dark mode, so other filled controls use a `ring.offset-color` gap and the standard ring instead (focus-ring-policy.md). */
|
|
292
292
|
--cinder-ring-on-accent: light-dark(oklch(15% 0.035 245), oklch(100% 0 0));
|
|
293
293
|
/* Scrollbar thickness. */
|
|
294
294
|
--cinder-scrollbar-size: 0.625rem;
|
|
@@ -1105,7 +1105,7 @@
|
|
|
1105
1105
|
"public": true,
|
|
1106
1106
|
"themeAware": false,
|
|
1107
1107
|
"deprecated": false,
|
|
1108
|
-
"description": "Focus ring offset from the control edge."
|
|
1108
|
+
"description": "Focus ring offset from the control edge. Zero: the ring sits directly on the control edge with no offset band, so focus reads as one tight 2px line rather than a 4px double band (COR-1498). Filled controls add a private 2px gap instead; see `ring.offset-color`. Emitted as `0px`, not a bare `0`, because the ring recipes add it to `--cinder-ring-width` inside `calc()`, where a unitless zero is a number and invalidates the sum."
|
|
1109
1109
|
},
|
|
1110
1110
|
{
|
|
1111
1111
|
"path": "ring.offset-color",
|
|
@@ -1114,7 +1114,7 @@
|
|
|
1114
1114
|
"public": true,
|
|
1115
1115
|
"themeAware": true,
|
|
1116
1116
|
"deprecated": false,
|
|
1117
|
-
"description": "
|
|
1117
|
+
"description": "Color of the gap band between a focus ring and the control. Filled controls (a solid accent, danger or status fill on the focused element) paint a 2px gap in this color before the ring, so the accent-hued ring sits on the page instead of on a same-hue fill. Unfilled controls use `ring.offset`, which is zero, so they paint no gap. box-shadow cannot paint a transparent gap, so the band needs a real color; it is pinned to `surface.raised`, where controls overwhelmingly live."
|
|
1118
1118
|
},
|
|
1119
1119
|
{
|
|
1120
1120
|
"path": "ring.color",
|
|
@@ -1132,7 +1132,7 @@
|
|
|
1132
1132
|
"public": true,
|
|
1133
1133
|
"themeAware": true,
|
|
1134
1134
|
"deprecated": false,
|
|
1135
|
-
"description": "Ring color
|
|
1135
|
+
"description": "Ring color used by the FloatingAction primary variant, whose ring sits directly on its accent fill. Light arm is a near-black and dark arm a near-white, both strongly contrasting the page background. Against the fill itself it measures about 3:1 in light mode and about 2.5:1 in dark mode, so other filled controls use a `ring.offset-color` gap and the standard ring instead (focus-ring-policy.md)."
|
|
1136
1136
|
},
|
|
1137
1137
|
{
|
|
1138
1138
|
"path": "scrollbar.size",
|