@jcsoftdev/ui 0.3.0 → 0.5.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/CHANGELOG.md +200 -1
- package/README.md +56 -3
- package/bin/ui-theme.mjs +13 -2
- package/dist/atoms/button/button.d.ts +8 -1
- package/dist/atoms/button/button.js +10 -3
- package/dist/atoms/checkbox/checkbox.js +3 -1
- package/dist/atoms/chip/chip.d.ts +11 -3
- package/dist/atoms/chip/chip.js +8 -1
- package/dist/atoms/chip/index.d.ts +1 -1
- package/dist/atoms/chip/index.js +2 -0
- package/dist/atoms/divider/divider.d.ts +15 -0
- package/dist/atoms/divider/divider.js +27 -0
- package/dist/atoms/divider/index.d.ts +1 -0
- package/dist/atoms/divider/index.js +1 -0
- package/dist/atoms/due-chip/due-chip.d.ts +31 -0
- package/dist/atoms/due-chip/due-chip.js +41 -0
- package/dist/atoms/due-chip/index.d.ts +2 -0
- package/dist/atoms/due-chip/index.js +6 -0
- package/dist/atoms/due-chip/model.d.ts +25 -0
- package/dist/atoms/due-chip/model.js +44 -0
- package/dist/atoms/icon-button/icon-button.d.ts +22 -0
- package/dist/atoms/icon-button/icon-button.js +38 -0
- package/dist/atoms/icon-button/index.d.ts +1 -0
- package/dist/atoms/icon-button/index.js +8 -0
- package/dist/atoms/index.d.ts +6 -0
- package/dist/atoms/index.js +6 -0
- package/dist/atoms/internal/hit-area.d.ts +6 -0
- package/dist/atoms/internal/hit-area.js +4 -0
- package/dist/atoms/kbd/index.d.ts +1 -0
- package/dist/atoms/kbd/index.js +4 -0
- package/dist/atoms/kbd/kbd.d.ts +7 -0
- package/dist/atoms/kbd/kbd.js +17 -0
- package/dist/atoms/radio-group/radio-group.js +6 -2
- package/dist/atoms/seal/index.d.ts +1 -0
- package/dist/atoms/seal/index.js +4 -0
- package/dist/atoms/seal/seal.d.ts +30 -0
- package/dist/atoms/seal/seal.js +71 -0
- package/dist/atoms/spinner/index.d.ts +1 -0
- package/dist/atoms/spinner/index.js +5 -0
- package/dist/atoms/spinner/spinner.d.ts +19 -0
- package/dist/atoms/spinner/spinner.js +31 -0
- package/dist/atoms/switch/switch.js +3 -1
- package/dist/auth/auth-illustration/auth-illustration.d.ts +35 -0
- package/dist/auth/auth-illustration/auth-illustration.js +72 -0
- package/dist/auth/auth-illustration/index.d.ts +3 -0
- package/dist/auth/auth-illustration/index.js +11 -0
- package/dist/auth/auth-illustration/look.d.ts +30 -0
- package/dist/auth/auth-illustration/look.js +0 -0
- package/dist/auth/auth-illustration/model.d.ts +133 -0
- package/dist/auth/auth-illustration/model.js +202 -0
- package/dist/auth/auth-illustration/use-art-pointer.d.ts +9 -0
- package/dist/auth/auth-illustration/use-art-pointer.js +69 -0
- package/dist/auth/auth-layout/auth-layout.d.ts +80 -0
- package/dist/auth/auth-layout/auth-layout.js +190 -0
- package/dist/auth/auth-layout/index.d.ts +1 -0
- package/dist/auth/auth-layout/index.js +1 -0
- package/dist/auth/character/character.d.ts +12 -0
- package/dist/auth/character/character.js +333 -0
- package/dist/auth/character/index.d.ts +1 -0
- package/dist/auth/character/index.js +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/internal/auth-context.d.ts +17 -0
- package/dist/auth/internal/auth-context.js +10 -0
- package/dist/auth/internal/auth-styles.d.ts +1 -0
- package/dist/auth/internal/auth-styles.js +29 -0
- package/dist/auth/internal/portal-glyphs.d.ts +6 -0
- package/dist/auth/internal/portal-glyphs.js +39 -0
- package/dist/auth/login-form/context.d.ts +51 -0
- package/dist/auth/login-form/context.js +12 -0
- package/dist/auth/login-form/index.d.ts +2 -0
- package/dist/auth/login-form/index.js +23 -0
- package/dist/auth/login-form/login-form.d.ts +66 -0
- package/dist/auth/login-form/login-form.js +233 -0
- package/dist/auth/login-form/parts.d.ts +71 -0
- package/dist/auth/login-form/parts.js +371 -0
- package/dist/auth/looks/auth-illustration-any.d.ts +16 -0
- package/dist/auth/looks/auth-illustration-any.js +24 -0
- package/dist/auth/looks/index.d.ts +1 -0
- package/dist/auth/looks/index.js +1 -0
- package/dist/auth/mosaic/index.d.ts +1 -0
- package/dist/auth/mosaic/index.js +1 -0
- package/dist/auth/mosaic/mosaic.d.ts +11 -0
- package/dist/auth/mosaic/mosaic.js +195 -0
- package/dist/auth/slabs/index.d.ts +1 -0
- package/dist/auth/slabs/index.js +1 -0
- package/dist/auth/slabs/slabs.d.ts +13 -0
- package/dist/auth/slabs/slabs.js +136 -0
- package/dist/auth/stack/index.d.ts +1 -0
- package/dist/auth/stack/index.js +1 -0
- package/dist/auth/stack/stack.d.ts +6 -0
- package/dist/auth/stack/stack.js +222 -0
- package/dist/auth/statement/index.d.ts +1 -0
- package/dist/auth/statement/index.js +1 -0
- package/dist/auth/statement/statement.d.ts +13 -0
- package/dist/auth/statement/statement.js +99 -0
- package/dist/calendar/date-calendar/date-calendar.d.ts +32 -0
- package/dist/calendar/date-calendar/date-calendar.js +189 -0
- package/dist/calendar/date-calendar/index.d.ts +1 -0
- package/dist/calendar/date-calendar/index.js +6 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +1 -0
- package/dist/calendar/internal/date-utils.d.ts +26 -0
- package/dist/calendar/internal/date-utils.js +95 -1
- package/dist/containers/aside/aside.d.ts +14 -0
- package/dist/containers/aside/aside.js +25 -0
- package/dist/containers/aside/index.d.ts +1 -0
- package/dist/containers/aside/index.js +5 -0
- package/dist/containers/banner/banner.d.ts +4 -1
- package/dist/containers/banner/banner.js +9 -1
- package/dist/containers/description-list/description-list.d.ts +29 -6
- package/dist/containers/description-list/description-list.js +47 -6
- package/dist/containers/feed/feed.d.ts +23 -0
- package/dist/containers/feed/feed.js +77 -0
- package/dist/containers/feed/index.d.ts +2 -0
- package/dist/containers/feed/index.js +10 -0
- package/dist/containers/feed/model.d.ts +19 -0
- package/dist/containers/feed/model.js +38 -0
- package/dist/containers/index.d.ts +6 -0
- package/dist/containers/index.js +6 -0
- package/dist/containers/kpi/kpi.d.ts +50 -8
- package/dist/containers/kpi/kpi.js +91 -39
- package/dist/containers/list-detail/index.d.ts +1 -0
- package/dist/containers/list-detail/index.js +20 -0
- package/dist/containers/list-detail/list-detail.d.ts +55 -0
- package/dist/containers/list-detail/list-detail.js +221 -0
- package/dist/containers/note/index.d.ts +1 -0
- package/dist/containers/note/index.js +4 -0
- package/dist/containers/note/note.d.ts +13 -0
- package/dist/containers/note/note.js +27 -0
- package/dist/containers/section/index.d.ts +1 -0
- package/dist/containers/section/index.js +6 -0
- package/dist/containers/section/section.d.ts +68 -0
- package/dist/containers/section/section.js +198 -0
- package/dist/containers/shortcuts/index.d.ts +1 -0
- package/dist/containers/shortcuts/index.js +8 -0
- package/dist/containers/shortcuts/shortcuts.d.ts +18 -0
- package/dist/containers/shortcuts/shortcuts.js +50 -0
- package/dist/containers/table/selection.d.ts +9 -0
- package/dist/containers/table/selection.js +20 -0
- package/dist/containers/table/table.d.ts +66 -4
- package/dist/containers/table/table.js +128 -7
- package/dist/containers/timeline/index.d.ts +1 -1
- package/dist/containers/timeline/index.js +4 -2
- package/dist/containers/timeline/timeline.d.ts +32 -5
- package/dist/containers/timeline/timeline.js +154 -90
- package/dist/forms/chip-group/chip-group.d.ts +54 -0
- package/dist/forms/chip-group/chip-group.js +114 -0
- package/dist/forms/chip-group/index.d.ts +1 -0
- package/dist/forms/chip-group/index.js +6 -0
- package/dist/forms/combobox/combobox.d.ts +60 -0
- package/dist/forms/combobox/combobox.js +281 -0
- package/dist/forms/combobox/index.d.ts +1 -0
- package/dist/forms/combobox/index.js +6 -0
- package/dist/forms/date-picker/date-picker.d.ts +40 -0
- package/dist/forms/date-picker/date-picker.js +183 -0
- package/dist/forms/date-picker/date-time-picker.d.ts +43 -0
- package/dist/forms/date-picker/date-time-picker.js +121 -0
- package/dist/forms/date-picker/index.d.ts +2 -0
- package/dist/forms/date-picker/index.js +10 -0
- package/dist/forms/date-picker/model.d.ts +35 -0
- package/dist/forms/date-picker/model.js +83 -0
- package/dist/forms/dropzone/dropzone.d.ts +30 -2
- package/dist/forms/dropzone/dropzone.js +153 -23
- package/dist/forms/field/field.d.ts +16 -10
- package/dist/forms/field/field.js +41 -5
- package/dist/forms/index.d.ts +5 -0
- package/dist/forms/index.js +5 -0
- package/dist/forms/input/index.d.ts +1 -1
- package/dist/forms/input/index.js +4 -1
- package/dist/forms/input/input.d.ts +21 -5
- package/dist/forms/input/input.js +75 -9
- package/dist/forms/input-icon/input-icon.d.ts +1 -1
- package/dist/forms/internal/listbox-items.d.ts +18 -0
- package/dist/forms/internal/listbox-items.js +88 -0
- package/dist/forms/internal/listbox.d.ts +44 -0
- package/dist/forms/internal/listbox.js +74 -0
- package/dist/forms/number-stepper/model.d.ts +16 -0
- package/dist/forms/number-stepper/model.js +23 -0
- package/dist/forms/number-stepper/number-stepper.d.ts +36 -6
- package/dist/forms/number-stepper/number-stepper.js +86 -37
- package/dist/forms/password-input/index.d.ts +1 -0
- package/dist/forms/password-input/index.js +1 -0
- package/dist/forms/password-input/password-input.d.ts +16 -0
- package/dist/forms/password-input/password-input.js +45 -0
- package/dist/forms/select-menu/index.d.ts +1 -0
- package/dist/forms/select-menu/index.js +6 -0
- package/dist/forms/select-menu/select-menu.d.ts +35 -0
- package/dist/forms/select-menu/select-menu.js +230 -0
- package/dist/i18n/strings.d.ts +153 -0
- package/dist/i18n/strings.js +86 -2
- package/dist/i18n/ui-strings-provider.d.ts +1 -1
- package/dist/i18n/ui-strings-provider.js +6 -2
- package/dist/icons/eye.d.ts +2 -0
- package/dist/icons/eye.js +11 -0
- package/dist/icons/graduation-cap.d.ts +2 -0
- package/dist/icons/graduation-cap.js +12 -0
- package/dist/icons/house.d.ts +2 -0
- package/dist/icons/house.js +11 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +8 -0
- package/dist/icons/mail.d.ts +2 -0
- package/dist/icons/mail.js +11 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/stepper/index.d.ts +1 -1
- package/dist/navigation/stepper/index.js +3 -1
- package/dist/navigation/stepper/stepper.d.ts +8 -0
- package/dist/navigation/stepper/stepper.js +68 -45
- package/dist/navigation/tabs/index.d.ts +1 -0
- package/dist/navigation/tabs/index.js +6 -0
- package/dist/navigation/tabs/tabs-nav.d.ts +37 -0
- package/dist/navigation/tabs/tabs-nav.js +57 -0
- package/dist/navigation/wizard/index.d.ts +1 -0
- package/dist/navigation/wizard/index.js +6 -0
- package/dist/navigation/wizard/model.d.ts +33 -0
- package/dist/navigation/wizard/model.js +34 -0
- package/dist/navigation/wizard/wizard.d.ts +45 -0
- package/dist/navigation/wizard/wizard.js +169 -0
- package/dist/overlays/alert-dialog/alert-dialog.d.ts +103 -0
- package/dist/overlays/alert-dialog/alert-dialog.js +342 -0
- package/dist/overlays/alert-dialog/index.d.ts +1 -0
- package/dist/overlays/alert-dialog/index.js +26 -0
- package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +17 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.js +12 -4
- package/dist/overlays/dropdown-menu/index.d.ts +1 -1
- package/dist/overlays/dropdown-menu/index.js +8 -2
- package/dist/overlays/index.d.ts +2 -0
- package/dist/overlays/index.js +2 -0
- package/dist/overlays/testing/index.d.ts +5 -0
- package/dist/overlays/testing/index.js +4 -0
- package/dist/overlays/toaster/index.d.ts +2 -1
- package/dist/overlays/toaster/index.js +4 -2
- package/dist/overlays/toaster/toast-store.d.ts +6 -2
- package/dist/overlays/toaster/toast.d.ts +3 -0
- package/dist/overlays/toaster/toast.js +3 -0
- package/dist/overlays/toaster/toaster.d.ts +3 -0
- package/dist/overlays/toaster/toaster.js +36 -3
- package/dist/overlays/tooltip/index.d.ts +1 -0
- package/dist/overlays/tooltip/index.js +4 -0
- package/dist/overlays/tooltip/model.d.ts +10 -0
- package/dist/overlays/tooltip/model.js +13 -0
- package/dist/overlays/tooltip/tooltip.d.ts +41 -0
- package/dist/overlays/tooltip/tooltip.js +116 -0
- package/dist/primitives/use-dismissable-layer.js +1 -1
- package/dist/states/error-state/error-state.d.ts +6 -1
- package/dist/states/error-state/error-state.js +13 -9
- package/dist/states/skeleton/skeleton.d.ts +8 -2
- package/dist/states/skeleton/skeleton.js +44 -2
- package/icons/svg/eye.svg +4 -0
- package/icons/svg/graduation-cap.svg +5 -0
- package/icons/svg/house.svg +4 -0
- package/icons/svg/mail.svg +4 -0
- package/package.json +2 -2
- package/scripts/build-theme.mjs +12 -1
- package/src/atoms/button/button.tsx +25 -3
- package/src/atoms/checkbox/checkbox.tsx +3 -1
- package/src/atoms/chip/chip.tsx +18 -3
- package/src/atoms/chip/index.ts +2 -0
- package/src/atoms/divider/divider.tsx +40 -0
- package/src/atoms/divider/index.ts +1 -0
- package/src/atoms/due-chip/due-chip.tsx +75 -0
- package/src/atoms/due-chip/index.ts +2 -0
- package/src/atoms/due-chip/model.ts +67 -0
- package/src/atoms/icon-button/icon-button.tsx +58 -0
- package/src/atoms/icon-button/index.ts +6 -0
- package/src/atoms/index.ts +6 -0
- package/src/atoms/internal/hit-area.ts +7 -0
- package/src/atoms/kbd/index.ts +1 -0
- package/src/atoms/kbd/kbd.tsx +20 -0
- package/src/atoms/radio-group/radio-group.tsx +8 -2
- package/src/atoms/seal/index.ts +1 -0
- package/src/atoms/seal/seal.tsx +107 -0
- package/src/atoms/spinner/index.ts +1 -0
- package/src/atoms/spinner/spinner.tsx +49 -0
- package/src/atoms/switch/switch.tsx +3 -1
- package/src/auth/auth-illustration/auth-illustration.tsx +100 -0
- package/src/auth/auth-illustration/index.ts +8 -0
- package/src/auth/auth-illustration/look.ts +32 -0
- package/src/auth/auth-illustration/model.ts +330 -0
- package/src/auth/auth-illustration/use-art-pointer.ts +78 -0
- package/src/auth/auth-layout/auth-layout.tsx +282 -0
- package/src/auth/auth-layout/index.ts +1 -0
- package/src/auth/character/character.tsx +346 -0
- package/src/auth/character/index.ts +1 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/internal/auth-context.ts +26 -0
- package/src/auth/internal/auth-styles.tsx +39 -0
- package/src/auth/internal/portal-glyphs.tsx +32 -0
- package/src/auth/login-form/context.ts +78 -0
- package/src/auth/login-form/index.ts +21 -0
- package/src/auth/login-form/login-form.tsx +330 -0
- package/src/auth/login-form/parts.tsx +457 -0
- package/src/auth/looks/auth-illustration-any.tsx +38 -0
- package/src/auth/looks/index.ts +1 -0
- package/src/auth/mosaic/index.ts +1 -0
- package/src/auth/mosaic/mosaic.tsx +255 -0
- package/src/auth/slabs/index.ts +1 -0
- package/src/auth/slabs/slabs.tsx +181 -0
- package/src/auth/stack/index.ts +1 -0
- package/src/auth/stack/stack.tsx +267 -0
- package/src/auth/statement/index.ts +1 -0
- package/src/auth/statement/statement.tsx +122 -0
- package/src/calendar/date-calendar/date-calendar.tsx +230 -0
- package/src/calendar/date-calendar/index.ts +5 -0
- package/src/calendar/index.ts +1 -0
- package/src/calendar/internal/date-utils.ts +115 -0
- package/src/containers/aside/aside.tsx +40 -0
- package/src/containers/aside/index.ts +1 -0
- package/src/containers/banner/banner.tsx +18 -1
- package/src/containers/description-list/description-list.tsx +85 -9
- package/src/containers/feed/feed.tsx +99 -0
- package/src/containers/feed/index.ts +8 -0
- package/src/containers/feed/model.ts +54 -0
- package/src/containers/index.ts +6 -0
- package/src/containers/kpi/kpi.tsx +161 -62
- package/src/containers/list-detail/index.ts +15 -0
- package/src/containers/list-detail/list-detail.tsx +293 -0
- package/src/containers/note/index.ts +1 -0
- package/src/containers/note/note.tsx +38 -0
- package/src/containers/section/index.ts +11 -0
- package/src/containers/section/section.tsx +281 -0
- package/src/containers/shortcuts/index.ts +6 -0
- package/src/containers/shortcuts/shortcuts.tsx +92 -0
- package/src/containers/table/selection.ts +26 -0
- package/src/containers/table/table.tsx +215 -13
- package/src/containers/timeline/index.ts +3 -0
- package/src/containers/timeline/timeline.tsx +204 -93
- package/src/forms/chip-group/chip-group.tsx +184 -0
- package/src/forms/chip-group/index.ts +8 -0
- package/src/forms/combobox/combobox.tsx +359 -0
- package/src/forms/combobox/index.ts +7 -0
- package/src/forms/date-picker/date-picker.tsx +239 -0
- package/src/forms/date-picker/date-time-picker.tsx +178 -0
- package/src/forms/date-picker/index.ts +10 -0
- package/src/forms/date-picker/model.ts +108 -0
- package/src/forms/dropzone/dropzone.tsx +217 -35
- package/src/forms/field/field.tsx +72 -7
- package/src/forms/index.ts +5 -0
- package/src/forms/input/index.ts +8 -1
- package/src/forms/input/input.tsx +99 -12
- package/src/forms/input-icon/input-icon.tsx +1 -1
- package/src/forms/internal/listbox-items.tsx +103 -0
- package/src/forms/internal/listbox.ts +124 -0
- package/src/forms/number-stepper/model.ts +35 -0
- package/src/forms/number-stepper/number-stepper.tsx +132 -42
- package/src/forms/password-input/index.ts +1 -0
- package/src/forms/password-input/password-input.tsx +57 -0
- package/src/forms/select-menu/index.ts +7 -0
- package/src/forms/select-menu/select-menu.tsx +280 -0
- package/src/i18n/strings.ts +153 -0
- package/src/i18n/ui-strings-provider.tsx +15 -4
- package/src/icons/eye.tsx +12 -0
- package/src/icons/graduation-cap.tsx +13 -0
- package/src/icons/house.tsx +12 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/mail.tsx +12 -0
- package/src/navigation/index.ts +1 -0
- package/src/navigation/stepper/index.ts +7 -1
- package/src/navigation/stepper/stepper.tsx +41 -5
- package/src/navigation/tabs/index.ts +7 -0
- package/src/navigation/tabs/tabs-nav.tsx +131 -0
- package/src/navigation/wizard/index.ts +7 -0
- package/src/navigation/wizard/model.ts +61 -0
- package/src/navigation/wizard/wizard.tsx +222 -0
- package/src/overlays/alert-dialog/alert-dialog.tsx +486 -0
- package/src/overlays/alert-dialog/index.ts +19 -0
- package/src/overlays/dropdown-menu/dropdown-menu.tsx +29 -4
- package/src/overlays/dropdown-menu/index.ts +3 -0
- package/src/overlays/index.ts +2 -0
- package/src/overlays/testing/index.ts +5 -0
- package/src/overlays/toaster/index.ts +2 -0
- package/src/overlays/toaster/toast-store.ts +6 -2
- package/src/overlays/toaster/toast.ts +6 -0
- package/src/overlays/toaster/toaster.tsx +44 -2
- package/src/overlays/tooltip/index.ts +1 -0
- package/src/overlays/tooltip/model.ts +18 -0
- package/src/overlays/tooltip/tooltip.tsx +166 -0
- package/src/primitives/use-dismissable-layer.ts +7 -2
- package/src/states/error-state/error-state.tsx +19 -8
- package/src/states/skeleton/skeleton.tsx +68 -2
- package/styles/tailwind.css +33 -30
- package/styles/theme.css +33 -30
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { CSSProperties } from "react";
|
|
4
|
+
import type { AuthVariantProps } from "../auth-illustration/look.js";
|
|
5
|
+
import {
|
|
6
|
+
isoBox,
|
|
7
|
+
isoPoint,
|
|
8
|
+
keystroke,
|
|
9
|
+
MOSAIC_GLYPH_TILES,
|
|
10
|
+
MOSAIC_SIZES,
|
|
11
|
+
mosaicFilled,
|
|
12
|
+
mosaicGlint,
|
|
13
|
+
mosaicTiles,
|
|
14
|
+
} from "../auth-illustration/model.js";
|
|
15
|
+
import { PORTAL_GLYPHS } from "../internal/portal-glyphs.js";
|
|
16
|
+
|
|
17
|
+
/** Side of the tiled floor, the platform's margin and thickness, and the tiles' depth, in iso units. */
|
|
18
|
+
const FLOOR = 260;
|
|
19
|
+
const MARGIN = 12;
|
|
20
|
+
const BASE_H = 26;
|
|
21
|
+
const TILE_H = 14;
|
|
22
|
+
const GAP = 3;
|
|
23
|
+
const VIEW = { x: -270, y: -215, w: 540, h: 400 } as const;
|
|
24
|
+
const CENTER_Y = VIEW.y + VIEW.h / 2;
|
|
25
|
+
|
|
26
|
+
const PLATFORM = isoBox(FLOOR + MARGIN * 2, FLOOR + MARGIN * 2, BASE_H);
|
|
27
|
+
const SHADOW = isoBox(FLOOR + MARGIN * 2 + 30, FLOOR + MARGIN * 2 + 30, 0).top;
|
|
28
|
+
|
|
29
|
+
/** Everything above the platform's two front edges: tile sides below the floor stay hidden. */
|
|
30
|
+
const CLIP = (() => {
|
|
31
|
+
const half = FLOOR / 2 + MARGIN;
|
|
32
|
+
const left = isoPoint(-half, half, BASE_H);
|
|
33
|
+
const front = isoPoint(half, half, BASE_H);
|
|
34
|
+
const right = isoPoint(half, -half, BASE_H);
|
|
35
|
+
return `M${left.x} ${left.y}L${front.x} ${front.y}L${right.x} ${right.y}L${right.x} ${VIEW.y}L${left.x} ${VIEW.y}Z`;
|
|
36
|
+
})();
|
|
37
|
+
|
|
38
|
+
/** The tiled floor seen from above, raised a little so lifted tiles stay inside it. */
|
|
39
|
+
const FLOOR_TOP = isoBox(FLOOR + MARGIN * 2, FLOOR + MARGIN * 2, BASE_H + 10).top;
|
|
40
|
+
/**
|
|
41
|
+
* A soft horizontal band, parked just above the floor: on this floor a diagonal of tiles is a
|
|
42
|
+
* screen row, so moving it 375px down sweeps the tiles in order.
|
|
43
|
+
*/
|
|
44
|
+
const BAND = { x: -280, y: -251, w: 560, h: 72 } as const;
|
|
45
|
+
/** The idle sheen and the error sweep. */
|
|
46
|
+
const BANDS = ["sheen", "alarm"] as const;
|
|
47
|
+
|
|
48
|
+
const GRIDS = MOSAIC_SIZES.map((n) => {
|
|
49
|
+
const size = FLOOR / n;
|
|
50
|
+
const face = size - GAP;
|
|
51
|
+
const shape = isoBox(face, face, TILE_H);
|
|
52
|
+
const inset = face * 0.07;
|
|
53
|
+
const corner = isoPoint(-face / 2 + inset, -face / 2 + inset, TILE_H);
|
|
54
|
+
const k = (face - inset * 2) / 100;
|
|
55
|
+
const glyphTransform = `translate(${corner.x} ${corner.y}) matrix(${0.866 * k} ${0.5 * k} ${-0.866 * k} ${0.5 * k} 0 0)`;
|
|
56
|
+
const glyphs = MOSAIC_GLYPH_TILES[n];
|
|
57
|
+
const tiles = mosaicTiles(n).map((tile) => {
|
|
58
|
+
const at = isoPoint(
|
|
59
|
+
-FLOOR / 2 + (tile.col + 0.5) * size,
|
|
60
|
+
-FLOOR / 2 + (tile.row + 0.5) * size,
|
|
61
|
+
BASE_H - TILE_H,
|
|
62
|
+
);
|
|
63
|
+
const glyph = glyphs.findIndex(([row, col]) => row === tile.row && col === tile.col);
|
|
64
|
+
const top = isoPoint(0, 0, TILE_H);
|
|
65
|
+
return {
|
|
66
|
+
...tile,
|
|
67
|
+
at,
|
|
68
|
+
glyph,
|
|
69
|
+
tx: Math.round(((at.x + top.x) / (VIEW.w / 2)) * 1000) / 1000,
|
|
70
|
+
ty: Math.round(((at.y + top.y - CENTER_Y) / (VIEW.h / 2)) * 1000) / 1000,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return { n, shape, glyphTransform, tiles };
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Only the floor on screen animates. The other two sizes stay in the markup for the container
|
|
78
|
+
* queries, and Chrome still runs animations inside a hidden SVG group, so a hidden grid names no
|
|
79
|
+
* animation: the visible one sets the names through custom properties (an unset one leaves the
|
|
80
|
+
* `animation` declaration invalid, which means none).
|
|
81
|
+
*/
|
|
82
|
+
const ON = '.ui-msc-grid[data-n="';
|
|
83
|
+
const SHOW =
|
|
84
|
+
"display:inline;--b:ui-msc-bob;--r:ui-msc-ripple;--g0:ui-msc-glint-0;--g1:ui-msc-glint-1";
|
|
85
|
+
|
|
86
|
+
const CSS = `
|
|
87
|
+
@keyframes ui-msc-glint-0{35%{transform:translateY(-9px)}}
|
|
88
|
+
@keyframes ui-msc-glint-1{35%{transform:translateY(-9px)}}
|
|
89
|
+
@keyframes ui-msc-sheen{58%{transform:none}86%,to{transform:translateY(375px)}}
|
|
90
|
+
@keyframes ui-msc-sweep{to{transform:translateY(375px)}}
|
|
91
|
+
@keyframes ui-msc-ripple{40%{transform:translateY(-12px)}75%{transform:translateY(2px)}}
|
|
92
|
+
@keyframes ui-msc-bob{50%{transform:translateY(-5px)}}
|
|
93
|
+
@keyframes ui-msc-rise{from{opacity:0;transform:translateY(40px)}}
|
|
94
|
+
.ui-msc{scale:1.12;transform-origin:50% 60%;--msc-base:color-mix(in srgb,var(--ink) 12%,var(--surface));--msc-tile:var(--surface);--msc-lit:var(--accent);--msc-active:color-mix(in srgb,var(--ink) 86%,var(--surface));--msc-glow:color-mix(in srgb,var(--accent-2) 70%,white);--msc-grout:color-mix(in srgb,var(--ink) 22%,transparent);--glyph-line:var(--accent)}
|
|
95
|
+
.ui-auth-art[data-panel=solid] .ui-msc{--msc-base:var(--ua-tint);--msc-tile:color-mix(in srgb,white 55%,var(--auth-art-bg));--msc-lit:var(--ua-mid);--msc-active:var(--auth-art-ink);--msc-glow:white;--msc-grout:color-mix(in srgb,var(--auth-art-ink) 28%,transparent);--glyph-line:var(--auth-art-ink)}
|
|
96
|
+
.ui-msc-grid{display:none}
|
|
97
|
+
@container art (width<24rem){${ON}4"]{${SHOW}}}
|
|
98
|
+
@container art (24rem<=width<34rem){.ui-msc{scale:.88}${ON}5"]{${SHOW}}}
|
|
99
|
+
@container art (width>=34rem){.ui-msc{scale:.9}${ON}6"]{${SHOW}}}
|
|
100
|
+
.ui-msc-stage{animation:ui-msc-rise .9s var(--ua-land) backwards .1s}
|
|
101
|
+
.ui-msc-shadow{fill:var(--ua-shadow)}
|
|
102
|
+
.ui-msc-base-top{fill:var(--msc-base)}
|
|
103
|
+
.ui-msc-base-left{fill:color-mix(in srgb,var(--msc-base) 82%,black)}
|
|
104
|
+
.ui-msc-base-right{fill:color-mix(in srgb,var(--msc-base) 66%,black)}
|
|
105
|
+
.ui-msc-dots{fill:color-mix(in srgb,black 28%,transparent)}
|
|
106
|
+
.ui-msc-edge{stroke:var(--msc-edge,var(--ua-edge));stroke-width:2.2;stroke-linejoin:round}
|
|
107
|
+
.ui-auth-art[data-state=error] .ui-msc{--msc-edge:color-mix(in srgb,var(--danger) 70%,var(--ua-edge))}
|
|
108
|
+
.ui-msc-tile{--top:var(--msc-tile);--glow:max(0,1 - (max(var(--px,9) - var(--tx),var(--tx) - var(--px,9)) + max(var(--py,9) - var(--ty),var(--ty) - var(--py,9))) * 2.6)}
|
|
109
|
+
.ui-msc-tile[data-lit]{--top:var(--msc-lit)}
|
|
110
|
+
.ui-msc-tile[data-active]{--top:var(--msc-active)}
|
|
111
|
+
.ui-msc-lift{transform:translateY(calc((var(--lit) * -8 - var(--glow) * 5 - var(--act) * 14) * 1px));transition:transform .55s var(--ua-bounce);transition-delay:calc(var(--d) * 28ms)}
|
|
112
|
+
.ui-msc-tile-top{fill:var(--msc-tile);stroke:var(--msc-grout);stroke-width:1.2;stroke-linejoin:round}
|
|
113
|
+
.ui-msc-tile[data-active] .ui-msc-tile-top{fill:var(--msc-active)}
|
|
114
|
+
.ui-msc-litface{fill:var(--msc-lit);opacity:var(--lit);transition:opacity .35s linear;transition-delay:calc(var(--d) * 28ms)}
|
|
115
|
+
.ui-msc-tile[data-active] .ui-msc-litface{opacity:0}
|
|
116
|
+
.ui-msc-tile-left{fill:color-mix(in srgb,var(--top) 78%,black)}
|
|
117
|
+
.ui-msc-side{opacity:max(var(--lit),var(--act));transition:opacity .2s linear;transition-delay:calc(var(--d) * 28ms)}
|
|
118
|
+
.ui-msc-tile-right{fill:color-mix(in srgb,var(--top) 62%,black)}
|
|
119
|
+
.ui-msc-tile[data-lit] .ui-msc-litface,.ui-msc-tile[data-active] .ui-msc-tile-top,.ui-msc-tile:is([data-lit],[data-active]) .ui-msc-side{stroke:var(--ua-edge);stroke-width:1.6;stroke-linejoin:round}
|
|
120
|
+
.ui-msc-glow{fill:var(--msc-glow);opacity:calc(var(--glow) * .7);transition:opacity .25s linear}
|
|
121
|
+
.ui-msc-sheen-stop{stop-color:white}
|
|
122
|
+
.ui-msc-alarm-stop{stop-color:var(--danger)}
|
|
123
|
+
.ui-msc-sheen{opacity:.5;animation:ui-msc-sheen 5s ease-in-out infinite}
|
|
124
|
+
.ui-auth-art[data-state=success] .ui-msc-sheen{opacity:.9;animation:ui-msc-sweep 1.1s .25s var(--ua-glide) backwards}
|
|
125
|
+
.ui-msc-alarm{opacity:.85}
|
|
126
|
+
.ui-auth-art[data-state=error] .ui-msc-alarm{animation:ui-msc-sweep .8s var(--ua-glide) both}
|
|
127
|
+
.ui-msc-bob{animation:var(--b) 3.2s ease-in-out infinite}
|
|
128
|
+
.ui-msc-glint-0{animation:var(--g0) .4s var(--ua-glide)}
|
|
129
|
+
.ui-msc-glint-1{animation:var(--g1) .4s var(--ua-glide)}
|
|
130
|
+
.ui-auth-art[data-state=success] .ui-msc-pop{animation:var(--r) .6s var(--ua-glide) backwards;animation-delay:calc(.25s + var(--ring) * 75ms)}
|
|
131
|
+
.ui-msc-glyph{--glyph-a:color-mix(in srgb,var(--ua-edge) 30%,var(--msc-tile));--glyph-b:color-mix(in srgb,var(--ua-edge) 30%,var(--msc-tile));--glyph-c:var(--msc-tile);--glyph-line:var(--msc-tile)}
|
|
132
|
+
.ui-msc-tile[data-lit] .ui-msc-glyph{--glyph-a:color-mix(in srgb,var(--msc-lit) 55%,black);--glyph-b:color-mix(in srgb,var(--msc-lit) 55%,black);--glyph-c:var(--msc-lit);--glyph-line:var(--msc-lit)}
|
|
133
|
+
.ui-msc-tile[data-active] .ui-msc-glyph{--glyph-a:var(--msc-lit);--glyph-b:var(--msc-tile);--glyph-c:var(--msc-active);--glyph-line:var(--msc-tile)}
|
|
134
|
+
.ui-auth-art[data-panel=solid] .ui-msc-tile[data-active] .ui-msc-glyph{--glyph-a:var(--ua-tint);--glyph-b:var(--ua-tint);--glyph-c:var(--auth-art-ink)}
|
|
135
|
+
@media (prefers-reduced-motion:reduce){
|
|
136
|
+
.ui-msc *{animation:none!important}
|
|
137
|
+
.ui-auth-art[data-state=error] .ui-msc-alarm{opacity:.5;transform:translateY(916px) scaleY(4.4)}
|
|
138
|
+
.ui-msc-lift,.ui-msc-litface,.ui-msc-side{transition:none}
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* A living floor of isometric tiles on a platform. The tiles light diagonally as the form fills,
|
|
144
|
+
* glint on each keystroke and glow under the pointer, and a soft sheen crosses the floor now and
|
|
145
|
+
* then; an error sweeps a red band across it and success ripples out from the centre. Three tiles carry the portal glyphs and the active one
|
|
146
|
+
* stands raised. Its container picks a 4, 5 or 6 tile wide floor.
|
|
147
|
+
*/
|
|
148
|
+
export function Mosaic({ state, progress, activeIndex, uid }: AuthVariantProps) {
|
|
149
|
+
const dots = `url(#${uid}-mosaic-dots)`;
|
|
150
|
+
// The glint class of the last keystroke stays on through every state, so leaving an error does
|
|
151
|
+
// not replay it (a CSS animation restarts only when its class changes).
|
|
152
|
+
const tick = keystroke(progress);
|
|
153
|
+
return (
|
|
154
|
+
<>
|
|
155
|
+
<style href="jcsoftdev-ui-auth-mosaic" precedence="default">
|
|
156
|
+
{CSS}
|
|
157
|
+
</style>
|
|
158
|
+
{/* biome-ignore lint/a11y/noSvgWithoutTitle: the wrapper names the illustration or hides it */}
|
|
159
|
+
<svg viewBox={`${VIEW.x} ${VIEW.y} ${VIEW.w} ${VIEW.h}`} focusable="false" className="ui-msc">
|
|
160
|
+
<defs>
|
|
161
|
+
<pattern id={`${uid}-mosaic-dots`} width="5" height="5" patternUnits="userSpaceOnUse">
|
|
162
|
+
<circle className="ui-msc-dots" cx="2.5" cy="2.5" r="1" />
|
|
163
|
+
</pattern>
|
|
164
|
+
<clipPath id={`${uid}-mosaic-clip`}>
|
|
165
|
+
<path d={CLIP} />
|
|
166
|
+
</clipPath>
|
|
167
|
+
<clipPath id={`${uid}-mosaic-floor`}>
|
|
168
|
+
<path d={FLOOR_TOP} />
|
|
169
|
+
</clipPath>
|
|
170
|
+
{BANDS.map((band) => (
|
|
171
|
+
<linearGradient key={band} id={`${uid}-mosaic-${band}`} x1="0" y1="0" x2="0" y2="1">
|
|
172
|
+
<stop className={`ui-msc-${band}-stop`} offset="0" stopOpacity="0" />
|
|
173
|
+
<stop className={`ui-msc-${band}-stop`} offset=".5" stopOpacity="1" />
|
|
174
|
+
<stop className={`ui-msc-${band}-stop`} offset="1" stopOpacity="0" />
|
|
175
|
+
</linearGradient>
|
|
176
|
+
))}
|
|
177
|
+
</defs>
|
|
178
|
+
<g className="ui-msc-stage">
|
|
179
|
+
<path className="ui-msc-shadow" d={SHADOW} transform="translate(16 18)" />
|
|
180
|
+
<path className="ui-msc-base-left ui-msc-edge" d={PLATFORM.left} />
|
|
181
|
+
<path className="ui-msc-base-right ui-msc-edge" d={PLATFORM.right} />
|
|
182
|
+
<path d={PLATFORM.left} fill={dots} />
|
|
183
|
+
<path d={PLATFORM.right} fill={dots} />
|
|
184
|
+
<path className="ui-msc-base-top ui-msc-edge" d={PLATFORM.top} />
|
|
185
|
+
<g clipPath={`url(#${uid}-mosaic-clip)`}>
|
|
186
|
+
{GRIDS.map(({ n, shape, glyphTransform, tiles }) => {
|
|
187
|
+
const lit = mosaicFilled(state, progress, n);
|
|
188
|
+
const glint = mosaicGlint(tick.count, n);
|
|
189
|
+
return (
|
|
190
|
+
<g key={n} className="ui-msc-grid" data-n={n}>
|
|
191
|
+
{tiles.map((tile, k) => {
|
|
192
|
+
const on = tile.diagonal < lit;
|
|
193
|
+
const active = tile.glyph >= 0 && tile.glyph === activeIndex;
|
|
194
|
+
const vars = {
|
|
195
|
+
"--d": tile.diagonal,
|
|
196
|
+
"--ring": tile.ring,
|
|
197
|
+
"--lit": on ? 1 : 0,
|
|
198
|
+
"--act": active ? 1 : 0,
|
|
199
|
+
"--tx": tile.tx,
|
|
200
|
+
"--ty": tile.ty,
|
|
201
|
+
} as CSSProperties;
|
|
202
|
+
const pop =
|
|
203
|
+
k === glint ? `ui-msc-pop ui-msc-glint-${tick.phase}` : "ui-msc-pop";
|
|
204
|
+
return (
|
|
205
|
+
<g
|
|
206
|
+
key={`${tile.row}:${tile.col}`}
|
|
207
|
+
className="ui-msc-tile"
|
|
208
|
+
data-lit={on || undefined}
|
|
209
|
+
data-active={active || undefined}
|
|
210
|
+
style={vars}
|
|
211
|
+
transform={`translate(${tile.at.x} ${tile.at.y})`}
|
|
212
|
+
>
|
|
213
|
+
<g className="ui-msc-lift">
|
|
214
|
+
<g className={pop}>
|
|
215
|
+
<g className={active ? "ui-msc-bob" : undefined}>
|
|
216
|
+
<path className="ui-msc-side ui-msc-tile-left" d={shape.left} />
|
|
217
|
+
<path className="ui-msc-side ui-msc-tile-right" d={shape.right} />
|
|
218
|
+
<path className="ui-msc-tile-top" d={shape.top} />
|
|
219
|
+
<path className="ui-msc-litface" d={shape.top} />
|
|
220
|
+
<path className="ui-msc-glow" d={shape.top} />
|
|
221
|
+
{tile.glyph >= 0 ? (
|
|
222
|
+
<g className="ui-msc-glyph" transform={glyphTransform}>
|
|
223
|
+
{PORTAL_GLYPHS[tile.glyph]}
|
|
224
|
+
</g>
|
|
225
|
+
) : null}
|
|
226
|
+
</g>
|
|
227
|
+
</g>
|
|
228
|
+
</g>
|
|
229
|
+
</g>
|
|
230
|
+
);
|
|
231
|
+
})}
|
|
232
|
+
</g>
|
|
233
|
+
);
|
|
234
|
+
})}
|
|
235
|
+
</g>
|
|
236
|
+
<g clipPath={`url(#${uid}-mosaic-floor)`}>
|
|
237
|
+
{BANDS.map((band) => (
|
|
238
|
+
<rect
|
|
239
|
+
key={band}
|
|
240
|
+
className={`ui-msc-band ui-msc-${band}`}
|
|
241
|
+
fill={`url(#${uid}-mosaic-${band})`}
|
|
242
|
+
x={BAND.x}
|
|
243
|
+
y={BAND.y}
|
|
244
|
+
width={BAND.w}
|
|
245
|
+
height={BAND.h}
|
|
246
|
+
/>
|
|
247
|
+
))}
|
|
248
|
+
</g>
|
|
249
|
+
</g>
|
|
250
|
+
</svg>
|
|
251
|
+
</>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
Mosaic.variant = "mosaic";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./slabs.js";
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { CSSProperties } from "react";
|
|
4
|
+
import {
|
|
5
|
+
type AuthState,
|
|
6
|
+
keystroke,
|
|
7
|
+
SLAB_COUNT,
|
|
8
|
+
slabPlacement,
|
|
9
|
+
slabSpread,
|
|
10
|
+
sparkVectors,
|
|
11
|
+
} from "../auth-illustration/model.js";
|
|
12
|
+
import { PORTAL_GLYPHS } from "../internal/portal-glyphs.js";
|
|
13
|
+
|
|
14
|
+
/** Rules of the slabs look: colours per slab, depth faces, entrance, parallax, hop and cheer. */
|
|
15
|
+
const CSS = `
|
|
16
|
+
@keyframes ui-auth-drop{0%{opacity:0;transform:translateY(-180px)}45%{opacity:1}}
|
|
17
|
+
@keyframes ui-auth-shadow-in{from{opacity:0;transform:scale(.35)}}
|
|
18
|
+
@keyframes ui-auth-bob{50%{transform:translateY(-7px)}}
|
|
19
|
+
@keyframes ui-auth-hop-0{40%{transform:translateY(-11px)}}
|
|
20
|
+
@keyframes ui-auth-hop-1{40%{transform:translateY(-11px)}}
|
|
21
|
+
@keyframes ui-auth-cheer{35%{transform:translateY(-18px)}70%{transform:translateY(3px)}}
|
|
22
|
+
.ui-auth-slab-tone-0{--top:var(--accent);--glyph-a:var(--surface);--glyph-b:var(--ink);--glyph-c:var(--accent);--dots:color-mix(in srgb,black 30%,transparent)}
|
|
23
|
+
.ui-auth-slab-tone-1{--top:var(--surface);--glyph-a:var(--accent);--glyph-b:var(--ink);--glyph-c:var(--surface);--dots:color-mix(in srgb,black 30%,transparent)}
|
|
24
|
+
.ui-auth-slab-tone-2{--top:color-mix(in srgb,var(--ink) 86%,var(--surface));--glyph-a:var(--accent);--glyph-b:var(--surface);--glyph-c:var(--surface);--dots:color-mix(in srgb,white 20%,transparent)}
|
|
25
|
+
.ui-auth-art[data-panel=solid] .ui-auth-slab-tone-0{--top:var(--auth-art-ink);--glyph-a:var(--auth-art-bg);--glyph-b:var(--auth-art-ink);--glyph-c:var(--ua-tint);--dots:color-mix(in srgb,var(--auth-art-bg) 30%,transparent)}
|
|
26
|
+
.ui-auth-art[data-panel=solid] .ui-auth-slab-tone-1{--top:var(--ua-tint);--glyph-a:var(--auth-art-ink);--glyph-b:var(--auth-art-ink);--glyph-c:var(--ua-tint);--dots:color-mix(in srgb,var(--auth-art-ink) 35%,transparent)}
|
|
27
|
+
.ui-auth-art[data-panel=solid] .ui-auth-slab-tone-2{--top:var(--ua-mid);--glyph-a:var(--ua-tint);--glyph-b:var(--auth-art-ink);--glyph-c:var(--ua-mid);--dots:color-mix(in srgb,var(--auth-art-ink) 35%,transparent)}
|
|
28
|
+
.ui-auth-art[data-panel=solid] .ui-auth-inlay{stroke:color-mix(in srgb,var(--auth-art-ink) 22%,transparent)}
|
|
29
|
+
.ui-auth-slab{--glyph-line:var(--accent);--left:color-mix(in srgb,var(--top) 82%,black);--right:color-mix(in srgb,var(--top) 66%,black)}
|
|
30
|
+
.ui-auth-art[data-panel=solid] .ui-auth-slab-tone-0{--glyph-line:var(--auth-art-ink)}
|
|
31
|
+
.ui-auth-art[data-panel=solid] .ui-auth-slab-tone-2{--glyph-line:var(--ua-tint)}
|
|
32
|
+
.ui-auth-art[data-state=error] .ui-auth-slab{--edge:color-mix(in srgb,var(--danger) 70%,var(--ua-edge))}
|
|
33
|
+
.ui-auth-pos{transform:translate(calc(var(--x) * 1px),calc(var(--y) * 1px));transition:transform .85s var(--ua-bounce)}
|
|
34
|
+
.ui-auth-par{transform:translate(calc(var(--px,0) * (5px + var(--i) * 3px)),calc(var(--py,0) * (4px + var(--i) * 2px)));transition:transform .6s var(--ua-glide)}
|
|
35
|
+
.ui-auth-lift{transform:translateY(calc(var(--lift) * -1px));transition:transform .85s var(--ua-bounce)}
|
|
36
|
+
.ui-auth-enter{animation:ui-auth-drop .9s var(--ua-land) backwards;animation-delay:calc(.15s + var(--i) * .14s)}
|
|
37
|
+
.ui-auth-hop-0{animation:ui-auth-hop-0 .32s var(--ua-glide)}
|
|
38
|
+
.ui-auth-hop-1{animation:ui-auth-hop-1 .32s var(--ua-glide)}
|
|
39
|
+
.ui-auth-art[data-state=success] .ui-auth-hop{animation:ui-auth-cheer .5s var(--ua-glide) backwards;animation-delay:calc(.75s + var(--i) * .07s)}
|
|
40
|
+
.ui-auth-bob{animation:ui-auth-bob 4.6s ease-in-out infinite;animation-delay:calc(var(--i) * -1.4s)}
|
|
41
|
+
.ui-auth-face-top{fill:var(--top)}
|
|
42
|
+
.ui-auth-face-left{fill:var(--left)}
|
|
43
|
+
.ui-auth-face-right{fill:var(--right)}
|
|
44
|
+
.ui-auth-edge{stroke:var(--edge,var(--ua-edge));stroke-width:2.2;stroke-linejoin:round}
|
|
45
|
+
.ui-auth-dots{fill:var(--dots)}
|
|
46
|
+
.ui-auth-shadow{fill:var(--ua-shadow);transform-box:fill-box;transform-origin:center;opacity:calc(1 - var(--lift) / 150);transition:opacity .85s var(--ua-glide);animation:ui-auth-shadow-in .9s var(--ua-land) backwards;animation-delay:calc(.15s + var(--i) * .14s)}
|
|
47
|
+
.ui-auth-inlay{fill:none;stroke:color-mix(in srgb,var(--ink) 14%,transparent);stroke-width:2}
|
|
48
|
+
@media (prefers-reduced-motion:reduce){
|
|
49
|
+
.ui-auth-enter,.ui-auth-bob,.ui-auth-art[data-state] .ui-auth-hop,.ui-auth-hop-0,.ui-auth-hop-1,.ui-auth-shadow{animation:none}
|
|
50
|
+
.ui-auth-pos,.ui-auth-lift,.ui-auth-shadow{transition:none}
|
|
51
|
+
.ui-auth-par{transform:none;transition:none}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const THICKNESS = 22;
|
|
56
|
+
const TOP = "M0 0 L86.6 50 L0 100 L-86.6 50Z";
|
|
57
|
+
const LEFT = `M-86.6 50 L0 100 L0 ${100 + THICKNESS} L-86.6 ${50 + THICKNESS}Z`;
|
|
58
|
+
const RIGHT = `M0 100 L86.6 50 L86.6 ${50 + THICKNESS} L0 ${100 + THICKNESS}Z`;
|
|
59
|
+
const SPARK = "M0-11 L3-3 L11 0 L3 3 L0 11 L-3 3 L-11 0 L-3-3Z";
|
|
60
|
+
const SPARKS = sparkVectors();
|
|
61
|
+
|
|
62
|
+
function Slab({
|
|
63
|
+
index,
|
|
64
|
+
spread,
|
|
65
|
+
activeIndex,
|
|
66
|
+
dotsId,
|
|
67
|
+
hop,
|
|
68
|
+
}: {
|
|
69
|
+
index: number;
|
|
70
|
+
spread: number;
|
|
71
|
+
activeIndex: number;
|
|
72
|
+
dotsId: string;
|
|
73
|
+
hop: 0 | 1 | null;
|
|
74
|
+
}) {
|
|
75
|
+
const live = slabPlacement(index, spread, activeIndex);
|
|
76
|
+
const vars = {
|
|
77
|
+
"--i": index,
|
|
78
|
+
"--x": live.x,
|
|
79
|
+
"--y": live.y,
|
|
80
|
+
"--lift": live.lift,
|
|
81
|
+
} as CSSProperties;
|
|
82
|
+
const dots = `url(#${dotsId})`;
|
|
83
|
+
return (
|
|
84
|
+
<g className={`ui-auth-pos ui-auth-slab ui-auth-slab-tone-${index}`} style={vars}>
|
|
85
|
+
<g transform={`translate(24 ${THICKNESS + 22})`}>
|
|
86
|
+
<path className="ui-auth-shadow" d={TOP} />
|
|
87
|
+
</g>
|
|
88
|
+
<g className="ui-auth-par">
|
|
89
|
+
<g className="ui-auth-lift">
|
|
90
|
+
<g className="ui-auth-enter">
|
|
91
|
+
<g className={hop === null ? "ui-auth-hop" : `ui-auth-hop ui-auth-hop-${hop}`}>
|
|
92
|
+
<g className="ui-auth-bob">
|
|
93
|
+
<path className="ui-auth-face-left ui-auth-edge" d={LEFT} />
|
|
94
|
+
<path className="ui-auth-face-right ui-auth-edge" d={RIGHT} />
|
|
95
|
+
<path d={LEFT} fill={dots} />
|
|
96
|
+
<path d={RIGHT} fill={dots} />
|
|
97
|
+
<path className="ui-auth-face-top ui-auth-edge" d={TOP} />
|
|
98
|
+
<g transform="matrix(0.866 0.5 -0.866 0.5 0 0)">
|
|
99
|
+
<rect className="ui-auth-inlay" x="9" y="9" width="82" height="82" rx="8" />
|
|
100
|
+
{PORTAL_GLYPHS[index]}
|
|
101
|
+
</g>
|
|
102
|
+
</g>
|
|
103
|
+
</g>
|
|
104
|
+
</g>
|
|
105
|
+
</g>
|
|
106
|
+
</g>
|
|
107
|
+
</g>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface SlabsProps {
|
|
112
|
+
state: AuthState;
|
|
113
|
+
progress: number;
|
|
114
|
+
activeIndex: number;
|
|
115
|
+
/** Unique within the page; names the halftone pattern. */
|
|
116
|
+
uid: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Three isometric portal slabs that float apart at rest and assemble as the form fills. */
|
|
120
|
+
export function Slabs({ state, progress, activeIndex, uid }: SlabsProps) {
|
|
121
|
+
const spread = slabSpread(state, progress);
|
|
122
|
+
const dotsId = `${uid}-dots`;
|
|
123
|
+
// The last keystroke's hop class stays on through every state: a CSS animation restarts only
|
|
124
|
+
// when its class changes, so an error settling back to password, or a refocus, never hops.
|
|
125
|
+
const tick = keystroke(progress, SLAB_COUNT);
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<style href="jcsoftdev-ui-auth-slabs" precedence="default">
|
|
129
|
+
{CSS}
|
|
130
|
+
</style>
|
|
131
|
+
{/* biome-ignore lint/a11y/noSvgWithoutTitle: the wrapper names the illustration or hides it */}
|
|
132
|
+
<svg
|
|
133
|
+
viewBox="40 60 560 440"
|
|
134
|
+
focusable="false"
|
|
135
|
+
style={{ "--spread": spread } as CSSProperties}
|
|
136
|
+
>
|
|
137
|
+
<defs>
|
|
138
|
+
<pattern id={dotsId} width="5" height="5" patternUnits="userSpaceOnUse">
|
|
139
|
+
<circle className="ui-auth-dots" cx="2.5" cy="2.5" r="1" />
|
|
140
|
+
</pattern>
|
|
141
|
+
</defs>
|
|
142
|
+
{Array.from({ length: SLAB_COUNT }, (_, index) => (
|
|
143
|
+
<Slab
|
|
144
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: the three slabs are fixed
|
|
145
|
+
key={index}
|
|
146
|
+
index={index}
|
|
147
|
+
spread={spread}
|
|
148
|
+
activeIndex={activeIndex}
|
|
149
|
+
dotsId={dotsId}
|
|
150
|
+
hop={tick.count > 0 && tick.target === index ? tick.phase : null}
|
|
151
|
+
/>
|
|
152
|
+
))}
|
|
153
|
+
{state === "success" ? (
|
|
154
|
+
<g>
|
|
155
|
+
{SPARKS.map((spark, n) => (
|
|
156
|
+
<g key={`${spark.dx}:${spark.dy}`} transform="translate(320 250)">
|
|
157
|
+
{n % 2 ? (
|
|
158
|
+
<circle
|
|
159
|
+
className="ui-auth-spark"
|
|
160
|
+
data-tone={n % 4}
|
|
161
|
+
r="5"
|
|
162
|
+
style={{ "--dx": `${spark.dx}px`, "--dy": `${spark.dy}px` } as CSSProperties}
|
|
163
|
+
/>
|
|
164
|
+
) : (
|
|
165
|
+
<path
|
|
166
|
+
className="ui-auth-spark"
|
|
167
|
+
data-tone={n % 4}
|
|
168
|
+
d={SPARK}
|
|
169
|
+
style={{ "--dx": `${spark.dx}px`, "--dy": `${spark.dy}px` } as CSSProperties}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</g>
|
|
173
|
+
))}
|
|
174
|
+
</g>
|
|
175
|
+
) : null}
|
|
176
|
+
</svg>
|
|
177
|
+
</>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
Slabs.variant = "slabs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./stack.js";
|