fluorokit 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +181 -2
- package/bin/fluorokit.mjs +50 -0
- package/dist/base.css +201 -0
- package/dist/enter.d.ts +8 -0
- package/dist/enter.js +83 -0
- package/dist/fonts/selawik/LICENSE.txt +91 -0
- package/dist/fonts/selawik/selawk.woff2 +0 -0
- package/dist/fonts/selawik/selawkb.woff2 +0 -0
- package/dist/fonts/selawik/selawkl.woff2 +0 -0
- package/dist/fonts/selawik/selawksb.woff2 +0 -0
- package/dist/fonts/selawik/selawksl.woff2 +0 -0
- package/dist/fonts/selawik.css +38 -0
- package/dist/shiki/blueberry-dark.json +157 -0
- package/dist/shiki/blueberry-light.json +157 -0
- package/dist/shiki/cobalt-dark.json +157 -0
- package/dist/shiki/cobalt-light.json +157 -0
- package/dist/shiki/ink-dark.json +157 -0
- package/dist/shiki/ink-light.json +157 -0
- package/dist/shiki/twilight-dark.json +157 -0
- package/dist/shiki/twilight-light.json +157 -0
- package/dist/structure.css +48 -0
- package/dist/svelte/Pivot.svelte +45 -0
- package/dist/tailwind.css +52 -0
- package/dist/themes/blueberry.css +185 -0
- package/dist/themes/blueberry.scoped.css +274 -0
- package/dist/themes/blueberry.shadcn.css +274 -0
- package/dist/themes/catppuccin.css +155 -0
- package/dist/themes/catppuccin.scoped.css +244 -0
- package/dist/themes/catppuccin.shadcn.css +244 -0
- package/dist/themes/cobalt.css +185 -0
- package/dist/themes/cobalt.scoped.css +274 -0
- package/dist/themes/cobalt.shadcn.css +274 -0
- package/dist/themes/ink.css +185 -0
- package/dist/themes/ink.scoped.css +274 -0
- package/dist/themes/ink.shadcn.css +274 -0
- package/dist/themes/twilight.css +185 -0
- package/dist/themes/twilight.scoped.css +274 -0
- package/dist/themes/twilight.shadcn.css +274 -0
- package/dist/themes/zune.css +76 -0
- package/dist/themes/zune.scoped.css +125 -0
- package/dist/themes/zune.shadcn.css +125 -0
- package/dist/themes.json +855 -0
- package/dist/tools/color.mjs +51 -0
- package/dist/tools/fluoro.mjs +207 -0
- package/dist/tools/presets.mjs +87 -0
- package/dist/tools/theme-css.mjs +133 -0
- package/package.json +70 -4
- package/tokens/structure.json +51 -0
- package/tokens/themes/blueberry.json +157 -0
- package/tokens/themes/catppuccin.json +133 -0
- package/tokens/themes/cobalt.json +157 -0
- package/tokens/themes/ink.json +157 -0
- package/tokens/themes/twilight.json +157 -0
- package/tokens/themes/zune.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abby Bigaouette
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,182 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="logo/fluorokit.svg" alt="" width="96" height="96">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# fluorokit
|
|
4
|
+
|
|
5
|
+
A Metro theme for shadcn-svelte. Add components with the shadcn-svelte CLI as
|
|
6
|
+
usual and import a fluorokit theme: the components take the look, and nothing
|
|
7
|
+
is forked. It also adds Metro pieces that shadcn-svelte doesn't have (tiles, a
|
|
8
|
+
pivot, the type scale, a direction-aware page-enter), which also work as plain
|
|
9
|
+
CSS without Svelte.
|
|
10
|
+
|
|
11
|
+
The structure is the same in each project: zero radius, a light-weight type
|
|
12
|
+
scale, one left edge. A theme is a palette and a set of fonts.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install fluorokit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Showcase site
|
|
21
|
+
|
|
22
|
+
The showcase and the theme builder are in a separate repo,
|
|
23
|
+
[fluorokit-site](https://github.com/abbyfluoroethane/fluorokit-site), live at
|
|
24
|
+
<https://fluorokit.bigaouette.com/>.
|
|
25
|
+
|
|
26
|
+
## Presets and the command
|
|
27
|
+
|
|
28
|
+
A preset is six named choices, as a short code: `f009000`. The create page of
|
|
29
|
+
the site makes the code. The command writes the theme of a code:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npx fluorokit theme --preset f009000 --out src/theme.css
|
|
33
|
+
npx fluorokit theme --preset f009000 --format json --out tokens/themes/mine.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`--format` is `shadcn` (CSS with the shadcn names, the default), `css` (the
|
|
37
|
+
fluorokit variables only) or `json` (a theme file for the kit).
|
|
38
|
+
|
|
39
|
+
## Build
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
npm run build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| File | Contents |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `dist/structure.css` | Spacing, shape, type scale and motion |
|
|
48
|
+
| `dist/themes/<name>.css` | One theme: colors and fonts |
|
|
49
|
+
| `dist/themes/<name>.shadcn.css` | The same theme, plus the shadcn variable names |
|
|
50
|
+
| `dist/base.css` | Type classes, the energy bar, status, the pivot, `.fk-enter` |
|
|
51
|
+
| `dist/tailwind.css` | Tailwind 4 `@theme` mapping for shadcn-svelte |
|
|
52
|
+
| `dist/shiki/<name>-<scheme>.json` | A Shiki syntax theme for code blocks, for a theme that has syntax colors |
|
|
53
|
+
| `dist/fonts/selawik.css` | The Selawik font, for the `zune` theme |
|
|
54
|
+
| `dist/tools/` | The theme recipe (`fluoro.mjs`), the presets (`presets.mjs`) and the CSS writer (`theme-css.mjs`), as modules for the browser or Node |
|
|
55
|
+
| `dist/enter.js` | `setEnterDirection`, for a direction-aware page-enter |
|
|
56
|
+
| `dist/svelte/` | Svelte 5 components: `Pivot` |
|
|
57
|
+
|
|
58
|
+
Every fluorokit variable and class has the `fk` prefix (`--fk-base`,
|
|
59
|
+
`.fk-title`). The shadcn names `--muted` and `--accent` mean different things
|
|
60
|
+
from `--fk-muted` and `--fk-accent`, so the two sets do not share a namespace.
|
|
61
|
+
|
|
62
|
+
## Use
|
|
63
|
+
|
|
64
|
+
Plain CSS:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import 'fluorokit/structure.css';
|
|
68
|
+
import 'fluorokit/themes/catppuccin.css';
|
|
69
|
+
import 'fluorokit/base.css';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Tailwind 4 with shadcn-svelte:
|
|
73
|
+
|
|
74
|
+
```css
|
|
75
|
+
@import 'tailwindcss';
|
|
76
|
+
@import 'fluorokit/structure.css';
|
|
77
|
+
@import 'fluorokit/themes/zune.shadcn.css';
|
|
78
|
+
@import 'fluorokit/tailwind.css';
|
|
79
|
+
@import 'fluorokit/base.css' layer(components);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `components` layer lets Tailwind utilities override the kit's classes.
|
|
83
|
+
|
|
84
|
+
Selawik, the sans font of the `zune` theme, is included (SIL Open Font
|
|
85
|
+
License 1.1):
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
@import 'fluorokit/fonts/selawik.css';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
IBM Plex is not included. For a theme that names it, the project supplies
|
|
92
|
+
the `@font-face` rules, from `@fontsource/ibm-plex-sans` for example.
|
|
93
|
+
|
|
94
|
+
## Page-enter and pivots
|
|
95
|
+
|
|
96
|
+
Put `.fk-enter` on content that mounts when the page changes. It fades in
|
|
97
|
+
while it slides 80px into place. Set `--i` (0, 1, 2 ...) on siblings to
|
|
98
|
+
stagger them.
|
|
99
|
+
|
|
100
|
+
The slide is direction-aware by default. `Pivot` sets `--fk-enter-dir` on the
|
|
101
|
+
root element at each click: 1 when the new header is to the right, -1 when it
|
|
102
|
+
is to the left. Thus a page comes from the side its header lies on. This is
|
|
103
|
+
the same for a top-level pivot and a subpivot.
|
|
104
|
+
|
|
105
|
+
```svelte
|
|
106
|
+
<script>
|
|
107
|
+
import Pivot from 'fluorokit/svelte/Pivot.svelte';
|
|
108
|
+
let page = $state('music');
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<Pivot items={['music', 'videos', 'pictures']} bind:value={page} size="subpivot" />
|
|
112
|
+
{#key page}
|
|
113
|
+
<section class="fk-enter">...</section>
|
|
114
|
+
{/key}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
When code changes the page (a menu command, a shortcut), call
|
|
118
|
+
`setEnterDirection(items, from, to)` from `fluorokit/enter` before the
|
|
119
|
+
change. To keep the direction local, give `Pivot` a `scope` element, or set
|
|
120
|
+
`--fk-enter-dir` on a container.
|
|
121
|
+
|
|
122
|
+
On a site of separate pages (Astro), the direction comes from the page the
|
|
123
|
+
visitor came from. Put this in the `<head>`, with the section roots in the
|
|
124
|
+
order of the nav:
|
|
125
|
+
|
|
126
|
+
```astro
|
|
127
|
+
---
|
|
128
|
+
import { enterDirectionScript } from 'fluorokit/enter';
|
|
129
|
+
---
|
|
130
|
+
<script is:inline set:html={enterDirectionScript(['/', '/blog/', '/projects/'])} />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
A section further right comes from the right, and one further left from the
|
|
134
|
+
left. In one section, a deeper page comes from the right and the way back
|
|
135
|
+
from the left.
|
|
136
|
+
|
|
137
|
+
## Themes
|
|
138
|
+
|
|
139
|
+
| Theme | Modes | Follows the OS setting |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| `catppuccin` | `mocha` (default), `latte`, `paper` (print) | Yes |
|
|
142
|
+
| `ink`, `blueberry`, `twilight`, `cobalt` | `freon` (default, dark), `teflon` (light), `paper` (print) | Yes |
|
|
143
|
+
| `zune` | `light` (default), `dark` | No: the app sets the mode |
|
|
144
|
+
|
|
145
|
+
Select a mode with `data-theme="<mode>"` on the root element. The `.dark` and
|
|
146
|
+
`.light` classes also select the mode with that color scheme.
|
|
147
|
+
|
|
148
|
+
Tailwind's `dark:` variant applies under `.dark` or `data-theme="dark"`. With
|
|
149
|
+
`catppuccin` in a shadcn-svelte project, put `.dark` on the root element for Mocha.
|
|
150
|
+
|
|
151
|
+
`ink`, `blueberry`, `twilight` and `cobalt` are the fluoro family, the house
|
|
152
|
+
palette. They share light pink and light blue accents and strong tiles with
|
|
153
|
+
white text, and differ in the base: `ink` is almost black, `blueberry` a
|
|
154
|
+
saturated blue, `twilight` a rich violet, `cobalt` a brighter blue. They are
|
|
155
|
+
generated: edit the recipe in `scripts/make-fluoro.mjs`, then run
|
|
156
|
+
`node scripts/make-fluoro.mjs && npm run build`. The script prints the
|
|
157
|
+
contrast of each text and fill pair.
|
|
158
|
+
|
|
159
|
+
A mode can have a `syntax` object (comment, keyword, string, number and so
|
|
160
|
+
on). The build writes a Shiki theme from it, `fluorokit/shiki/ink-dark.json`
|
|
161
|
+
for example, with the mode's text color as the default and no background.
|
|
162
|
+
|
|
163
|
+
A theme can have a `tiles` object. Each entry becomes `--fk-tile-<name>`, a
|
|
164
|
+
tile fill that is the same in each mode. `tileText` becomes `--fk-tile-text`,
|
|
165
|
+
the text color on a tile.
|
|
166
|
+
|
|
167
|
+
## Add a theme
|
|
168
|
+
|
|
169
|
+
Copy a file in `tokens/themes/`. Each mode must define each color in the
|
|
170
|
+
`REQUIRED` list in `scripts/build.mjs`. `chart-4` and `chart-5` are optional.
|
|
171
|
+
To give a shadcn variable a value that no fluorokit color has, put it in the
|
|
172
|
+
mode's `shadcn` object.
|
|
173
|
+
|
|
174
|
+
## Credits
|
|
175
|
+
|
|
176
|
+
The logo (`logo/`) is set in IBM Plex Sans Bold, outlined.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
The `catppuccin` theme uses colors from [Catppuccin](https://github.com/catppuccin/catppuccin) (MIT).
|
|
180
|
+
|
|
181
|
+
Selawik is copyright Microsoft Corporation, under the SIL Open Font License
|
|
182
|
+
1.1 (`src/fonts/selawik/LICENSE.txt`).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// fluorokit theme --preset <code> [--name <name>] [--format shadcn|css|json] [--out <file>]
|
|
3
|
+
// Writes the theme of a preset from the create page. With no --out, it
|
|
4
|
+
// prints the theme.
|
|
5
|
+
import { writeFileSync } from 'node:fs';
|
|
6
|
+
import { decodePreset, themeOf } from '../dist/tools/presets.mjs';
|
|
7
|
+
import { themeCss } from '../dist/tools/theme-css.mjs';
|
|
8
|
+
|
|
9
|
+
const USAGE = `Usage: fluorokit theme --preset <code> [--name <name>] [--format shadcn|css|json] [--out <file>]
|
|
10
|
+
|
|
11
|
+
--preset the code from the create page, for example f090000
|
|
12
|
+
--name the name of the theme (default: custom)
|
|
13
|
+
--format shadcn: CSS with the shadcn variable names (default)
|
|
14
|
+
css: CSS with the fluorokit variables only
|
|
15
|
+
json: a theme file for tokens/themes/ of the kit
|
|
16
|
+
--out the file to write. With no --out, the theme is printed.`;
|
|
17
|
+
|
|
18
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
19
|
+
const flags = {};
|
|
20
|
+
for (let i = 0; i < rest.length; i += 2) {
|
|
21
|
+
if (!rest[i].startsWith('--') || rest[i + 1] === undefined) {
|
|
22
|
+
console.error(USAGE);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
flags[rest[i].slice(2)] = rest[i + 1];
|
|
26
|
+
}
|
|
27
|
+
if (command !== 'theme' || !flags.preset) {
|
|
28
|
+
console.error(USAGE);
|
|
29
|
+
process.exit(command === undefined || command === 'help' ? 0 : 1);
|
|
30
|
+
}
|
|
31
|
+
const choice = decodePreset(flags.preset);
|
|
32
|
+
if (!choice) {
|
|
33
|
+
console.error(`"${flags.preset}" is not a preset code. Copy the code from the create page.`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
const format = flags.format ?? 'shadcn';
|
|
37
|
+
if (!['shadcn', 'css', 'json'].includes(format)) {
|
|
38
|
+
console.error(`--format must be shadcn, css or json, not "${format}".`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const name = (flags.name ?? 'custom').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'custom';
|
|
42
|
+
const theme = themeOf(choice, name);
|
|
43
|
+
const { tileMin, ...file } = theme;
|
|
44
|
+
const text = format === 'json' ? JSON.stringify(file, null, 2) + '\n' : themeCss(theme, format === 'shadcn');
|
|
45
|
+
if (flags.out) {
|
|
46
|
+
writeFileSync(flags.out, text);
|
|
47
|
+
console.error(`Wrote the ${name} theme (${flags.preset}) to ${flags.out}`);
|
|
48
|
+
} else {
|
|
49
|
+
process.stdout.write(text);
|
|
50
|
+
}
|
package/dist/base.css
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* fluorokit base: the classes that make a page Metro and are not
|
|
2
|
+
components. Needs structure.css and one theme. It sets no element styles
|
|
3
|
+
and no reset, so it is safe in an app shell and on a document site.
|
|
4
|
+
|
|
5
|
+
Rules the CSS cannot enforce:
|
|
6
|
+
- Radius 0. No shadows.
|
|
7
|
+
- Light weight only from 24px.
|
|
8
|
+
- Uppercase only in the overline, set with text-transform.
|
|
9
|
+
- Muted text only on base, mantle and deep. On raised or hover, use text. */
|
|
10
|
+
|
|
11
|
+
/* ---- the type scale ---- */
|
|
12
|
+
.fk-hero {
|
|
13
|
+
font-size: var(--fk-hero-size);
|
|
14
|
+
font-weight: 300;
|
|
15
|
+
line-height: var(--fk-hero-leading);
|
|
16
|
+
letter-spacing: -0.03em;
|
|
17
|
+
}
|
|
18
|
+
.fk-title {
|
|
19
|
+
font-size: var(--fk-title-size);
|
|
20
|
+
font-weight: 300;
|
|
21
|
+
line-height: var(--fk-title-leading);
|
|
22
|
+
letter-spacing: -0.02em;
|
|
23
|
+
}
|
|
24
|
+
.fk-heading {
|
|
25
|
+
font-size: var(--fk-heading-size);
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
line-height: var(--fk-heading-leading);
|
|
28
|
+
letter-spacing: -0.01em;
|
|
29
|
+
}
|
|
30
|
+
.fk-subheading {
|
|
31
|
+
font-size: var(--fk-subheading-size);
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
line-height: var(--fk-subheading-leading);
|
|
34
|
+
}
|
|
35
|
+
.fk-small {
|
|
36
|
+
font-size: var(--fk-small-size);
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
line-height: var(--fk-small-leading);
|
|
39
|
+
}
|
|
40
|
+
.fk-label {
|
|
41
|
+
font-size: var(--fk-label-size);
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
line-height: var(--fk-label-leading);
|
|
44
|
+
}
|
|
45
|
+
.fk-overline {
|
|
46
|
+
font-family: var(--fk-font-mono);
|
|
47
|
+
font-size: var(--fk-overline-size);
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
line-height: var(--fk-overline-leading);
|
|
50
|
+
letter-spacing: 0.08em;
|
|
51
|
+
text-transform: uppercase;
|
|
52
|
+
}
|
|
53
|
+
/* Measured values, units, IDs, hostnames, dates. */
|
|
54
|
+
.fk-data {
|
|
55
|
+
font-family: var(--fk-font-mono);
|
|
56
|
+
font-size: var(--fk-data-size);
|
|
57
|
+
font-weight: 500;
|
|
58
|
+
line-height: var(--fk-data-leading);
|
|
59
|
+
font-variant-numeric: tabular-nums;
|
|
60
|
+
}
|
|
61
|
+
.fk-muted {
|
|
62
|
+
color: var(--fk-muted);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ---- the energy bar: the one gradient ---- */
|
|
66
|
+
.fk-bar {
|
|
67
|
+
background-image: linear-gradient(90deg, var(--fk-bar-start), var(--fk-bar-end));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ---- status: a square plus a label. The label carries the state ---- */
|
|
71
|
+
.fk-status {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: var(--fk-space-2);
|
|
75
|
+
font-size: var(--fk-label-size);
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
line-height: var(--fk-label-leading);
|
|
78
|
+
}
|
|
79
|
+
.fk-status::before {
|
|
80
|
+
content: "";
|
|
81
|
+
flex: none;
|
|
82
|
+
width: 8px;
|
|
83
|
+
height: 8px;
|
|
84
|
+
background: var(--fk-status-color, var(--fk-overlay));
|
|
85
|
+
}
|
|
86
|
+
.fk-status.ok { --fk-status-color: var(--fk-status-ok); }
|
|
87
|
+
.fk-status.warn { --fk-status-color: var(--fk-status-warn); }
|
|
88
|
+
.fk-status.error { --fk-status-color: var(--fk-status-error); }
|
|
89
|
+
.fk-status.info { --fk-status-color: var(--fk-status-info); }
|
|
90
|
+
|
|
91
|
+
/* ---- pivot: type as navigation ----
|
|
92
|
+
A row of headers. The selected one is solid, the rest are faint. The
|
|
93
|
+
markup is a tablist of buttons (svelte/Pivot.svelte writes it), or a nav
|
|
94
|
+
of links with aria-current="page" on the current one. Write the labels
|
|
95
|
+
in lowercase by hand. */
|
|
96
|
+
.fk-pivot {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: baseline;
|
|
99
|
+
gap: 1.5rem;
|
|
100
|
+
}
|
|
101
|
+
.fk-pivot > :is([role="tab"], a) {
|
|
102
|
+
margin: 0;
|
|
103
|
+
padding: 0;
|
|
104
|
+
border: 0;
|
|
105
|
+
background: none;
|
|
106
|
+
font-family: inherit;
|
|
107
|
+
font-size: var(--fk-pivot-size);
|
|
108
|
+
font-weight: 300;
|
|
109
|
+
line-height: var(--fk-pivot-leading);
|
|
110
|
+
letter-spacing: -0.02em;
|
|
111
|
+
color: var(--fk-overlay);
|
|
112
|
+
text-decoration: none;
|
|
113
|
+
transition: color 150ms;
|
|
114
|
+
}
|
|
115
|
+
.fk-pivot.fk-pivot-sub > :is([role="tab"], a) {
|
|
116
|
+
font-size: var(--fk-subpivot-size);
|
|
117
|
+
font-weight: 350;
|
|
118
|
+
line-height: inherit;
|
|
119
|
+
letter-spacing: normal;
|
|
120
|
+
}
|
|
121
|
+
.fk-pivot > :is([role="tab"], a):hover {
|
|
122
|
+
color: var(--fk-muted);
|
|
123
|
+
background: none;
|
|
124
|
+
}
|
|
125
|
+
.fk-pivot > :is([role="tab"][aria-selected="true"], a[aria-current="page"]) {
|
|
126
|
+
color: var(--fk-text);
|
|
127
|
+
}
|
|
128
|
+
.fk-pivot > [role="tab"]:disabled {
|
|
129
|
+
color: color-mix(in oklab, var(--fk-overlay) 60%, transparent);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ---- tiles: the Start screen ----
|
|
133
|
+
A grid of flat squares. A tile is a link or a div with its label at the
|
|
134
|
+
bottom left. data-size is square (the default), wide or large. Set the
|
|
135
|
+
fill with --fk-tile-color, for example var(--fk-tile-sky). */
|
|
136
|
+
.fk-tile-grid {
|
|
137
|
+
display: grid;
|
|
138
|
+
grid-template-columns: repeat(auto-fill, var(--fk-tile-1));
|
|
139
|
+
grid-auto-rows: var(--fk-tile-1);
|
|
140
|
+
grid-auto-flow: dense;
|
|
141
|
+
gap: var(--fk-tile-gap);
|
|
142
|
+
}
|
|
143
|
+
.fk-tile {
|
|
144
|
+
--fk-tile-fill: var(--fk-tile-color, var(--fk-tile-pink, var(--fk-accent)));
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
justify-content: flex-end;
|
|
148
|
+
padding: var(--fk-space-2) var(--fk-space-3);
|
|
149
|
+
background: var(--fk-tile-fill);
|
|
150
|
+
color: var(--fk-tile-text, var(--fk-on-accent));
|
|
151
|
+
text-decoration: none;
|
|
152
|
+
}
|
|
153
|
+
.fk-tile[data-size="wide"] {
|
|
154
|
+
grid-column: span 2;
|
|
155
|
+
}
|
|
156
|
+
.fk-tile[data-size="large"] {
|
|
157
|
+
grid-column: span 2;
|
|
158
|
+
grid-row: span 2;
|
|
159
|
+
}
|
|
160
|
+
a.fk-tile:hover {
|
|
161
|
+
background: color-mix(in srgb, var(--fk-tile-fill) 85%, #000);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* ---- the Metro page-enter ----
|
|
165
|
+
Fade in while sliding into place. Set --i on siblings (0, 1, 2 ...) to
|
|
166
|
+
stagger them. --fk-enter-dir is the side: 1 from the right (the default),
|
|
167
|
+
-1 from the left. A pivot sets it on the root element at each click, so a
|
|
168
|
+
page comes from the side its header lies on. Set it on a container to
|
|
169
|
+
override that. */
|
|
170
|
+
@keyframes fk-enter {
|
|
171
|
+
from {
|
|
172
|
+
opacity: 0;
|
|
173
|
+
transform: translateX(calc(var(--fk-enter-offset) * var(--fk-enter-dir, 1)));
|
|
174
|
+
}
|
|
175
|
+
to {
|
|
176
|
+
opacity: 1;
|
|
177
|
+
transform: none;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
.fk-enter {
|
|
181
|
+
animation: fk-enter var(--fk-enter-duration) var(--fk-ease-metro) backwards;
|
|
182
|
+
animation-delay: calc(var(--i, 0) * var(--fk-enter-stagger));
|
|
183
|
+
}
|
|
184
|
+
@media (prefers-reduced-motion: reduce) {
|
|
185
|
+
.fk-enter {
|
|
186
|
+
animation: none;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* ---- utilities ---- */
|
|
191
|
+
.fk-sr-only {
|
|
192
|
+
position: absolute;
|
|
193
|
+
width: 1px;
|
|
194
|
+
height: 1px;
|
|
195
|
+
padding: 0;
|
|
196
|
+
margin: -1px;
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
clip: rect(0, 0, 0, 0);
|
|
199
|
+
white-space: nowrap;
|
|
200
|
+
border: 0;
|
|
201
|
+
}
|
package/dist/enter.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function setEnterDirection<T>(
|
|
2
|
+
items: readonly T[],
|
|
3
|
+
from: T,
|
|
4
|
+
to: T,
|
|
5
|
+
scope?: HTMLElement | null,
|
|
6
|
+
): 1 | -1 | 0;
|
|
7
|
+
export function enterDirectionFromReferrer(paths: readonly string[]): 1 | -1;
|
|
8
|
+
export function enterDirectionScript(paths: readonly string[]): string;
|
package/dist/enter.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Direction for the Metro page-enter. `.fk-enter` slides in from the right
|
|
2
|
+
// when --fk-enter-dir is 1 and from the left when it is -1.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Point the next page-enter at the side the new item lies on: from the right
|
|
6
|
+
* when `to` comes after `from` in `items`, from the left when it comes before.
|
|
7
|
+
* Call it before the state change that mounts the new content. Pivot does
|
|
8
|
+
* this on its own; call it yourself when code changes the page (a menu
|
|
9
|
+
* command, a keyboard shortcut).
|
|
10
|
+
*
|
|
11
|
+
* @template T
|
|
12
|
+
* @param {readonly T[]} items the pages in display order
|
|
13
|
+
* @param {T} from the current page
|
|
14
|
+
* @param {T} to the page that will show
|
|
15
|
+
* @param {HTMLElement | null} [scope] the element that holds the entering content. Default: the root element.
|
|
16
|
+
* @returns {1 | -1 | 0} the direction, or 0 when nothing changes
|
|
17
|
+
*/
|
|
18
|
+
export function setEnterDirection(items, from, to, scope) {
|
|
19
|
+
const a = items.indexOf(from);
|
|
20
|
+
const b = items.indexOf(to);
|
|
21
|
+
if (a === b || b === -1) return 0;
|
|
22
|
+
const dir = b > a ? 1 : -1;
|
|
23
|
+
if (typeof document !== 'undefined') {
|
|
24
|
+
(scope ?? document.documentElement).style.setProperty('--fk-enter-dir', String(dir));
|
|
25
|
+
}
|
|
26
|
+
return dir;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* For a site of separate pages. Point the page-enter at the side this page
|
|
31
|
+
* lies on, seen from the page the visitor came from (document.referrer):
|
|
32
|
+
* - a section further right in `paths` comes from the right, one further
|
|
33
|
+
* left from the left;
|
|
34
|
+
* - in one section, a deeper page comes from the right and a shallower one
|
|
35
|
+
* (back to the index) from the left.
|
|
36
|
+
* A first visit, or one from a different site, comes from the right.
|
|
37
|
+
*
|
|
38
|
+
* Run it in the <head>, before the first paint. Use enterDirectionScript for
|
|
39
|
+
* that. The function uses nothing outside its own body, so that its source
|
|
40
|
+
* can be put inline.
|
|
41
|
+
*
|
|
42
|
+
* @param {readonly string[]} paths the section roots in display order, for example ['/', '/blog/', '/projects/']
|
|
43
|
+
* @returns {1 | -1} the direction
|
|
44
|
+
*/
|
|
45
|
+
export function enterDirectionFromReferrer(paths) {
|
|
46
|
+
let dir = 1;
|
|
47
|
+
try {
|
|
48
|
+
const from = document.referrer ? new URL(document.referrer) : null;
|
|
49
|
+
if (from && from.origin === location.origin) {
|
|
50
|
+
const norm = (p) => (p.endsWith('/') ? p : p + '/');
|
|
51
|
+
// The section is the longest root the path starts with.
|
|
52
|
+
const section = (p) => {
|
|
53
|
+
let best = -1;
|
|
54
|
+
paths.forEach((root, i) => {
|
|
55
|
+
if (norm(p).startsWith(norm(root)) && (best === -1 || root.length > paths[best].length)) best = i;
|
|
56
|
+
});
|
|
57
|
+
return best;
|
|
58
|
+
};
|
|
59
|
+
const depth = (p) => p.split('/').filter(Boolean).length;
|
|
60
|
+
const a = section(from.pathname);
|
|
61
|
+
const b = section(location.pathname);
|
|
62
|
+
if (a !== -1 && b !== -1 && a !== b) dir = b > a ? 1 : -1;
|
|
63
|
+
else if (depth(location.pathname) < depth(from.pathname)) dir = -1;
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
// A referrer that is not a URL: keep the default.
|
|
67
|
+
}
|
|
68
|
+
document.documentElement.style.setProperty('--fk-enter-dir', String(dir));
|
|
69
|
+
return dir;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The source of an inline script that calls enterDirectionFromReferrer.
|
|
74
|
+
* Put it in the <head>:
|
|
75
|
+
* <script is:inline set:html={enterDirectionScript(['/', '/blog/'])} />
|
|
76
|
+
*
|
|
77
|
+
* @param {readonly string[]} paths the section roots in display order
|
|
78
|
+
* @returns {string}
|
|
79
|
+
*/
|
|
80
|
+
export function enterDirectionScript(paths) {
|
|
81
|
+
const json = JSON.stringify(paths).replace(/</g, '\\u003c');
|
|
82
|
+
return `(${enterDirectionFromReferrer})(${json})`;
|
|
83
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Copyright 2015, Microsoft Corporation (www.microsoft.com), with Reserved Font Name Selawik. All Rights Reserved. Selawik is a trademark of Microsoft Corporation in the United States and/or other countries.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
PREAMBLE
|
|
11
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
12
|
+
development of collaborative font projects, to support the font creation
|
|
13
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
14
|
+
open framework in which fonts may be shared and improved in partnership
|
|
15
|
+
with others.
|
|
16
|
+
|
|
17
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
18
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
19
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
20
|
+
redistributed and/or sold with any software provided that any reserved
|
|
21
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
22
|
+
however, cannot be released under any other type of license. The
|
|
23
|
+
requirement for fonts to remain under this license does not apply
|
|
24
|
+
to any document created using the fonts or their derivatives.
|
|
25
|
+
|
|
26
|
+
DEFINITIONS
|
|
27
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
28
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
29
|
+
include source files, build scripts and documentation.
|
|
30
|
+
|
|
31
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
32
|
+
copyright statement(s).
|
|
33
|
+
|
|
34
|
+
"Original Version" refers to the collection of Font Software components as
|
|
35
|
+
distributed by the Copyright Holder(s).
|
|
36
|
+
|
|
37
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
38
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
39
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
40
|
+
new environment.
|
|
41
|
+
|
|
42
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
43
|
+
writer or other person who contributed to the Font Software.
|
|
44
|
+
|
|
45
|
+
PERMISSION & CONDITIONS
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
47
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
48
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
49
|
+
Software, subject to the following conditions:
|
|
50
|
+
|
|
51
|
+
1) Neither the Font Software nor any of its individual components,
|
|
52
|
+
in Original or Modified Versions, may be sold by itself.
|
|
53
|
+
|
|
54
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
55
|
+
redistributed and/or sold with any software, provided that each copy
|
|
56
|
+
contains the above copyright notice and this license. These can be
|
|
57
|
+
included either as stand-alone text files, human-readable headers or
|
|
58
|
+
in the appropriate machine-readable metadata fields within text or
|
|
59
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
60
|
+
|
|
61
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
62
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
63
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
64
|
+
presented to the users.
|
|
65
|
+
|
|
66
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
67
|
+
Software shall not be used to promote, endorse or advertise any
|
|
68
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
69
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
70
|
+
permission.
|
|
71
|
+
|
|
72
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
73
|
+
must be distributed entirely under this license, and must not be
|
|
74
|
+
distributed under any other license. The requirement for fonts to
|
|
75
|
+
remain under this license does not apply to any document created
|
|
76
|
+
using the Font Software.
|
|
77
|
+
|
|
78
|
+
TERMINATION
|
|
79
|
+
This license becomes null and void if any of the above conditions are
|
|
80
|
+
not met.
|
|
81
|
+
|
|
82
|
+
DISCLAIMER
|
|
83
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
84
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
85
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
86
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
87
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
88
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
89
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
90
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
91
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|