@xerios/design-system 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +403 -2
- package/dist/components/AnchorHeading.svelte +79 -0
- package/dist/components/AnchorHeading.svelte.d.ts +28 -0
- package/dist/components/Breadcrumbs.svelte +216 -0
- package/dist/components/Breadcrumbs.svelte.d.ts +37 -0
- package/dist/components/Button.svelte +178 -0
- package/dist/components/Button.svelte.d.ts +58 -0
- package/dist/components/Canvas.svelte +248 -0
- package/dist/components/Canvas.svelte.d.ts +91 -0
- package/dist/components/Collapsible.svelte +139 -0
- package/dist/components/Collapsible.svelte.d.ts +52 -0
- package/dist/components/CollapsibleAdvanced.svelte +174 -0
- package/dist/components/CollapsibleAdvanced.svelte.d.ts +43 -0
- package/dist/components/DashOutline.svelte +47 -0
- package/dist/components/DashOutline.svelte.d.ts +6 -0
- package/dist/components/Dialogs.svelte +123 -0
- package/dist/components/Dialogs.svelte.d.ts +6 -0
- package/dist/components/Drawer.svelte +231 -0
- package/dist/components/Drawer.svelte.d.ts +62 -0
- package/dist/components/ErrorMessage.svelte +140 -0
- package/dist/components/ErrorMessage.svelte.d.ts +41 -0
- package/dist/components/Icon.svelte +94 -0
- package/dist/components/Icon.svelte.d.ts +33 -0
- package/dist/components/InfoTip.svelte +183 -0
- package/dist/components/InfoTip.svelte.d.ts +28 -0
- package/dist/components/Md.svelte +28 -0
- package/dist/components/Md.svelte.d.ts +11 -0
- package/dist/components/Modal.svelte +91 -0
- package/dist/components/Modal.svelte.d.ts +41 -0
- package/dist/components/Notice.svelte +50 -0
- package/dist/components/Notice.svelte.d.ts +30 -0
- package/dist/components/Popover.svelte +212 -0
- package/dist/components/Popover.svelte.d.ts +70 -0
- package/dist/components/Shimmer.svelte +27 -0
- package/dist/components/Shimmer.svelte.d.ts +22 -0
- package/dist/components/Splitter.svelte +152 -0
- package/dist/components/Splitter.svelte.d.ts +41 -0
- package/dist/components/Table.svelte +448 -0
- package/dist/components/Table.svelte.d.ts +268 -0
- package/dist/components/Toast.svelte +273 -0
- package/dist/components/Toast.svelte.d.ts +31 -0
- package/dist/components/Tooltip.svelte +97 -0
- package/dist/components/Tooltip.svelte.d.ts +19 -0
- package/dist/components/WorkingBorder.svelte +105 -0
- package/dist/components/WorkingBorder.svelte.d.ts +26 -0
- package/dist/components/empty/Empty.svelte +55 -0
- package/dist/components/empty/Empty.svelte.d.ts +39 -0
- package/dist/components/empty/EmptyError.svelte +47 -0
- package/dist/components/empty/EmptyError.svelte.d.ts +28 -0
- package/dist/components/empty/index.d.ts +18 -0
- package/dist/components/empty/index.js +10 -0
- package/dist/components/filters/DateFilter.svelte +59 -0
- package/dist/components/filters/DateFilter.svelte.d.ts +23 -0
- package/dist/components/filters/FilterBar.svelte +342 -0
- package/dist/components/filters/FilterBar.svelte.d.ts +283 -0
- package/dist/components/filters/FilterChip.svelte +235 -0
- package/dist/components/filters/FilterChip.svelte.d.ts +68 -0
- package/dist/components/filters/OptionList.svelte +352 -0
- package/dist/components/filters/OptionList.svelte.d.ts +91 -0
- package/dist/components/filters/Panel.svelte +123 -0
- package/dist/components/filters/Panel.svelte.d.ts +25 -0
- package/dist/components/filters/index.d.ts +288 -0
- package/dist/components/filters/index.js +12 -0
- package/dist/components/icons.d.ts +54 -0
- package/dist/components/icons.js +58 -0
- package/dist/components/inputs/ButtonGroup.svelte +104 -0
- package/dist/components/inputs/ButtonGroup.svelte.d.ts +40 -0
- package/dist/components/inputs/Calendar.svelte +535 -0
- package/dist/components/inputs/Calendar.svelte.d.ts +45 -0
- package/dist/components/inputs/DateField.svelte +247 -0
- package/dist/components/inputs/DateField.svelte.d.ts +74 -0
- package/dist/components/inputs/DateInput.svelte +118 -0
- package/dist/components/inputs/DateInput.svelte.d.ts +43 -0
- package/dist/components/inputs/DatePicker.svelte +102 -0
- package/dist/components/inputs/DatePicker.svelte.d.ts +67 -0
- package/dist/components/inputs/DateRangePicker.svelte +208 -0
- package/dist/components/inputs/DateRangePicker.svelte.d.ts +76 -0
- package/dist/components/inputs/DateRangeSelect.svelte +548 -0
- package/dist/components/inputs/DateRangeSelect.svelte.d.ts +70 -0
- package/dist/components/inputs/FieldLabel.svelte +43 -0
- package/dist/components/inputs/FieldLabel.svelte.d.ts +28 -0
- package/dist/components/inputs/ListSearch.svelte +142 -0
- package/dist/components/inputs/ListSearch.svelte.d.ts +35 -0
- package/dist/components/inputs/RadioGroup.svelte +153 -0
- package/dist/components/inputs/RadioGroup.svelte.d.ts +49 -0
- package/dist/components/inputs/RangeShortcuts.svelte +90 -0
- package/dist/components/inputs/RangeShortcuts.svelte.d.ts +31 -0
- package/dist/components/inputs/RangeSlider.svelte +225 -0
- package/dist/components/inputs/RangeSlider.svelte.d.ts +37 -0
- package/dist/components/inputs/SearchField.svelte +24 -0
- package/dist/components/inputs/SearchField.svelte.d.ts +41 -0
- package/dist/components/inputs/Segmented.svelte +76 -0
- package/dist/components/inputs/Segmented.svelte.d.ts +43 -0
- package/dist/components/inputs/Select.svelte +552 -0
- package/dist/components/inputs/Select.svelte.d.ts +100 -0
- package/dist/components/inputs/Slider.svelte +177 -0
- package/dist/components/inputs/Slider.svelte.d.ts +33 -0
- package/dist/components/inputs/SliderTicks.svelte +62 -0
- package/dist/components/inputs/SliderTicks.svelte.d.ts +23 -0
- package/dist/components/inputs/Switch.svelte +120 -0
- package/dist/components/inputs/Switch.svelte.d.ts +31 -0
- package/dist/components/inputs/TagInput.svelte +296 -0
- package/dist/components/inputs/TagInput.svelte.d.ts +61 -0
- package/dist/components/inputs/TextArea.svelte +86 -0
- package/dist/components/inputs/TextArea.svelte.d.ts +56 -0
- package/dist/components/inputs/TextField.svelte +170 -0
- package/dist/components/inputs/TextField.svelte.d.ts +80 -0
- package/dist/components/menu/ContextMenu.svelte +25 -0
- package/dist/components/menu/ContextMenu.svelte.d.ts +26 -0
- package/dist/components/menu/MenuButton.svelte +46 -0
- package/dist/components/menu/MenuButton.svelte.d.ts +16 -0
- package/dist/components/menu/MenuList.svelte +319 -0
- package/dist/components/menu/MenuList.svelte.d.ts +30 -0
- package/dist/components/metadata/Metadata.svelte +38 -0
- package/dist/components/metadata/Metadata.svelte.d.ts +31 -0
- package/dist/components/metadata/MetadataRow.svelte +84 -0
- package/dist/components/metadata/MetadataRow.svelte.d.ts +26 -0
- package/dist/components/metadata/index.d.ts +8 -0
- package/dist/components/metadata/index.js +13 -0
- package/dist/components/side-menu/SideMenu.svelte +138 -0
- package/dist/components/side-menu/SideMenu.svelte.d.ts +25 -0
- package/dist/components/side-menu/SideMenuGroup.svelte +108 -0
- package/dist/components/side-menu/SideMenuGroup.svelte.d.ts +31 -0
- package/dist/components/side-menu/SideMenuItem.svelte +221 -0
- package/dist/components/side-menu/SideMenuItem.svelte.d.ts +46 -0
- package/dist/components/side-menu/context.d.ts +1 -0
- package/dist/components/side-menu/context.js +3 -0
- package/dist/components/side-menu/index.d.ts +62 -0
- package/dist/components/side-menu/index.js +15 -0
- package/dist/components/tiles/Tile.svelte +419 -0
- package/dist/components/tiles/Tile.svelte.d.ts +58 -0
- package/dist/components/tiles/TileGroup.svelte +135 -0
- package/dist/components/tiles/TileGroup.svelte.d.ts +45 -0
- package/dist/components/tiles/context.d.ts +35 -0
- package/dist/components/tiles/context.js +14 -0
- package/dist/components/tiles/index.d.ts +6 -0
- package/dist/components/tiles/index.js +13 -0
- package/dist/components/upload/FileCard.svelte +301 -0
- package/dist/components/upload/FileCard.svelte.d.ts +127 -0
- package/dist/components/upload/Thumb.svelte +274 -0
- package/dist/components/upload/Thumb.svelte.d.ts +101 -0
- package/dist/components/upload/UploadFile.svelte +123 -0
- package/dist/components/upload/UploadFile.svelte.d.ts +48 -0
- package/dist/components/upload/UploadFiles.svelte +177 -0
- package/dist/components/upload/UploadFiles.svelte.d.ts +50 -0
- package/dist/components/upload/UploadFolder.svelte +153 -0
- package/dist/components/upload/UploadFolder.svelte.d.ts +63 -0
- package/dist/components/upload/UploadImage.svelte +137 -0
- package/dist/components/upload/UploadImage.svelte.d.ts +52 -0
- package/dist/components/upload/UploadImages.svelte +172 -0
- package/dist/components/upload/UploadImages.svelte.d.ts +52 -0
- package/dist/components/upload/UploadZone.svelte +130 -0
- package/dist/components/upload/UploadZone.svelte.d.ts +41 -0
- package/dist/components/upload/common.d.ts +31 -0
- package/dist/components/upload/common.js +103 -0
- package/dist/components/upload/context.d.ts +18 -0
- package/dist/components/upload/context.js +10 -0
- package/dist/components/upload/index.d.ts +16 -0
- package/dist/components/upload/index.js +18 -0
- package/dist/css/atoms.css +892 -0
- package/dist/css/base.css +333 -0
- package/dist/css/effects.css +430 -0
- package/dist/css/index.css +10 -0
- package/dist/css/tokens.css +296 -0
- package/dist/fonts.d.ts +1 -0
- package/dist/fonts.js +7 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +77 -0
- package/dist/lib/announce.d.ts +8 -0
- package/dist/lib/announce.js +48 -0
- package/dist/lib/controls.d.ts +10 -0
- package/dist/lib/controls.js +42 -0
- package/dist/lib/dates.d.ts +104 -0
- package/dist/lib/dates.js +235 -0
- package/dist/lib/dialogs.svelte.d.ts +8 -0
- package/dist/lib/dialogs.svelte.js +45 -0
- package/dist/lib/dom.d.ts +34 -0
- package/dist/lib/dom.js +90 -0
- package/dist/lib/field-errors.svelte.d.ts +40 -0
- package/dist/lib/field-errors.svelte.js +89 -0
- package/dist/lib/files.d.ts +74 -0
- package/dist/lib/files.js +215 -0
- package/dist/lib/inline-md.d.ts +1 -0
- package/dist/lib/inline-md.js +36 -0
- package/dist/lib/invalid.d.ts +4 -0
- package/dist/lib/invalid.js +35 -0
- package/dist/lib/list-search.d.ts +9 -0
- package/dist/lib/list-search.js +27 -0
- package/dist/lib/menu.svelte.d.ts +39 -0
- package/dist/lib/menu.svelte.js +98 -0
- package/dist/lib/morph.svelte.d.ts +17 -0
- package/dist/lib/morph.svelte.js +46 -0
- package/dist/lib/motion.d.ts +115 -0
- package/dist/lib/motion.js +174 -0
- package/dist/lib/observe.d.ts +36 -0
- package/dist/lib/observe.js +142 -0
- package/dist/lib/reveal.d.ts +7 -0
- package/dist/lib/reveal.js +28 -0
- package/dist/lib/roving.d.ts +16 -0
- package/dist/lib/roving.js +35 -0
- package/dist/lib/runs.d.ts +18 -0
- package/dist/lib/runs.js +25 -0
- package/dist/lib/scroll-fade.d.ts +4 -0
- package/dist/lib/scroll-fade.js +71 -0
- package/dist/lib/spotlight.d.ts +4 -0
- package/dist/lib/spotlight.js +109 -0
- package/dist/lib/ticks.d.ts +12 -0
- package/dist/lib/ticks.js +24 -0
- package/dist/lib/tooltip.d.ts +4 -0
- package/dist/lib/tooltip.js +110 -0
- package/dist/lib/validity.d.ts +16 -0
- package/dist/lib/validity.js +36 -0
- package/package.json +69 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/* Theme tokens, light and dark. Token names are stable across themes; components only ever read tokens.
|
|
2
|
+
Design language: Linear's app (as in the interactive demo on linear.app). Surfaces are near-black (or white) with
|
|
3
|
+
translucent hairlines, translucent fills for hover/active, pill-shaped controls, Inter at 13px with weights 510/590
|
|
4
|
+
(JetBrains Mono for data), and one indigo accent.
|
|
5
|
+
Text: --fg (primary), --fg-2 (secondary), --muted (tertiary), --faint (quaternary).
|
|
6
|
+
Fills (translucent, stack on any surface): --fill-1 resting, --fill-2 hover, --fill-3 pressed/raised, --fill-4 active.
|
|
7
|
+
Controls take the same steps tinted with the brand hue (--control-1..4), so they stand apart from neutral surfaces.
|
|
8
|
+
Theme: follows the OS; <html data-theme="light|dark"> overrides it. Colours are light-dark(light, dark) pairs. */
|
|
9
|
+
:root {
|
|
10
|
+
/* Each colour is light-dark(light, dark), resolved by color-scheme (set below). */
|
|
11
|
+
color-scheme: light dark;
|
|
12
|
+
/* Surfaces, back to front (Linear's hero frame): --bg is the app frame the header and status line sit on; --view-bg the
|
|
13
|
+
inset view card the layouts live in; --surface the cards and panes inside it; --elevated the floating layers. */
|
|
14
|
+
--bg: light-dark(#ebebeb, #020202);
|
|
15
|
+
--view-bg: light-dark(#fbfbfb, #121314);
|
|
16
|
+
--surface: light-dark(#ffffff, #171819);
|
|
17
|
+
--surface-2: light-dark(#f4f4f5, #1b1c1d);
|
|
18
|
+
--surface-3: light-dark(#ececee, #222325);
|
|
19
|
+
--elevated: light-dark(#ffffff, #1b1c1e);
|
|
20
|
+
--line: light-dark(rgb(0 0 0 / 0.075), rgb(255 255 255 / 0.06));
|
|
21
|
+
--line-strong: light-dark(rgb(0 0 0 / 0.11), rgb(255 255 255 / 0.08));
|
|
22
|
+
/* Floating layers (menus, popovers, dialogs) get a stronger hairline than resting cards. */
|
|
23
|
+
--line-float: light-dark(rgb(0 0 0 / 0.13), rgb(255 255 255 / 0.12));
|
|
24
|
+
/* Edges (Linear's lit corner, their .edgeHighlightRing): a base hairline, plus --edge-hi stacked on it inside a 100px
|
|
25
|
+
radial at the top-left corner (solid for the first 16%, then fading). --edge-shadow is the outer ring.
|
|
26
|
+
--edge-grad / --edge-grad-float paint the same edge as background layers, for scroll containers: under a transparent
|
|
27
|
+
1px border, below a padding-box fill (effects.css). Each layer is placed and clipped on the border box (border-box)
|
|
28
|
+
and drawn once (no-repeat): placed on the padding box, as backgrounds are by default, the image is 2px smaller than
|
|
29
|
+
the box and repeats into the border, so the next tile's lit corner showed along the right and bottom hairlines. */
|
|
30
|
+
--edge-hi: light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.12));
|
|
31
|
+
--edge-r: 100px;
|
|
32
|
+
--edge-plateau: 16%;
|
|
33
|
+
--edge-grad:
|
|
34
|
+
radial-gradient(var(--edge-r) var(--edge-r) at 0 0, var(--edge-hi) 0%, var(--edge-hi) var(--edge-plateau), transparent 100%) border-box no-repeat,
|
|
35
|
+
linear-gradient(var(--line-strong), var(--line-strong)) border-box no-repeat;
|
|
36
|
+
--edge-grad-float:
|
|
37
|
+
radial-gradient(var(--edge-r) var(--edge-r) at 0 0, var(--edge-hi) 0%, var(--edge-hi) var(--edge-plateau), transparent 100%) border-box no-repeat,
|
|
38
|
+
linear-gradient(var(--line-float), var(--line-float)) border-box no-repeat;
|
|
39
|
+
--edge-shadow: 0 1px 2px light-dark(rgb(0 0 0 / 0.04), transparent), 0 0 0 1px light-dark(transparent, rgb(0 0 0 / 0.2));
|
|
40
|
+
/* Shine (Linear's .shine): a 200px beam of brighter hairline on the view card's left edge, near the top. */
|
|
41
|
+
--shine: light-dark(rgb(0 0 0 / 0.4), rgb(255 255 255 / 0.4));
|
|
42
|
+
--view-line: light-dark(rgb(0 0 0 / 0.07), rgb(255 255 255 / 0.05));
|
|
43
|
+
--view-shadow:
|
|
44
|
+
0 0 0 1px light-dark(rgb(0 0 0 / 0.015), transparent), 0 1px 3px light-dark(rgb(0 0 0 / 0.04), transparent),
|
|
45
|
+
0 0 0 1px light-dark(transparent, rgb(0 0 0 / 0.2));
|
|
46
|
+
/* Thinking shimmer (see Shimmer.svelte): the label rests at --shimmer-base and a band of --shimmer-hi sweeps across it. */
|
|
47
|
+
--shimmer-base: var(--muted);
|
|
48
|
+
--shimmer-hi: var(--fg);
|
|
49
|
+
/* How strongly the working sweep along a pill's edge shows (.shimmer: Select loading, a busy Button, status pills).
|
|
50
|
+
Its image is indigo and greys, so light surfaces need all of it, dark ones less: 1 here, 0.7 in dark (below). */
|
|
51
|
+
--shimmer-strength: 1;
|
|
52
|
+
/* Raised relief (the chosen segment of a RadioGroup): the top inner edge catches the light and the bottom inner edge
|
|
53
|
+
falls into shade, so the box reads as standing off the surface. Use both: inset 0 1px 0 …-edge, inset 0 -1px 0 …-base. */
|
|
54
|
+
--raised-edge: light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.12));
|
|
55
|
+
--raised-base: light-dark(rgb(0 0 0 / 0.06), rgb(0 0 0 / 0.25));
|
|
56
|
+
/* Solid buttons (primary, danger) on their own colour, both themes: the lit top inner edge, and the hairline around them. */
|
|
57
|
+
--solid-edge: rgb(255 255 255 / 0.2);
|
|
58
|
+
--solid-line: rgb(255 255 255 / 0.12);
|
|
59
|
+
/* Thumbs and knobs (Switch, Slider): a white disc that keeps its contact shadow on any track. */
|
|
60
|
+
--knob: #ffffff;
|
|
61
|
+
--knob-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
|
|
62
|
+
--knob-ring: rgb(0 0 0 / 0.12);
|
|
63
|
+
/* Sunken relief for fields and tracks, the counterpart of --shadow-btn at about the same edge contrast, kept crisp: the
|
|
64
|
+
button's faint lit ring inside, a sharp shade under the top edge with a short falloff, and the lit edge at the bottom
|
|
65
|
+
instead of the top, so the box reads as pressed into the surface. No dark ring: on the dark frame it would sink the
|
|
66
|
+
edge into the page instead of drawing it. Goes under the field's own hairline. */
|
|
67
|
+
--sunken-shadow:
|
|
68
|
+
inset 0 0 0 1px light-dark(transparent, rgb(255 255 255 / 0.03)), inset 0 -1px 0 light-dark(rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.04)),
|
|
69
|
+
inset 0 2px 0 light-dark(rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.35)), inset 0 2px 2px light-dark(rgb(0 0 0 / 0.04), rgb(0 0 0 / 0.2));
|
|
70
|
+
/* Atmosphere: a soft light in the top-left corner of the shell (Linear's sidebar glow), and a fine film grain for the
|
|
71
|
+
modal backdrops. The grain's strength is baked into its alpha (the matrix's last value), so it can be one background
|
|
72
|
+
layer over a colour. */
|
|
73
|
+
--glow: light-dark(color-mix(in lch, #5e6ad2 7%, transparent), rgb(255 255 255 / 0.04));
|
|
74
|
+
--grain: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 .13'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
|
75
|
+
/* Lit relief (Surface Lab: texture 0.3, reflection 0.2, light 137°), painted under the frame. A lit fractal-noise bump map
|
|
76
|
+
that overlay-blends into --bg, so flat areas stay neutral and only the relief reads; works on light and dark alike.
|
|
77
|
+
The original's layer opacities are baked in: 0.24 into the SVG's alpha row, 0.2 into the shading gradient's stops. */
|
|
78
|
+
--relief-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='2' seed='0' stitchTiles='stitch' result='n'/%3E%3CfeDiffuseLighting in='n' surfaceScale='2.2' diffuseConstant='1' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='227' elevation='52'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='1 0 0 0 -.29 0 1 0 0 -.29 0 0 1 0 -.29 0 0 0 0 .24'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E")
|
|
79
|
+
0 0 / 240px 240px;
|
|
80
|
+
--relief-shade: linear-gradient(137deg, rgb(255 255 255 / 0.048) 0%, rgb(255 255 255 / 0) 38%, rgb(0 0 0 / 0) 70%, rgb(0 0 0 / 0.028) 100%);
|
|
81
|
+
--fill-1: light-dark(rgb(0 0 0 / 0.02), rgb(255 255 255 / 0.02));
|
|
82
|
+
--fill-2: light-dark(rgb(0 0 0 / 0.035), rgb(255 255 255 / 0.035));
|
|
83
|
+
--fill-3: light-dark(rgb(0 0 0 / 0.055), rgb(255 255 255 / 0.05));
|
|
84
|
+
--fill-4: light-dark(rgb(0 0 0 / 0.08), rgb(255 255 255 / 0.08));
|
|
85
|
+
/* Control fills: the --fill-* scale with a faint cast of the brand hue, for anything you can press, type into or drag
|
|
86
|
+
(buttons, fields, triggers, segments, tracks, menu items). Surfaces and their fills stay neutral grey, so a control
|
|
87
|
+
reads apart from the elevation it sits on. --control-hue is a deep indigo on light, a pale one on dark, so the
|
|
88
|
+
cast darkens light surfaces and lightens dark ones as the plain fills do. */
|
|
89
|
+
--control-hue: light-dark(color-mix(in lch, var(--brand), black 25%), color-mix(in lch, var(--brand), white 20%));
|
|
90
|
+
--control-1: color-mix(in lch, var(--control-hue) 5%, transparent);
|
|
91
|
+
--control-2: color-mix(in lch, var(--control-hue) 8%, transparent);
|
|
92
|
+
--control-3: color-mix(in lch, var(--control-hue) 11%, transparent);
|
|
93
|
+
--control-4: color-mix(in lch, var(--control-hue) 15%, transparent);
|
|
94
|
+
--fg: light-dark(#282a30, #f7f8f8);
|
|
95
|
+
--fg-2: light-dark(#3c4149, #d0d6e0);
|
|
96
|
+
--muted: light-dark(#6f6e77, #8a8f98);
|
|
97
|
+
--faint: light-dark(#8f8d96, #62666d);
|
|
98
|
+
--accent: light-dark(#5e6ad2, #7170ff);
|
|
99
|
+
--brand: #5e6ad2;
|
|
100
|
+
--accent-ink: #ffffff;
|
|
101
|
+
--accent-soft: light-dark(color-mix(in lch, var(--accent) 10%, transparent), color-mix(in lch, var(--brand) 18%, transparent));
|
|
102
|
+
--accent-line: light-dark(color-mix(in lch, var(--accent) 36%, transparent), color-mix(in lch, var(--accent) 45%, transparent));
|
|
103
|
+
/* Link text (a, .linklike): a brighter, more vivid indigo than --accent so links stand out from accented text.
|
|
104
|
+
AA on every surface: 5.2:1 on light --surface, 6.7:1 on dark --surface. */
|
|
105
|
+
--link: light-dark(#4c5ce8, #8f95ff);
|
|
106
|
+
|
|
107
|
+
/* Semantic tones (separate from the accent): Linear's green / blue / yellow / grey / red. Each has a translucent -soft
|
|
108
|
+
fill for chips and tinted rows. Set data-tone="success|info|warning|neutral|danger" on an element to get --tone / --tone-soft. */
|
|
109
|
+
--success: light-dark(#1f8b4c, #4cb782);
|
|
110
|
+
--info: light-dark(#1b6fc2, #4ea7fc);
|
|
111
|
+
--warning: light-dark(#9a6700, #f2c94c);
|
|
112
|
+
--neutral: light-dark(#6f6e77, #8a8f98);
|
|
113
|
+
--danger: light-dark(#c93b3b, #eb5757);
|
|
114
|
+
--success-soft: light-dark(color-mix(in lch, var(--success) 11%, transparent), color-mix(in lch, var(--success) 14%, transparent));
|
|
115
|
+
--info-soft: light-dark(color-mix(in lch, var(--info) 10%, transparent), color-mix(in lch, var(--info) 14%, transparent));
|
|
116
|
+
--warning-soft: light-dark(color-mix(in lch, var(--warning) 11%, transparent), color-mix(in lch, var(--warning) 13%, transparent));
|
|
117
|
+
--neutral-soft: light-dark(color-mix(in lch, var(--neutral) 10%, transparent), color-mix(in lch, var(--neutral) 13%, transparent));
|
|
118
|
+
--danger-soft: light-dark(color-mix(in lch, var(--danger) 10%, transparent), color-mix(in lch, var(--danger) 14%, transparent));
|
|
119
|
+
|
|
120
|
+
/* Elevation: Linear keeps resting surfaces flat; only floating layers (menus, popovers, dialogs) cast a shadow. */
|
|
121
|
+
--shadow-sm: 0 1px 1px light-dark(rgb(0 0 0 / 0.04), transparent), 0 0 0 1px light-dark(transparent, rgb(0 0 0 / 0.2));
|
|
122
|
+
--shadow-md:
|
|
123
|
+
0 1px 4px -1px light-dark(rgb(0 0 0 / 0.09), transparent), 0 0 0 1px light-dark(transparent, rgb(0 0 0 / 0.2)),
|
|
124
|
+
0 2px 4px light-dark(transparent, rgb(0 0 0 / 0.1));
|
|
125
|
+
/* Raised controls (buttons, select triggers, chosen segments; Linear's buttons): a faint lit ring and a lit top edge
|
|
126
|
+
inside, a contact ring and a soft drop outside. Dark rings the control in near-black against the frame; light has
|
|
127
|
+
no use for the inner ring, takes a stronger top light and a quieter contact ring and drop. */
|
|
128
|
+
--shadow-btn:
|
|
129
|
+
inset 0 0 0 1px light-dark(transparent, rgb(255 255 255 / 0.03)), inset 0 1px 0 light-dark(rgb(255 255 255 / 0.17), rgb(255 255 255 / 0.04)),
|
|
130
|
+
0 0 0 1px light-dark(rgb(0 0 0 / 0.14), rgb(0 0 0 / 0.6)), 0 4px 4px light-dark(rgb(0 0 0 / 0.04), rgb(0 0 0 / 0.1));
|
|
131
|
+
--shadow:
|
|
132
|
+
0 0 0 1px light-dark(rgb(0 0 0 / 0.02), rgb(0 0 0 / 0.2)), 0 2px 32px light-dark(rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.25)),
|
|
133
|
+
0 4px 12px light-dark(rgb(0 0 0 / 0.05), transparent), 0 8px 16px light-dark(transparent, rgb(0 0 0 / 0.2));
|
|
134
|
+
--ring: 0 0 0 2px light-dark(color-mix(in lch, var(--accent) 30%, transparent), color-mix(in lch, var(--accent) 40%, transparent));
|
|
135
|
+
/* Translucent chrome over scrolling content. */
|
|
136
|
+
--glass: light-dark(color-mix(in lch, var(--bg) 82%, transparent), color-mix(in lch, var(--bg) 80%, transparent));
|
|
137
|
+
|
|
138
|
+
/* Type: Inter for UI, headings and text; JetBrains Mono for scores, counts, dates and code. Both bundled (see ../fonts.js). */
|
|
139
|
+
--font-display: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
140
|
+
--font-body: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
141
|
+
--font-data: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
|
|
142
|
+
--font-mono: var(--font-data);
|
|
143
|
+
--w-normal: 400;
|
|
144
|
+
--w-medium: 510;
|
|
145
|
+
--w-semibold: 590;
|
|
146
|
+
|
|
147
|
+
/* Spacing: 4px base, dense dashboard scale. */
|
|
148
|
+
--space-1: 4px;
|
|
149
|
+
--space-2: 8px;
|
|
150
|
+
--space-3: 12px;
|
|
151
|
+
--space-4: 16px;
|
|
152
|
+
--space-5: 20px;
|
|
153
|
+
--space-6: 24px;
|
|
154
|
+
--space-8: 32px;
|
|
155
|
+
|
|
156
|
+
/* Motion: Linear's quick ease-out-quad, ~160ms. */
|
|
157
|
+
--dur-fast: 120ms;
|
|
158
|
+
--dur: 160ms;
|
|
159
|
+
--dur-slow: 240ms;
|
|
160
|
+
--ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
161
|
+
--ease-in: cubic-bezier(0.55, 0.085, 0.68, 0.53);
|
|
162
|
+
/* Material 3's standard decelerate and accelerate curves with their durations (modals use them): entering decelerates
|
|
163
|
+
into place, exiting accelerates away and takes less time. */
|
|
164
|
+
--ease-enter: cubic-bezier(0, 0, 0, 1);
|
|
165
|
+
--dur-enter: 120ms;
|
|
166
|
+
--ease-exit: cubic-bezier(0.3, 0, 1, 1);
|
|
167
|
+
--dur-exit: 80ms;
|
|
168
|
+
/* Modal dialogs' own motion. Spring: a damped spring that overshoots by a fifth and settles back (the bounce a dialog
|
|
169
|
+
scales in with). Dip: sinks to a third of the way below the start by 30%, then accelerates to the end (the small
|
|
170
|
+
drop before a dialog lifts away). Both are sampled curves, so they go past 0 and 1 where cubic-bezier() can't shape them. */
|
|
171
|
+
--ease-spring: linear(
|
|
172
|
+
0,
|
|
173
|
+
0.047,
|
|
174
|
+
0.167,
|
|
175
|
+
0.332,
|
|
176
|
+
0.515,
|
|
177
|
+
0.695,
|
|
178
|
+
0.857,
|
|
179
|
+
0.991,
|
|
180
|
+
1.092,
|
|
181
|
+
1.16,
|
|
182
|
+
1.196,
|
|
183
|
+
1.205,
|
|
184
|
+
1.194,
|
|
185
|
+
1.168,
|
|
186
|
+
1.134,
|
|
187
|
+
1.096,
|
|
188
|
+
1.059,
|
|
189
|
+
1.027,
|
|
190
|
+
1,
|
|
191
|
+
0.979,
|
|
192
|
+
0.966,
|
|
193
|
+
0.959,
|
|
194
|
+
0.958,
|
|
195
|
+
0.961,
|
|
196
|
+
0.966,
|
|
197
|
+
0.973,
|
|
198
|
+
0.981,
|
|
199
|
+
0.988,
|
|
200
|
+
0.995,
|
|
201
|
+
1.001,
|
|
202
|
+
1.005,
|
|
203
|
+
1.007,
|
|
204
|
+
1.008,
|
|
205
|
+
1.009,
|
|
206
|
+
1.008,
|
|
207
|
+
1.007,
|
|
208
|
+
1.005,
|
|
209
|
+
1.004,
|
|
210
|
+
1.002,
|
|
211
|
+
1.001,
|
|
212
|
+
1
|
|
213
|
+
);
|
|
214
|
+
--dur-spring: 400ms;
|
|
215
|
+
--ease-dip: linear(
|
|
216
|
+
0,
|
|
217
|
+
-0.085,
|
|
218
|
+
-0.165,
|
|
219
|
+
-0.233,
|
|
220
|
+
-0.286,
|
|
221
|
+
-0.319,
|
|
222
|
+
-0.33,
|
|
223
|
+
-0.323,
|
|
224
|
+
-0.303,
|
|
225
|
+
-0.269,
|
|
226
|
+
-0.221,
|
|
227
|
+
-0.16,
|
|
228
|
+
-0.086,
|
|
229
|
+
0.003,
|
|
230
|
+
0.104,
|
|
231
|
+
0.22,
|
|
232
|
+
0.349,
|
|
233
|
+
0.491,
|
|
234
|
+
0.647,
|
|
235
|
+
0.817,
|
|
236
|
+
1
|
|
237
|
+
);
|
|
238
|
+
--dur-dip: 240ms;
|
|
239
|
+
/* How long a pointer rests on something before it lights up (a splitter's edge), so merely passing over doesn't flash. */
|
|
240
|
+
--delay-intent: 300ms;
|
|
241
|
+
|
|
242
|
+
/* Layers, lowest to highest. */
|
|
243
|
+
--z-sticky: 10;
|
|
244
|
+
--z-header: 20;
|
|
245
|
+
--z-drawer: 40;
|
|
246
|
+
--z-toast: 50;
|
|
247
|
+
--z-menu: 60;
|
|
248
|
+
--z-overlay: 70;
|
|
249
|
+
|
|
250
|
+
/* Icons (one family: Phosphor regular). */
|
|
251
|
+
--icon-sm: 14px;
|
|
252
|
+
--icon-md: 16px;
|
|
253
|
+
--icon-lg: 20px;
|
|
254
|
+
|
|
255
|
+
--scrim: light-dark(rgb(0 0 0 / 0.25), rgb(0 0 0 / 0.55));
|
|
256
|
+
--scrollbar-thumb: light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.1));
|
|
257
|
+
--scrollbar-thumb-hover: light-dark(rgb(0 0 0 / 0.2), rgb(255 255 255 / 0.2));
|
|
258
|
+
|
|
259
|
+
/* Radii: sm for small chips and keys, r for rows, menu items and fields, lg for cards and popovers, xl for the panel and dialogs. */
|
|
260
|
+
--r-sm: 6px;
|
|
261
|
+
--r: 8px;
|
|
262
|
+
--r-lg: 10px;
|
|
263
|
+
--r-xl: 12px;
|
|
264
|
+
--r-pill: 9999px;
|
|
265
|
+
--gutter-l: max(16px, env(safe-area-inset-left, 0px));
|
|
266
|
+
--gutter-r: max(16px, env(safe-area-inset-right, 0px));
|
|
267
|
+
}
|
|
268
|
+
/* Theme: follows the OS; data-theme pins it. color-scheme picks the side of every light-dark() token. */
|
|
269
|
+
/* More contrast (the OS setting): the design leans on faint hairlines and quiet secondary text, so those get stronger.
|
|
270
|
+
Every boundary (fields, cards, menus) reaches 3:1 against its surface and --muted and --faint body text 4.5:1,
|
|
271
|
+
in both themes. */
|
|
272
|
+
@media (prefers-contrast: more) {
|
|
273
|
+
:root {
|
|
274
|
+
--line: light-dark(rgb(0 0 0 / 0.45), rgb(255 255 255 / 0.4));
|
|
275
|
+
--line-strong: light-dark(rgb(0 0 0 / 0.5), rgb(255 255 255 / 0.48));
|
|
276
|
+
--line-float: light-dark(rgb(0 0 0 / 0.55), rgb(255 255 255 / 0.52));
|
|
277
|
+
--view-line: var(--line);
|
|
278
|
+
--muted: light-dark(#55545c, #b4b9c2);
|
|
279
|
+
--faint: light-dark(#646369, #8a8f98);
|
|
280
|
+
--scrollbar-thumb: light-dark(rgb(0 0 0 / 0.45), rgb(255 255 255 / 0.45));
|
|
281
|
+
--scrollbar-thumb-hover: light-dark(rgb(0 0 0 / 0.6), rgb(255 255 255 / 0.6));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
:root[data-theme='light'] {
|
|
285
|
+
color-scheme: light;
|
|
286
|
+
}
|
|
287
|
+
:root[data-theme='dark'] {
|
|
288
|
+
color-scheme: dark;
|
|
289
|
+
--shimmer-strength: 0.7;
|
|
290
|
+
}
|
|
291
|
+
/* Dark values that aren't colours (light-dark() only takes colours), when the OS is dark and no theme is pinned. */
|
|
292
|
+
@media (prefers-color-scheme: dark) {
|
|
293
|
+
:root:not([data-theme='light']) {
|
|
294
|
+
--shimmer-strength: 0.7;
|
|
295
|
+
}
|
|
296
|
+
}
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The two typefaces the tokens name (--font-body / --font-display: Inter; --font-data: JetBrains Mono), bundled with
|
|
2
|
+
// the app so nothing loads from the network. Import once from the app's entry, or skip it and point the --font-*
|
|
3
|
+
// tokens at your own faces.
|
|
4
|
+
// oxlint-disable-next-line import/no-unassigned-import -- a font package exports nothing; importing it is what registers its @font-face CSS
|
|
5
|
+
import '@fontsource-variable/inter';
|
|
6
|
+
// oxlint-disable-next-line import/no-unassigned-import -- same: imported only for its @font-face CSS
|
|
7
|
+
import '@fontsource-variable/jetbrains-mono';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export { default as Button } from "./components/Button.svelte";
|
|
2
|
+
export { default as ErrorMessage } from "./components/ErrorMessage.svelte";
|
|
3
|
+
export { default as Notice } from "./components/Notice.svelte";
|
|
4
|
+
export { default as Shimmer } from "./components/Shimmer.svelte";
|
|
5
|
+
export { default as DashOutline } from "./components/DashOutline.svelte";
|
|
6
|
+
export { default as WorkingBorder } from "./components/WorkingBorder.svelte";
|
|
7
|
+
export { default as Canvas } from "./components/Canvas.svelte";
|
|
8
|
+
export { default as Collapsible } from "./components/Collapsible.svelte";
|
|
9
|
+
export { default as CollapsibleAdvanced } from "./components/CollapsibleAdvanced.svelte";
|
|
10
|
+
export { default as Splitter } from "./components/Splitter.svelte";
|
|
11
|
+
export { default as Popover } from "./components/Popover.svelte";
|
|
12
|
+
export { default as Tooltip } from "./components/Tooltip.svelte";
|
|
13
|
+
export { default as InfoTip } from "./components/InfoTip.svelte";
|
|
14
|
+
export { default as Md } from "./components/Md.svelte";
|
|
15
|
+
export { default as AnchorHeading } from "./components/AnchorHeading.svelte";
|
|
16
|
+
export { default as Table } from "./components/Table.svelte";
|
|
17
|
+
export { default as Toast } from "./components/Toast.svelte";
|
|
18
|
+
export { default as Dialogs } from "./components/Dialogs.svelte";
|
|
19
|
+
export { default as Modal } from "./components/Modal.svelte";
|
|
20
|
+
export { default as Drawer } from "./components/Drawer.svelte";
|
|
21
|
+
export { default as Breadcrumbs } from "./components/Breadcrumbs.svelte";
|
|
22
|
+
export { default as ButtonGroup } from "./components/inputs/ButtonGroup.svelte";
|
|
23
|
+
export { default as SearchField } from "./components/inputs/SearchField.svelte";
|
|
24
|
+
export { default as RadioGroup } from "./components/inputs/RadioGroup.svelte";
|
|
25
|
+
export { default as Segmented } from "./components/inputs/Segmented.svelte";
|
|
26
|
+
export { default as Select } from "./components/inputs/Select.svelte";
|
|
27
|
+
export { default as Slider } from "./components/inputs/Slider.svelte";
|
|
28
|
+
export { default as RangeSlider } from "./components/inputs/RangeSlider.svelte";
|
|
29
|
+
export { default as FieldLabel } from "./components/inputs/FieldLabel.svelte";
|
|
30
|
+
export { default as DatePicker } from "./components/inputs/DatePicker.svelte";
|
|
31
|
+
export { default as DateRangePicker } from "./components/inputs/DateRangePicker.svelte";
|
|
32
|
+
export { default as DateRangeSelect } from "./components/inputs/DateRangeSelect.svelte";
|
|
33
|
+
export { default as Calendar } from "./components/inputs/Calendar.svelte";
|
|
34
|
+
export { default as ListSearch } from "./components/inputs/ListSearch.svelte";
|
|
35
|
+
export { default as Switch } from "./components/inputs/Switch.svelte";
|
|
36
|
+
export { default as TagInput } from "./components/inputs/TagInput.svelte";
|
|
37
|
+
export { default as TextArea } from "./components/inputs/TextArea.svelte";
|
|
38
|
+
export { default as TextField } from "./components/inputs/TextField.svelte";
|
|
39
|
+
export { default as ContextMenu } from "./components/menu/ContextMenu.svelte";
|
|
40
|
+
export { default as MenuList } from "./components/menu/MenuList.svelte";
|
|
41
|
+
export { default as MenuButton } from "./components/menu/MenuButton.svelte";
|
|
42
|
+
export { radioKeys } from "./lib/roving.js";
|
|
43
|
+
export * as dates from "./lib/dates.js";
|
|
44
|
+
export { scrollFade } from "./lib/scroll-fade.js";
|
|
45
|
+
export { validity } from "./lib/validity.js";
|
|
46
|
+
export { tooltip } from "./lib/tooltip.js";
|
|
47
|
+
export { reveal } from "./lib/reveal.js";
|
|
48
|
+
export { fieldErrors } from "./lib/field-errors.svelte.js";
|
|
49
|
+
export { inlineMd } from "./lib/inline-md.js";
|
|
50
|
+
export { spotlight } from "./lib/spotlight.js";
|
|
51
|
+
export { morph } from "./lib/morph.svelte.js";
|
|
52
|
+
export { default as Icon, registerIcons, iconNames, hasIcon } from "./components/Icon.svelte";
|
|
53
|
+
export { default as Empty, EmptyError } from "./components/empty/index.js";
|
|
54
|
+
export { default as SideMenu, SideMenuGroup, SideMenuItem } from "./components/side-menu/index.js";
|
|
55
|
+
export { default as Tile, TileGroup } from "./components/tiles/index.js";
|
|
56
|
+
export { default as Metadata, MetadataRow } from "./components/metadata/index.js";
|
|
57
|
+
export { default as FilterBar, FilterChip, OptionList } from "./components/filters/index.js";
|
|
58
|
+
export { default as Upload, UploadFile, UploadFiles, UploadFolder, UploadImage, UploadImages, UploadZone } from "./components/upload/index.js";
|
|
59
|
+
export { menu, openMenu, openMenuFrom, closeMenu, contextMenu } from "./lib/menu.svelte.js";
|
|
60
|
+
export { alertDialog, confirmDialog, promptDialog } from "./lib/dialogs.svelte.js";
|
|
61
|
+
export { portal, portalNear, topLayer, backdropClose, closeRequests, composing } from "./lib/dom.js";
|
|
62
|
+
export { invalid, FIRST_INVALID } from "./lib/invalid.js";
|
|
63
|
+
export { relativeDay, datePresets } from "./lib/dates.js";
|
|
64
|
+
export { announce, cancelAnnouncement } from "./lib/announce.js";
|
|
65
|
+
export { motion, durations, easings, fade, fly, slide, scale, flip, tween } from "./lib/motion.js";
|
|
66
|
+
export { observeSize, observeVisibility } from "./lib/observe.js";
|
|
67
|
+
export { wantsSearch, matches, SEARCH_AFTER } from "./lib/list-search.js";
|
|
68
|
+
export { dropped, droppedFiles, filesUnder, filesOfDrop, accepts, fileSize, preview, fileDrop } from "./lib/files.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Everything the design system exports, by name: import { Button, tooltip } from '@xerios/design-system'.
|
|
2
|
+
// Single files can also be imported by path (@xerios/design-system/components/inputs/Select.svelte).
|
|
3
|
+
// The global CSS and the fonts are side-effect imports and are not included here:
|
|
4
|
+
// import '@xerios/design-system/fonts.js';
|
|
5
|
+
// import '@xerios/design-system/css/index.css';
|
|
6
|
+
|
|
7
|
+
export { default as Icon, registerIcons, iconNames, hasIcon } from './components/Icon.svelte'
|
|
8
|
+
export { default as Empty, EmptyError } from './components/empty/index.js'
|
|
9
|
+
export { default as Button } from './components/Button.svelte'
|
|
10
|
+
export { default as ErrorMessage } from './components/ErrorMessage.svelte'
|
|
11
|
+
export { default as Notice } from './components/Notice.svelte'
|
|
12
|
+
export { default as Shimmer } from './components/Shimmer.svelte'
|
|
13
|
+
export { default as DashOutline } from './components/DashOutline.svelte'
|
|
14
|
+
export { default as WorkingBorder } from './components/WorkingBorder.svelte'
|
|
15
|
+
export { default as Canvas } from './components/Canvas.svelte'
|
|
16
|
+
export { default as Collapsible } from './components/Collapsible.svelte'
|
|
17
|
+
export { default as CollapsibleAdvanced } from './components/CollapsibleAdvanced.svelte'
|
|
18
|
+
export { default as Splitter } from './components/Splitter.svelte'
|
|
19
|
+
export { default as Popover } from './components/Popover.svelte'
|
|
20
|
+
export { default as Tooltip } from './components/Tooltip.svelte'
|
|
21
|
+
export { default as InfoTip } from './components/InfoTip.svelte'
|
|
22
|
+
export { default as Md } from './components/Md.svelte'
|
|
23
|
+
export { default as AnchorHeading } from './components/AnchorHeading.svelte'
|
|
24
|
+
export { default as Table } from './components/Table.svelte'
|
|
25
|
+
export { default as Toast } from './components/Toast.svelte'
|
|
26
|
+
export { default as Dialogs } from './components/Dialogs.svelte'
|
|
27
|
+
export { default as Modal } from './components/Modal.svelte'
|
|
28
|
+
export { default as Drawer } from './components/Drawer.svelte'
|
|
29
|
+
export { default as Breadcrumbs } from './components/Breadcrumbs.svelte'
|
|
30
|
+
export { default as SideMenu, SideMenuGroup, SideMenuItem } from './components/side-menu/index.js'
|
|
31
|
+
export { default as Tile, TileGroup } from './components/tiles/index.js'
|
|
32
|
+
export { default as Metadata, MetadataRow } from './components/metadata/index.js'
|
|
33
|
+
export { default as FilterBar, FilterChip, OptionList } from './components/filters/index.js'
|
|
34
|
+
export { default as Upload, UploadFile, UploadFiles, UploadFolder, UploadImage, UploadImages, UploadZone } from './components/upload/index.js'
|
|
35
|
+
|
|
36
|
+
export { default as ButtonGroup } from './components/inputs/ButtonGroup.svelte'
|
|
37
|
+
export { default as SearchField } from './components/inputs/SearchField.svelte'
|
|
38
|
+
export { default as RadioGroup } from './components/inputs/RadioGroup.svelte'
|
|
39
|
+
export { default as Segmented } from './components/inputs/Segmented.svelte'
|
|
40
|
+
export { default as Select } from './components/inputs/Select.svelte'
|
|
41
|
+
export { default as Slider } from './components/inputs/Slider.svelte'
|
|
42
|
+
export { default as RangeSlider } from './components/inputs/RangeSlider.svelte'
|
|
43
|
+
export { default as FieldLabel } from './components/inputs/FieldLabel.svelte'
|
|
44
|
+
export { default as DatePicker } from './components/inputs/DatePicker.svelte'
|
|
45
|
+
export { default as DateRangePicker } from './components/inputs/DateRangePicker.svelte'
|
|
46
|
+
export { default as DateRangeSelect } from './components/inputs/DateRangeSelect.svelte'
|
|
47
|
+
export { default as Calendar } from './components/inputs/Calendar.svelte'
|
|
48
|
+
export { default as ListSearch } from './components/inputs/ListSearch.svelte'
|
|
49
|
+
export { default as Switch } from './components/inputs/Switch.svelte'
|
|
50
|
+
export { default as TagInput } from './components/inputs/TagInput.svelte'
|
|
51
|
+
export { default as TextArea } from './components/inputs/TextArea.svelte'
|
|
52
|
+
export { default as TextField } from './components/inputs/TextField.svelte'
|
|
53
|
+
|
|
54
|
+
export { default as ContextMenu } from './components/menu/ContextMenu.svelte'
|
|
55
|
+
export { default as MenuList } from './components/menu/MenuList.svelte'
|
|
56
|
+
export { default as MenuButton } from './components/menu/MenuButton.svelte'
|
|
57
|
+
|
|
58
|
+
export { menu, openMenu, openMenuFrom, closeMenu, contextMenu } from './lib/menu.svelte.js'
|
|
59
|
+
export { alertDialog, confirmDialog, promptDialog } from './lib/dialogs.svelte.js'
|
|
60
|
+
export { portal, portalNear, topLayer, backdropClose, closeRequests, composing } from './lib/dom.js'
|
|
61
|
+
export { radioKeys } from './lib/roving.js'
|
|
62
|
+
export { invalid, FIRST_INVALID } from './lib/invalid.js'
|
|
63
|
+
export * as dates from './lib/dates.js'
|
|
64
|
+
export { relativeDay, datePresets } from './lib/dates.js'
|
|
65
|
+
export { announce, cancelAnnouncement } from './lib/announce.js'
|
|
66
|
+
export { motion, durations, easings, fade, fly, slide, scale, flip, tween } from './lib/motion.js'
|
|
67
|
+
export { scrollFade } from './lib/scroll-fade.js'
|
|
68
|
+
export { observeSize, observeVisibility } from './lib/observe.js'
|
|
69
|
+
export { validity } from './lib/validity.js'
|
|
70
|
+
export { tooltip } from './lib/tooltip.js'
|
|
71
|
+
export { wantsSearch, matches, SEARCH_AFTER } from './lib/list-search.js'
|
|
72
|
+
export { reveal } from './lib/reveal.js'
|
|
73
|
+
export { fieldErrors } from './lib/field-errors.svelte.js'
|
|
74
|
+
export { inlineMd } from './lib/inline-md.js'
|
|
75
|
+
export { spotlight } from './lib/spotlight.js'
|
|
76
|
+
export { dropped, droppedFiles, filesUnder, filesOfDrop, accepts, fileSize, preview, fileDrop } from './lib/files.js'
|
|
77
|
+
export { morph } from './lib/morph.svelte.js'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The page's one polite live region, for screen reader announcements that nothing else carries: a field's error once
|
|
2
|
+
// it is left, a tag added or removed. One region for the whole page: a live region per message, or one that only
|
|
3
|
+
// appears with its message, is not reliably read out.
|
|
4
|
+
//
|
|
5
|
+
// announce('Enter a name') read out after a short pause (default 500ms), so it doesn't cut into
|
|
6
|
+
// whatever the next focused control announces
|
|
7
|
+
// announce('Added docs', { delay: 0 }) right away
|
|
8
|
+
// cancelAnnouncement() drop a pending one (the error was fixed before it was read)
|
|
9
|
+
//
|
|
10
|
+
// Errors shown by a failed submit aren't announced here: moving the focus to the first invalid field reads them.
|
|
11
|
+
// Critical failures that need interrupting (a save that failed) use role="alert" instead (ErrorMessage, inline).
|
|
12
|
+
|
|
13
|
+
/** @type {HTMLElement | null} */
|
|
14
|
+
let region = null
|
|
15
|
+
/** @type {ReturnType<typeof setTimeout> | undefined} */
|
|
16
|
+
let timer
|
|
17
|
+
|
|
18
|
+
/** The region, inside the topmost modal dialog if one is open: everything outside a modal is inert and isn't read. */
|
|
19
|
+
function ensureRegion() {
|
|
20
|
+
if (!region) {
|
|
21
|
+
region = document.createElement('div')
|
|
22
|
+
region.setAttribute('aria-live', 'polite')
|
|
23
|
+
region.className = 'sr-only'
|
|
24
|
+
region.dataset.announcer = ''
|
|
25
|
+
}
|
|
26
|
+
const modals = document.querySelectorAll('dialog:modal')
|
|
27
|
+
const host = modals[modals.length - 1] ?? document.body
|
|
28
|
+
if (region.parentNode !== host) host.append(region)
|
|
29
|
+
return region
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} text
|
|
34
|
+
* @param {{ delay?: number }} [options]
|
|
35
|
+
*/
|
|
36
|
+
export function announce(text, { delay = 500 } = {}) {
|
|
37
|
+
if (typeof document === 'undefined' || !text) return
|
|
38
|
+
const live = ensureRegion()
|
|
39
|
+
clearTimeout(timer)
|
|
40
|
+
// Emptied first, so the same text said twice is read twice.
|
|
41
|
+
live.textContent = ''
|
|
42
|
+
timer = setTimeout(() => (live.textContent = text), Math.max(delay, 50))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function cancelAnnouncement() {
|
|
46
|
+
clearTimeout(timer)
|
|
47
|
+
if (region) region.textContent = ''
|
|
48
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether text in el can be selected, resolved as the browser does: the nearest user-select that isn't auto wins
|
|
3
|
+
* (Chromium inherits the property, Firefox doesn't, so walk up). Editable elements always can.
|
|
4
|
+
* @param {Element} el
|
|
5
|
+
*/
|
|
6
|
+
export function selectable(el: Element): boolean;
|
|
7
|
+
/** contextmenu listener: no browser menu over a control. @param {MouseEvent} e */
|
|
8
|
+
export function noControlMenu(e: MouseEvent): void;
|
|
9
|
+
/** dragstart listener: a control's label, link or image isn't dragged out. @param {DragEvent} e */
|
|
10
|
+
export function noControlDrag(e: DragEvent): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls aren't content. Where base.css turns text selection off (buttons, lists, menus, pickers, labels…), these
|
|
3
|
+
* document listeners also cancel the browser's own drag and right-click menu, so pressing and dragging a control can't
|
|
4
|
+
* pick up its label or a link, and a right-click doesn't offer Back, Reload or Save over it. Content keeps both: text,
|
|
5
|
+
* toasts, alerts, and anything a component sets back to user-select: text (a pinned InfoTip). Text fields and links
|
|
6
|
+
* keep their menu (paste, open in a new tab), an element marked draggable="true" keeps its drag, a contextMenu
|
|
7
|
+
* attachment still opens its menu, and Shift + right-click always gets the browser's menu (to inspect an element).
|
|
8
|
+
* The ContextMenu singleton installs both on the document.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @param {EventTarget | null} target */
|
|
12
|
+
const elementOf = (target) => (target instanceof Element ? target : target instanceof Node ? target.parentElement : null)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether text in el can be selected, resolved as the browser does: the nearest user-select that isn't auto wins
|
|
16
|
+
* (Chromium inherits the property, Firefox doesn't, so walk up). Editable elements always can.
|
|
17
|
+
* @param {Element} el
|
|
18
|
+
*/
|
|
19
|
+
export function selectable(el) {
|
|
20
|
+
for (let node = el; node; node = node.parentElement) {
|
|
21
|
+
if (node instanceof HTMLElement && node.isContentEditable) return true
|
|
22
|
+
const style = getComputedStyle(node)
|
|
23
|
+
const value = style.userSelect || style.webkitUserSelect
|
|
24
|
+
if (value && value !== 'auto') return value !== 'none'
|
|
25
|
+
}
|
|
26
|
+
return true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** contextmenu listener: no browser menu over a control. @param {MouseEvent} e */
|
|
30
|
+
export function noControlMenu(e) {
|
|
31
|
+
if (e.defaultPrevented || e.shiftKey) return
|
|
32
|
+
const el = elementOf(e.target)
|
|
33
|
+
if (!el || el.closest('a[href]') || selectable(el)) return
|
|
34
|
+
e.preventDefault()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** dragstart listener: a control's label, link or image isn't dragged out. @param {DragEvent} e */
|
|
38
|
+
export function noControlDrag(e) {
|
|
39
|
+
const el = elementOf(e.target)
|
|
40
|
+
if (!el || el.closest('[draggable="true"]') || selectable(el)) return
|
|
41
|
+
e.preventDefault()
|
|
42
|
+
}
|