@krizaka/ui 3.63.1 → 3.64.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/dist/account-menu.d.ts +1 -1
- package/dist/account-menu.js +1 -1
- package/dist/account-settings.d.ts +61 -4
- package/dist/account-settings.js +206 -44
- package/dist/account-settings.js.map +1 -1
- package/dist/avatar/defaults.d.ts +16 -5
- package/dist/avatar/defaults.js +15 -1
- package/dist/avatar/defaults.js.map +1 -1
- package/dist/{avatar-BL2iG_Js.d.ts → avatar-BdZcfkWR.d.ts} +11 -4
- package/dist/avatar.d.ts +16 -5
- package/dist/avatar.js +15 -1
- package/dist/avatar.js.map +1 -1
- package/dist/blocks.css +41 -0
- package/dist/chat.js +1 -1
- package/dist/chunk-5D7NMUF6.js +35 -0
- package/dist/chunk-5D7NMUF6.js.map +1 -0
- package/dist/chunk-A7MQPIEG.js +31 -0
- package/dist/chunk-A7MQPIEG.js.map +1 -0
- package/dist/chunk-B47WSPMP.js +60 -0
- package/dist/chunk-B47WSPMP.js.map +1 -0
- package/dist/chunk-EUJ7337V.js +137 -0
- package/dist/chunk-EUJ7337V.js.map +1 -0
- package/dist/chunk-HK525THY.js +139 -0
- package/dist/chunk-HK525THY.js.map +1 -0
- package/dist/chunk-HKEAYSFS.js +19 -0
- package/dist/chunk-HKEAYSFS.js.map +1 -0
- package/dist/{chunk-3D2YI63L.js → chunk-SHBYNQFS.js} +7 -2
- package/dist/{chunk-3D2YI63L.js.map → chunk-SHBYNQFS.js.map} +1 -1
- package/dist/chunk-ZYHWJ7U5.js +20 -0
- package/dist/chunk-ZYHWJ7U5.js.map +1 -0
- package/dist/cover-hero.d.ts +4 -0
- package/dist/cover-hero.js +5 -2
- package/dist/cover-hero.js.map +1 -1
- package/dist/dashboard-layout.js +2 -1
- package/dist/dashboard-layout.js.map +1 -1
- package/dist/docs-layout.js +1 -1
- package/dist/filter-bar.d.ts +3 -3
- package/dist/frame-D6Xv83t8.d.ts +52 -0
- package/dist/match-dialog.js +1 -1
- package/dist/media-grid.d.ts +8 -3
- package/dist/media-grid.js +1 -1
- package/dist/native.d.ts +8 -3
- package/dist/native.js +51 -0
- package/dist/native.js.map +1 -1
- package/dist/service-card.d.ts +25 -1
- package/dist/service-card.js +7 -3
- package/dist/service-card.js.map +1 -1
- package/dist/shop/booking.d.ts +36 -0
- package/dist/shop/booking.js +37 -0
- package/dist/shop/booking.js.map +1 -0
- package/dist/shop/bulletin.d.ts +28 -0
- package/dist/shop/bulletin.js +29 -0
- package/dist/shop/bulletin.js.map +1 -0
- package/dist/shop/demo.d.ts +135 -0
- package/dist/shop/demo.js +141 -0
- package/dist/shop/demo.js.map +1 -0
- package/dist/shop/faq.d.ts +20 -0
- package/dist/shop/faq.js +33 -0
- package/dist/shop/faq.js.map +1 -0
- package/dist/shop/gallery.d.ts +46 -0
- package/dist/shop/gallery.js +76 -0
- package/dist/shop/gallery.js.map +1 -0
- package/dist/shop/hero.d.ts +36 -0
- package/dist/shop/hero.js +70 -0
- package/dist/shop/hero.js.map +1 -0
- package/dist/shop/map-gate.d.ts +22 -0
- package/dist/shop/map-gate.js +34 -0
- package/dist/shop/map-gate.js.map +1 -0
- package/dist/shop/policies.d.ts +18 -0
- package/dist/shop/policies.js +16 -0
- package/dist/shop/policies.js.map +1 -0
- package/dist/shop/reviews.d.ts +25 -0
- package/dist/shop/reviews.js +47 -0
- package/dist/shop/reviews.js.map +1 -0
- package/dist/shop/services.d.ts +57 -0
- package/dist/shop/services.js +118 -0
- package/dist/shop/services.js.map +1 -0
- package/dist/shop/social.d.ts +27 -0
- package/dist/shop/social.js +27 -0
- package/dist/shop/social.js.map +1 -0
- package/dist/shop/story.d.ts +24 -0
- package/dist/shop/story.js +26 -0
- package/dist/shop/story.js.map +1 -0
- package/dist/shop/team.d.ts +24 -0
- package/dist/shop/team.js +26 -0
- package/dist/shop/team.js.map +1 -0
- package/dist/shop/video.d.ts +40 -0
- package/dist/shop/video.js +33 -0
- package/dist/shop/video.js.map +1 -0
- package/dist/shop/visit.d.ts +29 -0
- package/dist/shop/visit.js +38 -0
- package/dist/shop/visit.js.map +1 -0
- package/dist/shop-composer.d.ts +490 -0
- package/dist/shop-composer.js +2061 -0
- package/dist/shop-composer.js.map +1 -0
- package/dist/shop.d.ts +316 -0
- package/dist/shop.js +389 -0
- package/dist/shop.js.map +1 -0
- package/dist/vertical-video.js +1 -1
- package/package.json +267 -9
- package/registry/account-menu.json +1 -1
- package/registry/account-settings.json +67 -6
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/activity-feed.json +1 -1
- package/registry/agenda.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/analysis-report.json +1 -1
- package/registry/anatomy-plate.json +1 -1
- package/registry/app-header.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +6 -5
- package/registry/badge.json +1 -1
- package/registry/bird-plate.json +1 -1
- package/registry/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/chapter.json +1 -1
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip-row.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cover-hero.json +2 -2
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +2 -2
- package/registry/data-table.json +1 -1
- package/registry/date-picker.json +1 -1
- package/registry/decision-list.json +1 -1
- package/registry/description-list.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +1 -1
- package/registry/doodle.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/elephant.json +2 -2
- package/registry/embed-facade.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/engine-flow.json +1 -1
- package/registry/environment-notice.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/account-settings/avatar-picker-folder.d.ts +4 -0
- package/registry/examples/account-settings/avatar-picker-folder.js +27 -0
- package/registry/examples/account-settings/avatar-picker-folder.tsx +23 -0
- package/registry/examples/shop/booking-panel.d.ts +4 -0
- package/registry/examples/shop/booking-panel.js +12 -0
- package/registry/examples/shop/booking-panel.tsx +11 -0
- package/registry/examples/shop/booking-sticky.d.ts +4 -0
- package/registry/examples/shop/booking-sticky.js +15 -0
- package/registry/examples/shop/booking-sticky.tsx +12 -0
- package/registry/examples/shop/booking-strip.d.ts +4 -0
- package/registry/examples/shop/booking-strip.js +13 -0
- package/registry/examples/shop/booking-strip.tsx +12 -0
- package/registry/examples/shop/bulletin-banner.d.ts +4 -0
- package/registry/examples/shop/bulletin-banner.js +13 -0
- package/registry/examples/shop/bulletin-banner.tsx +12 -0
- package/registry/examples/shop/bulletin-board.d.ts +4 -0
- package/registry/examples/shop/bulletin-board.js +13 -0
- package/registry/examples/shop/bulletin-board.tsx +12 -0
- package/registry/examples/shop/cards.d.ts +4 -0
- package/registry/examples/shop/cards.js +13 -0
- package/registry/examples/shop/cards.tsx +12 -0
- package/registry/examples/shop/carousel.d.ts +4 -0
- package/registry/examples/shop/carousel.js +13 -0
- package/registry/examples/shop/carousel.tsx +12 -0
- package/registry/examples/shop/document.d.ts +4 -0
- package/registry/examples/shop/document.js +20 -0
- package/registry/examples/shop/document.tsx +13 -0
- package/registry/examples/shop/faq.d.ts +4 -0
- package/registry/examples/shop/faq.js +13 -0
- package/registry/examples/shop/faq.tsx +12 -0
- package/registry/examples/shop/gallery-filmstrip.d.ts +4 -0
- package/registry/examples/shop/gallery-filmstrip.js +13 -0
- package/registry/examples/shop/gallery-filmstrip.tsx +12 -0
- package/registry/examples/shop/gallery-grid.d.ts +4 -0
- package/registry/examples/shop/gallery-grid.js +13 -0
- package/registry/examples/shop/gallery-grid.tsx +12 -0
- package/registry/examples/shop/gallery-mosaic.d.ts +4 -0
- package/registry/examples/shop/gallery-mosaic.js +13 -0
- package/registry/examples/shop/gallery-mosaic.tsx +12 -0
- package/registry/examples/shop/gallery-wall.d.ts +4 -0
- package/registry/examples/shop/gallery-wall.js +13 -0
- package/registry/examples/shop/gallery-wall.tsx +12 -0
- package/registry/examples/shop/hero-banner.d.ts +4 -0
- package/registry/examples/shop/hero-banner.js +15 -0
- package/registry/examples/shop/hero-banner.tsx +14 -0
- package/registry/examples/shop/hero-poster.d.ts +4 -0
- package/registry/examples/shop/hero-poster.js +15 -0
- package/registry/examples/shop/hero-poster.tsx +14 -0
- package/registry/examples/shop/hero-split.d.ts +4 -0
- package/registry/examples/shop/hero-split.js +15 -0
- package/registry/examples/shop/hero-split.tsx +14 -0
- package/registry/examples/shop/hero-tv.d.ts +4 -0
- package/registry/examples/shop/hero-tv.js +15 -0
- package/registry/examples/shop/hero-tv.tsx +14 -0
- package/registry/examples/shop/index.d.ts +4 -0
- package/registry/examples/shop/index.js +13 -0
- package/registry/examples/shop/index.tsx +12 -0
- package/registry/examples/shop/menu-columns.d.ts +4 -0
- package/registry/examples/shop/menu-columns.js +13 -0
- package/registry/examples/shop/menu-columns.tsx +12 -0
- package/registry/examples/shop/menu.d.ts +4 -0
- package/registry/examples/shop/menu.js +25 -0
- package/registry/examples/shop/menu.tsx +21 -0
- package/registry/examples/shop/page.d.ts +4 -0
- package/registry/examples/shop/page.js +32 -0
- package/registry/examples/shop/page.tsx +27 -0
- package/registry/examples/shop/policies.d.ts +4 -0
- package/registry/examples/shop/policies.js +13 -0
- package/registry/examples/shop/policies.tsx +12 -0
- package/registry/examples/shop/reviews-quote.d.ts +4 -0
- package/registry/examples/shop/reviews-quote.js +13 -0
- package/registry/examples/shop/reviews-quote.tsx +12 -0
- package/registry/examples/shop/reviews-strip.d.ts +4 -0
- package/registry/examples/shop/reviews-strip.js +13 -0
- package/registry/examples/shop/reviews-strip.tsx +12 -0
- package/registry/examples/shop/reviews-summary-cards.d.ts +4 -0
- package/registry/examples/shop/reviews-summary-cards.js +13 -0
- package/registry/examples/shop/reviews-summary-cards.tsx +12 -0
- package/registry/examples/shop/social-facade.d.ts +4 -0
- package/registry/examples/shop/social-facade.js +13 -0
- package/registry/examples/shop/social-facade.tsx +12 -0
- package/registry/examples/shop/social-links.d.ts +4 -0
- package/registry/examples/shop/social-links.js +12 -0
- package/registry/examples/shop/social-links.tsx +11 -0
- package/registry/examples/shop/story-owner.d.ts +4 -0
- package/registry/examples/shop/story-owner.js +13 -0
- package/registry/examples/shop/story-owner.tsx +12 -0
- package/registry/examples/shop/story-quote.d.ts +4 -0
- package/registry/examples/shop/story-quote.js +13 -0
- package/registry/examples/shop/story-quote.tsx +12 -0
- package/registry/examples/shop/team-cards.d.ts +4 -0
- package/registry/examples/shop/team-cards.js +13 -0
- package/registry/examples/shop/team-cards.tsx +12 -0
- package/registry/examples/shop/team-row.d.ts +4 -0
- package/registry/examples/shop/team-row.js +13 -0
- package/registry/examples/shop/team-row.tsx +12 -0
- package/registry/examples/shop/video-shorts.d.ts +4 -0
- package/registry/examples/shop/video-shorts.js +14 -0
- package/registry/examples/shop/video-shorts.tsx +13 -0
- package/registry/examples/shop/video-tv.d.ts +4 -0
- package/registry/examples/shop/video-tv.js +13 -0
- package/registry/examples/shop/video-tv.tsx +12 -0
- package/registry/examples/shop/visit-card.d.ts +4 -0
- package/registry/examples/shop/visit-card.js +13 -0
- package/registry/examples/shop/visit-card.tsx +12 -0
- package/registry/examples/shop/visit-map.d.ts +4 -0
- package/registry/examples/shop/visit-map.js +13 -0
- package/registry/examples/shop/visit-map.tsx +12 -0
- package/registry/examples/shop/visit-split.d.ts +4 -0
- package/registry/examples/shop/visit-split.js +13 -0
- package/registry/examples/shop/visit-split.tsx +12 -0
- package/registry/examples/shop-composer/composer.d.ts +4 -0
- package/registry/examples/shop-composer/composer.js +17 -0
- package/registry/examples/shop-composer/composer.tsx +21 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/flock.json +1 -1
- package/registry/footnote.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form.json +1 -1
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +1 -1
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/grade-stamp.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +98 -7
- package/registry/iso.json +1 -1
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +1 -1
- package/registry/kpi-explained.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +1 -1
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +1 -1
- package/registry/map.json +2 -2
- package/registry/margin-layout.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/match-dialog.json +1 -1
- package/registry/media-capture.json +1 -1
- package/registry/media-gallery.json +1 -1
- package/registry/media-grid.json +1 -1
- package/registry/meta-row.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/nav-bar.json +2 -2
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/opening-hours.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +1 -1
- package/registry/page-index.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/photo-grid.json +1 -1
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/quota-meter.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/rail-nav.json +2 -2
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +1 -1
- package/registry/reviews.json +1 -1
- package/registry/router.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +1 -1
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/service-card.json +24 -6
- package/registry/settings-layout.json +1 -1
- package/registry/shop-composer.json +424 -0
- package/registry/shop.json +776 -0
- package/registry/showcase.json +1 -1
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +1 -1
- package/registry/site-footer.json +2 -2
- package/registry/sites.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-chip.json +1 -1
- package/registry/status-page.json +1 -1
- package/registry/step-progress.json +1 -1
- package/registry/step-showcase.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/sticky-action.json +1 -1
- package/registry/stuck.json +1 -1
- package/registry/swipe-deck.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +1 -1
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +1 -1
- package/registry/text-style.json +1 -1
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +1 -1
- package/registry/update-prompt.json +1 -1
- package/registry/upload-queue.json +1 -1
- package/registry/usage.json +1 -1
- package/registry/verified-badge.json +1 -1
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +1 -1
- package/registry/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/registry/wall.json +3 -3
- package/registry/waveform.json +1 -1
- package/dist/chunk-7AZ23BUX.js +0 -88
- package/dist/chunk-7AZ23BUX.js.map +0 -1
- package/dist/chunk-PW2FVPTV.js +0 -85
- package/dist/chunk-PW2FVPTV.js.map +0 -1
package/dist/avatar.d.ts
CHANGED
|
@@ -4,11 +4,19 @@ import * as React from 'react';
|
|
|
4
4
|
|
|
5
5
|
/** A brand of the default avatars. `orochia`, `yasakia`, `yororis` and `kachizaka` are deprecated: paused products (2026-10-25), removed in the next major; their pictures stay served until then. */
|
|
6
6
|
type DefaultAvatarBrand = "krizaka" | "orazaka" | "orochia" | "yasakia" | "yororis" | "yomizaka" | "kachizaka" | "akinaza";
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* What the picture is of. `person`: a neutral silhouette. `plain`: the brand's gradient alone, ready for initials.
|
|
9
|
+
* `folder`, `organisation` and `shop` are the pictures of a thing that is not a person (a folder or collection, a company, a shop):
|
|
10
|
+
* a glyph on the gradient, never a silhouette. The central sets of these kinds are in the Krizaka org JSON (`defaults`, `@krizaka/org`).
|
|
11
|
+
*/
|
|
12
|
+
type DefaultAvatarKind = "person" | "plain" | "folder" | "organisation" | "shop";
|
|
13
|
+
/** The kinds of entity that have a set of default pictures of their own (`plain` is a style of `person`). */
|
|
14
|
+
type DefaultAvatarEntityKind = "person" | "folder" | "organisation" | "shop";
|
|
9
15
|
type DefaultAvatarSize = 256 | 512;
|
|
10
16
|
declare const DEFAULT_AVATAR_BRANDS: readonly DefaultAvatarBrand[];
|
|
17
|
+
/** The two styles of the legacy brand sets (`people/defaults/v1/<brand>`); the kinds of the central sets are `DEFAULT_AVATAR_ENTITY_KINDS`. */
|
|
11
18
|
declare const DEFAULT_AVATAR_KINDS: readonly DefaultAvatarKind[];
|
|
19
|
+
declare const DEFAULT_AVATAR_ENTITY_KINDS: readonly DefaultAvatarEntityKind[];
|
|
12
20
|
declare const DEFAULT_AVATAR_SIZES: readonly DefaultAvatarSize[];
|
|
13
21
|
/** How many tones each brand has: a person always gets the same one from their seed, so a list is not one colour. */
|
|
14
22
|
declare const DEFAULT_AVATAR_TONES = 6;
|
|
@@ -22,7 +30,8 @@ interface DefaultAvatar {
|
|
|
22
30
|
/** Force a tone, 1 to 6, instead of deriving it from `seed`. */
|
|
23
31
|
tone?: number;
|
|
24
32
|
/**
|
|
25
|
-
* `person` (default): a silhouette. `plain`: the gradient alone.
|
|
33
|
+
* `person` (default): a silhouette. `plain`: the gradient alone. `folder`, `organisation`, `shop`: that thing's glyph, drawn here
|
|
34
|
+
* (a data URL, no request) — a folder is never given a person.
|
|
26
35
|
* @default "person"
|
|
27
36
|
*/
|
|
28
37
|
kind?: DefaultAvatarKind;
|
|
@@ -42,6 +51,8 @@ declare function defaultAvatarUrl(avatar: DefaultAvatar, { size, base }?: {
|
|
|
42
51
|
size?: DefaultAvatarSize | "svg";
|
|
43
52
|
base?: string;
|
|
44
53
|
}): string;
|
|
54
|
+
/** The picture as a `data:` URL: nothing to fetch, so a folder, an organisation or a shop always has its picture (offline, in a test, before the CDN answers). */
|
|
55
|
+
declare function defaultAvatarDataUrl(avatar: DefaultAvatar): string;
|
|
45
56
|
/** The SVG source of a default avatar, 512 × 512 and square (the Avatar clips it round). */
|
|
46
57
|
declare function defaultAvatarSvg(avatar: DefaultAvatar): string;
|
|
47
58
|
|
|
@@ -150,5 +161,5 @@ declare const Avatar: typeof AvatarRoot & {
|
|
|
150
161
|
Group: typeof AvatarGroup;
|
|
151
162
|
};
|
|
152
163
|
|
|
153
|
-
export { Avatar, AvatarGroup, AvatarRoot, DEFAULT_AVATAR_BASE, DEFAULT_AVATAR_BRANDS, DEFAULT_AVATAR_KINDS, DEFAULT_AVATAR_SIZES, DEFAULT_AVATAR_TONES, defaultAvatarFile, defaultAvatarSvg, defaultAvatarTone, defaultAvatarToneOf, defaultAvatarUrl };
|
|
154
|
-
export type { AvatarGroupProps, AvatarProps, AvatarSize, DefaultAvatar, DefaultAvatarBrand, DefaultAvatarKind, DefaultAvatarSize };
|
|
164
|
+
export { Avatar, AvatarGroup, AvatarRoot, DEFAULT_AVATAR_BASE, DEFAULT_AVATAR_BRANDS, DEFAULT_AVATAR_ENTITY_KINDS, DEFAULT_AVATAR_KINDS, DEFAULT_AVATAR_SIZES, DEFAULT_AVATAR_TONES, defaultAvatarDataUrl, defaultAvatarFile, defaultAvatarSvg, defaultAvatarTone, defaultAvatarToneOf, defaultAvatarUrl };
|
|
165
|
+
export type { AvatarGroupProps, AvatarProps, AvatarSize, DefaultAvatar, DefaultAvatarBrand, DefaultAvatarEntityKind, DefaultAvatarKind, DefaultAvatarSize };
|
package/dist/avatar.js
CHANGED
|
@@ -8,6 +8,7 @@ import { tv } from "tailwind-variants";
|
|
|
8
8
|
// src/avatar/default-avatar.ts
|
|
9
9
|
var DEFAULT_AVATAR_BRANDS = ["krizaka", "orazaka", "orochia", "yasakia", "yororis", "yomizaka", "kachizaka", "akinaza"];
|
|
10
10
|
var DEFAULT_AVATAR_KINDS = ["person", "plain"];
|
|
11
|
+
var DEFAULT_AVATAR_ENTITY_KINDS = ["person", "folder", "organisation", "shop"];
|
|
11
12
|
var DEFAULT_AVATAR_SIZES = [256, 512];
|
|
12
13
|
var DEFAULT_AVATAR_TONES = 6;
|
|
13
14
|
var DEFAULT_AVATAR_BASE = "https://krizaka-assets.b-cdn.net/people/defaults/v1";
|
|
@@ -66,11 +67,22 @@ function trimTrailingSlashes(value) {
|
|
|
66
67
|
return value.slice(0, end);
|
|
67
68
|
}
|
|
68
69
|
function defaultAvatarUrl(avatar2, { size = 256, base = DEFAULT_AVATAR_BASE } = {}) {
|
|
70
|
+
if (isGlyphKind(avatar2.kind)) return defaultAvatarDataUrl(avatar2);
|
|
69
71
|
return `${trimTrailingSlashes(base)}/${avatar2.brand}/${defaultAvatarFile(avatar2.kind ?? "person", resolveTone(avatar2), size)}`;
|
|
70
72
|
}
|
|
73
|
+
var GLYPHS = {
|
|
74
|
+
folder: () => `<path d="M96 176a28 28 0 0 1 28-28h92l40 44h132a28 28 0 0 1 28 28v152a28 28 0 0 1-28 28H124a28 28 0 0 1-28-28z" fill="#fff" fill-opacity=".92"/>`,
|
|
75
|
+
organisation: (from) => `<rect x="136" y="104" width="240" height="304" rx="16" fill="#fff" fill-opacity=".92"/>${[160, 226, 292].flatMap((y) => [168, 236, 304].map((x) => `<rect x="${x}" y="${y}" width="40" height="40" rx="6" fill="${from}"/>`)).join("")}<rect x="232" y="352" width="48" height="56" rx="6" fill="${from}"/>`,
|
|
76
|
+
shop: (from) => `<path d="M112 132h288l24 84a56 56 0 0 1-112 0 56 56 0 0 1-112 0 56 56 0 0 1-112 0z" fill="#fff" fill-opacity=".92"/><rect x="136" y="292" width="240" height="116" rx="12" fill="#fff" fill-opacity=".92"/><rect x="226" y="326" width="60" height="82" rx="8" fill="${from}"/><rect x="156" y="318" width="48" height="44" rx="6" fill="${from}"/><rect x="308" y="318" width="48" height="44" rx="6" fill="${from}"/>`
|
|
77
|
+
};
|
|
78
|
+
var isGlyphKind = (kind) => kind === "folder" || kind === "organisation" || kind === "shop";
|
|
79
|
+
function defaultAvatarDataUrl(avatar2) {
|
|
80
|
+
return `data:image/svg+xml,${encodeURIComponent(defaultAvatarSvg(avatar2))}`;
|
|
81
|
+
}
|
|
71
82
|
function defaultAvatarSvg(avatar2) {
|
|
72
83
|
const [from, to] = defaultAvatarTone(avatar2.brand, resolveTone(avatar2));
|
|
73
|
-
const
|
|
84
|
+
const kind = avatar2.kind ?? "person";
|
|
85
|
+
const person = isGlyphKind(kind) ? GLYPHS[kind](from) : kind === "person" ? `<circle cx="256" cy="200" r="86" fill="#fff" fill-opacity=".92"/><path d="M84 512c0-108 78-182 172-182s172 74 172 182z" fill="#fff" fill-opacity=".92"/>` : "";
|
|
74
86
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="${from}"/><stop offset="1" stop-color="${to}"/></linearGradient><radialGradient id="l" cx=".28" cy=".18" r=".85"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient></defs><rect width="512" height="512" fill="url(#g)"/><rect width="512" height="512" fill="url(#l)"/>${person}</svg>`;
|
|
75
87
|
}
|
|
76
88
|
|
|
@@ -130,9 +142,11 @@ export {
|
|
|
130
142
|
AvatarRoot,
|
|
131
143
|
DEFAULT_AVATAR_BASE,
|
|
132
144
|
DEFAULT_AVATAR_BRANDS,
|
|
145
|
+
DEFAULT_AVATAR_ENTITY_KINDS,
|
|
133
146
|
DEFAULT_AVATAR_KINDS,
|
|
134
147
|
DEFAULT_AVATAR_SIZES,
|
|
135
148
|
DEFAULT_AVATAR_TONES,
|
|
149
|
+
defaultAvatarDataUrl,
|
|
136
150
|
defaultAvatarFile,
|
|
137
151
|
defaultAvatarSvg,
|
|
138
152
|
defaultAvatarTone,
|
package/dist/avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/avatar/avatar.tsx","../src/avatar/default-avatar.ts"],"sourcesContent":["// Client: Radix tracks the image's loading state and shows the fallback until it has loaded (or when it fails).\nimport { Avatar as AvatarPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { type DefaultAvatar, defaultAvatarUrl } from \"./default-avatar\";\n\nconst avatar = tv({\n slots: {\n root: \"relative inline-flex shrink-0 overflow-hidden rounded-full bg-surface-3 align-middle\",\n image: \"h-full w-full object-cover\",\n fallback: \"flex h-full w-full items-center justify-center font-semibold uppercase text-fg-secondary\",\n group: \"flex items-center -space-x-2 [&>*]:ring-2 [&>*]:ring-surface-0\",\n },\n variants: {\n size: {\n xs: { root: \"h-5 w-5 text-[9px]\" },\n sm: { root: \"h-8 w-8 text-xs\" },\n md: { root: \"h-10 w-10 text-sm\" },\n lg: { root: \"h-14 w-14 text-base\" },\n xl: { root: \"h-20 w-20 text-lg\" },\n },\n },\n defaultVariants: { size: \"md\" },\n});\n\nexport type AvatarSize = NonNullable<VariantProps<typeof avatar>[\"size\"]>;\n\nexport type AvatarProps = Omit<React.ComponentProps<\"span\">, \"children\"> & {\n /** The image's URL; `null` or nothing shows the `fallback`. */\n src?: string | null;\n /** The image's text alternative (the person's name); empty when a visible name sits next to the avatar. */\n alt?: string;\n /** Shown while the image loads, when it fails or when there is none: initials, an icon. */\n fallback?: React.ReactNode;\n /** The picture to show instead when `src` is missing or fails to load (an image URL). The `fallback` still covers its own loading. */\n fallbackSrc?: string;\n /**\n * The Krizaka default picture when the person has no photo (or it fails): their brand's gradient and a silhouette,\n * one of six tones from `seed` — `defaultAvatar={{ brand: \"orazaka\", seed: user.id }}`. `fallbackSrc` wins over it.\n */\n defaultAvatar?: DefaultAvatar;\n /**\n * xs · sm · md · lg · xl.\n * @default \"md\"\n */\n size?: AvatarSize;\n};\n\nexport function AvatarRoot({ src, alt = \"\", fallback, fallbackSrc, defaultAvatar, size, className, ...props }: AvatarProps) {\n const s = avatar({ size });\n const [failed, setFailed] = React.useState<string | null>(null);\n // 512 px for the big sizes, 256 for the others: sharp on a 2x screen either way.\n const backup = fallbackSrc ?? (defaultAvatar ? defaultAvatarUrl(defaultAvatar, { size: size === \"xl\" || size === \"lg\" ? 512 : 256 }) : undefined);\n const shown = src && failed !== src ? src : backup;\n return (\n <AvatarPrimitive.Root data-size={size ?? \"md\"} className={s.root({ className })} {...props}>\n {shown && (\n <AvatarPrimitive.Image\n src={shown}\n alt={alt}\n className={s.image()}\n onLoadingStatusChange={(status) => {\n if (status === \"error\" && shown === src) setFailed(src);\n }}\n />\n )}\n <AvatarPrimitive.Fallback delayMs={shown ? 300 : 0} className={s.fallback()}>\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n}\n\nexport type AvatarGroupProps = React.ComponentProps<\"div\"> & {\n /** How many avatars are shown; the rest becomes a `+n` avatar. */\n max?: number;\n /** The size of the `+n` avatar (match the avatars of the group). */\n size?: AvatarSize;\n};\n\n/** Overlapping avatars; past `max`, a `+n` avatar counts the rest. */\nexport function AvatarGroup({ max, size, className, children, ...props }: AvatarGroupProps) {\n const items = React.Children.toArray(children);\n const shown = max === undefined ? items : items.slice(0, max);\n const rest = items.length - shown.length;\n return (\n <div className={avatar().group({ className })} {...props}>\n {shown}\n {rest > 0 && <AvatarRoot size={size} fallback={`+${rest}`} />}\n </div>\n );\n}\n\n/** `Avatar` (an image with a fallback) and `Avatar.Group`. */\nexport const Avatar = Object.assign(AvatarRoot, { Group: AvatarGroup });\n","// The default profile pictures of the Krizaka family: what a product shows when a person has no photo.\n// They are generated from this file (tools/export-brand.mjs renders them to SVG and WebP and uploads them to Bunny,\n// `people/defaults/v1/<brand>/…`), so the pictures and the URLs that name them cannot drift apart.\n\n/** A brand of the default avatars. `orochia`, `yasakia`, `yororis` and `kachizaka` are deprecated: paused products (2026-10-25), removed in the next major; their pictures stay served until then. */\nexport type DefaultAvatarBrand = \"krizaka\" | \"orazaka\" | \"orochia\" | \"yasakia\" | \"yororis\" | \"yomizaka\" | \"kachizaka\" | \"akinaza\";\n/** `person`: a neutral silhouette. `plain`: the brand's gradient alone, ready for initials. */\nexport type DefaultAvatarKind = \"person\" | \"plain\";\nexport type DefaultAvatarSize = 256 | 512;\n\nexport const DEFAULT_AVATAR_BRANDS: readonly DefaultAvatarBrand[] = [\"krizaka\", \"orazaka\", \"orochia\", \"yasakia\", \"yororis\", \"yomizaka\", \"kachizaka\", \"akinaza\"];\nexport const DEFAULT_AVATAR_KINDS: readonly DefaultAvatarKind[] = [\"person\", \"plain\"];\nexport const DEFAULT_AVATAR_SIZES: readonly DefaultAvatarSize[] = [256, 512];\n/** How many tones each brand has: a person always gets the same one from their seed, so a list is not one colour. */\nexport const DEFAULT_AVATAR_TONES = 6;\n\n/** Where the set lives. `v1` is the set's version: a changed picture is a new version folder, never an overwrite. */\nexport const DEFAULT_AVATAR_BASE = \"https://krizaka-assets.b-cdn.net/people/defaults/v1\";\n\nexport interface DefaultAvatar {\n /** The brand of the product showing the avatar: its gradient, its hues. */\n brand: DefaultAvatarBrand;\n /** Any stable text or number of the person (their id): the same seed gives the same tone everywhere. */\n seed?: string | number;\n /** Force a tone, 1 to 6, instead of deriving it from `seed`. */\n tone?: number;\n /**\n * `person` (default): a silhouette. `plain`: the gradient alone.\n * @default \"person\"\n */\n kind?: DefaultAvatarKind;\n}\n\n/** The mark gradient of each brand (BRAND.md, `$extensions[\"com.krizaka\"].mark`) as [hue, saturation %, lightness %] and the hue spread of its tones. */\nconst BRANDS: Record<DefaultAvatarBrand, { from: [number, number, number]; to: [number, number, number]; spread: number }> = {\n krizaka: { from: [217, 92, 53], to: [217, 92, 68], spread: 14 },\n orazaka: { from: [26, 90.5, 37.1], to: [26, 92, 45], spread: 7 },\n orochia: { from: [262.1, 83.3, 57.8], to: [328.6, 85.5, 70.2], spread: 12 },\n yasakia: { from: [156, 92, 32], to: [178, 90, 32], spread: 12 },\n yororis: { from: [34, 46, 44], to: [104, 28, 42], spread: 10 },\n yomizaka: { from: [232, 50, 55], to: [248, 50, 58], spread: 10 },\n kachizaka: { from: [226, 80, 56], to: [44, 92, 33], spread: 10 },\n akinaza: { from: [140, 48, 34], to: [22, 60, 46], spread: 10 },\n};\n\n/** White on top of a stop must stay visible: a stop is darkened until the contrast reaches this (WCAG 1.4.11, non-text). */\nconst MIN_CONTRAST = 3.2;\nconst OFFSETS = [0, -1, 1, -2, 2, 3] as const;\n\nfunction hslToHex([h, s, l]: [number, number, number]): string {\n const sat = s / 100;\n const light = l / 100;\n const k = (n: number) => (n + (((h % 360) + 360) % 360) / 30) % 12;\n const a = sat * Math.min(light, 1 - light);\n const channel = (n: number) => Math.round(255 * (light - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));\n return `#${[0, 8, 4].map((n) => channel(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst channelLuminance = (v: number) => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst whiteContrast = (hex: string) => {\n const [r, g, b] = [1, 3, 5].map((i) => channelLuminance(Number.parseInt(hex.slice(i, i + 2), 16) / 255));\n return 1.05 / (0.2126 * r! + 0.7152 * g! + 0.0722 * b! + 0.05);\n};\n/** The stop, darkened one point of lightness at a time until white reads on it. */\nfunction readable([h, s, l]: [number, number, number]): string {\n let hex = hslToHex([h, s, l]);\n for (let light = l; whiteContrast(hex) < MIN_CONTRAST && light > 10; light -= 1) hex = hslToHex([h, s, light]);\n return hex;\n}\n\n/** The two stops (hex) of tone `tone` (1 to 6) of a brand. */\nexport function defaultAvatarTone(brand: DefaultAvatarBrand, tone: number): readonly [string, string] {\n const b = BRANDS[brand];\n const o = OFFSETS[(clampTone(tone) - 1) % OFFSETS.length] * b.spread;\n return [readable([b.from[0] + o, b.from[1], b.from[2]]), readable([b.to[0] + o, b.to[1], b.to[2]])];\n}\n\nconst clampTone = (tone: number) => Math.min(DEFAULT_AVATAR_TONES, Math.max(1, Math.round(tone)));\n\n/** 1 to 6 from a seed (FNV-1a): stable across renders, devices and products. */\nexport function defaultAvatarToneOf(seed: string | number | undefined): number {\n if (seed === undefined) return 1;\n let h = 0x811c9dc5;\n for (const ch of String(seed)) {\n h ^= ch.codePointAt(0) ?? 0;\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return (h % DEFAULT_AVATAR_TONES) + 1;\n}\n\nconst resolveTone = (a: DefaultAvatar) => (a.tone === undefined ? defaultAvatarToneOf(a.seed) : clampTone(a.tone));\n\n/** The file name of a picture in the set: `person-3` + 256 → `person-3-256.webp`; `svg` has no size. */\nexport function defaultAvatarFile(kind: DefaultAvatarKind, tone: number, size: DefaultAvatarSize | \"svg\"): string {\n return size === \"svg\" ? `${kind}-${tone}.svg` : `${kind}-${tone}-${size}.webp`;\n}\n\n/** Linear on purpose: a `/\\/+$/` regex backtracks quadratically on a long run of slashes. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) end--;\n return value.slice(0, end);\n}\n\n/**\n * The URL of a default avatar: `defaultAvatarUrl({ brand: \"orazaka\", seed: user.id })`.\n * @param size 256 for lists, 512 for a profile; `\"svg\"` for the vector.\n * @param base Another host or version of the set (a self-hosted copy); the default is the Krizaka CDN.\n */\nexport function defaultAvatarUrl(avatar: DefaultAvatar, { size = 256, base = DEFAULT_AVATAR_BASE }: { size?: DefaultAvatarSize | \"svg\"; base?: string } = {}): string {\n return `${trimTrailingSlashes(base)}/${avatar.brand}/${defaultAvatarFile(avatar.kind ?? \"person\", resolveTone(avatar), size)}`;\n}\n\n/** The SVG source of a default avatar, 512 × 512 and square (the Avatar clips it round). */\nexport function defaultAvatarSvg(avatar: DefaultAvatar): string {\n const [from, to] = defaultAvatarTone(avatar.brand, resolveTone(avatar));\n const person =\n (avatar.kind ?? \"person\") === \"person\"\n ? `<circle cx=\"256\" cy=\"200\" r=\"86\" fill=\"#fff\" fill-opacity=\".92\"/><path d=\"M84 512c0-108 78-182 172-182s172 74 172 182z\" fill=\"#fff\" fill-opacity=\".92\"/>`\n : \"\";\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"${from}\"/><stop offset=\"1\" stop-color=\"${to}\"/></linearGradient><radialGradient id=\"l\" cx=\".28\" cy=\".18\" r=\".85\"><stop offset=\"0\" stop-color=\"#fff\" stop-opacity=\".24\"/><stop offset=\"1\" stop-color=\"#fff\" stop-opacity=\"0\"/></radialGradient></defs><rect width=\"512\" height=\"512\" fill=\"url(#g)\"/><rect width=\"512\" height=\"512\" fill=\"url(#l)\"/>${person}</svg>`;\n}\n"],"mappings":";;;AACA,SAAS,UAAU,uBAAuB;AAC1C,YAAY,WAAW;AACvB,SAAS,UAA6B;;;ACO/B,IAAM,wBAAuD,CAAC,WAAW,WAAW,WAAW,WAAW,WAAW,YAAY,aAAa,SAAS;AACvJ,IAAM,uBAAqD,CAAC,UAAU,OAAO;AAC7E,IAAM,uBAAqD,CAAC,KAAK,GAAG;AAEpE,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAiBnC,IAAM,SAAuH;AAAA,EAC3H,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,GAAG,QAAQ,GAAG;AAAA,EAC9D,SAAS,EAAE,MAAM,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,QAAQ,EAAE;AAAA,EAC/D,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,MAAM,IAAI,GAAG,QAAQ,GAAG;AAAA,EAC1E,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,GAAG,QAAQ,GAAG;AAAA,EAC9D,SAAS,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,I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AACzB,QAAM,CAAC,QAAQ,SAAS,IAAU,eAAwB,IAAI;AAE9D,QAAM,SAAS,gBAAgB,gBAAgB,iBAAiB,eAAe,EAAE,MAAM,SAAS,QAAQ,SAAS,OAAO,MAAM,IAAI,CAAC,IAAI;AACvI,QAAM,QAAQ,OAAO,WAAW,MAAM,MAAM;AAC5C,SACE,qBAAC,gBAAgB,MAAhB,EAAqB,aAAW,QAAQ,MAAM,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAClF;AAAA,aACC;AAAA,MAAC,gBAAgB;AAAA,MAAhB;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,WAAW,EAAE,MAAM;AAAA,QACnB,uBAAuB,CAAC,WAAW;AACjC,cAAI,WAAW,WAAW,UAAU,IAAK,WAAU,GAAG;AAAA,QACxD;AAAA;AAAA,IACF;AAAA,IAEF,oBAAC,gBAAgB,UAAhB,EAAyB,SAAS,QAAQ,MAAM,GAAG,WAAW,EAAE,SAAS,GACvE,oBACH;AAAA,KACF;AAEJ;AAUO,SAAS,YAAY,EAAE,KAAK,MAAM,WAAW,UAAU,GAAG,MAAM,GAAqB;AAC1F,QAAM,QAAc,eAAS,QAAQ,QAAQ;AAC7C,QAAM,QAAQ,QAAQ,SAAY,QAAQ,MAAM,MAAM,GAAG,GAAG;AAC5D,QAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SACE,qBAAC,SAAI,WAAW,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAChD;AAAA;AAAA,IACA,OAAO,KAAK,oBAAC,cAAW,MAAY,UAAU,IAAI,IAAI,IAAI;AAAA,KAC7D;AAEJ;AAGO,IAAM,SAAS,OAAO,OAAO,YAAY,EAAE,OAAO,YAAY,CAAC;","names":["avatar"]}
|
|
1
|
+
{"version":3,"sources":["../src/avatar/avatar.tsx","../src/avatar/default-avatar.ts"],"sourcesContent":["// Client: Radix tracks the image's loading state and shows the fallback until it has loaded (or when it fails).\nimport { Avatar as AvatarPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { type DefaultAvatar, defaultAvatarUrl } from \"./default-avatar\";\n\nconst avatar = tv({\n slots: {\n root: \"relative inline-flex shrink-0 overflow-hidden rounded-full bg-surface-3 align-middle\",\n image: \"h-full w-full object-cover\",\n fallback: \"flex h-full w-full items-center justify-center font-semibold uppercase text-fg-secondary\",\n group: \"flex items-center -space-x-2 [&>*]:ring-2 [&>*]:ring-surface-0\",\n },\n variants: {\n size: {\n xs: { root: \"h-5 w-5 text-[9px]\" },\n sm: { root: \"h-8 w-8 text-xs\" },\n md: { root: \"h-10 w-10 text-sm\" },\n lg: { root: \"h-14 w-14 text-base\" },\n xl: { root: \"h-20 w-20 text-lg\" },\n },\n },\n defaultVariants: { size: \"md\" },\n});\n\nexport type AvatarSize = NonNullable<VariantProps<typeof avatar>[\"size\"]>;\n\nexport type AvatarProps = Omit<React.ComponentProps<\"span\">, \"children\"> & {\n /** The image's URL; `null` or nothing shows the `fallback`. */\n src?: string | null;\n /** The image's text alternative (the person's name); empty when a visible name sits next to the avatar. */\n alt?: string;\n /** Shown while the image loads, when it fails or when there is none: initials, an icon. */\n fallback?: React.ReactNode;\n /** The picture to show instead when `src` is missing or fails to load (an image URL). The `fallback` still covers its own loading. */\n fallbackSrc?: string;\n /**\n * The Krizaka default picture when the person has no photo (or it fails): their brand's gradient and a silhouette,\n * one of six tones from `seed` — `defaultAvatar={{ brand: \"orazaka\", seed: user.id }}`. `fallbackSrc` wins over it.\n */\n defaultAvatar?: DefaultAvatar;\n /**\n * xs · sm · md · lg · xl.\n * @default \"md\"\n */\n size?: AvatarSize;\n};\n\nexport function AvatarRoot({ src, alt = \"\", fallback, fallbackSrc, defaultAvatar, size, className, ...props }: AvatarProps) {\n const s = avatar({ size });\n const [failed, setFailed] = React.useState<string | null>(null);\n // 512 px for the big sizes, 256 for the others: sharp on a 2x screen either way.\n const backup = fallbackSrc ?? (defaultAvatar ? defaultAvatarUrl(defaultAvatar, { size: size === \"xl\" || size === \"lg\" ? 512 : 256 }) : undefined);\n const shown = src && failed !== src ? src : backup;\n return (\n <AvatarPrimitive.Root data-size={size ?? \"md\"} className={s.root({ className })} {...props}>\n {shown && (\n <AvatarPrimitive.Image\n src={shown}\n alt={alt}\n className={s.image()}\n onLoadingStatusChange={(status) => {\n if (status === \"error\" && shown === src) setFailed(src);\n }}\n />\n )}\n <AvatarPrimitive.Fallback delayMs={shown ? 300 : 0} className={s.fallback()}>\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n}\n\nexport type AvatarGroupProps = React.ComponentProps<\"div\"> & {\n /** How many avatars are shown; the rest becomes a `+n` avatar. */\n max?: number;\n /** The size of the `+n` avatar (match the avatars of the group). */\n size?: AvatarSize;\n};\n\n/** Overlapping avatars; past `max`, a `+n` avatar counts the rest. */\nexport function AvatarGroup({ max, size, className, children, ...props }: AvatarGroupProps) {\n const items = React.Children.toArray(children);\n const shown = max === undefined ? items : items.slice(0, max);\n const rest = items.length - shown.length;\n return (\n <div className={avatar().group({ className })} {...props}>\n {shown}\n {rest > 0 && <AvatarRoot size={size} fallback={`+${rest}`} />}\n </div>\n );\n}\n\n/** `Avatar` (an image with a fallback) and `Avatar.Group`. */\nexport const Avatar = Object.assign(AvatarRoot, { Group: AvatarGroup });\n","// The default profile pictures of the Krizaka family: what a product shows when a person has no photo.\n// They are generated from this file (tools/export-brand.mjs renders them to SVG and WebP and uploads them to Bunny,\n// `people/defaults/v1/<brand>/…`), so the pictures and the URLs that name them cannot drift apart.\n\n/** A brand of the default avatars. `orochia`, `yasakia`, `yororis` and `kachizaka` are deprecated: paused products (2026-10-25), removed in the next major; their pictures stay served until then. */\nexport type DefaultAvatarBrand = \"krizaka\" | \"orazaka\" | \"orochia\" | \"yasakia\" | \"yororis\" | \"yomizaka\" | \"kachizaka\" | \"akinaza\";\n/**\n * What the picture is of. `person`: a neutral silhouette. `plain`: the brand's gradient alone, ready for initials.\n * `folder`, `organisation` and `shop` are the pictures of a thing that is not a person (a folder or collection, a company, a shop):\n * a glyph on the gradient, never a silhouette. The central sets of these kinds are in the Krizaka org JSON (`defaults`, `@krizaka/org`).\n */\nexport type DefaultAvatarKind = \"person\" | \"plain\" | \"folder\" | \"organisation\" | \"shop\";\n/** The kinds of entity that have a set of default pictures of their own (`plain` is a style of `person`). */\nexport type DefaultAvatarEntityKind = \"person\" | \"folder\" | \"organisation\" | \"shop\";\nexport type DefaultAvatarSize = 256 | 512;\n\nexport const DEFAULT_AVATAR_BRANDS: readonly DefaultAvatarBrand[] = [\"krizaka\", \"orazaka\", \"orochia\", \"yasakia\", \"yororis\", \"yomizaka\", \"kachizaka\", \"akinaza\"];\n/** The two styles of the legacy brand sets (`people/defaults/v1/<brand>`); the kinds of the central sets are `DEFAULT_AVATAR_ENTITY_KINDS`. */\nexport const DEFAULT_AVATAR_KINDS: readonly DefaultAvatarKind[] = [\"person\", \"plain\"];\nexport const DEFAULT_AVATAR_ENTITY_KINDS: readonly DefaultAvatarEntityKind[] = [\"person\", \"folder\", \"organisation\", \"shop\"];\nexport const DEFAULT_AVATAR_SIZES: readonly DefaultAvatarSize[] = [256, 512];\n/** How many tones each brand has: a person always gets the same one from their seed, so a list is not one colour. */\nexport const DEFAULT_AVATAR_TONES = 6;\n\n/** Where the set lives. `v1` is the set's version: a changed picture is a new version folder, never an overwrite. */\nexport const DEFAULT_AVATAR_BASE = \"https://krizaka-assets.b-cdn.net/people/defaults/v1\";\n\nexport interface DefaultAvatar {\n /** The brand of the product showing the avatar: its gradient, its hues. */\n brand: DefaultAvatarBrand;\n /** Any stable text or number of the person (their id): the same seed gives the same tone everywhere. */\n seed?: string | number;\n /** Force a tone, 1 to 6, instead of deriving it from `seed`. */\n tone?: number;\n /**\n * `person` (default): a silhouette. `plain`: the gradient alone. `folder`, `organisation`, `shop`: that thing's glyph, drawn here\n * (a data URL, no request) — a folder is never given a person.\n * @default \"person\"\n */\n kind?: DefaultAvatarKind;\n}\n\n/** The mark gradient of each brand (BRAND.md, `$extensions[\"com.krizaka\"].mark`) as [hue, saturation %, lightness %] and the hue spread of its tones. */\nconst BRANDS: Record<DefaultAvatarBrand, { from: [number, number, number]; to: [number, number, number]; spread: number }> = {\n krizaka: { from: [217, 92, 53], to: [217, 92, 68], spread: 14 },\n orazaka: { from: [26, 90.5, 37.1], to: [26, 92, 45], spread: 7 },\n orochia: { from: [262.1, 83.3, 57.8], to: [328.6, 85.5, 70.2], spread: 12 },\n yasakia: { from: [156, 92, 32], to: [178, 90, 32], spread: 12 },\n yororis: { from: [34, 46, 44], to: [104, 28, 42], spread: 10 },\n yomizaka: { from: [232, 50, 55], to: [248, 50, 58], spread: 10 },\n kachizaka: { from: [226, 80, 56], to: [44, 92, 33], spread: 10 },\n akinaza: { from: [140, 48, 34], to: [22, 60, 46], spread: 10 },\n};\n\n/** White on top of a stop must stay visible: a stop is darkened until the contrast reaches this (WCAG 1.4.11, non-text). */\nconst MIN_CONTRAST = 3.2;\nconst OFFSETS = [0, -1, 1, -2, 2, 3] as const;\n\nfunction hslToHex([h, s, l]: [number, number, number]): string {\n const sat = s / 100;\n const light = l / 100;\n const k = (n: number) => (n + (((h % 360) + 360) % 360) / 30) % 12;\n const a = sat * Math.min(light, 1 - light);\n const channel = (n: number) => Math.round(255 * (light - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));\n return `#${[0, 8, 4].map((n) => channel(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst channelLuminance = (v: number) => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst whiteContrast = (hex: string) => {\n const [r, g, b] = [1, 3, 5].map((i) => channelLuminance(Number.parseInt(hex.slice(i, i + 2), 16) / 255));\n return 1.05 / (0.2126 * r! + 0.7152 * g! + 0.0722 * b! + 0.05);\n};\n/** The stop, darkened one point of lightness at a time until white reads on it. */\nfunction readable([h, s, l]: [number, number, number]): string {\n let hex = hslToHex([h, s, l]);\n for (let light = l; whiteContrast(hex) < MIN_CONTRAST && light > 10; light -= 1) hex = hslToHex([h, s, light]);\n return hex;\n}\n\n/** The two stops (hex) of tone `tone` (1 to 6) of a brand. */\nexport function defaultAvatarTone(brand: DefaultAvatarBrand, tone: number): readonly [string, string] {\n const b = BRANDS[brand];\n const o = OFFSETS[(clampTone(tone) - 1) % OFFSETS.length] * b.spread;\n return [readable([b.from[0] + o, b.from[1], b.from[2]]), readable([b.to[0] + o, b.to[1], b.to[2]])];\n}\n\nconst clampTone = (tone: number) => Math.min(DEFAULT_AVATAR_TONES, Math.max(1, Math.round(tone)));\n\n/** 1 to 6 from a seed (FNV-1a): stable across renders, devices and products. */\nexport function defaultAvatarToneOf(seed: string | number | undefined): number {\n if (seed === undefined) return 1;\n let h = 0x811c9dc5;\n for (const ch of String(seed)) {\n h ^= ch.codePointAt(0) ?? 0;\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return (h % DEFAULT_AVATAR_TONES) + 1;\n}\n\nconst resolveTone = (a: DefaultAvatar) => (a.tone === undefined ? defaultAvatarToneOf(a.seed) : clampTone(a.tone));\n\n/** The file name of a picture in the set: `person-3` + 256 → `person-3-256.webp`; `svg` has no size. */\nexport function defaultAvatarFile(kind: DefaultAvatarKind, tone: number, size: DefaultAvatarSize | \"svg\"): string {\n return size === \"svg\" ? `${kind}-${tone}.svg` : `${kind}-${tone}-${size}.webp`;\n}\n\n/** Linear on purpose: a `/\\/+$/` regex backtracks quadratically on a long run of slashes. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) end--;\n return value.slice(0, end);\n}\n\n/**\n * The URL of a default avatar: `defaultAvatarUrl({ brand: \"orazaka\", seed: user.id })`.\n * @param size 256 for lists, 512 for a profile; `\"svg\"` for the vector.\n * @param base Another host or version of the set (a self-hosted copy); the default is the Krizaka CDN.\n */\nexport function defaultAvatarUrl(avatar: DefaultAvatar, { size = 256, base = DEFAULT_AVATAR_BASE }: { size?: DefaultAvatarSize | \"svg\"; base?: string } = {}): string {\n if (isGlyphKind(avatar.kind)) return defaultAvatarDataUrl(avatar);\n return `${trimTrailingSlashes(base)}/${avatar.brand}/${defaultAvatarFile(avatar.kind ?? \"person\", resolveTone(avatar), size)}`;\n}\n\nconst GLYPHS: Record<\"folder\" | \"organisation\" | \"shop\", (from: string) => string> = {\n folder: () => `<path d=\"M96 176a28 28 0 0 1 28-28h92l40 44h132a28 28 0 0 1 28 28v152a28 28 0 0 1-28 28H124a28 28 0 0 1-28-28z\" fill=\"#fff\" fill-opacity=\".92\"/>`,\n organisation: (from) =>\n `<rect x=\"136\" y=\"104\" width=\"240\" height=\"304\" rx=\"16\" fill=\"#fff\" fill-opacity=\".92\"/>${[160, 226, 292]\n .flatMap((y) => [168, 236, 304].map((x) => `<rect x=\"${x}\" y=\"${y}\" width=\"40\" height=\"40\" rx=\"6\" fill=\"${from}\"/>`))\n .join(\"\")}<rect x=\"232\" y=\"352\" width=\"48\" height=\"56\" rx=\"6\" fill=\"${from}\"/>`,\n shop: (from) =>\n `<path d=\"M112 132h288l24 84a56 56 0 0 1-112 0 56 56 0 0 1-112 0 56 56 0 0 1-112 0z\" fill=\"#fff\" fill-opacity=\".92\"/><rect x=\"136\" y=\"292\" width=\"240\" height=\"116\" rx=\"12\" fill=\"#fff\" fill-opacity=\".92\"/><rect x=\"226\" y=\"326\" width=\"60\" height=\"82\" rx=\"8\" fill=\"${from}\"/><rect x=\"156\" y=\"318\" width=\"48\" height=\"44\" rx=\"6\" fill=\"${from}\"/><rect x=\"308\" y=\"318\" width=\"48\" height=\"44\" rx=\"6\" fill=\"${from}\"/>`,\n};\n\ntype GlyphKind = keyof typeof GLYPHS;\nconst isGlyphKind = (kind: DefaultAvatarKind | undefined): kind is GlyphKind => kind === \"folder\" || kind === \"organisation\" || kind === \"shop\";\n\n/** The picture as a `data:` URL: nothing to fetch, so a folder, an organisation or a shop always has its picture (offline, in a test, before the CDN answers). */\nexport function defaultAvatarDataUrl(avatar: DefaultAvatar): string {\n return `data:image/svg+xml,${encodeURIComponent(defaultAvatarSvg(avatar))}`;\n}\n\n/** The SVG source of a default avatar, 512 × 512 and square (the Avatar clips it round). */\nexport function defaultAvatarSvg(avatar: DefaultAvatar): string {\n const [from, to] = defaultAvatarTone(avatar.brand, resolveTone(avatar));\n const kind = avatar.kind ?? \"person\";\n const person = isGlyphKind(kind)\n ? GLYPHS[kind](from)\n : kind === \"person\"\n ? `<circle cx=\"256\" cy=\"200\" r=\"86\" fill=\"#fff\" fill-opacity=\".92\"/><path d=\"M84 512c0-108 78-182 172-182s172 74 172 182z\" fill=\"#fff\" fill-opacity=\".92\"/>`\n : \"\";\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"${from}\"/><stop offset=\"1\" stop-color=\"${to}\"/></linearGradient><radialGradient id=\"l\" cx=\".28\" cy=\".18\" r=\".85\"><stop offset=\"0\" stop-color=\"#fff\" stop-opacity=\".24\"/><stop offset=\"1\" stop-color=\"#fff\" stop-opacity=\"0\"/></radialGradient></defs><rect width=\"512\" height=\"512\" fill=\"url(#g)\"/><rect width=\"512\" height=\"512\" fill=\"url(#l)\"/>${person}</svg>`;\n}\n"],"mappings":";;;AACA,SAAS,UAAU,uBAAuB;AAC1C,YAAY,WAAW;AACvB,SAAS,UAA6B;;;ACa/B,IAAM,wBAAuD,CAAC,WAAW,WAAW,WAAW,WAAW,WAAW,YAAY,aAAa,SAAS;AAEvJ,IAAM,uBAAqD,CAAC,UAAU,OAAO;AAC7E,IAAM,8BAAkE,CAAC,UAAU,UAAU,gBAAgB,MAAM;AACnH,IAAM,uBAAqD,CAAC,KAAK,GAAG;AAEpE,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAkBnC,IAAM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AS,gBAAgB,gBAAgB,iBAAiB,eAAe,EAAE,MAAM,SAAS,QAAQ,SAAS,OAAO,MAAM,IAAI,CAAC,IAAI;AACvI,QAAM,QAAQ,OAAO,WAAW,MAAM,MAAM;AAC5C,SACE,qBAAC,gBAAgB,MAAhB,EAAqB,aAAW,QAAQ,MAAM,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAClF;AAAA,aACC;AAAA,MAAC,gBAAgB;AAAA,MAAhB;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,WAAW,EAAE,MAAM;AAAA,QACnB,uBAAuB,CAAC,WAAW;AACjC,cAAI,WAAW,WAAW,UAAU,IAAK,WAAU,GAAG;AAAA,QACxD;AAAA;AAAA,IACF;AAAA,IAEF,oBAAC,gBAAgB,UAAhB,EAAyB,SAAS,QAAQ,MAAM,GAAG,WAAW,EAAE,SAAS,GACvE,oBACH;AAAA,KACF;AAEJ;AAUO,SAAS,YAAY,EAAE,KAAK,MAAM,WAAW,UAAU,GAAG,MAAM,GAAqB;AAC1F,QAAM,QAAc,eAAS,QAAQ,QAAQ;AAC7C,QAAM,QAAQ,QAAQ,SAAY,QAAQ,MAAM,MAAM,GAAG,GAAG;AAC5D,QAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SACE,qBAAC,SAAI,WAAW,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAChD;AAAA;AAAA,IACA,OAAO,KAAK,oBAAC,cAAW,MAAY,UAAU,IAAI,IAAI,IAAI;AAAA,KAC7D;AAEJ;AAGO,IAAM,SAAS,OAAO,OAAO,YAAY,EAAE,OAAO,YAAY,CAAC;","names":["avatar"]}
|
package/dist/blocks.css
CHANGED
|
@@ -1878,3 +1878,44 @@ svg[data-bird="beaver"]{--kzb-pivot:60px 56px;--kzb-head-a:kzb-beaver-head 10s e
|
|
|
1878
1878
|
.kz-review-reply { margin-inline-start: 1rem; padding-inline-start: .75rem; border-inline-start: 2px solid var(--kz-paper-rule-margin); display: grid; gap: .25rem; }
|
|
1879
1879
|
.kz-review-reply-label { margin: 0; font: .8125rem/1.4 var(--kz-font-mono); color: var(--kz-text-secondary); }
|
|
1880
1880
|
.kz-review-reply-text { margin: 0; font: .9375rem/1.55 var(--kz-font-sans); color: var(--kz-accent-text); white-space: pre-wrap; }
|
|
1881
|
+
|
|
1882
|
+
/* ─── Shop page (ADR-007 §2, krizaka-ui#742): the frame and the rhythm of every section of a shop page ───
|
|
1883
|
+
The density sets one rhythm for the page: `compact` 40 px between two sections (24 on a phone), `airy` 64 px (40);
|
|
1884
|
+
heading to content 16 px; a hairline between sections, inside the gutters. A section never sets its own margin. */
|
|
1885
|
+
.kz-shop { --kz-shop-gap: 24px; --kz-shop-g: var(--kz-page-gutter, clamp(16px, 3.2vw, 32px)); }
|
|
1886
|
+
.kz-shop[data-density="airy"] { --kz-shop-gap: 40px; }
|
|
1887
|
+
@media (min-width: 40rem) {
|
|
1888
|
+
.kz-shop { --kz-shop-gap: 40px; }
|
|
1889
|
+
.kz-shop[data-density="airy"] { --kz-shop-gap: 64px; }
|
|
1890
|
+
}
|
|
1891
|
+
.kz-shop-section { position: relative; padding-block: calc(var(--kz-shop-gap) / 2); }
|
|
1892
|
+
.kz-shop-section + .kz-shop-section::before {
|
|
1893
|
+
content: ""; position: absolute; top: 0; left: 50%; height: 1px; transform: translateX(-50%);
|
|
1894
|
+
width: min(calc(100% - 2 * var(--kz-shop-g)), var(--kz-page-max, 72rem)); background: var(--kz-border-subtle);
|
|
1895
|
+
}
|
|
1896
|
+
.kz-shop-section[data-first] { padding-block: 0; }
|
|
1897
|
+
.kz-shop-section[data-first] + .kz-shop-section::before { display: none; }
|
|
1898
|
+
.kz-shop-section :is(h2, h3)[id] { scroll-margin-top: var(--kz-anchor-offset, 96px); }
|
|
1899
|
+
.kz-shop-section .kz-heading { margin-bottom: 16px; gap: 4px; }
|
|
1900
|
+
.kz-shop-section .kz-heading-title { max-width: none; font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
|
|
1901
|
+
.kz-shop-section .kz-heading-lead { font-size: 14.5px; line-height: 1.55; }
|
|
1902
|
+
/* The look preset's photo treatment (a CSS filter on the media box: no re-encoded image) — see @krizaka/tokens presets/shop. */
|
|
1903
|
+
.kz-shop [data-shop-photo] { filter: var(--kz-shop-photo-filter, none); border-radius: var(--kz-shop-photo-radius, var(--kz-radius-md, 8px)); }
|
|
1904
|
+
@media (min-width: 64rem) { .kz-shop-aside { position: sticky; top: var(--kz-anchor-offset, 96px); } }
|
|
1905
|
+
|
|
1906
|
+
/* The look presets' typography and photo treatment (@krizaka/tokens `shop-presets.css`, krizaka-ui#745): the title weight and the
|
|
1907
|
+
grain are the preset's (`--kz-shop-title-weight`, `--kz-shop-grain`); without a preset the page keeps its default. */
|
|
1908
|
+
.kz-shop-title { font-weight: var(--kz-shop-title-weight, 700); }
|
|
1909
|
+
.kz-shop-section .kz-heading-title { font-weight: var(--kz-shop-title-weight); }
|
|
1910
|
+
.kz-shop [data-shop-photo]::after {
|
|
1911
|
+
content: var(--kz-shop-grain, none); position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay; opacity: 0.07;
|
|
1912
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
|
|
1913
|
+
}
|
|
1914
|
+
/* Washi: a thin paper, the page's surface warmed by a few percent of the accent (the contrast test reads the same mix). */
|
|
1915
|
+
[data-paper="washi"] { background-color: color-mix(in srgb, var(--kz-surface-0) 94%, var(--kz-accent) 6%); }
|
|
1916
|
+
|
|
1917
|
+
/* The composer's thumbnails (ADR-007 §5): a section drawn with demo data at the size of a card — 960 px of page in 160 × 96. */
|
|
1918
|
+
.kz-shop-thumb { position: relative; width: 160px; height: 96px; margin-inline: auto; overflow: hidden; border-radius: 6px; background: var(--kz-surface-0); pointer-events: none; }
|
|
1919
|
+
.kz-shop-thumb-inner { position: absolute; top: 0; left: 0; width: 960px; transform-origin: top left; transform: scale(0.16667); }
|
|
1920
|
+
/* The section the composer outlines in the preview page (the bridge sets `data-shop-selected` on the block wrapped around it): a ring, never a layout change. */
|
|
1921
|
+
[data-shop-key][data-shop-selected] { outline: 2px solid var(--kz-accent); outline-offset: -2px; }
|
package/dist/chat.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-B47WSPMP.js";
|
|
4
|
+
|
|
5
|
+
// src/shop/photo.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var RATIOS = {
|
|
8
|
+
"1/1": "aspect-square",
|
|
9
|
+
"4/5": "aspect-[4/5]",
|
|
10
|
+
"3/4": "aspect-[3/4]",
|
|
11
|
+
"4/3": "aspect-[4/3]",
|
|
12
|
+
"3/2": "aspect-[3/2]",
|
|
13
|
+
"16/9": "aspect-video",
|
|
14
|
+
"21/9": "aspect-[21/9]"
|
|
15
|
+
};
|
|
16
|
+
function Photo({ photo, ratio, sizes, priority, className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("div", { "data-shop-photo": "", "data-ratio": ratio, className: cn("relative w-full overflow-hidden bg-media", RATIOS[ratio], className), ...props, children: /* @__PURE__ */ jsx(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
src: photo.src,
|
|
21
|
+
srcSet: photo.srcSet,
|
|
22
|
+
sizes: photo.srcSet ? sizes : void 0,
|
|
23
|
+
alt: photo.alt,
|
|
24
|
+
loading: priority ? void 0 : "lazy",
|
|
25
|
+
fetchPriority: priority ? "high" : void 0,
|
|
26
|
+
decoding: "async",
|
|
27
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
28
|
+
}
|
|
29
|
+
) });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
Photo
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-5D7NMUF6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shop/photo.tsx"],"sourcesContent":["// Server-safe. A photo in a box of one fixed ratio (CLS 0): the box is the ratio, the image fills it (ADR-007 §6).\nimport type * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport type { ShopPhoto } from \"./frame\";\n\nconst RATIOS = {\n \"1/1\": \"aspect-square\",\n \"4/5\": \"aspect-[4/5]\",\n \"3/4\": \"aspect-[3/4]\",\n \"4/3\": \"aspect-[4/3]\",\n \"3/2\": \"aspect-[3/2]\",\n \"16/9\": \"aspect-video\",\n \"21/9\": \"aspect-[21/9]\",\n} as const;\nexport type ShopRatio = keyof typeof RATIOS;\n\nexport type PhotoProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n photo: ShopPhoto;\n ratio: ShopRatio;\n /** The `sizes` of the image for this variant (ADR-007 §6). */\n sizes?: string;\n /** The first screen's image: high priority, never lazy. */\n priority?: boolean;\n};\n\n/** A photo in a fixed-ratio box; the look preset's grade and radius apply (`data-shop-photo`). */\nexport function Photo({ photo, ratio, sizes, priority, className, ...props }: PhotoProps) {\n return (\n <div data-shop-photo=\"\" data-ratio={ratio} className={cn(\"relative w-full overflow-hidden bg-media\", RATIOS[ratio], className)} {...props}>\n <img\n src={photo.src}\n srcSet={photo.srcSet}\n sizes={photo.srcSet ? sizes : undefined}\n alt={photo.alt}\n loading={priority ? undefined : \"lazy\"}\n fetchPriority={priority ? \"high\" : undefined}\n decoding=\"async\"\n className=\"absolute inset-0 h-full w-full object-cover\"\n />\n </div>\n );\n}\n"],"mappings":";;;;;AA8BM;AAxBN,IAAM,SAAS;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;AAaO,SAAS,MAAM,EAAE,OAAO,OAAO,OAAO,UAAU,WAAW,GAAG,MAAM,GAAe;AACxF,SACE,oBAAC,SAAI,mBAAgB,IAAG,cAAY,OAAO,WAAW,GAAG,4CAA4C,OAAO,KAAK,GAAG,SAAS,GAAI,GAAG,OAClI;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,MAAM;AAAA,MACX,QAAQ,MAAM;AAAA,MACd,OAAO,MAAM,SAAS,QAAQ;AAAA,MAC9B,KAAK,MAAM;AAAA,MACX,SAAS,WAAW,SAAY;AAAA,MAChC,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT,WAAU;AAAA;AAAA,EACZ,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Page,
|
|
3
|
+
SectionHeading,
|
|
4
|
+
cn
|
|
5
|
+
} from "./chunk-B47WSPMP.js";
|
|
6
|
+
|
|
7
|
+
// src/shop/frame.tsx
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var PAPERS = { plain: void 0, seyes: "ruled", kraft: "kraft", washi: "washi" };
|
|
11
|
+
function ShopFrame({ preset, density = "compact", accent, paper = "plain", className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { "data-shop-preset": preset, "data-shop-accent": accent, "data-paper": PAPERS[paper], "data-density": density, className: cn("kz-shop", className), ...props });
|
|
13
|
+
}
|
|
14
|
+
function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, className, children, ...props }) {
|
|
15
|
+
const auto = React.useId();
|
|
16
|
+
const headingId = title ? `${id ?? auto}-title` : void 0;
|
|
17
|
+
const heading = title ? /* @__PURE__ */ jsx(SectionHeading, { id: headingId, size: "sm", eyebrow, title, lead, actions }) : null;
|
|
18
|
+
return /* @__PURE__ */ jsx("section", { id, "aria-labelledby": headingId, "data-first": first ? "" : void 0, "data-bleed": bleed ? "" : void 0, className: cn("kz-shop-section", className), ...props, children: bleed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
+
heading && /* @__PURE__ */ jsx(Page, { children: heading }),
|
|
20
|
+
children
|
|
21
|
+
] }) : /* @__PURE__ */ jsxs(Page, { children: [
|
|
22
|
+
heading,
|
|
23
|
+
children
|
|
24
|
+
] }) });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
ShopFrame,
|
|
29
|
+
ShopSection
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chunk-A7MQPIEG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shop/frame.tsx"],"sourcesContent":["// Server-safe. The frame and the rhythm of a shop page (ADR-007 §2): every section draws inside the page frame between the\n// gutters (`bleed` for a photo only), one vertical rhythm set by the density, a hairline between sections. No section sets\n// its own margin: it only says what it holds.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Page, SectionHeading } from \"../page/page\";\n\n/** A photo the product resolved: the address, its words, and the widths it has (`srcSet`). */\nexport type ShopPhoto = {\n src: string;\n /** What it shows, in words; empty when it only sets a mood. */\n alt: string;\n /** The widths the product holds (`/a-480.avif 480w, /a-960.avif 960w`); the section brings the `sizes`. */\n srcSet?: string;\n};\n\nexport type ShopFrameProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The look preset (`salon-vitrine`, `@krizaka/tokens`): its tokens apply to everything inside. */\n preset?: string;\n /**\n * The rhythm: `compact` 40 px between sections (24 on a phone), `airy` 64 px (40). The document's, or the preset's.\n * @default \"compact\"\n */\n density?: \"compact\" | \"airy\";\n /**\n * One of the accents the preset lists as tested (`krizaka`, `akinaza:accent-2`…): the owner's choice within the look. Without it, the preset's own.\n * @see @krizaka/tokens `shopPresets`\n */\n accent?: string;\n /**\n * The paper under the page, from the preset: `seyes` (ruled), `kraft` (brown — mount `PaperGrain` once), `washi` (a tint of the accent) or `plain`.\n * @default \"plain\"\n */\n paper?: \"plain\" | \"seyes\" | \"kraft\" | \"washi\";\n};\n\nconst PAPERS = { plain: undefined, seyes: \"ruled\", kraft: \"kraft\", washi: \"washi\" } as const;\n\n/** The page: sets the look preset, the accent, the paper and the density the sections below read. */\nexport function ShopFrame({ preset, density = \"compact\", accent, paper = \"plain\", className, ...props }: ShopFrameProps) {\n return <div data-shop-preset={preset} data-shop-accent={accent} data-paper={PAPERS[paper]} data-density={density} className={cn(\"kz-shop\", className)} {...props} />;\n}\n\nexport type ShopSectionProps = Omit<React.HTMLAttributes<HTMLElement>, \"title\"> & {\n /** The section's id: the anchor, and the heading's id. */\n id?: string;\n /** The `h2`. Without one the section is named by `aria-label`. */\n title?: React.ReactNode;\n /** A short lower-case note above the title. */\n eyebrow?: React.ReactNode;\n /** One sentence under the title. */\n lead?: React.ReactNode;\n /** A link or a button on the right of the heading (« All times → »). */\n actions?: React.ReactNode;\n /** The content reaches the edges of the screen (a photo, a strip); the heading stays on the frame. */\n bleed?: boolean;\n /** The section is the page's first (the hero): no hairline, no padding. */\n first?: boolean;\n};\n\n/** A section of a shop page. */\nexport function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, className, children, ...props }: ShopSectionProps) {\n const auto = React.useId();\n const headingId = title ? `${id ?? auto}-title` : undefined;\n const heading = title ? <SectionHeading id={headingId} size=\"sm\" eyebrow={eyebrow} title={title} lead={lead} actions={actions} /> : null;\n return (\n <section id={id} aria-labelledby={headingId} data-first={first ? \"\" : undefined} data-bleed={bleed ? \"\" : undefined} className={cn(\"kz-shop-section\", className)} {...props}>\n {bleed ? (\n <>\n {heading && <Page>{heading}</Page>}\n {children}\n </>\n ) : (\n <Page>\n {heading}\n {children}\n </Page>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;AAGA,YAAY,WAAW;AAsCd,SA4BD,UA5BC,KA4BD,YA5BC;AAJT,IAAM,SAAS,EAAE,OAAO,QAAW,OAAO,SAAS,OAAO,SAAS,OAAO,QAAQ;AAG3E,SAAS,UAAU,EAAE,QAAQ,UAAU,WAAW,QAAQ,QAAQ,SAAS,WAAW,GAAG,MAAM,GAAmB;AACvH,SAAO,oBAAC,SAAI,oBAAkB,QAAQ,oBAAkB,QAAQ,cAAY,OAAO,KAAK,GAAG,gBAAc,SAAS,WAAW,GAAG,WAAW,SAAS,GAAI,GAAG,OAAO;AACpK;AAoBO,SAAS,YAAY,EAAE,IAAI,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO,WAAW,UAAU,GAAG,MAAM,GAAqB;AAChI,QAAM,OAAa,YAAM;AACzB,QAAM,YAAY,QAAQ,GAAG,MAAM,IAAI,WAAW;AAClD,QAAM,UAAU,QAAQ,oBAAC,kBAAe,IAAI,WAAW,MAAK,MAAK,SAAkB,OAAc,MAAY,SAAkB,IAAK;AACpI,SACE,oBAAC,aAAQ,IAAQ,mBAAiB,WAAW,cAAY,QAAQ,KAAK,QAAW,cAAY,QAAQ,KAAK,QAAW,WAAW,GAAG,mBAAmB,SAAS,GAAI,GAAG,OACnK,kBACC,iCACG;AAAA,eAAW,oBAAC,QAAM,mBAAQ;AAAA,IAC1B;AAAA,KACH,IAEA,qBAAC,QACE;AAAA;AAAA,IACA;AAAA,KACH,GAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/cn.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { cnMerge } from "tailwind-variants";
|
|
4
|
+
var twMergeConfig = {
|
|
5
|
+
extend: {
|
|
6
|
+
classGroups: {
|
|
7
|
+
"bg-image": ["bg-sheen", "bg-fill-shade", "bg-halo"],
|
|
8
|
+
shadow: ["shadow-raised", "shadow-floating", "shadow-overlay", "shadow-glow", "shadow-glow-lg"],
|
|
9
|
+
"inset-shadow": ["inset-shadow-edge", "inset-shadow-edge-fill", "inset-shadow-well"]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var mergeConfig = { twMergeConfig };
|
|
14
|
+
function cn(...inputs) {
|
|
15
|
+
return cnMerge(clsx(inputs))(mergeConfig) ?? "";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/page/page.tsx
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
function Page({ size = "default", as: Tag = "div", paper, margin, className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Tag,
|
|
24
|
+
{
|
|
25
|
+
"data-size": size === "default" ? void 0 : size,
|
|
26
|
+
"data-paper": paper,
|
|
27
|
+
"data-margin": margin ? "" : void 0,
|
|
28
|
+
className: cn("kz-frame", className),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function SectionHeading({ id, eyebrow, number, title, lead, actions, level = 2, size = "md", align = "start", reveal, className, ...props }) {
|
|
34
|
+
const H = level === 2 ? "h2" : "h3";
|
|
35
|
+
return /* @__PURE__ */ jsxs(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: cn("kz-heading", className),
|
|
39
|
+
"data-size": size === "md" ? void 0 : size,
|
|
40
|
+
"data-align": align === "start" ? void 0 : align,
|
|
41
|
+
"data-actions": actions ? "" : void 0,
|
|
42
|
+
"data-reveal": reveal ? "" : void 0,
|
|
43
|
+
...props,
|
|
44
|
+
children: [
|
|
45
|
+
number && /* @__PURE__ */ jsx("span", { className: "kz-heading-number", children: number }),
|
|
46
|
+
eyebrow && /* @__PURE__ */ jsx("p", { className: "kz-eyebrow", children: eyebrow }),
|
|
47
|
+
/* @__PURE__ */ jsx(H, { id, className: "kz-heading-title", children: title }),
|
|
48
|
+
lead && /* @__PURE__ */ jsx("p", { className: "kz-heading-lead", children: lead }),
|
|
49
|
+
actions && /* @__PURE__ */ jsx("div", { className: "kz-heading-actions", children: actions })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
cn,
|
|
57
|
+
Page,
|
|
58
|
+
SectionHeading
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=chunk-B47WSPMP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cn.ts","../src/page/page.tsx"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { cnMerge, type TWMergeConfig } from \"tailwind-variants\";\n\nexport type { ClassValue };\n\n/**\n * The preset's own utilities, told to the merge engine: the material (BRAND.md §6: `bg-sheen`, `bg-fill-shade`,\n * `bg-halo` are background images; `shadow-raised` · `-floating` · `-overlay` · `-glow` are shadows; `inset-shadow-edge`\n * · `-edge-fill` · `-well` are inset shadows). Unknown, tailwind-merge would take `bg-sheen` for a colour and drop the\n * `bg-surface-2` it lies on.\n */\nexport const twMergeConfig: TWMergeConfig = {\n extend: {\n classGroups: {\n \"bg-image\": [\"bg-sheen\", \"bg-fill-shade\", \"bg-halo\"],\n shadow: [\"shadow-raised\", \"shadow-floating\", \"shadow-overlay\", \"shadow-glow\", \"shadow-glow-lg\"],\n \"inset-shadow\": [\"inset-shadow-edge\", \"inset-shadow-edge-fill\", \"inset-shadow-well\"],\n },\n },\n};\n\nconst mergeConfig = { twMergeConfig };\n\n/**\n * Merges Tailwind classes: the last one wins — a product's `className` overrides the primitive's. The merge engine is\n * tailwind-merge as tailwind-variants ships it (the one `tv` uses), so the platform carries a single copy of it.\n * tailwind-variants bundles that engine since 3.3 (it never imports the `tailwind-merge` package, an optional peer):\n * hence `tailwind-variants ^3.3.1` and no `tailwind-merge` dependency — `scripts/consumer.mjs` checks it on a clean\n * install of the packed package.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return cnMerge(clsx(inputs))(mergeConfig) ?? \"\";\n}\n\n","// Server-safe. The frame of every page (blocks.css): one width, one pair of gutters, one vertical rhythm — so the\n// navigation, the hero and every section line up on the same edges, at any width.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { SectionBackdrop, type SectionBackdropProps } from \"../section-backdrop/section-backdrop\";\n\nexport type PageSize = \"narrow\" | \"default\" | \"wide\" | \"full\";\n\n/**\n * The paper under a page or a section (Cahier, ADR-004): `ruled` (Seyès squares), `lines` (lines only), `dot-grid` (a dot\n * every 24 px), `kraft` (brown paper with a grain: mount `PaperGrain` once), or plain.\n */\nexport type PagePaper = \"ruled\" | \"lines\" | \"dot-grid\" | \"kraft\";\n\ntype PaperProps = {\n /** The notebook's paper under the content: `ruled` (Seyès: 32 px squares, three fine lines), `lines` (lines only, a page to read), `dot-grid` (dots), `kraft` (brown, grained). */\n paper?: PagePaper;\n /** The red margin line on the left, where section numbers and notes hang (`§ 2`, `fig. 1`). */\n margin?: boolean;\n};\n\nexport type PageProps = React.HTMLAttributes<HTMLElement> & {\n /**\n * The width of the content: `default` (72rem, `--kz-page-max`), `narrow` (48rem, a reading column), `wide`\n * (88rem, documentation with a sidebar), `full` (the gutters only).\n * @default \"default\"\n */\n size?: PageSize;\n /** The element: `div` (default), `main`, `header`, `footer`, `section` or `article`. */\n as?: \"div\" | \"main\" | \"header\" | \"footer\" | \"section\" | \"article\";\n} & PaperProps;\n\n/** The page frame: centred, at most `--kz-page-max` wide, with the gutters of `--kz-page-gutter` (16 → 32 px). */\nexport function Page({ size = \"default\", as: Tag = \"div\", paper, margin, className, ...props }: PageProps) {\n return (\n <Tag\n data-size={size === \"default\" ? undefined : size}\n data-paper={paper}\n data-margin={margin ? \"\" : undefined}\n className={cn(\"kz-frame\", className)}\n {...props}\n />\n );\n}\n\nexport type SectionHeadingProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> & {\n /** The id of the title: the section's anchor and its accessible name. */\n id?: string;\n /** A short note above the title (the section's subject), in the note face, lower case — never an uppercase overline. */\n eyebrow?: React.ReactNode;\n /** The section's number, hung in the margin as a notebook numbers its pages (`§ 2`). */\n number?: React.ReactNode;\n /** The title. */\n title: React.ReactNode;\n /** One or two sentences under the title. */\n lead?: React.ReactNode;\n /** Actions on the right of the heading (a link to everything, a filter). */\n actions?: React.ReactNode;\n /**\n * The level of the title.\n * @default 2\n */\n level?: 2 | 3;\n /**\n * `md` for a section that argues, `sm` for a section of a reading page.\n * @default \"md\"\n */\n size?: \"sm\" | \"md\";\n /**\n * `center` for a heading that stands alone above a grid.\n * @default \"start\"\n */\n align?: \"start\" | \"center\";\n /** Rises into place once, as it enters the viewport (`[data-reveal]`, MotionObserver). Never on the first screen. */\n reveal?: boolean;\n};\n\n/** The head of a section: eyebrow (mono, the accent), title, lead — and its actions on the right. */\nexport function SectionHeading({ id, eyebrow, number, title, lead, actions, level = 2, size = \"md\", align = \"start\", reveal, className, ...props }: SectionHeadingProps) {\n const H = level === 2 ? \"h2\" : \"h3\";\n return (\n <div\n className={cn(\"kz-heading\", className)}\n data-size={size === \"md\" ? undefined : size}\n data-align={align === \"start\" ? undefined : align}\n data-actions={actions ? \"\" : undefined}\n data-reveal={reveal ? \"\" : undefined}\n {...props}\n >\n {number && <span className=\"kz-heading-number\">{number}</span>}\n {eyebrow && <p className=\"kz-eyebrow\">{eyebrow}</p>}\n <H id={id} className=\"kz-heading-title\">\n {title}\n </H>\n {lead && <p className=\"kz-heading-lead\">{lead}</p>}\n {actions && <div className=\"kz-heading-actions\">{actions}</div>}\n </div>\n );\n}\n\nexport type SectionProps = Omit<React.HTMLAttributes<HTMLElement>, \"title\"> & {\n /** The id of the title (and the anchor of the section). Required with a `title`. */\n id?: string;\n /** The heading's eyebrow. */\n eyebrow?: React.ReactNode;\n /** The section's number in the margin (`§ 2`). */\n number?: React.ReactNode;\n /** The section's title: an `h2` (a `SectionHeading`), which names the section for assistive technology. */\n title?: React.ReactNode;\n /** The heading's lead. */\n lead?: React.ReactNode;\n /** The heading's actions. */\n actions?: React.ReactNode;\n /**\n * The heading's size: `md` for a page that argues, `sm` for a reading page.\n * @default \"md\"\n */\n headingSize?: \"sm\" | \"md\";\n /**\n * The heading's alignment.\n * @default \"start\"\n */\n headingAlign?: \"start\" | \"center\";\n /** The heading rises into place once (never on the first screen). */\n reveal?: boolean;\n /** A hairline above the section, inside the gutters: the transition between two sections of the same surface. */\n divider?: boolean;\n /**\n * The vertical space above and below: `sm` (a reading page), `md`, `lg` (a page's main moments).\n * @default \"md\"\n */\n spacing?: \"sm\" | \"md\" | \"lg\";\n /**\n * The width of the content.\n * @default \"default\"\n */\n size?: PageSize;\n /** The brand's colour transition behind the section (SectionBackdrop): `true`, or its props (`direction`, `grid`…). */\n backdrop?: boolean | Omit<SectionBackdropProps, \"as\" | \"children\">;\n} & PaperProps;\n\n/**\n * A section of a page: full-bleed (its backdrop reaches the edges), its content in the page frame, its heading on top.\n * Sections follow each other on one rhythm; a `divider` or a `backdrop` marks the transition.\n */\nexport function Section({\n id,\n eyebrow,\n number,\n title,\n lead,\n actions,\n headingSize,\n headingAlign,\n reveal,\n divider,\n spacing = \"md\",\n size,\n backdrop,\n paper,\n margin,\n className,\n children,\n ...props\n}: SectionProps) {\n const body = (\n <Page size={size} data-margin={margin ? \"\" : undefined}>\n {title && <SectionHeading id={id} eyebrow={eyebrow} number={number} title={title} lead={lead} actions={actions} size={headingSize} align={headingAlign} reveal={reveal} />}\n {children}\n </Page>\n );\n const shared = {\n \"aria-labelledby\": title && id ? id : undefined,\n \"data-divider\": divider ? \"\" : undefined,\n \"data-spacing\": spacing === \"md\" ? undefined : spacing,\n \"data-paper\": paper,\n ...props,\n };\n if (backdrop) {\n const backdropProps = backdrop === true ? {} : backdrop;\n return (\n <SectionBackdrop {...backdropProps} {...shared} className={cn(\"kz-section\", className)}>\n {body}\n </SectionBackdrop>\n );\n }\n return (\n <section {...shared} className={cn(\"kz-section\", className)}>\n {body}\n </section>\n );\n}\n\nexport type TicksProps = {\n /** A sentence where words between backticks are code: \"Every request carries a `requestId`.\" */\n children: string;\n};\n\n/** A sentence of a message catalogue where words between backticks read as code — no markup in the translations. */\nexport function Ticks({ children }: TicksProps) {\n const parts = children.split(\"`\");\n return (\n <>\n {parts.map((part, i) =>\n i % 2 ? (\n <code key={i} className=\"kz-ic\">\n {part}\n </code>\n ) : (\n <React.Fragment key={i}>{part}</React.Fragment>\n ),\n )}\n </>\n );\n}\n\nexport interface Fact {\n /** A few words: `npm 2.5.0`, `Maven Central`, `in progress`. */\n label: string;\n /**\n * `ok` — published, usable today; `wip` — in progress, said honestly; `neutral` — a fact.\n * @default \"neutral\"\n */\n tone?: \"ok\" | \"wip\" | \"neutral\";\n /** Where the fact is proven (a registry page): the fact becomes a link. */\n href?: string;\n}\n\nexport type FactsProps = React.HTMLAttributes<HTMLUListElement> & {\n /** The facts, in reading order. */\n items: readonly Fact[];\n};\n\n/** Compact facts on one line — a dot that says the state, a few mono words. Links open in a new tab. */\nexport function Facts({ items, className, ...props }: FactsProps) {\n return (\n <ul className={cn(\"kz-facts\", className)} {...props}>\n {items.map((fact) => {\n const body = (\n <>\n <span className=\"kz-fact-dot\" aria-hidden /> {fact.label}\n </>\n );\n const tone = fact.tone && fact.tone !== \"neutral\" ? fact.tone : undefined;\n return (\n <li key={fact.label}>\n {fact.href ? (\n <a href={fact.href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"kz-fact\" data-tone={tone}>\n {body}\n </a>\n ) : (\n <span className=\"kz-fact\" data-tone={tone}>\n {body}\n </span>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":";AAAA,SAA0B,YAAY;AACtC,SAAS,eAAmC;AAUrC,IAAM,gBAA+B;AAAA,EAC1C,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,YAAY,CAAC,YAAY,iBAAiB,SAAS;AAAA,MACnD,QAAQ,CAAC,iBAAiB,mBAAmB,kBAAkB,eAAe,gBAAgB;AAAA,MAC9F,gBAAgB,CAAC,qBAAqB,0BAA0B,mBAAmB;AAAA,IACrF;AAAA,EACF;AACF;AAEA,IAAM,cAAc,EAAE,cAAc;AAS7B,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,C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.b-cdn.net/people/defaults/v1";
|
|
4
|
+
var BRANDS = {
|
|
5
|
+
krizaka: { from: [217, 92, 53], to: [217, 92, 68], spread: 14 },
|
|
6
|
+
orazaka: { from: [26, 90.5, 37.1], to: [26, 92, 45], spread: 7 },
|
|
7
|
+
orochia: { from: [262.1, 83.3, 57.8], to: [328.6, 85.5, 70.2], spread: 12 },
|
|
8
|
+
yasakia: { from: [156, 92, 32], to: [178, 90, 32], spread: 12 },
|
|
9
|
+
yororis: { from: [34, 46, 44], to: [104, 28, 42], spread: 10 },
|
|
10
|
+
yomizaka: { from: [232, 50, 55], to: [248, 50, 58], spread: 10 },
|
|
11
|
+
kachizaka: { from: [226, 80, 56], to: [44, 92, 33], spread: 10 },
|
|
12
|
+
akinaza: { from: [140, 48, 34], to: [22, 60, 46], spread: 10 }
|
|
13
|
+
};
|
|
14
|
+
var MIN_CONTRAST = 3.2;
|
|
15
|
+
var OFFSETS = [0, -1, 1, -2, 2, 3];
|
|
16
|
+
function hslToHex([h, s, l]) {
|
|
17
|
+
const sat = s / 100;
|
|
18
|
+
const light = l / 100;
|
|
19
|
+
const k = (n) => (n + (h % 360 + 360) % 360 / 30) % 12;
|
|
20
|
+
const a = sat * Math.min(light, 1 - light);
|
|
21
|
+
const channel = (n) => Math.round(255 * (light - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));
|
|
22
|
+
return `#${[0, 8, 4].map((n) => channel(n).toString(16).padStart(2, "0")).join("")}`;
|
|
23
|
+
}
|
|
24
|
+
var channelLuminance = (v) => v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
25
|
+
var whiteContrast = (hex) => {
|
|
26
|
+
const [r, g, b] = [1, 3, 5].map((i) => channelLuminance(Number.parseInt(hex.slice(i, i + 2), 16) / 255));
|
|
27
|
+
return 1.05 / (0.2126 * r + 0.7152 * g + 0.0722 * b + 0.05);
|
|
28
|
+
};
|
|
29
|
+
function readable([h, s, l]) {
|
|
30
|
+
let hex = hslToHex([h, s, l]);
|
|
31
|
+
for (let light = l; whiteContrast(hex) < MIN_CONTRAST && light > 10; light -= 1) hex = hslToHex([h, s, light]);
|
|
32
|
+
return hex;
|
|
33
|
+
}
|
|
34
|
+
function defaultAvatarTone(brand, tone) {
|
|
35
|
+
const b = BRANDS[brand];
|
|
36
|
+
const o = OFFSETS[(clampTone(tone) - 1) % OFFSETS.length] * b.spread;
|
|
37
|
+
return [readable([b.from[0] + o, b.from[1], b.from[2]]), readable([b.to[0] + o, b.to[1], b.to[2]])];
|
|
38
|
+
}
|
|
39
|
+
var clampTone = (tone) => Math.min(DEFAULT_AVATAR_TONES, Math.max(1, Math.round(tone)));
|
|
40
|
+
function defaultAvatarToneOf(seed) {
|
|
41
|
+
if (seed === void 0) return 1;
|
|
42
|
+
let h = 2166136261;
|
|
43
|
+
for (const ch of String(seed)) {
|
|
44
|
+
h ^= ch.codePointAt(0) ?? 0;
|
|
45
|
+
h = Math.imul(h, 16777619) >>> 0;
|
|
46
|
+
}
|
|
47
|
+
return h % DEFAULT_AVATAR_TONES + 1;
|
|
48
|
+
}
|
|
49
|
+
var resolveTone = (a) => a.tone === void 0 ? defaultAvatarToneOf(a.seed) : clampTone(a.tone);
|
|
50
|
+
function defaultAvatarFile(kind, tone, size) {
|
|
51
|
+
return size === "svg" ? `${kind}-${tone}.svg` : `${kind}-${tone}-${size}.webp`;
|
|
52
|
+
}
|
|
53
|
+
function trimTrailingSlashes(value) {
|
|
54
|
+
let end = value.length;
|
|
55
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end--;
|
|
56
|
+
return value.slice(0, end);
|
|
57
|
+
}
|
|
58
|
+
function defaultAvatarUrl(avatar2, { size = 256, base = DEFAULT_AVATAR_BASE } = {}) {
|
|
59
|
+
if (isGlyphKind(avatar2.kind)) return defaultAvatarDataUrl(avatar2);
|
|
60
|
+
return `${trimTrailingSlashes(base)}/${avatar2.brand}/${defaultAvatarFile(avatar2.kind ?? "person", resolveTone(avatar2), size)}`;
|
|
61
|
+
}
|
|
62
|
+
var GLYPHS = {
|
|
63
|
+
folder: () => `<path d="M96 176a28 28 0 0 1 28-28h92l40 44h132a28 28 0 0 1 28 28v152a28 28 0 0 1-28 28H124a28 28 0 0 1-28-28z" fill="#fff" fill-opacity=".92"/>`,
|
|
64
|
+
organisation: (from) => `<rect x="136" y="104" width="240" height="304" rx="16" fill="#fff" fill-opacity=".92"/>${[160, 226, 292].flatMap((y) => [168, 236, 304].map((x) => `<rect x="${x}" y="${y}" width="40" height="40" rx="6" fill="${from}"/>`)).join("")}<rect x="232" y="352" width="48" height="56" rx="6" fill="${from}"/>`,
|
|
65
|
+
shop: (from) => `<path d="M112 132h288l24 84a56 56 0 0 1-112 0 56 56 0 0 1-112 0 56 56 0 0 1-112 0z" fill="#fff" fill-opacity=".92"/><rect x="136" y="292" width="240" height="116" rx="12" fill="#fff" fill-opacity=".92"/><rect x="226" y="326" width="60" height="82" rx="8" fill="${from}"/><rect x="156" y="318" width="48" height="44" rx="6" fill="${from}"/><rect x="308" y="318" width="48" height="44" rx="6" fill="${from}"/>`
|
|
66
|
+
};
|
|
67
|
+
var isGlyphKind = (kind) => kind === "folder" || kind === "organisation" || kind === "shop";
|
|
68
|
+
function defaultAvatarDataUrl(avatar2) {
|
|
69
|
+
return `data:image/svg+xml,${encodeURIComponent(defaultAvatarSvg(avatar2))}`;
|
|
70
|
+
}
|
|
71
|
+
function defaultAvatarSvg(avatar2) {
|
|
72
|
+
const [from, to] = defaultAvatarTone(avatar2.brand, resolveTone(avatar2));
|
|
73
|
+
const kind = avatar2.kind ?? "person";
|
|
74
|
+
const person = isGlyphKind(kind) ? GLYPHS[kind](from) : kind === "person" ? `<circle cx="256" cy="200" r="86" fill="#fff" fill-opacity=".92"/><path d="M84 512c0-108 78-182 172-182s172 74 172 182z" fill="#fff" fill-opacity=".92"/>` : "";
|
|
75
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="${from}"/><stop offset="1" stop-color="${to}"/></linearGradient><radialGradient id="l" cx=".28" cy=".18" r=".85"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient></defs><rect width="512" height="512" fill="url(#g)"/><rect width="512" height="512" fill="url(#l)"/>${person}</svg>`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/avatar/avatar.tsx
|
|
79
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
80
|
+
import * as React from "react";
|
|
81
|
+
import { tv } from "tailwind-variants";
|
|
82
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
83
|
+
var avatar = tv({
|
|
84
|
+
slots: {
|
|
85
|
+
root: "relative inline-flex shrink-0 overflow-hidden rounded-full bg-surface-3 align-middle",
|
|
86
|
+
image: "h-full w-full object-cover",
|
|
87
|
+
fallback: "flex h-full w-full items-center justify-center font-semibold uppercase text-fg-secondary",
|
|
88
|
+
group: "flex items-center -space-x-2 [&>*]:ring-2 [&>*]:ring-surface-0"
|
|
89
|
+
},
|
|
90
|
+
variants: {
|
|
91
|
+
size: {
|
|
92
|
+
xs: { root: "h-5 w-5 text-[9px]" },
|
|
93
|
+
sm: { root: "h-8 w-8 text-xs" },
|
|
94
|
+
md: { root: "h-10 w-10 text-sm" },
|
|
95
|
+
lg: { root: "h-14 w-14 text-base" },
|
|
96
|
+
xl: { root: "h-20 w-20 text-lg" }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: { size: "md" }
|
|
100
|
+
});
|
|
101
|
+
function AvatarRoot({ src, alt = "", fallback, fallbackSrc, defaultAvatar, size, className, ...props }) {
|
|
102
|
+
const s = avatar({ size });
|
|
103
|
+
const [failed, setFailed] = React.useState(null);
|
|
104
|
+
const backup = fallbackSrc ?? (defaultAvatar ? defaultAvatarUrl(defaultAvatar, { size: size === "xl" || size === "lg" ? 512 : 256 }) : void 0);
|
|
105
|
+
const shown = src && failed !== src ? src : backup;
|
|
106
|
+
return /* @__PURE__ */ jsxs(AvatarPrimitive.Root, { "data-size": size ?? "md", className: s.root({ className }), ...props, children: [
|
|
107
|
+
shown && /* @__PURE__ */ jsx(
|
|
108
|
+
AvatarPrimitive.Image,
|
|
109
|
+
{
|
|
110
|
+
src: shown,
|
|
111
|
+
alt,
|
|
112
|
+
className: s.image(),
|
|
113
|
+
onLoadingStatusChange: (status) => {
|
|
114
|
+
if (status === "error" && shown === src) setFailed(src);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsx(AvatarPrimitive.Fallback, { delayMs: shown ? 300 : 0, className: s.fallback(), children: fallback })
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
function AvatarGroup({ max, size, className, children, ...props }) {
|
|
122
|
+
const items = React.Children.toArray(children);
|
|
123
|
+
const shown = max === void 0 ? items : items.slice(0, max);
|
|
124
|
+
const rest = items.length - shown.length;
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", { className: avatar().group({ className }), ...props, children: [
|
|
126
|
+
shown,
|
|
127
|
+
rest > 0 && /* @__PURE__ */ jsx(AvatarRoot, { size, fallback: `+${rest}` })
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
var Avatar = Object.assign(AvatarRoot, { Group: AvatarGroup });
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
DEFAULT_AVATAR_TONES,
|
|
134
|
+
defaultAvatarUrl,
|
|
135
|
+
Avatar
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=chunk-EUJ7337V.js.map
|