@tzslot/theme 0.1.0-beta.0 → 1.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/README.md CHANGED
@@ -19,8 +19,8 @@ what the clock faces suggest.
19
19
  |---|---|
20
20
  | `@tzslot/core` | The arithmetic. No DOM, no framework — usable on a server too. |
21
21
  | `@tzslot/dom` | Every widget, in plain DOM. Works in any framework, or none. |
22
- | `@tzslot/angular` | Angular components over `@tzslot/dom`: signals, forms, zoneless or not. Angular 18 to 21. |
23
- | `@tzslot/theme` | Optional. CSS (or Sass) setting the widgets' colours; light, dark, high contrast, a Tailwind v4 bridge. |
22
+ | `@tzslot/angular` | Angular components over `@tzslot/dom`: signals, forms, zoneless or not. Angular 18 to 22. |
23
+ | `@tzslot/theme` | Optional. CSS (or Sass) setting the widgets' colours; light, dark, high contrast, a bridge for Tailwind v4 and one for v3. |
24
24
 
25
25
  The widgets live in `@tzslot/dom`; a framework package only translates its own
26
26
  idioms into calls on them. A behaviour fixed there is fixed everywhere.
@@ -32,12 +32,54 @@ idioms into calls on them. A behaviour fixed there is fixed everywhere.
32
32
  | `<tz-calendar>` | `createCalendar` | a day — month and year views, keyboard, Today / Clear |
33
33
  | `<tz-multi-date>` | `createMultiDate` | several days, not necessarily adjacent |
34
34
  | `<tz-date-field>` | `createDateField` | a day, from a field that opens a panel, anchored or centred |
35
+ | `<tz-datetime-field>` | `createDateTimeField` | a moment: the same panel with a time under the calendar — flatpickr's `enableTime`, except that it says when the time cannot happen and offers both readings when it happens twice |
36
+ | — | `createTimeInput` | an hour and a minute on their own: arrows, wheel, up/down keys, 12- or 24-hour |
35
37
  | `<tz-date-range>` | `createDateRange` | two days, refusing a range across a closed one |
38
+ | `<tz-range-field>` | `createRangeField` | a period in one field: named ranges, months side by side, whole days or moments |
36
39
  | `<tz-time-slots>` | `createTimeSlots` | a moment on one day: the skipped hour struck through, the repeated one offered twice |
37
- | `<tz-datetime-range>` | `createDateTimeRange` | an interval with a time at both ends, and the hour it hides |
40
+ | `<tz-datetime-range>` | `createDateTimeRange` | an interval: two date-and-time fields, and the hour it hides |
38
41
  | `<tz-daily-range>` | `createDailyRange` | a range of days with the same hours on each, overnight allowed |
39
42
 
40
- `renderCell` puts a price, places left or your own class on any day.
43
+ `renderCell` puts a price, places left or your own class on any day, and
44
+ `weekNumbers` adds a column of ISO week numbers down the left.
45
+ `timeLayout` chooses how a time is asked for: `'input'` for the compact field
46
+ with arrows, `'select'` for two menus (`minuteStep`, every minute by default),
47
+ `'list'` for the times on offer that day. The menus show the chosen day as the
48
+ zone really has it: the hour the clocks skip is not offered, and the hour they
49
+ repeat appears twice, in the words everyone uses — "02 — summer" and
50
+ "02 — winter", "02 — été" and "02 — hiver" — so there is nothing left to ask
51
+ afterwards. The zone's official name for each is on the tooltip. The compact field does ask, with the same names, and the
52
+ text itself says which of the two it holds — `25/10/2026 02:30 (winter)` —
53
+ because 02:30 looks identical either way. Typed back in, that name is read
54
+ too, so the text always means exactly one moment.
55
+
56
+ ## The text in a field
57
+
58
+ A field can be typed into as well as chosen from, and what it writes is what
59
+ it reads back:
60
+
61
+ ```html
62
+ <!-- the locale's own numeric form: 20/09/2026 09:15 in French -->
63
+ <tz-datetime-field [(value)]="at" timeZone="Europe/Paris" />
64
+
65
+ <!-- a pattern, when the shape matters more than the reader -->
66
+ <tz-datetime-field format="yyyy-MM-dd HH:mm" />
67
+
68
+ <!-- read-only, and then free to be written any way at all -->
69
+ <tz-datetime-field [editable]="false" dateStyle="long" timeStyle="short" />
70
+ <tz-datetime-field [editable]="false" [displayWith]="mine" />
71
+ ```
72
+
73
+ Tokens: `yyyy yy MMMM MMM MM M dd d EEEE EEE HH H hh h mm a`, anything else
74
+ kept as written, `'quoted'` to keep letters. Typing gets the separators as the
75
+ figures arrive, the way a card number gets its spaces — `2009` becomes
76
+ `20/09/` — for patterns that leave no doubt about where each part ends; pass
77
+ `[mask]="false"` to turn that off. The pattern is never used as the
78
+ placeholder. Text that cannot be read is
79
+ refused rather than guessed at, and the field goes back to the last moment it
80
+ held when you leave it. A pattern that names its month is for display only:
81
+ "sept.", "Sept" and "septembre" are one month in three spellings, and picking
82
+ between them is how a field stores the wrong date quietly.
41
83
 
