@sepale/components 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 +65 -3
- package/dist/components/Accordion.svelte +48 -0
- package/dist/components/Accordion.svelte.d.ts +24 -0
- package/dist/components/Alert.svelte +107 -0
- package/dist/components/Alert.svelte.d.ts +40 -0
- package/dist/components/Avatar.svelte +75 -0
- package/dist/components/Avatar.svelte.d.ts +37 -0
- package/dist/components/Badge.svelte +46 -0
- package/dist/components/Badge.svelte.d.ts +22 -0
- package/dist/components/Breadcrumbs.svelte +36 -0
- package/dist/components/Breadcrumbs.svelte.d.ts +18 -0
- package/dist/components/Bubble.svelte +43 -0
- package/dist/components/Bubble.svelte.d.ts +23 -0
- package/dist/components/Button.svelte +132 -0
- package/dist/components/Button.svelte.d.ts +40 -0
- package/dist/components/Calendar.svelte +193 -0
- package/dist/components/Calendar.svelte.d.ts +60 -0
- package/dist/components/Card.svelte +69 -0
- package/dist/components/Card.svelte.d.ts +37 -0
- package/dist/components/Carousel.svelte +550 -0
- package/dist/components/Carousel.svelte.d.ts +124 -0
- package/dist/components/Checkbox.svelte +48 -0
- package/dist/components/Checkbox.svelte.d.ts +26 -0
- package/dist/components/Chip.svelte +60 -0
- package/dist/components/Chip.svelte.d.ts +26 -0
- package/dist/components/ChipsInput.svelte +158 -0
- package/dist/components/ChipsInput.svelte.d.ts +64 -0
- package/dist/components/Collapse.svelte +101 -0
- package/dist/components/Collapse.svelte.d.ts +46 -0
- package/dist/components/ColorPicker.svelte +135 -0
- package/dist/components/ColorPicker.svelte.d.ts +44 -0
- package/dist/components/Combobox.svelte +496 -0
- package/dist/components/Combobox.svelte.d.ts +96 -0
- package/dist/components/DataControl.svelte +754 -0
- package/dist/components/DataControl.svelte.d.ts +143 -0
- package/dist/components/DataHandler.svelte +67 -0
- package/dist/components/DataHandler.svelte.d.ts +44 -0
- package/dist/components/DatePicker.svelte +185 -0
- package/dist/components/DatePicker.svelte.d.ts +56 -0
- package/dist/components/Dialog.svelte +194 -0
- package/dist/components/Dialog.svelte.d.ts +51 -0
- package/dist/components/Divider.svelte +54 -0
- package/dist/components/Divider.svelte.d.ts +27 -0
- package/dist/components/Dock.svelte +34 -0
- package/dist/components/Dock.svelte.d.ts +18 -0
- package/dist/components/Drawer.svelte +174 -0
- package/dist/components/Drawer.svelte.d.ts +51 -0
- package/dist/components/Dropdown.svelte +183 -0
- package/dist/components/Dropdown.svelte.d.ts +52 -0
- package/dist/components/Editable.svelte +292 -0
- package/dist/components/Editable.svelte.d.ts +113 -0
- package/dist/components/EmptyState.svelte +64 -0
- package/dist/components/EmptyState.svelte.d.ts +29 -0
- package/dist/components/Fieldset.svelte +42 -0
- package/dist/components/Fieldset.svelte.d.ts +20 -0
- package/dist/components/FileDropzone.svelte +154 -0
- package/dist/components/FileDropzone.svelte.d.ts +45 -0
- package/dist/components/FileExplorer.svelte +643 -0
- package/dist/components/FileExplorer.svelte.d.ts +114 -0
- package/dist/components/FileInput.svelte +125 -0
- package/dist/components/FileInput.svelte.d.ts +51 -0
- package/dist/components/FloatingLabel.svelte +38 -0
- package/dist/components/FloatingLabel.svelte.d.ts +24 -0
- package/dist/components/Footer.svelte +68 -0
- package/dist/components/Footer.svelte.d.ts +37 -0
- package/dist/components/Grid.svelte +122 -0
- package/dist/components/Grid.svelte.d.ts +72 -0
- package/dist/components/Hero.svelte +62 -0
- package/dist/components/Hero.svelte.d.ts +33 -0
- package/dist/components/Input.svelte +184 -0
- package/dist/components/Input.svelte.d.ts +65 -0
- package/dist/components/Join.svelte +38 -0
- package/dist/components/Join.svelte.d.ts +21 -0
- package/dist/components/Kanban.svelte +284 -0
- package/dist/components/Kanban.svelte.d.ts +93 -0
- package/dist/components/Label.svelte +32 -0
- package/dist/components/Label.svelte.d.ts +21 -0
- package/dist/components/LaptopFrame.svelte +44 -0
- package/dist/components/LaptopFrame.svelte.d.ts +21 -0
- package/dist/components/List.svelte +95 -0
- package/dist/components/List.svelte.d.ts +69 -0
- package/dist/components/Loading.svelte +37 -0
- package/dist/components/Loading.svelte.d.ts +17 -0
- package/dist/components/Menu.svelte +144 -0
- package/dist/components/Menu.svelte.d.ts +53 -0
- package/dist/components/MobileFrame.svelte +41 -0
- package/dist/components/MobileFrame.svelte.d.ts +21 -0
- package/dist/components/Navbar.svelte +49 -0
- package/dist/components/Navbar.svelte.d.ts +25 -0
- package/dist/components/NumberInput.svelte +255 -0
- package/dist/components/NumberInput.svelte.d.ts +68 -0
- package/dist/components/Pagination.svelte +169 -0
- package/dist/components/Pagination.svelte.d.ts +50 -0
- package/dist/components/Progress.svelte +65 -0
- package/dist/components/Progress.svelte.d.ts +28 -0
- package/dist/components/RadialProgress.svelte +48 -0
- package/dist/components/RadialProgress.svelte.d.ts +20 -0
- package/dist/components/Radio.svelte +50 -0
- package/dist/components/Radio.svelte.d.ts +28 -0
- package/dist/components/Range.svelte +53 -0
- package/dist/components/Range.svelte.d.ts +26 -0
- package/dist/components/Rating.svelte +90 -0
- package/dist/components/Rating.svelte.d.ts +41 -0
- package/dist/components/Select.svelte +338 -0
- package/dist/components/Select.svelte.d.ts +74 -0
- package/dist/components/Sidebar.svelte +100 -0
- package/dist/components/Sidebar.svelte.d.ts +54 -0
- package/dist/components/Skeleton.svelte +40 -0
- package/dist/components/Skeleton.svelte.d.ts +18 -0
- package/dist/components/Stat.svelte +71 -0
- package/dist/components/Stat.svelte.d.ts +35 -0
- package/dist/components/Stats.svelte +38 -0
- package/dist/components/Stats.svelte.d.ts +22 -0
- package/dist/components/Steps.svelte +204 -0
- package/dist/components/Steps.svelte.d.ts +66 -0
- package/dist/components/Subtitle.svelte +44 -0
- package/dist/components/Subtitle.svelte.d.ts +26 -0
- package/dist/components/Swatch.svelte +61 -0
- package/dist/components/Swatch.svelte.d.ts +27 -0
- package/dist/components/Switch.svelte +105 -0
- package/dist/components/Switch.svelte.d.ts +44 -0
- package/dist/components/Table.svelte +243 -0
- package/dist/components/Table.svelte.d.ts +121 -0
- package/dist/components/Tabs.svelte +142 -0
- package/dist/components/Tabs.svelte.d.ts +80 -0
- package/dist/components/Text.svelte +43 -0
- package/dist/components/Text.svelte.d.ts +25 -0
- package/dist/components/Textarea.svelte +76 -0
- package/dist/components/Textarea.svelte.d.ts +39 -0
- package/dist/components/Title.svelte +46 -0
- package/dist/components/Title.svelte.d.ts +29 -0
- package/dist/components/Toast.svelte +154 -0
- package/dist/components/Toast.svelte.d.ts +49 -0
- package/dist/components/Toggle.svelte +48 -0
- package/dist/components/Toggle.svelte.d.ts +25 -0
- package/dist/components/Tooltip.svelte +70 -0
- package/dist/components/Tooltip.svelte.d.ts +34 -0
- package/dist/components/WindowFrame.svelte +53 -0
- package/dist/components/WindowFrame.svelte.d.ts +24 -0
- package/dist/components/accordion-context.d.ts +8 -0
- package/dist/components/accordion-context.js +25 -0
- package/dist/components/color.d.ts +39 -0
- package/dist/components/color.js +92 -0
- package/dist/components/data-handler.svelte.d.ts +362 -0
- package/dist/components/data-handler.svelte.js +690 -0
- package/dist/components/file-icons.d.ts +25 -0
- package/dist/components/file-icons.js +46 -0
- package/dist/family-types.d.ts +45 -0
- package/dist/family-types.js +73 -0
- package/dist/generated/classes.d.ts +17 -0
- package/dist/generated/classes.js +2511 -0
- package/dist/generated/components.d.ts +39 -0
- package/dist/generated/components.js +28666 -0
- package/dist/generated/registry.d.ts +35 -0
- package/dist/generated/registry.js +2658 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +99 -0
- package/dist/sepale-types.d.ts +8 -0
- package/dist/sepale-types.js +200 -0
- package/dist/theme.d.ts +123 -0
- package/dist/theme.js +226 -0
- package/dist/variants.d.ts +124 -0
- package/dist/variants.js +70 -0
- package/dist/vendor/air-datepicker/LICENSE.md +21 -0
- package/dist/vendor/air-datepicker/README.md +19 -0
- package/dist/vendor/air-datepicker/buttonPresets.d.ts +13 -0
- package/dist/vendor/air-datepicker/buttonPresets.js +12 -0
- package/dist/vendor/air-datepicker/consts.d.ts +18 -0
- package/dist/vendor/air-datepicker/consts.js +35 -0
- package/dist/vendor/air-datepicker/datepicker.d.ts +289 -0
- package/dist/vendor/air-datepicker/datepicker.js +1435 -0
- package/dist/vendor/air-datepicker/datepickerBody.d.ts +46 -0
- package/dist/vendor/air-datepicker/datepickerBody.js +386 -0
- package/dist/vendor/air-datepicker/datepickerButtons.d.ts +25 -0
- package/dist/vendor/air-datepicker/datepickerButtons.js +85 -0
- package/dist/vendor/air-datepicker/datepickerCell.d.ts +35 -0
- package/dist/vendor/air-datepicker/datepickerCell.js +297 -0
- package/dist/vendor/air-datepicker/datepickerKeyboard.d.ts +26 -0
- package/dist/vendor/air-datepicker/datepickerKeyboard.js +207 -0
- package/dist/vendor/air-datepicker/datepickerNav.d.ts +31 -0
- package/dist/vendor/air-datepicker/datepickerNav.js +200 -0
- package/dist/vendor/air-datepicker/datepickerTime.d.ts +60 -0
- package/dist/vendor/air-datepicker/datepickerTime.js +276 -0
- package/dist/vendor/air-datepicker/defaults.d.ts +65 -0
- package/dist/vendor/air-datepicker/defaults.js +79 -0
- package/dist/vendor/air-datepicker/index.d.ts +168 -0
- package/dist/vendor/air-datepicker/index.js +3 -0
- package/dist/vendor/air-datepicker/locale/ar.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ar.js +14 -0
- package/dist/vendor/air-datepicker/locale/bg.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/bg.js +14 -0
- package/dist/vendor/air-datepicker/locale/ca.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ca.js +14 -0
- package/dist/vendor/air-datepicker/locale/cs.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/cs.js +14 -0
- package/dist/vendor/air-datepicker/locale/da.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/da.js +14 -0
- package/dist/vendor/air-datepicker/locale/de.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/de.js +14 -0
- package/dist/vendor/air-datepicker/locale/el.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/el.js +14 -0
- package/dist/vendor/air-datepicker/locale/en.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/en.js +14 -0
- package/dist/vendor/air-datepicker/locale/es.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/es.js +14 -0
- package/dist/vendor/air-datepicker/locale/eu.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/eu.js +14 -0
- package/dist/vendor/air-datepicker/locale/fi.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/fi.js +14 -0
- package/dist/vendor/air-datepicker/locale/fr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/fr.js +14 -0
- package/dist/vendor/air-datepicker/locale/hr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/hr.js +14 -0
- package/dist/vendor/air-datepicker/locale/hu.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/hu.js +14 -0
- package/dist/vendor/air-datepicker/locale/id.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/id.js +14 -0
- package/dist/vendor/air-datepicker/locale/it.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/it.js +14 -0
- package/dist/vendor/air-datepicker/locale/ja.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ja.js +14 -0
- package/dist/vendor/air-datepicker/locale/ko.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ko.js +14 -0
- package/dist/vendor/air-datepicker/locale/nb.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/nb.js +14 -0
- package/dist/vendor/air-datepicker/locale/nl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/nl.js +14 -0
- package/dist/vendor/air-datepicker/locale/pl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pl.js +14 -0
- package/dist/vendor/air-datepicker/locale/pt-BR.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pt-BR.js +14 -0
- package/dist/vendor/air-datepicker/locale/pt.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pt.js +14 -0
- package/dist/vendor/air-datepicker/locale/ro.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ro.js +14 -0
- package/dist/vendor/air-datepicker/locale/ru.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ru.js +14 -0
- package/dist/vendor/air-datepicker/locale/si.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/si.js +14 -0
- package/dist/vendor/air-datepicker/locale/sk.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sk.js +14 -0
- package/dist/vendor/air-datepicker/locale/sl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sl.js +14 -0
- package/dist/vendor/air-datepicker/locale/sv.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sv.js +14 -0
- package/dist/vendor/air-datepicker/locale/th.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/th.js +14 -0
- package/dist/vendor/air-datepicker/locale/tr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/tr.js +16 -0
- package/dist/vendor/air-datepicker/locale/uk.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/uk.js +14 -0
- package/dist/vendor/air-datepicker/locale/zh.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/zh.js +14 -0
- package/dist/vendor/air-datepicker/typedefs.d.ts +3 -0
- package/dist/vendor/air-datepicker/typedefs.js +15 -0
- package/dist/vendor/air-datepicker/utils.d.ts +155 -0
- package/dist/vendor/air-datepicker/utils.js +395 -0
- package/dist/vendor/air-datepicker/withEvents.d.ts +1 -0
- package/dist/vendor/air-datepicker/withEvents.js +39 -0
- package/package.json +44 -3
package/dist/theme.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme model.
|
|
3
|
+
*
|
|
4
|
+
* A *family* is a set of opinionated classes **with its own set of
|
|
5
|
+
* variables**. Sharing a variable name with another family is a convenience,
|
|
6
|
+
* never a rule. This module does not decide what a family exposes: it reads
|
|
7
|
+
* the declaration out of the registry and serialises the edited values back
|
|
8
|
+
* to a drop-in `:root { … }` stylesheet.
|
|
9
|
+
*
|
|
10
|
+
* Which inks are parameters is the family's call: daisy exposes every one
|
|
11
|
+
* (`--color-primary-content`, as daisyUI does), the others derive theirs in
|
|
12
|
+
* CSS (`--color-on-primary`, see each family's `_root.scss`). A colour token
|
|
13
|
+
* says which variable holds its ink through `on`; nothing here reads a name.
|
|
14
|
+
*/
|
|
15
|
+
const TOKEN_TYPES = ['color', 'length', 'number', 'text', 'edge-width', 'shadows'];
|
|
16
|
+
/** Units offered for editable lengths. `%` is excluded on purpose: it is
|
|
17
|
+
* meaningless on a border and unreadable on a slider. */
|
|
18
|
+
export const LENGTH_UNITS = ['px', 'rem', 'em', 'ch'];
|
|
19
|
+
/**
|
|
20
|
+
* Split a CSS length into its number and its unit (`"0.5rem"` → `[0.5, 'rem']`).
|
|
21
|
+
*
|
|
22
|
+
* A four-value shorthand — `1px 0 1px 0`, an edge set — reads back as its
|
|
23
|
+
* first non-zero part, which is exactly the number that was typed.
|
|
24
|
+
*/
|
|
25
|
+
export function splitLength(value, fallbackUnit = 'rem') {
|
|
26
|
+
const parts = String(value).trim().split(/\s+/);
|
|
27
|
+
const pick = parts.find((p) => p !== '0' && !/^0[a-z%]*$/i.test(p)) ?? parts[0] ?? '0';
|
|
28
|
+
const m = pick.match(/^(-?[\d.]+)\s*([a-z%]*)$/i);
|
|
29
|
+
if (!m)
|
|
30
|
+
return [0, fallbackUnit];
|
|
31
|
+
return [parseFloat(m[1]) || 0, m[2] || fallbackUnit];
|
|
32
|
+
}
|
|
33
|
+
export const SIDES = ['top', 'right', 'bottom', 'left'];
|
|
34
|
+
/** A width and its edges as one shorthand. All four on → just the length. */
|
|
35
|
+
export function edgeWidthToCss({ width, sides }) {
|
|
36
|
+
const e = (s) => (sides[s] ? width : '0');
|
|
37
|
+
return sides.top && sides.right && sides.bottom && sides.left
|
|
38
|
+
? width
|
|
39
|
+
: `${e('top')} ${e('right')} ${e('bottom')} ${e('left')}`;
|
|
40
|
+
}
|
|
41
|
+
/** And back. A part at `0` is an edge that is off. */
|
|
42
|
+
export function edgeWidthFromCss(raw, fallbackUnit = 'px') {
|
|
43
|
+
const p = raw.trim().split(/\s+/);
|
|
44
|
+
const zero = (x) => x === '0' || /^0[a-z%]*$/i.test(x);
|
|
45
|
+
const [n, u] = splitLength(raw, fallbackUnit);
|
|
46
|
+
if (p.length !== 4) {
|
|
47
|
+
const on = !zero(p[0] ?? '0');
|
|
48
|
+
return { width: `${n}${u}`, sides: { top: on, right: on, bottom: on, left: on } };
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
width: `${n}${u}`,
|
|
52
|
+
sides: { top: !zero(p[0] ?? '0'), right: !zero(p[1] ?? '0'), bottom: !zero(p[2] ?? '0'), left: !zero(p[3] ?? '0') }
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** The layers as CSS. An empty list is `none`, not an empty string. */
|
|
56
|
+
export function shadowsToCss(layers) {
|
|
57
|
+
if (!layers.length)
|
|
58
|
+
return 'none';
|
|
59
|
+
return layers
|
|
60
|
+
.map((l) => `${l.inset ? 'inset ' : ''}${l.x} ${l.y} ${l.blur} ${l.spread} ${l.color}`)
|
|
61
|
+
.join(', ');
|
|
62
|
+
}
|
|
63
|
+
/** Split on the commas at depth 0 — not the ones inside `oklch(…)`. */
|
|
64
|
+
function splitTop(v, sep) {
|
|
65
|
+
const out = [];
|
|
66
|
+
let depth = 0;
|
|
67
|
+
let acc = '';
|
|
68
|
+
for (const ch of v) {
|
|
69
|
+
if (ch === '(')
|
|
70
|
+
depth++;
|
|
71
|
+
if (ch === ')')
|
|
72
|
+
depth--;
|
|
73
|
+
if (depth === 0 && sep(ch)) {
|
|
74
|
+
if (acc.trim())
|
|
75
|
+
out.push(acc.trim());
|
|
76
|
+
acc = '';
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
acc += ch;
|
|
80
|
+
}
|
|
81
|
+
if (acc.trim())
|
|
82
|
+
out.push(acc.trim());
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* And back. A layer is up to four lengths and a colour, in any order the
|
|
87
|
+
* spec allows; whatever is not a length is the colour.
|
|
88
|
+
*/
|
|
89
|
+
export function shadowsFromCss(raw) {
|
|
90
|
+
const v = raw.trim();
|
|
91
|
+
if (!v || v === 'none' || v === 'initial')
|
|
92
|
+
return [];
|
|
93
|
+
return splitTop(v, (ch) => ch === ',').map((layer) => {
|
|
94
|
+
const words = splitTop(layer, (ch) => /\s/.test(ch));
|
|
95
|
+
const inset = words.includes('inset');
|
|
96
|
+
const rest = words.filter((w) => w !== 'inset');
|
|
97
|
+
const lengths = rest.filter((x) => /^-?[\d.]/.test(x) || x.startsWith('calc('));
|
|
98
|
+
const color = rest.filter((x) => !lengths.includes(x)).join(' ') || 'currentColor';
|
|
99
|
+
return {
|
|
100
|
+
x: lengths[0] ?? '0px',
|
|
101
|
+
y: lengths[1] ?? '0px',
|
|
102
|
+
blur: lengths[2] ?? '0px',
|
|
103
|
+
spread: lengths[3] ?? '0px',
|
|
104
|
+
color,
|
|
105
|
+
inset
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/* ------------------------------------------------------------------ *
|
|
110
|
+
* Theme files
|
|
111
|
+
* ------------------------------------------------------------------ */
|
|
112
|
+
/**
|
|
113
|
+
* Read a theme file — any stylesheet of `--name: value;` declarations — back
|
|
114
|
+
* into variables. A theme IS its variables, so this is all it takes; the
|
|
115
|
+
* family then keeps the ones it declares (see `tokensForFamily`).
|
|
116
|
+
*/
|
|
117
|
+
export function parseTheme(css) {
|
|
118
|
+
const clean = css.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
119
|
+
/* No prototype: a file may name a variable `__proto__`. */
|
|
120
|
+
const vars = Object.create(null);
|
|
121
|
+
for (const [, name, value] of clean.matchAll(/--([\w-]+)\s*:\s*([^;}]+)/g)) {
|
|
122
|
+
/* The file is not ours: a value that could leave its declaration is
|
|
123
|
+
dropped, and the family's default stands (see "What may be written"). */
|
|
124
|
+
const v = value.trim();
|
|
125
|
+
if (isSafeName(name) && isSafeValue(v))
|
|
126
|
+
vars[name] = v;
|
|
127
|
+
}
|
|
128
|
+
const scheme = safeScheme(clean.match(/(?:^|[\s;{])color-scheme\s*:\s*([^;}]+)/)?.[1]);
|
|
129
|
+
return { vars, scheme };
|
|
130
|
+
}
|
|
131
|
+
import { paramsByFamily, familyDocs } from './generated/registry.js';
|
|
132
|
+
/**
|
|
133
|
+
* Every family declares its own parameters in its SCSS; the build reads them
|
|
134
|
+
* back out and the registry hands them here. Nothing in this file decides what
|
|
135
|
+
* a family exposes — a family with five surfaces, or with none, or with a
|
|
136
|
+
* typeface, comes through unchanged.
|
|
137
|
+
*/
|
|
138
|
+
function fromParam(p) {
|
|
139
|
+
return {
|
|
140
|
+
name: p.name,
|
|
141
|
+
label: p.label,
|
|
142
|
+
group: p.group,
|
|
143
|
+
type: (TOKEN_TYPES.includes(p.type) ? p.type : 'text'),
|
|
144
|
+
value: p.value,
|
|
145
|
+
description: p.description,
|
|
146
|
+
min: p.min,
|
|
147
|
+
max: p.max,
|
|
148
|
+
step: p.step,
|
|
149
|
+
unit: p.unit,
|
|
150
|
+
units: p.units,
|
|
151
|
+
kind: p.kind,
|
|
152
|
+
on: p.on
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** A neutral fallback for the rare caller with no family in hand. */
|
|
156
|
+
export const defaultTheme = (paramsByFamily[Object.keys(paramsByFamily)[0]] ?? []).map(fromParam);
|
|
157
|
+
/** Human label of each family's design language, taken from its own header. */
|
|
158
|
+
export const familyCategory = Object.fromEntries(Object.entries(familyDocs).map(([name, doc]) => [name, doc.after.replace(/^after /, '')]));
|
|
159
|
+
/* ------------------------------------------------------------------ *
|
|
160
|
+
* What may be written into a stylesheet
|
|
161
|
+
*
|
|
162
|
+
* Theme values reach the page as CSS TEXT: the app writes them into a
|
|
163
|
+
* <style> element (routes/+layout.svelte), and they can come from files the
|
|
164
|
+
* user did not write — an imported theme, a family loaded from disk. A value
|
|
165
|
+
* holding `</style><img onerror=…>` would leave the stylesheet and run as
|
|
166
|
+
* script; one holding `}` or `;` would add rules of its own; one holding
|
|
167
|
+
* `url(` would make the browser fetch an address. So a name is a CSS ident,
|
|
168
|
+
* a value is a plain CSS value, a scheme is one of the keywords, and anything
|
|
169
|
+
* else is dropped. Applied where the text is written AND where files are
|
|
170
|
+
* read, so neither depends on the other.
|
|
171
|
+
* ------------------------------------------------------------------ */
|
|
172
|
+
const SAFE_NAME = /^[a-zA-Z][\w-]{0,79}$/;
|
|
173
|
+
/* Markup, blocks, declarations, escapes, comments, at-rules, and anything
|
|
174
|
+
that loads or evaluates something. */
|
|
175
|
+
const UNSAFE_VALUE = /[<>{};\\`]|\/\*|\*\/|@|url\s*\(|image-set|image\s*\(|src\s*\(|expression|javascript:|attr\s*\(/i;
|
|
176
|
+
const SCHEMES = new Set(['normal', 'light', 'dark', 'light dark', 'dark light', 'only light', 'only dark']);
|
|
177
|
+
/** A custom property name (without `--`) safe to write. */
|
|
178
|
+
export const isSafeName = (name) => typeof name === 'string' && SAFE_NAME.test(name);
|
|
179
|
+
/** A value safe to write after `--name:`: no way out of the declaration. */
|
|
180
|
+
export function isSafeValue(value) {
|
|
181
|
+
if (typeof value !== 'string' || value.length > 400 || UNSAFE_VALUE.test(value))
|
|
182
|
+
return false;
|
|
183
|
+
/* An unbalanced quote would swallow what follows it. */
|
|
184
|
+
return (value.split('"').length - 1) % 2 === 0 && (value.split("'").length - 1) % 2 === 0;
|
|
185
|
+
}
|
|
186
|
+
/** A `color-scheme` keyword, or undefined. */
|
|
187
|
+
export function safeScheme(scheme) {
|
|
188
|
+
if (typeof scheme !== 'string')
|
|
189
|
+
return undefined;
|
|
190
|
+
const s = scheme.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
191
|
+
return SCHEMES.has(s) ? s : undefined;
|
|
192
|
+
}
|
|
193
|
+
const safeTokens = (tokens) => tokens.filter((t) => isSafeName(t.name) && isSafeValue(t.value));
|
|
194
|
+
/** Convert tokens into an inline `style` string for a preview element. */
|
|
195
|
+
export function tokensToInlineStyle(tokens) {
|
|
196
|
+
return safeTokens(tokens)
|
|
197
|
+
.map((t) => `--${t.name}:${t.value}`)
|
|
198
|
+
.join(';');
|
|
199
|
+
}
|
|
200
|
+
/** Serialise tokens into a drop-in `:root { … }` stylesheet. */
|
|
201
|
+
export function serializeTheme(tokens, scheme) {
|
|
202
|
+
const lines = safeTokens(tokens).map((t) => `\t--${t.name}: ${t.value};`);
|
|
203
|
+
const keyword = safeScheme(scheme);
|
|
204
|
+
if (keyword)
|
|
205
|
+
lines.unshift(`\tcolor-scheme: ${keyword};`);
|
|
206
|
+
return `:root {\n${lines.join('\n')}\n}\n`;
|
|
207
|
+
}
|
|
208
|
+
/** Deep copy so callers can edit without mutating the schema. */
|
|
209
|
+
export function cloneTheme(tokens = defaultTheme) {
|
|
210
|
+
return tokens.map((t) => ({ ...t }));
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Editable tokens for a family: exactly the parameters that family declares,
|
|
214
|
+
* seeded from `vars` (a theme's parsed custom properties) where present and
|
|
215
|
+
* from the family's own default otherwise.
|
|
216
|
+
*/
|
|
217
|
+
export function tokensForFamily(family, vars = {}) {
|
|
218
|
+
return tokensFrom(paramsByFamily[family] ?? [], vars);
|
|
219
|
+
}
|
|
220
|
+
/** The same, from a parameter list in hand — a family the build never saw. */
|
|
221
|
+
export function tokensFrom(params, vars = {}) {
|
|
222
|
+
return params.map((p) => {
|
|
223
|
+
const token = fromParam(p);
|
|
224
|
+
return { ...token, value: vars[p.name] ?? token.value };
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plumbing behind a component's AXES and FLAGS blocks — in THIS source
|
|
3
|
+
* only. The copy of a component generated for a family has none of it: the
|
|
4
|
+
* build writes its props and classes out by hand (scripts/gen-components.mjs).
|
|
5
|
+
*
|
|
6
|
+
* An AXIS is a group of mutually exclusive variants of one component, named
|
|
7
|
+
* after what it impacts, written as the list of values its prop accepts. The
|
|
8
|
+
* class a value writes follows two rules, and nothing else:
|
|
9
|
+
*
|
|
10
|
+
* variant: ['outline', 'dash'] variant="dash" → .btn-dash
|
|
11
|
+
* shadow: ['none', 'reverse'] shadow="none" → .btn-noshadow
|
|
12
|
+
* s: ['1', '2', '3'] s="1" → .text-s1
|
|
13
|
+
*
|
|
14
|
+
* `none` writes `no<axis>`; a number writes `<axis><number>`; any other value
|
|
15
|
+
* writes itself. No prop at all writes nothing: the component's default look.
|
|
16
|
+
*
|
|
17
|
+
* A FLAG is a class that excludes nothing, written by a boolean prop. FLAGS
|
|
18
|
+
* maps each class suffix to the doc of its prop; the prop is the suffix in
|
|
19
|
+
* camelCase (`image-full` → `imageFull`).
|
|
20
|
+
*/
|
|
21
|
+
/** One axis: the values its prop accepts. */
|
|
22
|
+
export type Axis = readonly string[];
|
|
23
|
+
/** One component's flags: class suffix → what the prop does. */
|
|
24
|
+
export type Flags = Readonly<Record<string, string>>;
|
|
25
|
+
/** The values an axis accepts. Empty axis → `never`. */
|
|
26
|
+
export type Values<A> = A extends readonly (infer V extends string)[] ? V : never;
|
|
27
|
+
/** `image-full` → `imageFull`. */
|
|
28
|
+
export type Camel<S extends string> = S extends `${infer H}-${infer T}` ? `${H}${Capitalize<Camel<T>>}` : S;
|
|
29
|
+
declare global {
|
|
30
|
+
namespace Sepale {
|
|
31
|
+
/** family → component namespace → what the family draws. Filled by the
|
|
32
|
+
* families' `.css.d.ts`, never by hand. */
|
|
33
|
+
interface Families {
|
|
34
|
+
}
|
|
35
|
+
/** `portable: true` keeps only what EVERY registered family ships (the
|
|
36
|
+
* intersection), so switching between them never breaks a build. By
|
|
37
|
+
* default a prop accepts what ANY of them ships (the union). */
|
|
38
|
+
interface Config {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** The registered families' names; `never` when none is. */
|
|
43
|
+
type Registered = keyof Sepale.Families;
|
|
44
|
+
type Portable = Sepale.Config extends {
|
|
45
|
+
portable: true;
|
|
46
|
+
} ? true : false;
|
|
47
|
+
/** A namespace a family does not style: nothing drawn. (Not `never`, which
|
|
48
|
+
* would satisfy every `extends` test below.) */
|
|
49
|
+
type Unstyled = {
|
|
50
|
+
axes: {};
|
|
51
|
+
flags: never;
|
|
52
|
+
background: false;
|
|
53
|
+
};
|
|
54
|
+
/** What family `Fam` draws for namespace `P`. */
|
|
55
|
+
type Entry<Fam, P extends string> = Fam extends Registered ? P extends keyof Sepale.Families[Fam] ? Sepale.Families[Fam][P] : Unstyled : Unstyled;
|
|
56
|
+
/** The values of axis `K` family `Fam` ships (distributes over `Fam`). */
|
|
57
|
+
type FamValues<Fam, P extends string, K> = Fam extends Registered ? Entry<Fam, P> extends {
|
|
58
|
+
axes: infer X;
|
|
59
|
+
} ? K extends keyof X ? X[K] : never : never : never;
|
|
60
|
+
/** The flag suffixes family `Fam` draws (distributes over `Fam`). */
|
|
61
|
+
type FamFlags<Fam, P extends string> = Fam extends Registered ? Entry<Fam, P> extends {
|
|
62
|
+
flags: infer L;
|
|
63
|
+
} ? L : never : never;
|
|
64
|
+
/** `true` for each registered family that reads the `--<P>-bg` slot. */
|
|
65
|
+
type FamBackground<Fam, P extends string> = Fam extends Registered ? Entry<Fam, P> extends {
|
|
66
|
+
background: true;
|
|
67
|
+
} ? true : false : never;
|
|
68
|
+
/** Whether props narrow at all: a namespace is given and a family registered. */
|
|
69
|
+
type Narrows<P extends string> = [P] extends [never] ? false : [Registered] extends [never] ? false : true;
|
|
70
|
+
/** Of an axis's values, what the registered families accept: any of them
|
|
71
|
+
* (union), or every one of them when portable (intersection). */
|
|
72
|
+
type AcceptedValues<P extends string, K, Wide> = Narrows<P> extends false ? Wide : Portable extends true ? Exclude<Wide, {
|
|
73
|
+
[Fam in Registered]: Exclude<Wide, FamValues<Fam, P, K>>;
|
|
74
|
+
}[Registered]> : Extract<FamValues<Registered, P, K>, Wide>;
|
|
75
|
+
/** `K` if the registered families draw flag `K`, else `never`. */
|
|
76
|
+
type AcceptedFlag<P extends string, K> = Narrows<P> extends false ? K : Portable extends true ? Exclude<K, {
|
|
77
|
+
[Fam in Registered]: Exclude<K, FamFlags<Fam, P>>;
|
|
78
|
+
}[Registered]> : Extract<FamFlags<Registered, P>, K>;
|
|
79
|
+
/** Whether `background` is offered: some registered family reads the slot
|
|
80
|
+
* (every one, when portable). */
|
|
81
|
+
type HasBackground<P extends string> = Narrows<P> extends false ? true : Portable extends true ? false extends FamBackground<Registered, P> ? false : [FamBackground<Registered, P>] extends [never] ? false : true : true extends FamBackground<Registered, P> ? true : false;
|
|
82
|
+
/**
|
|
83
|
+
* One optional prop per axis, typed to that axis's values — and NO prop at all
|
|
84
|
+
* for an axis left empty — plus one boolean per flag, and `background`.
|
|
85
|
+
*
|
|
86
|
+
* `P` is the component's namespace (`typeof PREFIX`). With it, the props follow
|
|
87
|
+
* the registered families (see `Sepale.Families` above): an axis value, a flag
|
|
88
|
+
* or `background` the families do not draw is not offered. Without a
|
|
89
|
+
* registered family — or without `P` — they are the full, generic set.
|
|
90
|
+
*/
|
|
91
|
+
export type AxisProps<A extends Record<string, Axis>, F extends Flags = {}, P extends string = never> = {
|
|
92
|
+
[K in keyof A as [AcceptedValues<P, K, Values<A[K]>>] extends [never] ? never : K]?: AcceptedValues<P, K, Values<A[K]>>;
|
|
93
|
+
} & {
|
|
94
|
+
[K in keyof F & string as [AcceptedFlag<P, K>] extends [never] ? never : Camel<K>]?: boolean;
|
|
95
|
+
} & (HasBackground<P> extends true ? {
|
|
96
|
+
/**
|
|
97
|
+
* A one-off fill, BY VALUE — `background="#efb"`, not a token name.
|
|
98
|
+
*
|
|
99
|
+
* It writes `--<prefix>-bg` inline, the slot a component that paints a
|
|
100
|
+
* fill reads. It deliberately does NOT take a semantic: `color` is
|
|
101
|
+
* already the axis for that. Offered only when a registered family
|
|
102
|
+
* reads the slot.
|
|
103
|
+
*/
|
|
104
|
+
background?: string;
|
|
105
|
+
} : {});
|
|
106
|
+
/** The class one axis value writes. See the rules above. */
|
|
107
|
+
export declare function axisClass(prefix: string, axis: string, value: string): string;
|
|
108
|
+
/** `image-full` → `imageFull`. */
|
|
109
|
+
export declare function camel(name: string): string;
|
|
110
|
+
/** Join truthy class fragments into a single class string. */
|
|
111
|
+
export declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
112
|
+
/**
|
|
113
|
+
* Resolve every axis and flag into class names, and hand back everything that
|
|
114
|
+
* was NOT one so it can be spread onto the element.
|
|
115
|
+
*
|
|
116
|
+
* The component never names an axis individually — it passes the whole rest
|
|
117
|
+
* object through here. A value outside its axis resolves to nothing, and every
|
|
118
|
+
* axis and flag is removed from the rest, so none leaks out as a DOM attribute.
|
|
119
|
+
*/
|
|
120
|
+
export declare function applyAxes(prefix: string, axes: Record<string, Axis>, flags: Flags, props: Record<string, unknown>): {
|
|
121
|
+
classes: string;
|
|
122
|
+
rest: Record<string, unknown>;
|
|
123
|
+
};
|
|
124
|
+
export {};
|
package/dist/variants.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plumbing behind a component's AXES and FLAGS blocks — in THIS source
|
|
3
|
+
* only. The copy of a component generated for a family has none of it: the
|
|
4
|
+
* build writes its props and classes out by hand (scripts/gen-components.mjs).
|
|
5
|
+
*
|
|
6
|
+
* An AXIS is a group of mutually exclusive variants of one component, named
|
|
7
|
+
* after what it impacts, written as the list of values its prop accepts. The
|
|
8
|
+
* class a value writes follows two rules, and nothing else:
|
|
9
|
+
*
|
|
10
|
+
* variant: ['outline', 'dash'] variant="dash" → .btn-dash
|
|
11
|
+
* shadow: ['none', 'reverse'] shadow="none" → .btn-noshadow
|
|
12
|
+
* s: ['1', '2', '3'] s="1" → .text-s1
|
|
13
|
+
*
|
|
14
|
+
* `none` writes `no<axis>`; a number writes `<axis><number>`; any other value
|
|
15
|
+
* writes itself. No prop at all writes nothing: the component's default look.
|
|
16
|
+
*
|
|
17
|
+
* A FLAG is a class that excludes nothing, written by a boolean prop. FLAGS
|
|
18
|
+
* maps each class suffix to the doc of its prop; the prop is the suffix in
|
|
19
|
+
* camelCase (`image-full` → `imageFull`).
|
|
20
|
+
*/
|
|
21
|
+
/** The class one axis value writes. See the rules above. */
|
|
22
|
+
export function axisClass(prefix, axis, value) {
|
|
23
|
+
if (value === 'none')
|
|
24
|
+
return `${prefix}-no${axis}`;
|
|
25
|
+
if (/^\d+$/.test(value))
|
|
26
|
+
return `${prefix}-${axis}${value}`;
|
|
27
|
+
return `${prefix}-${value}`;
|
|
28
|
+
}
|
|
29
|
+
/** `image-full` → `imageFull`. */
|
|
30
|
+
export function camel(name) {
|
|
31
|
+
return name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
32
|
+
}
|
|
33
|
+
/** Join truthy class fragments into a single class string. */
|
|
34
|
+
export function cx(...parts) {
|
|
35
|
+
return parts.filter(Boolean).join(' ');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve every axis and flag into class names, and hand back everything that
|
|
39
|
+
* was NOT one so it can be spread onto the element.
|
|
40
|
+
*
|
|
41
|
+
* The component never names an axis individually — it passes the whole rest
|
|
42
|
+
* object through here. A value outside its axis resolves to nothing, and every
|
|
43
|
+
* axis and flag is removed from the rest, so none leaks out as a DOM attribute.
|
|
44
|
+
*/
|
|
45
|
+
export function applyAxes(prefix, axes, flags, props) {
|
|
46
|
+
const out = [];
|
|
47
|
+
const rest = { ...props };
|
|
48
|
+
/* `background` is not an axis — it writes a value, not a class — but it
|
|
49
|
+
belongs here because `rest` is what every component spreads onto its
|
|
50
|
+
element. A caller's own `style` still wins by being written last. */
|
|
51
|
+
const bg = rest.background;
|
|
52
|
+
delete rest.background;
|
|
53
|
+
if (typeof bg === 'string' && bg) {
|
|
54
|
+
const own = typeof rest.style === 'string' ? rest.style : '';
|
|
55
|
+
rest.style = `--${prefix}-bg: ${bg};` + (own ? ` ${own}` : '');
|
|
56
|
+
}
|
|
57
|
+
for (const [name, values] of Object.entries(axes)) {
|
|
58
|
+
const value = rest[name];
|
|
59
|
+
delete rest[name];
|
|
60
|
+
if (typeof value === 'string' && values.includes(value))
|
|
61
|
+
out.push(axisClass(prefix, name, value));
|
|
62
|
+
}
|
|
63
|
+
for (const name of Object.keys(flags)) {
|
|
64
|
+
const prop = camel(name);
|
|
65
|
+
if (rest[prop])
|
|
66
|
+
out.push(`${prefix}-${name}`);
|
|
67
|
+
delete rest[prop];
|
|
68
|
+
}
|
|
69
|
+
return { classes: out.join(' '), rest };
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Timofey Marochkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# air-datepicker, vendored
|
|
2
|
+
|
|
3
|
+
[air-datepicker](https://air-datepicker.com) 3.6.0 by Timofey Marochkin, MIT
|
|
4
|
+
(see `LICENSE.md`), copied from its repository's `src/` (tag `v3.6.0`) so the
|
|
5
|
+
`Calendar` component carries it: no npm dependency, and a family's copy of
|
|
6
|
+
`Calendar.svelte` ships with this folder next to it.
|
|
7
|
+
|
|
8
|
+
Changes to the source, and nothing else:
|
|
9
|
+
|
|
10
|
+
- the `import './*.scss'` lines are gone: the library's stylesheet is not
|
|
11
|
+
used. Each family draws the calendar in its `calendar.scss`, scoped under
|
|
12
|
+
`.calendar` (the class `Calendar` puts on the picker's root).
|
|
13
|
+
- relative imports carry their `.js` extension.
|
|
14
|
+
- the default locale is English (`locale/en.js`) instead of Russian.
|
|
15
|
+
- a `// @ts-nocheck` header on every file: typed by `index.d.ts` (the
|
|
16
|
+
library's own `src/datepicker.d.ts`), not checked line by line.
|
|
17
|
+
|
|
18
|
+
To update: copy `src/*.js` and `src/locale/*.js` from a new tag and reapply
|
|
19
|
+
the four changes above.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
namespace today {
|
|
3
|
+
function content(dp: any): any;
|
|
4
|
+
function onClick(dp: any): any;
|
|
5
|
+
}
|
|
6
|
+
namespace clear {
|
|
7
|
+
export function content_1(dp: any): any;
|
|
8
|
+
export { content_1 as content };
|
|
9
|
+
export function onClick_1(dp: any): any;
|
|
10
|
+
export { onClick_1 as onClick };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @ts-nocheck — vendored code, typed by index.d.ts; not ours to check.
|
|
2
|
+
// air-datepicker 3.6.0 (MIT, Timofey Marochkin) — see LICENSE.md and README.md.
|
|
3
|
+
export default {
|
|
4
|
+
today: {
|
|
5
|
+
content: dp => dp.locale.today,
|
|
6
|
+
onClick: dp => dp.setViewDate(new Date()),
|
|
7
|
+
},
|
|
8
|
+
clear: {
|
|
9
|
+
content: dp => dp.locale.clear,
|
|
10
|
+
onClick: dp => dp.clear()
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let days: string;
|
|
3
|
+
let months: string;
|
|
4
|
+
let years: string;
|
|
5
|
+
let day: string;
|
|
6
|
+
let month: string;
|
|
7
|
+
let year: string;
|
|
8
|
+
let eventChangeViewDate: string;
|
|
9
|
+
let eventChangeCurrentView: string;
|
|
10
|
+
let eventChangeFocusDate: string;
|
|
11
|
+
let eventChangeSelectedDate: string;
|
|
12
|
+
let eventChangeTime: string;
|
|
13
|
+
let eventChangeLastSelectedDate: string;
|
|
14
|
+
let actionSelectDate: string;
|
|
15
|
+
let actionUnselectDate: string;
|
|
16
|
+
let cssClassWeekend: string;
|
|
17
|
+
}
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @ts-nocheck — vendored code, typed by index.d.ts; not ours to check.
|
|
2
|
+
// air-datepicker 3.6.0 (MIT, Timofey Marochkin) — see LICENSE.md and README.md.
|
|
3
|
+
export default {
|
|
4
|
+
days: 'days',
|
|
5
|
+
months: 'months',
|
|
6
|
+
years: 'years',
|
|
7
|
+
day: 'day',
|
|
8
|
+
month: 'month',
|
|
9
|
+
year: 'year',
|
|
10
|
+
|
|
11
|
+
eventChangeViewDate: 'changeViewDate',
|
|
12
|
+
eventChangeCurrentView: 'changeCurrentView',
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {Boolean} [viewDateTransition] - should perform transition to new viewDate
|
|
16
|
+
* if passed date is out current month/year/decade range
|
|
17
|
+
*/
|
|
18
|
+
eventChangeFocusDate: 'changeFocusDate',
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {String} action
|
|
22
|
+
* @param {Date} date
|
|
23
|
+
* @param {Boolean} [updateTime] - if true, then timepicker will take time from passed date and save it to instance
|
|
24
|
+
* @param {Boolean} [silent] - if true, then onChange event wont be triggered
|
|
25
|
+
*/
|
|
26
|
+
eventChangeSelectedDate: 'changeSelectedDate',
|
|
27
|
+
|
|
28
|
+
eventChangeTime: 'changeTime',
|
|
29
|
+
eventChangeLastSelectedDate: 'changeLastSelectedDate',
|
|
30
|
+
|
|
31
|
+
actionSelectDate: 'selectDate',
|
|
32
|
+
actionUnselectDate: 'unselectDate',
|
|
33
|
+
|
|
34
|
+
cssClassWeekend: '-weekend-'
|
|
35
|
+
};
|