@zonsh/ui 0.0.0-stage → 0.2.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 +76 -2
- package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
- package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction.svg +77 -0
- package/assets/illustrations/drawing/crescent-dark.svg +28 -0
- package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
- package/assets/illustrations/drawing/crescent-guides.svg +33 -0
- package/assets/illustrations/drawing/crescent.svg +28 -0
- package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
- package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
- package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
- package/assets/illustrations/drawing/eclipse.svg +187 -0
- package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
- package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides.svg +31 -0
- package/assets/illustrations/drawing/horizon-dark.svg +30 -0
- package/assets/illustrations/drawing/horizon.svg +30 -0
- package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
- package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
- package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
- package/assets/illustrations/drawing/nib-study.svg +107 -0
- package/assets/illustrations/editorial/assistant-640.webp +0 -0
- package/assets/illustrations/editorial/assistant.webp +0 -0
- package/assets/illustrations/editorial/automation-640.webp +0 -0
- package/assets/illustrations/editorial/automation.webp +0 -0
- package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-left.webp +0 -0
- package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-right.webp +0 -0
- package/assets/illustrations/editorial/custom-software-640.webp +0 -0
- package/assets/illustrations/editorial/custom-software.webp +0 -0
- package/assets/illustrations/editorial/digitalization-640.webp +0 -0
- package/assets/illustrations/editorial/digitalization.webp +0 -0
- package/assets/illustrations/editorial/integration-640.webp +0 -0
- package/assets/illustrations/editorial/integration.webp +0 -0
- package/assets/illustrations/editorial/problem-640.webp +0 -0
- package/assets/illustrations/editorial/problem.webp +0 -0
- package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
- package/assets/illustrations/editorial/process-analysis.webp +0 -0
- package/assets/illustrations/editorial/process-concept-640.webp +0 -0
- package/assets/illustrations/editorial/process-concept.webp +0 -0
- package/assets/illustrations/editorial/process-development-640.webp +0 -0
- package/assets/illustrations/editorial/process-development.webp +0 -0
- package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
- package/assets/illustrations/editorial/process-discovery.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance.webp +0 -0
- package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
- package/assets/illustrations/editorial/process-prototype.webp +0 -0
- package/assets/illustrations/editorial/process-testing-640.webp +0 -0
- package/assets/illustrations/editorial/process-testing.webp +0 -0
- package/assets/illustrations/iso/automation-dark.svg +6 -0
- package/assets/illustrations/iso/automation.svg +6 -0
- package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
- package/assets/illustrations/iso/bar-chart.svg +6 -0
- package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
- package/assets/illustrations/iso/brackets-classic.svg +6 -0
- package/assets/illustrations/iso/brackets-dark.svg +6 -0
- package/assets/illustrations/iso/brackets.svg +6 -0
- package/assets/illustrations/iso/city-dark.svg +6 -0
- package/assets/illustrations/iso/city.svg +6 -0
- package/assets/illustrations/iso/conveyor-dark.svg +6 -0
- package/assets/illustrations/iso/conveyor.svg +6 -0
- package/assets/illustrations/iso/database-dark.svg +6 -0
- package/assets/illustrations/iso/database.svg +6 -0
- package/assets/illustrations/iso/documents-dark.svg +6 -0
- package/assets/illustrations/iso/documents.svg +6 -0
- package/assets/illustrations/iso/inbox-dark.svg +6 -0
- package/assets/illustrations/iso/inbox.svg +6 -0
- package/assets/illustrations/iso/laptop-dark.svg +6 -0
- package/assets/illustrations/iso/laptop.svg +6 -0
- package/assets/illustrations/iso/monitor-dark.svg +6 -0
- package/assets/illustrations/iso/monitor.svg +6 -0
- package/assets/illustrations/iso/pipeline-dark.svg +6 -0
- package/assets/illustrations/iso/pipeline.svg +6 -0
- package/assets/illustrations/iso/platform-dark.svg +6 -0
- package/assets/illustrations/iso/platform.svg +6 -0
- package/assets/illustrations/iso/server-dark.svg +6 -0
- package/assets/illustrations/iso/server.svg +6 -0
- package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
- package/assets/illustrations/iso/spreadsheet.svg +6 -0
- package/assets/illustrations/iso/timeline-dark.svg +6 -0
- package/assets/illustrations/iso/timeline.svg +6 -0
- package/assets/illustrations/sheet/construction.svg +115 -0
- package/assets/illustrations/sheet/crescent.svg +40 -0
- package/assets/illustrations/sheet/limb.svg +42 -0
- package/assets/illustrations/sheet/stress-axis.svg +119 -0
- package/assets/illustrations/sheet/totality.svg +215 -0
- package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
- package/assets/logo-left.svg +1 -0
- package/assets/logo-right.svg +1 -0
- package/assets/logo.svg +1 -0
- package/dist/components/_overlay.d.ts +47 -0
- package/dist/components/_overlay.js +59 -0
- package/dist/components/accordion.d.ts +32 -0
- package/dist/components/accordion.js +39 -0
- package/dist/components/alert-dialog.d.ts +45 -0
- package/dist/components/alert-dialog.js +56 -0
- package/dist/components/alert.d.ts +35 -0
- package/dist/components/alert.js +42 -0
- package/dist/components/ascii-field.d.ts +34 -0
- package/dist/components/ascii-field.js +410 -0
- package/dist/components/aspect-ratio.d.ts +14 -0
- package/dist/components/aspect-ratio.js +17 -0
- package/dist/components/avatar.d.ts +42 -0
- package/dist/components/avatar.js +55 -0
- package/dist/components/badge.d.ts +70 -0
- package/dist/components/badge.js +62 -0
- package/dist/components/breadcrumb.d.ts +22 -0
- package/dist/components/breadcrumb.js +32 -0
- package/dist/components/button-group.d.ts +30 -0
- package/dist/components/button-group.js +47 -0
- package/dist/components/button.d.ts +53 -0
- package/dist/components/button.js +130 -0
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.js +164 -0
- package/dist/components/card.d.ts +42 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +90 -0
- package/dist/components/carousel.js +213 -0
- package/dist/components/chart.d.ts +180 -0
- package/dist/components/chart.js +286 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +43 -0
- package/dist/components/code-block.d.ts +45 -0
- package/dist/components/code-block.js +58 -0
- package/dist/components/code-highlight.d.ts +13 -0
- package/dist/components/code-highlight.js +107 -0
- package/dist/components/collapsible.d.ts +20 -0
- package/dist/components/collapsible.js +32 -0
- package/dist/components/color-picker.d.ts +85 -0
- package/dist/components/color-picker.js +407 -0
- package/dist/components/combobox.d.ts +81 -0
- package/dist/components/combobox.js +100 -0
- package/dist/components/command.d.ts +112 -0
- package/dist/components/command.js +212 -0
- package/dist/components/context-menu.d.ts +29 -0
- package/dist/components/context-menu.js +35 -0
- package/dist/components/conversation.d.ts +27 -0
- package/dist/components/conversation.js +293 -0
- package/dist/components/copy-button.d.ts +46 -0
- package/dist/components/copy-button.js +118 -0
- package/dist/components/data-table.d.ts +175 -0
- package/dist/components/data-table.js +302 -0
- package/dist/components/date-picker.d.ts +91 -0
- package/dist/components/date-picker.js +207 -0
- package/dist/components/dialog.d.ts +48 -0
- package/dist/components/dialog.js +92 -0
- package/dist/components/direction.d.ts +16 -0
- package/dist/components/direction.js +18 -0
- package/dist/components/drawer.d.ts +60 -0
- package/dist/components/drawer.js +76 -0
- package/dist/components/empty.d.ts +31 -0
- package/dist/components/empty.js +50 -0
- package/dist/components/feature-list.d.ts +54 -0
- package/dist/components/feature-list.js +43 -0
- package/dist/components/field.d.ts +15 -0
- package/dist/components/field.js +36 -0
- package/dist/components/file-drop.d.ts +55 -0
- package/dist/components/file-drop.js +197 -0
- package/dist/components/filter-bar.d.ts +106 -0
- package/dist/components/filter-bar.js +296 -0
- package/dist/components/form.d.ts +33 -0
- package/dist/components/form.js +34 -0
- package/dist/components/graph.d.ts +105 -0
- package/dist/components/graph.js +786 -0
- package/dist/components/illustration.d.ts +85 -0
- package/dist/components/illustration.js +165 -0
- package/dist/components/input-group.d.ts +127 -0
- package/dist/components/input-group.js +292 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item.d.ts +64 -0
- package/dist/components/item.js +116 -0
- package/dist/components/kbd.d.ts +33 -0
- package/dist/components/kbd.js +38 -0
- package/dist/components/label.d.ts +12 -0
- package/dist/components/label.js +24 -0
- package/dist/components/layout.d.ts +136 -0
- package/dist/components/layout.js +162 -0
- package/dist/components/logo.d.ts +54 -0
- package/dist/components/logo.js +96 -0
- package/dist/components/menu.d.ts +60 -0
- package/dist/components/menu.js +138 -0
- package/dist/components/menubar.d.ts +62 -0
- package/dist/components/menubar.js +223 -0
- package/dist/components/message.d.ts +42 -0
- package/dist/components/message.js +56 -0
- package/dist/components/meter.d.ts +31 -0
- package/dist/components/meter.js +25 -0
- package/dist/components/native-select.d.ts +26 -0
- package/dist/components/native-select.js +35 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +97 -0
- package/dist/components/number-field.d.ts +36 -0
- package/dist/components/number-field.js +153 -0
- package/dist/components/otp-field.d.ts +35 -0
- package/dist/components/otp-field.js +94 -0
- package/dist/components/pagination.d.ts +31 -0
- package/dist/components/pagination.js +70 -0
- package/dist/components/pdf-viewer.d.ts +69 -0
- package/dist/components/pdf-viewer.js +929 -0
- package/dist/components/popover.d.ts +33 -0
- package/dist/components/popover.js +48 -0
- package/dist/components/preview-card.d.ts +25 -0
- package/dist/components/preview-card.js +22 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +23 -0
- package/dist/components/prompt-input.d.ts +131 -0
- package/dist/components/prompt-input.js +403 -0
- package/dist/components/quote.d.ts +22 -0
- package/dist/components/quote.js +15 -0
- package/dist/components/radio-group.d.ts +18 -0
- package/dist/components/radio-group.js +34 -0
- package/dist/components/reasoning.d.ts +31 -0
- package/dist/components/reasoning.js +70 -0
- package/dist/components/resizable.d.ts +38 -0
- package/dist/components/resizable.js +41 -0
- package/dist/components/response.d.ts +30 -0
- package/dist/components/response.js +538 -0
- package/dist/components/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area.js +31 -0
- package/dist/components/select.d.ts +35 -0
- package/dist/components/select.js +60 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +17 -0
- package/dist/components/sidebar.d.ts +147 -0
- package/dist/components/sidebar.js +489 -0
- package/dist/components/site-header.d.ts +59 -0
- package/dist/components/site-header.js +67 -0
- package/dist/components/skeleton.d.ts +31 -0
- package/dist/components/skeleton.js +29 -0
- package/dist/components/slider.d.ts +24 -0
- package/dist/components/slider.js +129 -0
- package/dist/components/sources.d.ts +25 -0
- package/dist/components/sources.js +35 -0
- package/dist/components/spinner.d.ts +36 -0
- package/dist/components/spinner.js +72 -0
- package/dist/components/suggestions.d.ts +20 -0
- package/dist/components/suggestions.js +18 -0
- package/dist/components/switch.d.ts +14 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table.d.ts +162 -0
- package/dist/components/table.js +758 -0
- package/dist/components/tabs.d.ts +25 -0
- package/dist/components/tabs.js +162 -0
- package/dist/components/tag.d.ts +41 -0
- package/dist/components/tag.js +88 -0
- package/dist/components/tags-input.d.ts +40 -0
- package/dist/components/tags-input.js +239 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +112 -0
- package/dist/components/time-field.d.ts +51 -0
- package/dist/components/time-field.js +437 -0
- package/dist/components/timeline.d.ts +76 -0
- package/dist/components/timeline.js +99 -0
- package/dist/components/toast.d.ts +72 -0
- package/dist/components/toast.js +196 -0
- package/dist/components/toggle-group.d.ts +41 -0
- package/dist/components/toggle-group.js +140 -0
- package/dist/components/toggle.d.ts +23 -0
- package/dist/components/toggle.js +35 -0
- package/dist/components/tool-call.d.ts +52 -0
- package/dist/components/tool-call.js +57 -0
- package/dist/components/toolbar.d.ts +17 -0
- package/dist/components/toolbar.js +34 -0
- package/dist/components/tooltip.d.ts +42 -0
- package/dist/components/tooltip.js +47 -0
- package/dist/components/tree.d.ts +75 -0
- package/dist/components/tree.js +636 -0
- package/dist/components/typography.d.ts +134 -0
- package/dist/components/typography.js +176 -0
- package/dist/components/video-player.d.ts +276 -0
- package/dist/components/video-player.js +1352 -0
- package/dist/components/whiteboard.d.ts +80 -0
- package/dist/components/whiteboard.js +389 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +86 -0
- package/dist/lib/cn.d.ts +20 -0
- package/dist/lib/cn.js +38 -0
- package/dist/lib/code-highlight.d.ts +31 -0
- package/dist/lib/code-highlight.js +24 -0
- package/dist/lib/code-theme.d.ts +19 -0
- package/dist/lib/code-theme.js +140 -0
- package/dist/lib/collapse-row.d.ts +9 -0
- package/dist/lib/collapse-row.js +129 -0
- package/dist/lib/digit-roll.d.ts +21 -0
- package/dist/lib/digit-roll.js +31 -0
- package/dist/lib/editorial-assets.d.ts +16 -0
- package/dist/lib/editorial-assets.js +56 -0
- package/dist/lib/figure/catalog.d.ts +127 -0
- package/dist/lib/figure/catalog.js +130 -0
- package/dist/lib/figure/figures/automation.d.ts +7 -0
- package/dist/lib/figure/figures/automation.js +143 -0
- package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
- package/dist/lib/figure/figures/bar-chart.js +99 -0
- package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
- package/dist/lib/figure/figures/brackets-classic.js +170 -0
- package/dist/lib/figure/figures/brackets.d.ts +8 -0
- package/dist/lib/figure/figures/brackets.js +84 -0
- package/dist/lib/figure/figures/city.d.ts +7 -0
- package/dist/lib/figure/figures/city.js +93 -0
- package/dist/lib/figure/figures/conveyor.d.ts +7 -0
- package/dist/lib/figure/figures/conveyor.js +97 -0
- package/dist/lib/figure/figures/database.d.ts +7 -0
- package/dist/lib/figure/figures/database.js +65 -0
- package/dist/lib/figure/figures/documents.d.ts +7 -0
- package/dist/lib/figure/figures/documents.js +83 -0
- package/dist/lib/figure/figures/inbox.d.ts +7 -0
- package/dist/lib/figure/figures/inbox.js +92 -0
- package/dist/lib/figure/figures/laptop.d.ts +7 -0
- package/dist/lib/figure/figures/laptop.js +67 -0
- package/dist/lib/figure/figures/monitor.d.ts +7 -0
- package/dist/lib/figure/figures/monitor.js +59 -0
- package/dist/lib/figure/figures/pipeline.d.ts +8 -0
- package/dist/lib/figure/figures/pipeline.js +117 -0
- package/dist/lib/figure/figures/platform.d.ts +7 -0
- package/dist/lib/figure/figures/platform.js +117 -0
- package/dist/lib/figure/figures/server.d.ts +7 -0
- package/dist/lib/figure/figures/server.js +115 -0
- package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
- package/dist/lib/figure/figures/spreadsheet.js +87 -0
- package/dist/lib/figure/figures/timeline.d.ts +7 -0
- package/dist/lib/figure/figures/timeline.js +65 -0
- package/dist/lib/figure/kernel.d.ts +152 -0
- package/dist/lib/figure/kernel.js +576 -0
- package/dist/lib/figure/parts.d.ts +42 -0
- package/dist/lib/figure/parts.js +126 -0
- package/dist/lib/form-reset.d.ts +11 -0
- package/dist/lib/form-reset.js +22 -0
- package/dist/lib/glide.d.ts +53 -0
- package/dist/lib/glide.js +138 -0
- package/dist/lib/graph-layout.d.ts +58 -0
- package/dist/lib/graph-layout.js +200 -0
- package/dist/lib/illustration-drawings.d.ts +89 -0
- package/dist/lib/illustration-drawings.js +539 -0
- package/dist/lib/illustration-info.d.ts +37 -0
- package/dist/lib/illustration-info.js +22 -0
- package/dist/lib/illustration-library.d.ts +87 -0
- package/dist/lib/illustration-library.js +352 -0
- package/dist/lib/logo-geometry.d.ts +29 -0
- package/dist/lib/logo-geometry.js +67 -0
- package/dist/lib/markdown-guard.d.ts +16 -0
- package/dist/lib/markdown-guard.js +123 -0
- package/dist/lib/merge-refs.d.ts +10 -0
- package/dist/lib/merge-refs.js +26 -0
- package/dist/lib/motion.d.ts +6 -0
- package/dist/lib/motion.js +12 -0
- package/dist/lib/pdf-worker.d.ts +1 -0
- package/dist/lib/pdf-worker.js +6 -0
- package/dist/lib/pdf.d.ts +19 -0
- package/dist/lib/pdf.js +58 -0
- package/dist/lib/platform.d.ts +33 -0
- package/dist/lib/platform.js +68 -0
- package/dist/lib/room.d.ts +25 -0
- package/dist/lib/room.js +46 -0
- package/dist/lib/table-fit.d.ts +143 -0
- package/dist/lib/table-fit.js +577 -0
- package/dist/lib/theme-script.d.ts +18 -0
- package/dist/lib/theme-script.js +29 -0
- package/dist/styles/expressive.css +188 -0
- package/dist/styles/fonts.css +145 -0
- package/dist/styles/index.css +206 -0
- package/dist/styles/material.css +313 -0
- package/dist/styles/parts/ai.css +360 -0
- package/dist/styles/parts/brand.css +75 -0
- package/dist/styles/parts/controls.css +725 -0
- package/dist/styles/parts/data.css +222 -0
- package/dist/styles/parts/editorial.css +120 -0
- package/dist/styles/parts/feedback.css +273 -0
- package/dist/styles/parts/foundations.css +166 -0
- package/dist/styles/parts/graph.css +214 -0
- package/dist/styles/parts/inputs.css +261 -0
- package/dist/styles/parts/isometric.css +124 -0
- package/dist/styles/parts/navigation.css +232 -0
- package/dist/styles/parts/overlays.css +250 -0
- package/dist/styles/parts/pdf.css +154 -0
- package/dist/styles/parts/react-flow.css +519 -0
- package/dist/styles/parts/whiteboard.css +855 -0
- package/dist/styles/tokens.css +290 -0
- package/dist/vite.d.ts +116 -0
- package/dist/vite.js +129 -0
- package/package.json +189 -3
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* zon tokens — the single source of truth for colour, material, geometry and motion.
|
|
3
|
+
*
|
|
4
|
+
* Light is the default (:root). Dark applies under `.dark` / `[data-theme="dark"]`.
|
|
5
|
+
* `.theme-dark` / `.theme-light` force a scheme locally (e.g. a night footer on a light page).
|
|
6
|
+
*
|
|
7
|
+
* Surfaces, controls and type are monochrome. Colour carries meaning, in small marks: four status
|
|
8
|
+
* colours (`--success`, `--warning`, `--info`, `--destructive`) and six category tones
|
|
9
|
+
* (`--tone-*`) for things people need to tell apart. Never decoration, never a fill for a button,
|
|
10
|
+
* a card or a page. Every colour reads at 4.5:1 or better as text on the grey grounds of its own
|
|
11
|
+
* theme: the page, a card, a raised surface, a menu and --control-hover, the hovered and selected
|
|
12
|
+
* fill (a selected table row).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
:root,
|
|
16
|
+
.theme-light {
|
|
17
|
+
color-scheme: light;
|
|
18
|
+
|
|
19
|
+
/* ── Canvas & ink ─────────────────────────────────────────── */
|
|
20
|
+
--background: oklch(0.99 0 0);
|
|
21
|
+
--foreground: oklch(0.145 0 0);
|
|
22
|
+
--foreground-soft: oklch(0.37 0 0);
|
|
23
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
24
|
+
--card: oklch(1 0 0);
|
|
25
|
+
--card-foreground: oklch(0.145 0 0);
|
|
26
|
+
--popover: oklch(1 0 0);
|
|
27
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
28
|
+
--primary: oklch(0.205 0 0);
|
|
29
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
30
|
+
--secondary: oklch(0.97 0 0);
|
|
31
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
32
|
+
--muted: oklch(0.97 0 0);
|
|
33
|
+
--accent: oklch(0.97 0 0);
|
|
34
|
+
/* Dark enough to keep 4.5:1 on --control-hover (#ebebeb). Success and destructive keep their
|
|
35
|
+
hue at the edge of sRGB, the most chroma an sRGB screen shows at this lightness. */
|
|
36
|
+
--destructive: oklch(0.55 0.224 27.325); /* errors, failed, destructive actions */
|
|
37
|
+
--success: oklch(0.505 0.133 152); /* saved, sent, connected, complete */
|
|
38
|
+
--warning: oklch(0.53 0.12 65); /* needs attention soon: nearly full, partial, expiring */
|
|
39
|
+
--info: oklch(0.52 0.15 250); /* neutral news: selected, unsaved, in progress, new */
|
|
40
|
+
|
|
41
|
+
/* ── Category tones ───────────────────────────────────────── */
|
|
42
|
+
/* No fixed meaning: the app decides what each stands for (a type, a phase, a kind), and keeps
|
|
43
|
+
it the same everywhere. About the lightness of the status colours, so none shouts, and like
|
|
44
|
+
them dark enough to keep 4.5:1 as text on --control-hover. Blue is info's colour; orange keeps
|
|
45
|
+
its hue at the edge of sRGB. */
|
|
46
|
+
--tone-blue: oklch(0.52 0.15 250);
|
|
47
|
+
--tone-aqua: oklch(0.51 0.09 195);
|
|
48
|
+
--tone-violet: oklch(0.53 0.17 300);
|
|
49
|
+
--tone-magenta: oklch(0.54 0.2 340);
|
|
50
|
+
--tone-orange: oklch(0.535 0.153 45);
|
|
51
|
+
--tone-lime: oklch(0.51 0.13 130);
|
|
52
|
+
--border: oklch(0.922 0 0);
|
|
53
|
+
--input: oklch(0.922 0 0);
|
|
54
|
+
--ring: oklch(0.708 0 0);
|
|
55
|
+
|
|
56
|
+
/* ── Material: controls ───────────────────────────────────── */
|
|
57
|
+
--control-surface: #f5f5f5; /* resting fill of secondary/raised surfaces */
|
|
58
|
+
--control-hover: #ebebeb; /* hovered / current fill — never use surface for this */
|
|
59
|
+
--control-pressed: #e4e4e4; /* a raised control held down: a step below hover */
|
|
60
|
+
--control-edge: #0000002e; /* fine outer stroke */
|
|
61
|
+
--control-highlight: #ffffffe6; /* inset top highlight */
|
|
62
|
+
--control-inner-edge: #00000009; /* inner hairline + top shading */
|
|
63
|
+
--control-menu: #fafafa; /* menus, popovers, toasts */
|
|
64
|
+
--control-muted: #737373; /* placeholder, inactive segment text */
|
|
65
|
+
--control-focus: #737373; /* 2px flush focus outline */
|
|
66
|
+
--control-thumb: #ffffff; /* switch/slider thumb at rest */
|
|
67
|
+
--control-thumb-on: #ffffff; /* thumb on a primary-filled (checked) track */
|
|
68
|
+
|
|
69
|
+
/* Internal geometry: controls nested inside a field (steppers, clear buttons, chips, addon
|
|
70
|
+
buttons). Not steps on the 30/38/46 scale — they are the field height minus its inset. */
|
|
71
|
+
--control-inset: 30px; /* inside a 38px field (3px inset + 1px border) */
|
|
72
|
+
--control-inset-sm: 24px; /* inside a 30px dense field */
|
|
73
|
+
|
|
74
|
+
/* ── Material: fields (recessed) ──────────────────────────── */
|
|
75
|
+
--field-surface: #ffffff;
|
|
76
|
+
--field-edge: #d4d4d4;
|
|
77
|
+
--field-inset: #00000009;
|
|
78
|
+
|
|
79
|
+
/* ── Material: primary (layered, not flat) ────────────────── */
|
|
80
|
+
--primary-fill: #292929;
|
|
81
|
+
--primary-fill-hover: #383838;
|
|
82
|
+
--primary-fill-pressed: #232323; /* the primary held down: a step below rest */
|
|
83
|
+
--primary-text: #fafafa;
|
|
84
|
+
--primary-text-shadow: 0 1px 1px #0003;
|
|
85
|
+
--primary-shadow:
|
|
86
|
+
0 4px 4px #2a2a2a33, 0 0 0 1px #0e0e0e, inset 0 4px 6px #fff3, inset 0 0 0 1px #ffffff26,
|
|
87
|
+
inset 0 -8px 14px #00000026;
|
|
88
|
+
/* Pressed: the same five layers as --primary-shadow, in the same order, so a press animates
|
|
89
|
+
(lists that do not line up swap at once): the drop shadow and the bottom shading fade out,
|
|
90
|
+
the top light turns into a dark inset. */
|
|
91
|
+
--primary-shadow-pressed:
|
|
92
|
+
0 0 0 #2a2a2a00, 0 0 0 1px #0e0e0e, inset 0 2px 6px #0000004d, inset 0 0 0 1px #ffffff1a,
|
|
93
|
+
inset 0 -8px 14px #00000000;
|
|
94
|
+
|
|
95
|
+
/* ── Drawing: grids, guides, light ────────────────────────── */
|
|
96
|
+
--grid-line: #0a0a0a0f;
|
|
97
|
+
--grid-bright: #0a0a0a42;
|
|
98
|
+
--guide: #0a0a0a29;
|
|
99
|
+
--ink-ghost: #0a0a0a14;
|
|
100
|
+
--glow: #fffffff2;
|
|
101
|
+
--grain-opacity: 0.35;
|
|
102
|
+
/* The light from above on the page ground (body). None on a light page: white on white. */
|
|
103
|
+
--page-glow: transparent;
|
|
104
|
+
/* Overlay and screen vanish on a light ground: the page grain multiplies there instead. */
|
|
105
|
+
--page-grain-blend: multiply;
|
|
106
|
+
--page-grain-opacity: 0.1;
|
|
107
|
+
|
|
108
|
+
/* ── Isometric illustrations (<Illustration name="iso/…">) ───────────── */
|
|
109
|
+
|
|
110
|
+
/* ── Data ─────────────────────────────────────────────────── */
|
|
111
|
+
--chart-1: oklch(0.205 0 0);
|
|
112
|
+
--chart-2: oklch(0.38 0 0);
|
|
113
|
+
--chart-3: oklch(0.52 0 0);
|
|
114
|
+
--chart-4: oklch(0.66 0 0);
|
|
115
|
+
--chart-5: oklch(0.8 0 0);
|
|
116
|
+
|
|
117
|
+
/* ── Type ─────────────────────────────────────────────────── */
|
|
118
|
+
--font-heading: "Licht", "Iowan Old Style", Georgia, serif;
|
|
119
|
+
--font-body: "Licht Sans", ui-sans-serif, system-ui, sans-serif;
|
|
120
|
+
--font-mono: "Licht Mono", ui-monospace, "SF Mono", monospace;
|
|
121
|
+
|
|
122
|
+
/* ── Geometry ─────────────────────────────────────────────── */
|
|
123
|
+
--radius-button: 12px; /* text buttons, menus, toasts, nav rows, panels */
|
|
124
|
+
--radius-control: 10px; /* inputs, textareas, select triggers */
|
|
125
|
+
--radius-item: 7px; /* select/menu items, segments, tags, swatches */
|
|
126
|
+
--radius-checkbox: 5px;
|
|
127
|
+
--radius-card: 20px; /* objects: cards, tables, form panels */
|
|
128
|
+
--radius-region: 0px; /* regions are square */
|
|
129
|
+
|
|
130
|
+
--control-h-sm: 30px; /* dense */
|
|
131
|
+
--control-h: 38px; /* default */
|
|
132
|
+
--control-h-lg: 46px; /* prominent */
|
|
133
|
+
--icon-button: 36px;
|
|
134
|
+
|
|
135
|
+
--container: 80rem;
|
|
136
|
+
--gutter: 24px;
|
|
137
|
+
--section-pad: clamp(3.5rem, 7vw, 7rem);
|
|
138
|
+
|
|
139
|
+
/* ── Motion ───────────────────────────────────────────────── */
|
|
140
|
+
--ease: cubic-bezier(0.16, 1, 0.3, 1);
|
|
141
|
+
--duration: 150ms;
|
|
142
|
+
--duration-reveal: 420ms;
|
|
143
|
+
|
|
144
|
+
/* ── The zon mark ─────────────────────────────────────────── */
|
|
145
|
+
/* One flat colour: the ink of zon.sh/logo-ink.svg here, the light of logo.svg on dark grounds. */
|
|
146
|
+
--logo: #141414;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* A night region (.theme-night, below) takes every dark token too, then deepens the ground and
|
|
150
|
+
inks; otherwise a primary, a card or a chart inside it on a light page would keep light values. */
|
|
151
|
+
.dark,
|
|
152
|
+
[data-theme="dark"],
|
|
153
|
+
.theme-dark,
|
|
154
|
+
.theme-night {
|
|
155
|
+
color-scheme: dark;
|
|
156
|
+
|
|
157
|
+
--background: oklch(0.07 0 0);
|
|
158
|
+
--foreground: oklch(0.985 0 0);
|
|
159
|
+
--foreground-soft: oklch(0.75 0 0);
|
|
160
|
+
--muted-foreground: oklch(0.66 0 0);
|
|
161
|
+
--card: oklch(0.115 0 0);
|
|
162
|
+
--card-foreground: oklch(0.985 0 0);
|
|
163
|
+
--popover: oklch(0.115 0 0);
|
|
164
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
165
|
+
--primary: oklch(0.985 0 0);
|
|
166
|
+
--primary-foreground: oklch(0.145 0 0);
|
|
167
|
+
--secondary: oklch(0.16 0 0);
|
|
168
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
169
|
+
--muted: oklch(0.155 0 0);
|
|
170
|
+
--accent: oklch(0.18 0 0);
|
|
171
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
172
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
173
|
+
--success: oklch(0.76 0.16 152);
|
|
174
|
+
--warning: oklch(0.78 0.15 75);
|
|
175
|
+
--info: oklch(0.74 0.14 245);
|
|
176
|
+
--tone-blue: oklch(0.74 0.14 245);
|
|
177
|
+
--tone-aqua: oklch(0.78 0.12 195);
|
|
178
|
+
--tone-violet: oklch(0.75 0.15 300);
|
|
179
|
+
--tone-magenta: oklch(0.74 0.18 340);
|
|
180
|
+
--tone-orange: oklch(0.76 0.15 50);
|
|
181
|
+
--tone-lime: oklch(0.8 0.16 130);
|
|
182
|
+
--border: oklch(1 0 0 / 10%);
|
|
183
|
+
--input: oklch(1 0 0 / 14%);
|
|
184
|
+
--ring: oklch(0.556 0 0);
|
|
185
|
+
|
|
186
|
+
--control-surface: #1e1e1e;
|
|
187
|
+
--control-hover: #2a2a2a;
|
|
188
|
+
--control-pressed: #1e1e1e;
|
|
189
|
+
--control-edge: #000000a6;
|
|
190
|
+
--control-highlight: #ffffff1a;
|
|
191
|
+
--control-inner-edge: #ffffff0f;
|
|
192
|
+
--control-menu: #1e1e1e;
|
|
193
|
+
--control-muted: #a3a3a3;
|
|
194
|
+
--control-focus: #999999;
|
|
195
|
+
--control-thumb: #8f8f8f; /* light enough to read on the #161616 track */
|
|
196
|
+
--control-thumb-on: #1c1c1c; /* dark thumb on the near-white checked track */
|
|
197
|
+
|
|
198
|
+
--field-surface: #161616;
|
|
199
|
+
--field-edge: #393939;
|
|
200
|
+
--field-inset: #00000038;
|
|
201
|
+
|
|
202
|
+
/* The dark primary mirrors the light one by perceived contrast (OKLab L), not by inverting
|
|
203
|
+
* colours: the fill sits as far from the page as #292929 does in light mode, and leaves the
|
|
204
|
+
* white glow and rim the same headroom to read (+0.16 / +0.14 L). A fill near white (#ededed)
|
|
205
|
+
* left them nowhere to go and the button went flat. Hover brightens only a little, for the
|
|
206
|
+
* same reason. */
|
|
207
|
+
--primary-fill: #cbcbcb;
|
|
208
|
+
--primary-fill-hover: #d5d5d5;
|
|
209
|
+
--primary-fill-pressed: #b9b9b9;
|
|
210
|
+
--primary-text: #171717;
|
|
211
|
+
--primary-text-shadow: 0 1px 0 #ffffffb3;
|
|
212
|
+
--primary-shadow:
|
|
213
|
+
0 4px 4px #00000073, 0 0 0 1px #000000, inset 0 4px 7px #ffffff, inset 0 0 0 1px #ffffffe6,
|
|
214
|
+
inset 0 -8px 14px #0000000b;
|
|
215
|
+
--primary-shadow-pressed:
|
|
216
|
+
0 0 0 #00000000, 0 0 0 1px #000000, inset 0 2px 6px #00000059, inset 0 0 0 1px #ffffff66,
|
|
217
|
+
inset 0 -8px 14px #00000000;
|
|
218
|
+
|
|
219
|
+
--grid-line: #ffffff0d;
|
|
220
|
+
--grid-bright: #ffffff38;
|
|
221
|
+
--guide: #ffffff29;
|
|
222
|
+
--ink-ghost: #ffffff12;
|
|
223
|
+
--glow: #ffffff1f;
|
|
224
|
+
--grain-opacity: 0.55;
|
|
225
|
+
--page-glow: rgb(255 255 255 / 0.035);
|
|
226
|
+
--page-grain-blend: overlay;
|
|
227
|
+
--page-grain-opacity: calc(var(--grain-opacity) * 1.5);
|
|
228
|
+
|
|
229
|
+
/* re-declared so var(--background) resolves inside dark regions, not at :root */
|
|
230
|
+
|
|
231
|
+
--chart-1: oklch(0.985 0 0);
|
|
232
|
+
--chart-2: oklch(0.8 0 0);
|
|
233
|
+
--chart-3: oklch(0.66 0 0);
|
|
234
|
+
--chart-4: oklch(0.52 0 0);
|
|
235
|
+
--chart-5: oklch(0.38 0 0);
|
|
236
|
+
|
|
237
|
+
--logo: #f6f6f4;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Night: the deepest ground, used by the Footer block and dark specimen sheets. On top of the dark
|
|
241
|
+
tokens; later in the file, so these win. */
|
|
242
|
+
.theme-night {
|
|
243
|
+
color-scheme: dark;
|
|
244
|
+
--background: #040404;
|
|
245
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
246
|
+
--success: oklch(0.76 0.16 152);
|
|
247
|
+
--warning: oklch(0.78 0.15 75);
|
|
248
|
+
--info: oklch(0.74 0.14 245);
|
|
249
|
+
--tone-blue: oklch(0.74 0.14 245);
|
|
250
|
+
--tone-aqua: oklch(0.78 0.12 195);
|
|
251
|
+
--tone-violet: oklch(0.75 0.15 300);
|
|
252
|
+
--tone-magenta: oklch(0.74 0.18 340);
|
|
253
|
+
--tone-orange: oklch(0.76 0.15 50);
|
|
254
|
+
--tone-lime: oklch(0.8 0.16 130);
|
|
255
|
+
--foreground: #fafafa;
|
|
256
|
+
--foreground-soft: #aeaeae;
|
|
257
|
+
--muted-foreground: #929292;
|
|
258
|
+
--border: #ffffff1a;
|
|
259
|
+
--control-surface: #1e1e1e;
|
|
260
|
+
--control-hover: #2a2a2a;
|
|
261
|
+
--control-pressed: #1e1e1e;
|
|
262
|
+
--control-edge: #000000a6;
|
|
263
|
+
--control-highlight: #ffffff1a;
|
|
264
|
+
--control-inner-edge: #ffffff0f;
|
|
265
|
+
--control-focus: #999999;
|
|
266
|
+
--control-thumb: #8f8f8f;
|
|
267
|
+
--control-thumb-on: #1c1c1c;
|
|
268
|
+
--field-surface: #161616;
|
|
269
|
+
--field-edge: #393939;
|
|
270
|
+
--field-inset: #00000038;
|
|
271
|
+
--grid-line: #ffffff0d;
|
|
272
|
+
--grid-bright: #ffffff38;
|
|
273
|
+
--guide: #ffffff29;
|
|
274
|
+
/* Lower than dark: on a #040404 ground the default reads as grey static. */
|
|
275
|
+
--grain-opacity: 0.3;
|
|
276
|
+
--page-glow: rgb(255 255 255 / 0.035);
|
|
277
|
+
--page-grain-blend: overlay;
|
|
278
|
+
--page-grain-opacity: calc(var(--grain-opacity) * 1.5);
|
|
279
|
+
|
|
280
|
+
--logo: #f6f6f4;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* .theme-light sets the durations again, so a forced light scope is named here too. */
|
|
284
|
+
@media (prefers-reduced-motion: reduce) {
|
|
285
|
+
:root,
|
|
286
|
+
.theme-light {
|
|
287
|
+
--duration: 0ms;
|
|
288
|
+
--duration-reveal: 0ms;
|
|
289
|
+
}
|
|
290
|
+
}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite helper: proxies the Licht faces (Licht, Licht Sans, Licht Mono …) from zon.sh to the app's own origin.
|
|
3
|
+
*
|
|
4
|
+
* import { zonFonts } from "@zonsh/ui/vite";
|
|
5
|
+
* export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts()] });
|
|
6
|
+
*
|
|
7
|
+
* The browser only ever requests /licht/fonts/*.woff2 from your origin, so no visitor IP
|
|
8
|
+
* reaches a third-party host before consent. In production, mirror this with a rewrite on
|
|
9
|
+
* your host (Vercel/Netlify/nginx): /licht/fonts/* → https://www.zon.sh/licht/fonts/*
|
|
10
|
+
*/
|
|
11
|
+
export declare const LICHT_ORIGIN = "https://www.zon.sh";
|
|
12
|
+
export declare function zonFonts(options?: {
|
|
13
|
+
origin?: string;
|
|
14
|
+
}): {
|
|
15
|
+
name: string;
|
|
16
|
+
config(config: {
|
|
17
|
+
build?: {
|
|
18
|
+
rollupOptions?: {
|
|
19
|
+
external?: unknown;
|
|
20
|
+
};
|
|
21
|
+
rolldownOptions?: {
|
|
22
|
+
external?: unknown;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}): {
|
|
26
|
+
build?: undefined;
|
|
27
|
+
server: {
|
|
28
|
+
proxy: {
|
|
29
|
+
"/licht/fonts": {
|
|
30
|
+
target: string;
|
|
31
|
+
changeOrigin: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
preview: {
|
|
36
|
+
proxy: {
|
|
37
|
+
"/licht/fonts": {
|
|
38
|
+
target: string;
|
|
39
|
+
changeOrigin: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
} | {
|
|
44
|
+
build: {
|
|
45
|
+
rollupOptions: {
|
|
46
|
+
external: RegExp[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
server: {
|
|
50
|
+
proxy: {
|
|
51
|
+
"/licht/fonts": {
|
|
52
|
+
target: string;
|
|
53
|
+
changeOrigin: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
preview: {
|
|
58
|
+
proxy: {
|
|
59
|
+
"/licht/fonts": {
|
|
60
|
+
target: string;
|
|
61
|
+
changeOrigin: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The Licht face each of Excalidraw's drawing fonts is drawn in, by Excalidraw's font folder.
|
|
69
|
+
* Text on the canvas — and in its SVG and PNG exports — is set in Licht: Soft for normal text
|
|
70
|
+
* (the default), Serif in place of the handwriting, Mono for code, Sans for the rest.
|
|
71
|
+
*/
|
|
72
|
+
export declare const EXCALIDRAW_LICHT: Record<string, string>;
|
|
73
|
+
/**
|
|
74
|
+
* Vite helper: serves Excalidraw's fonts — for Whiteboard (`@zonsh/ui/whiteboard`) — from the
|
|
75
|
+
* app's own origin, at /excalidraw/fonts/*, instead of the CDN Excalidraw would use. In
|
|
76
|
+
* development they stream from node_modules; a build writes them beside your assets.
|
|
77
|
+
*
|
|
78
|
+
* import { excalidrawAssets, zonFonts } from "@zonsh/ui/vite";
|
|
79
|
+
* export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts(), excalidrawAssets()] });
|
|
80
|
+
*
|
|
81
|
+
* Its drawing fonts are swapped for Licht (see EXCALIDRAW_LICHT): their requests go to
|
|
82
|
+
* /licht/fonts/*, the same proxy zonFonts() sets up and your host mirrors in production. Only
|
|
83
|
+
* Xiaolai, the CJK fallback, stays Excalidraw's.
|
|
84
|
+
*
|
|
85
|
+
* Pass the same folder to Whiteboard's `assetPath` (default `/excalidraw/`, plus your Vite
|
|
86
|
+
* `base` if the app is not served from the root). Only the fonts a drawing uses are downloaded.
|
|
87
|
+
*/
|
|
88
|
+
export declare function excalidrawAssets(options?: {
|
|
89
|
+
path?: string;
|
|
90
|
+
}): {
|
|
91
|
+
name: string;
|
|
92
|
+
configResolved(config: {
|
|
93
|
+
root: string;
|
|
94
|
+
}): void;
|
|
95
|
+
configureServer(server: {
|
|
96
|
+
middlewares: {
|
|
97
|
+
use: (handler: (req: {
|
|
98
|
+
url?: string;
|
|
99
|
+
}, res: {
|
|
100
|
+
setHeader: (name: string, value: string) => void;
|
|
101
|
+
statusCode: number;
|
|
102
|
+
} & NodeJS.WritableStream, next: () => void) => void) => void;
|
|
103
|
+
};
|
|
104
|
+
}): void;
|
|
105
|
+
transform(code: string, id: string): {
|
|
106
|
+
code: string;
|
|
107
|
+
map: null;
|
|
108
|
+
} | null;
|
|
109
|
+
generateBundle(this: {
|
|
110
|
+
emitFile: (file: {
|
|
111
|
+
type: "asset";
|
|
112
|
+
fileName: string;
|
|
113
|
+
source: Uint8Array;
|
|
114
|
+
}) => void;
|
|
115
|
+
}): void;
|
|
116
|
+
};
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createReadStream, existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join, sep } from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Vite helper: proxies the Licht faces (Licht, Licht Sans, Licht Mono …) from zon.sh to the app's own origin.
|
|
6
|
+
*
|
|
7
|
+
* import { zonFonts } from "@zonsh/ui/vite";
|
|
8
|
+
* export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts()] });
|
|
9
|
+
*
|
|
10
|
+
* The browser only ever requests /licht/fonts/*.woff2 from your origin, so no visitor IP
|
|
11
|
+
* reaches a third-party host before consent. In production, mirror this with a rewrite on
|
|
12
|
+
* your host (Vercel/Netlify/nginx): /licht/fonts/* → https://www.zon.sh/licht/fonts/*
|
|
13
|
+
*/
|
|
14
|
+
export const LICHT_ORIGIN = "https://www.zon.sh";
|
|
15
|
+
export function zonFonts(options = {}) {
|
|
16
|
+
const origin = options.origin ?? LICHT_ORIGIN;
|
|
17
|
+
// zon.sh serves the faces at the same path, /licht/fonts/*, so the path passes through as is.
|
|
18
|
+
const proxy = { "/licht/fonts": { target: origin, changeOrigin: true } };
|
|
19
|
+
return {
|
|
20
|
+
name: "zon-fonts",
|
|
21
|
+
config(config) {
|
|
22
|
+
// A build leaves the stylesheet's /licht/fonts/* URLs as they are, for the host's rewrite;
|
|
23
|
+
// marked external, Vite stops warning that it couldn't resolve them. A function `external`
|
|
24
|
+
// of the app's own can't be merged with a list, so then the warnings stay.
|
|
25
|
+
const external = config.build?.rolldownOptions?.external ?? config.build?.rollupOptions?.external;
|
|
26
|
+
const build = typeof external === "function"
|
|
27
|
+
? {}
|
|
28
|
+
: { build: { rollupOptions: { external: [/^\/licht\/fonts\//] } } };
|
|
29
|
+
return { server: { proxy }, preview: { proxy }, ...build };
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The Licht face each of Excalidraw's drawing fonts is drawn in, by Excalidraw's font folder.
|
|
35
|
+
* Text on the canvas — and in its SVG and PNG exports — is set in Licht: Soft for normal text
|
|
36
|
+
* (the default), Serif in place of the handwriting, Mono for code, Sans for the rest.
|
|
37
|
+
*/
|
|
38
|
+
export const EXCALIDRAW_LICHT = {
|
|
39
|
+
Nunito: "LichtSoft-Regular",
|
|
40
|
+
Virgil: "LichtSoft-Regular",
|
|
41
|
+
Excalifont: "LichtSerif-Regular",
|
|
42
|
+
Lilita: "LichtSans-Regular",
|
|
43
|
+
Liberation: "LichtSans-Regular",
|
|
44
|
+
ComicShanns: "LichtMono-Regular",
|
|
45
|
+
Cascadia: "LichtMono-Regular",
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Vite helper: serves Excalidraw's fonts — for Whiteboard (`@zonsh/ui/whiteboard`) — from the
|
|
49
|
+
* app's own origin, at /excalidraw/fonts/*, instead of the CDN Excalidraw would use. In
|
|
50
|
+
* development they stream from node_modules; a build writes them beside your assets.
|
|
51
|
+
*
|
|
52
|
+
* import { excalidrawAssets, zonFonts } from "@zonsh/ui/vite";
|
|
53
|
+
* export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts(), excalidrawAssets()] });
|
|
54
|
+
*
|
|
55
|
+
* Its drawing fonts are swapped for Licht (see EXCALIDRAW_LICHT): their requests go to
|
|
56
|
+
* /licht/fonts/*, the same proxy zonFonts() sets up and your host mirrors in production. Only
|
|
57
|
+
* Xiaolai, the CJK fallback, stays Excalidraw's.
|
|
58
|
+
*
|
|
59
|
+
* Pass the same folder to Whiteboard's `assetPath` (default `/excalidraw/`, plus your Vite
|
|
60
|
+
* `base` if the app is not served from the root). Only the fonts a drawing uses are downloaded.
|
|
61
|
+
*/
|
|
62
|
+
export function excalidrawAssets(options = {}) {
|
|
63
|
+
const folder = (options.path ?? "excalidraw").replace(/^\/+|\/+$/g, "");
|
|
64
|
+
const marker = `/${folder}/fonts/`;
|
|
65
|
+
let fonts = "";
|
|
66
|
+
const swapped = new RegExp(`"\\./fonts/(${Object.keys(EXCALIDRAW_LICHT).join("|")})/[^"]+\\.woff2"`, "g");
|
|
67
|
+
/** Excalidraw's font folder, found from the app or, failing that, from this package. */
|
|
68
|
+
const locate = (root) => {
|
|
69
|
+
for (const from of [join(root, "package.json"), import.meta.url]) {
|
|
70
|
+
try {
|
|
71
|
+
const dir = join(dirname(createRequire(from).resolve("@excalidraw/excalidraw")), "fonts");
|
|
72
|
+
if (existsSync(dir))
|
|
73
|
+
return dir;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Not resolvable from here: try the next place.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return "";
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
name: "zon-excalidraw-assets",
|
|
83
|
+
configResolved(config) {
|
|
84
|
+
fonts = locate(config.root);
|
|
85
|
+
},
|
|
86
|
+
configureServer(server) {
|
|
87
|
+
server.middlewares.use((req, res, next) => {
|
|
88
|
+
const url = (req.url ?? "").split("?")[0];
|
|
89
|
+
const at = url.indexOf(marker);
|
|
90
|
+
if (!fonts || at === -1)
|
|
91
|
+
return next();
|
|
92
|
+
const rest = decodeURIComponent(url.slice(at + marker.length));
|
|
93
|
+
// A drawing font: its Licht face, through the /licht/fonts proxy.
|
|
94
|
+
const licht = EXCALIDRAW_LICHT[rest.split("/")[0]];
|
|
95
|
+
if (licht) {
|
|
96
|
+
res.statusCode = 302;
|
|
97
|
+
res.setHeader("Location", `/licht/fonts/${licht}.woff2`);
|
|
98
|
+
res.end();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const file = join(fonts, rest);
|
|
102
|
+
if (!file.startsWith(fonts) || !existsSync(file) || !statSync(file).isFile())
|
|
103
|
+
return next();
|
|
104
|
+
res.setHeader("Content-Type", file.endsWith(".woff2") ? "font/woff2" : "application/octet-stream");
|
|
105
|
+
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
|
106
|
+
createReadStream(file).pipe(res);
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
// In a build, Excalidraw asks for its drawing fonts at their Licht address directly. (In
|
|
110
|
+
// development its prebundled code keeps its own paths, and the middleware above answers them.)
|
|
111
|
+
transform(code, id) {
|
|
112
|
+
if (!id.includes("excalidraw") || !code.includes('"./fonts/'))
|
|
113
|
+
return null;
|
|
114
|
+
const next = code.replace(swapped, (_, family) => `(location.origin+"/licht/fonts/${EXCALIDRAW_LICHT[family]}.woff2")`);
|
|
115
|
+
return next === code ? null : { code: next, map: null };
|
|
116
|
+
},
|
|
117
|
+
generateBundle() {
|
|
118
|
+
if (!fonts)
|
|
119
|
+
return;
|
|
120
|
+
for (const name of readdirSync(fonts, { recursive: true })) {
|
|
121
|
+
const full = join(fonts, name);
|
|
122
|
+
// Fonts Licht stands in for are never asked for.
|
|
123
|
+
if (EXCALIDRAW_LICHT[name.split(sep)[0]] || !statSync(full).isFile())
|
|
124
|
+
continue;
|
|
125
|
+
this.emitFile({ type: "asset", fileName: `${folder}/fonts/${name.split(sep).join("/")}`, source: readFileSync(full) });
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|