42
84
  ## Angular
43
85
 
@@ -118,7 +160,8 @@ Nine palette colours, each `light-dark(light, dark)`. `data-theme="dark"` on
118
160
  any element themes everything inside it; `--tz-accent` on any element
119
161
  recolours the selection, the range tint and the focus ring beneath it.
120
162
  `@tzslot/theme/contrast.css` follows `prefers-contrast: more`, and
121
- `@tzslot/theme/tailwind.css` maps the palette to a Tailwind v4 theme. From
163
+ `@tzslot/theme/tailwind.css` maps the palette to a Tailwind v4 theme and
164
+ `tailwind3.css` to a v3 one. From
122
165
  Sass, `@use '@tzslot/theme/tzslot' with ($accent: …)`. All of it in
123
166
  `docs/customising.md`.
124
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tzslot/theme",
3
- "version": "0.1.0-beta.0",
3
+ "version": "1.1.0",
4
4
  "description": "An optional stylesheet for the tzslot components. Plain CSS, no framework.",
5
5
  "license": "MIT",
6
6
  "main": "./tzslot.css",
@@ -13,7 +13,8 @@
13
13
  "sass": "./tzslot.scss",
14
14
  "default": "./tzslot.css"
15
15
  },
16
- "./tailwind.css": "./tailwind.css"
16
+ "./tailwind.css": "./tailwind.css",
17
+ "./tailwind3.css": "./tailwind3.css"
17
18
  },
18
19
  "sideEffects": [
19
20
  "*.css"
@@ -24,7 +25,7 @@
24
25
  "url": "git+https://github.com/plinthworks/tzslot.git",
25
26
  "directory": "packages/theme"
26
27
  },
27
- "homepage": "https://github.com/plinthworks/tzslot#readme",
28
+ "homepage": "https://plinthworks.github.io/tzslot/",
28
29
  "bugs": {
29
30
  "url": "https://github.com/plinthworks/tzslot/issues"
30
31
  },
package/tailwind.css CHANGED
@@ -28,9 +28,16 @@
28
28
  * nothing to do. With the class strategy (a .dark class toggled by your
29
29
  * app), the .dark rule below reaches them; add
30
30
  *
31
- * :root { --tz-color-scheme: light; }
31
+ * :root:not(.dark) { --tz-color-scheme: light; }
32
32
  *
33
33
  * so that no .dark means light even when the system is dark.
34
+ *
35
+ * The :not() is not decoration. `:root` and `.dark` weigh the same (0,1,0),
36
+ * so between two rules of equal weight the later one in the stylesheet wins —
37
+ * and yours is imported after this file. Written `:root`, it beats `.dark`
38
+ * every time and the widgets stay light inside a dark page: readable text on
39
+ * a light surface that is no longer there. `:root:not(.dark)` weighs (0,2,0)
40
+ * and says what it means whatever the order.
34
41
  */
35
42
 
36
43
  :root {
package/tailwind3.css ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @tzslot/theme/tailwind3.css — the widgets in your Tailwind v3 theme.
3
+ *
4
+ * In the CSS file that imports Tailwind, after it:
5
+ *
6
+ * @import "tailwindcss/base";
7
+ * @import "tailwindcss/components";
8
+ * @import "tailwindcss/utilities";
9
+ * @import "@tzslot/theme";
10
+ * @import "@tzslot/theme/tailwind3.css";
11
+ *
12
+ * The @import form of the three Tailwind directives, not @tailwind: CSS
13
+ * requires @import to come first and be consecutive, and postcss-import
14
+ * enforces it — an @import written after an @tailwind line is refused with
15
+ * "@import statements must precede all other statements", and the bridge
16
+ * never arrives.
17
+ *
18
+ * ── Why a second file ───────────────────────────────────────────────────────
19
+ *
20
+ * v4 publishes its theme as CSS variables, so tailwind.css reads them with
21
+ * var(). v3 keeps its theme in JavaScript and exposes it through theme(),
22
+ * which is resolved at build time — the two cannot share a file.
23
+ *
24
+ * This one therefore has to go *through* Tailwind: it is PostCSS that turns
25
+ * theme(colors.zinc.900) into #18181b. Linked from your HTML, or imported by
26
+ * a bundler that does not run Tailwind's plugin over it, it reaches the
27
+ * browser as written and every colour is dropped. v3 says nothing when this
28
+ * happens — the page simply comes out unstyled.
29
+ *
30
+ * Two conditions, both silent when unmet:
31
+ * 1. this file is part of the stylesheet Tailwind compiles;
32
+ * 2. your build inlines @import (postcss-import — Vite, Next and the
33
+ * Angular builder do; the tailwindcss CLI on its own does not).
34
+ *
35
+ * Neither holds? Paste the block below straight into your own CSS. It is the
36
+ * whole bridge; there is nothing else in this file.
37
+ *
38
+ * ── What it maps ────────────────────────────────────────────────────────────
39
+ *
40
+ * surfaces and text → the zinc scale
41
+ * accent → colors.primary.600 / .400 when your config has them,
42
+ * blue otherwise
43
+ * danger / warning → red / amber
44
+ * font, radius → fontFamily.sans, borderRadius.md
45
+ *
46
+ * Another grey (slate, neutral, stone…) is a matter of changing zinc below.
47
+ *
48
+ * ── Dark mode ───────────────────────────────────────────────────────────────
49
+ *
50
+ * With darkMode: 'media' (v3's default) the widgets follow the system and
51
+ * there is nothing to do. With darkMode: 'class' the .dark rule below reaches
52
+ * them, and you add
53
+ *
54
+ * :root:not(.dark) { --tz-color-scheme: light; }
55
+ *
56
+ * so that no .dark means light even when the system is dark. The :not() is
57
+ * not decoration: `:root` and `.dark` weigh the same (0,1,0), so a bare
58
+ * `:root` written after this file wins on source order and pins the widgets
59
+ * to light inside a dark page.
60
+ */
61
+
62
+ :root {
63
+ --tz-bg: light-dark(theme(colors.white), theme(colors.zinc.900));
64
+ --tz-bg-raised: light-dark(theme(colors.zinc.100), theme(colors.zinc.800));
65
+ --tz-fg: light-dark(theme(colors.zinc.900), theme(colors.zinc.100));
66
+ --tz-fg-muted: light-dark(theme(colors.zinc.600), theme(colors.zinc.400));
67
+ --tz-border: light-dark(theme(colors.zinc.300), theme(colors.zinc.700));
68
+ --tz-accent: light-dark(
69
+ theme(colors.primary.600, theme(colors.blue.600)),
70
+ theme(colors.primary.400, theme(colors.blue.400))
71
+ );
72
+ --tz-accent-fg: light-dark(theme(colors.white), theme(colors.zinc.950));
73
+ --tz-danger: light-dark(theme(colors.red.700), theme(colors.red.400));
74
+ --tz-warning: light-dark(theme(colors.amber.700), theme(colors.amber.400));
75
+ --tz-font: theme(fontFamily.sans);
76
+ --tz-radius: theme(borderRadius.md);
77
+ }
78
+
79
+ .dark {
80
+ --tz-color-scheme: dark;
81
+ }