@techfides/ui-library-design 0.5.0 → 0.8.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/dist/anatomies.d.ts +1586 -0
- package/dist/anatomies.js +107 -0
- package/dist/anatomies.js.map +1 -0
- package/dist/anatomy.d.ts +13 -0
- package/dist/anatomy.js +6 -0
- package/dist/anatomy.js.map +1 -0
- package/dist/cn.generated.js +217 -0
- package/dist/cn.generated.js.map +1 -0
- package/dist/cn.js +10 -166
- package/dist/cn.js.map +1 -1
- package/dist/control.d.ts +1 -2
- package/dist/control.js +1 -2
- package/dist/control.js.map +1 -1
- package/dist/index.d.ts +55 -52
- package/dist/index.js +59 -56
- package/dist/recipes/accordion.d.ts +28 -1
- package/dist/recipes/accordion.js +29 -1
- package/dist/recipes/accordion.js.map +1 -1
- package/dist/recipes/alert.d.ts +45 -1
- package/dist/recipes/alert.js +45 -1
- package/dist/recipes/alert.js.map +1 -1
- package/dist/recipes/band.d.ts +11 -1
- package/dist/recipes/band.js +7 -1
- package/dist/recipes/band.js.map +1 -1
- package/dist/recipes/bars.d.ts +60 -1
- package/dist/recipes/bars.js +59 -1
- package/dist/recipes/bars.js.map +1 -1
- package/dist/recipes/brandMark.d.ts +8 -1
- package/dist/recipes/brandMark.js +7 -1
- package/dist/recipes/brandMark.js.map +1 -1
- package/dist/recipes/button.d.ts +41 -4
- package/dist/recipes/button.js +31 -2
- package/dist/recipes/button.js.map +1 -1
- package/dist/recipes/cardHeader.d.ts +18 -1
- package/dist/recipes/cardHeader.js +19 -1
- package/dist/recipes/cardHeader.js.map +1 -1
- package/dist/recipes/checkbox.d.ts +16 -1
- package/dist/recipes/checkbox.js +16 -3
- package/dist/recipes/checkbox.js.map +1 -1
- package/dist/recipes/chip.d.ts +41 -2
- package/dist/recipes/chip.js +34 -1
- package/dist/recipes/chip.js.map +1 -1
- package/dist/recipes/codeEditor.d.ts +8 -1
- package/dist/recipes/codeEditor.js +7 -1
- package/dist/recipes/codeEditor.js.map +1 -1
- package/dist/recipes/datePicker.d.ts +62 -1
- package/dist/recipes/datePicker.js +56 -3
- package/dist/recipes/datePicker.js.map +1 -1
- package/dist/recipes/dialog.d.ts +49 -1
- package/dist/recipes/dialog.js +40 -1
- package/dist/recipes/dialog.js.map +1 -1
- package/dist/recipes/feature.d.ts +30 -1
- package/dist/recipes/feature.js +30 -2
- package/dist/recipes/feature.js.map +1 -1
- package/dist/recipes/field.js +1 -1
- package/dist/recipes/findings.d.ts +33 -1
- package/dist/recipes/findings.js +34 -1
- package/dist/recipes/findings.js.map +1 -1
- package/dist/recipes/heading.d.ts +12 -2
- package/dist/recipes/heading.js +7 -1
- package/dist/recipes/heading.js.map +1 -1
- package/dist/recipes/heartbeat.d.ts +52 -2
- package/dist/recipes/heartbeat.js +51 -4
- package/dist/recipes/heartbeat.js.map +1 -1
- package/dist/recipes/ink.d.ts +11 -0
- package/dist/recipes/ink.js +13 -0
- package/dist/recipes/ink.js.map +1 -0
- package/dist/recipes/input.d.ts +55 -1
- package/dist/recipes/input.js +52 -2
- package/dist/recipes/input.js.map +1 -1
- package/dist/recipes/listItem.d.ts +18 -1
- package/dist/recipes/listItem.js +20 -1
- package/dist/recipes/listItem.js.map +1 -1
- package/dist/recipes/listbox.d.ts +22 -2
- package/dist/recipes/listbox.js +19 -1
- package/dist/recipes/listbox.js.map +1 -1
- package/dist/recipes/marquee.d.ts +26 -2
- package/dist/recipes/marquee.js +24 -1
- package/dist/recipes/marquee.js.map +1 -1
- package/dist/recipes/menu.d.ts +33 -1
- package/dist/recipes/menu.js +29 -1
- package/dist/recipes/menu.js.map +1 -1
- package/dist/recipes/metaRow.d.ts +11 -2
- package/dist/recipes/metaRow.js +7 -1
- package/dist/recipes/metaRow.js.map +1 -1
- package/dist/recipes/meter.d.ts +36 -2
- package/dist/recipes/meter.js +34 -1
- package/dist/recipes/meter.js.map +1 -1
- package/dist/recipes/motion.d.ts +9 -1
- package/dist/recipes/nebula.js +1 -1
- package/dist/recipes/numberRange.d.ts +44 -1
- package/dist/recipes/numberRange.js +36 -1
- package/dist/recipes/numberRange.js.map +1 -1
- package/dist/recipes/paper.d.ts +55 -2
- package/dist/recipes/paper.js +47 -4
- package/dist/recipes/paper.js.map +1 -1
- package/dist/recipes/progressBar.d.ts +8 -1
- package/dist/recipes/progressBar.js +7 -1
- package/dist/recipes/progressBar.js.map +1 -1
- package/dist/recipes/queue.d.ts +33 -1
- package/dist/recipes/queue.js +35 -1
- package/dist/recipes/queue.js.map +1 -1
- package/dist/recipes/radioGroup.d.ts +18 -1
- package/dist/recipes/radioGroup.js +21 -3
- package/dist/recipes/radioGroup.js.map +1 -1
- package/dist/recipes/scopeSwitcher.d.ts +38 -1
- package/dist/recipes/scopeSwitcher.js +40 -1
- package/dist/recipes/scopeSwitcher.js.map +1 -1
- package/dist/recipes/scrollArea.d.ts +12 -3
- package/dist/recipes/scrollArea.js +7 -1
- package/dist/recipes/scrollArea.js.map +1 -1
- package/dist/recipes/searchPalette.d.ts +48 -1
- package/dist/recipes/searchPalette.js +49 -1
- package/dist/recipes/searchPalette.js.map +1 -1
- package/dist/recipes/sectionHeader.d.ts +20 -2
- package/dist/recipes/sectionHeader.js +20 -3
- package/dist/recipes/sectionHeader.js.map +1 -1
- package/dist/recipes/segmentedControl.d.ts +8 -1
- package/dist/recipes/segmentedControl.js +7 -1
- package/dist/recipes/segmentedControl.js.map +1 -1
- package/dist/recipes/select.d.ts +57 -1
- package/dist/recipes/select.js +51 -1
- package/dist/recipes/select.js.map +1 -1
- package/dist/recipes/separator.d.ts +13 -2
- package/dist/recipes/separator.js +8 -2
- package/dist/recipes/separator.js.map +1 -1
- package/dist/recipes/sidebar.d.ts +128 -2
- package/dist/recipes/sidebar.js +125 -2
- package/dist/recipes/sidebar.js.map +1 -1
- package/dist/recipes/sky.d.ts +31 -1
- package/dist/recipes/sky.js +30 -1
- package/dist/recipes/sky.js.map +1 -1
- package/dist/recipes/slider.d.ts +15 -1
- package/dist/recipes/slider.js +14 -1
- package/dist/recipes/slider.js.map +1 -1
- package/dist/recipes/stat.d.ts +71 -1
- package/dist/recipes/stat.js +73 -3
- package/dist/recipes/stat.js.map +1 -1
- package/dist/recipes/switch.d.ts +10 -1
- package/dist/recipes/switch.js +9 -3
- package/dist/recipes/switch.js.map +1 -1
- package/dist/recipes/table.d.ts +63 -3
- package/dist/recipes/table.js +56 -2
- package/dist/recipes/table.js.map +1 -1
- package/dist/recipes/tail.d.ts +40 -5
- package/dist/recipes/tail.js +37 -5
- package/dist/recipes/tail.js.map +1 -1
- package/dist/recipes/text.d.ts +16 -3
- package/dist/recipes/text.js +8 -3
- package/dist/recipes/text.js.map +1 -1
- package/dist/recipes/textarea.d.ts +46 -1
- package/dist/recipes/textarea.js +41 -1
- package/dist/recipes/textarea.js.map +1 -1
- package/dist/recipes/tile.d.ts +23 -1
- package/dist/recipes/tile.js +19 -1
- package/dist/recipes/tile.js.map +1 -1
- package/dist/recipes/tooltip.d.ts +8 -1
- package/dist/recipes/tooltip.js +7 -1
- package/dist/recipes/tooltip.js.map +1 -1
- package/dist/recipes/topBar.d.ts +43 -1
- package/dist/recipes/topBar.js +44 -1
- package/dist/recipes/topBar.js.map +1 -1
- package/dist/recipes/trail.d.ts +55 -5
- package/dist/recipes/trail.js +47 -5
- package/dist/recipes/trail.js.map +1 -1
- package/dist/recipes/userMenu.d.ts +23 -1
- package/dist/recipes/userMenu.js +24 -1
- package/dist/recipes/userMenu.js.map +1 -1
- package/package.json +3 -2
package/dist/recipes/sidebar.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { anatomy } from "../anatomy.js";
|
|
1
2
|
import { controlInert, controlPress, controlReach } from "../parts/control.js";
|
|
2
3
|
import { collapseMotion, drawerMotion, railCollapse, railMorph, scrimMirrorMotion } from "./motion.js";
|
|
3
|
-
import { eyebrowLead } from "../parts/eyebrow.js";
|
|
4
4
|
import { surfaceLifted, surfacePanel } from "../parts/surface.js";
|
|
5
|
+
import { eyebrowLead } from "../parts/eyebrow.js";
|
|
5
6
|
import { cva } from "class-variance-authority";
|
|
6
7
|
//#region src/recipes/sidebar.ts
|
|
7
8
|
const CHILD_INSET = "pl-11";
|
|
@@ -122,7 +123,129 @@ const sidebarDotRecipe = cva([
|
|
|
122
123
|
]);
|
|
123
124
|
const sidebarSubRecipe = cva(["flex flex-col gap-1 pt-1", ...collapseMotion]);
|
|
124
125
|
const sidebarFootRecipe = cva("relative mt-auto flex flex-none flex-col gap-1 px-3");
|
|
126
|
+
const sidebarAnatomy = anatomy({
|
|
127
|
+
brand: {
|
|
128
|
+
part: "brand",
|
|
129
|
+
recipe: sidebarBrandRecipe,
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
brandStack: {
|
|
133
|
+
part: "brand-stack",
|
|
134
|
+
recipe: sidebarBrandStackRecipe,
|
|
135
|
+
required: true
|
|
136
|
+
},
|
|
137
|
+
brandSubtitle: {
|
|
138
|
+
part: "brand-subtitle",
|
|
139
|
+
recipe: sidebarBrandSubtitleRecipe,
|
|
140
|
+
required: false
|
|
141
|
+
},
|
|
142
|
+
child: {
|
|
143
|
+
part: "child",
|
|
144
|
+
recipe: sidebarItemRecipe,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
dot: {
|
|
148
|
+
part: "dot",
|
|
149
|
+
recipe: sidebarDotRecipe,
|
|
150
|
+
required: false
|
|
151
|
+
},
|
|
152
|
+
foot: {
|
|
153
|
+
part: "foot",
|
|
154
|
+
recipe: sidebarFootRecipe,
|
|
155
|
+
required: true
|
|
156
|
+
},
|
|
157
|
+
head: {
|
|
158
|
+
part: "head",
|
|
159
|
+
recipe: sidebarHeadRecipe,
|
|
160
|
+
required: true
|
|
161
|
+
},
|
|
162
|
+
item: {
|
|
163
|
+
part: "item",
|
|
164
|
+
recipe: sidebarItemRecipe,
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
label: {
|
|
168
|
+
part: "label",
|
|
169
|
+
recipe: sidebarLabelRecipe,
|
|
170
|
+
required: true
|
|
171
|
+
},
|
|
172
|
+
mark: {
|
|
173
|
+
part: "mark",
|
|
174
|
+
recipe: sidebarMarkRecipe,
|
|
175
|
+
required: true
|
|
176
|
+
},
|
|
177
|
+
mobileBar: {
|
|
178
|
+
part: "mobile-bar",
|
|
179
|
+
recipe: sidebarMobileBarRecipe,
|
|
180
|
+
required: true
|
|
181
|
+
},
|
|
182
|
+
mobileEyebrow: {
|
|
183
|
+
part: "mobile-eyebrow",
|
|
184
|
+
recipe: sidebarMobileEyebrowRecipe,
|
|
185
|
+
required: false
|
|
186
|
+
},
|
|
187
|
+
mobileHeadings: {
|
|
188
|
+
part: "mobile-headings",
|
|
189
|
+
recipe: sidebarMobileHeadingsRecipe,
|
|
190
|
+
required: false
|
|
191
|
+
},
|
|
192
|
+
mobileTitle: {
|
|
193
|
+
part: "mobile-title",
|
|
194
|
+
recipe: sidebarMobileTitleRecipe,
|
|
195
|
+
required: false
|
|
196
|
+
},
|
|
197
|
+
nav: {
|
|
198
|
+
part: "nav",
|
|
199
|
+
recipe: sidebarNavRecipe,
|
|
200
|
+
required: true
|
|
201
|
+
},
|
|
202
|
+
overlayBody: {
|
|
203
|
+
part: "overlay-body",
|
|
204
|
+
recipe: sidebarOverlayBodyRecipe,
|
|
205
|
+
required: true
|
|
206
|
+
},
|
|
207
|
+
overlayBrand: {
|
|
208
|
+
part: "overlay-brand",
|
|
209
|
+
recipe: sidebarOverlayBrandRecipe,
|
|
210
|
+
required: true
|
|
211
|
+
},
|
|
212
|
+
overlayHead: {
|
|
213
|
+
part: "overlay-head",
|
|
214
|
+
recipe: sidebarOverlayHeadRecipe,
|
|
215
|
+
required: true
|
|
216
|
+
},
|
|
217
|
+
overlayScope: {
|
|
218
|
+
part: "overlay-scope",
|
|
219
|
+
recipe: sidebarOverlayScopeRecipe,
|
|
220
|
+
required: false
|
|
221
|
+
},
|
|
222
|
+
root: {
|
|
223
|
+
part: "sidebar",
|
|
224
|
+
recipe: sidebarRecipe,
|
|
225
|
+
required: true
|
|
226
|
+
},
|
|
227
|
+
scope: {
|
|
228
|
+
part: "scope",
|
|
229
|
+
recipe: sidebarScopeRecipe,
|
|
230
|
+
required: false
|
|
231
|
+
},
|
|
232
|
+
separator: {
|
|
233
|
+
part: "separator",
|
|
234
|
+
recipe: sidebarOverlaySeparatorRecipe,
|
|
235
|
+
required: true
|
|
236
|
+
},
|
|
237
|
+
switch: {
|
|
238
|
+
part: "switch",
|
|
239
|
+
recipe: sidebarSwitchRecipe,
|
|
240
|
+
required: true
|
|
241
|
+
},
|
|
242
|
+
wordmark: {
|
|
243
|
+
part: "wordmark",
|
|
244
|
+
recipe: sidebarWordmarkRecipe,
|
|
245
|
+
required: true
|
|
246
|
+
}
|
|
247
|
+
});
|
|
125
248
|
//#endregion
|
|
126
|
-
export { sidebarBrandRecipe, sidebarBrandStackRecipe, sidebarBrandSubtitleRecipe, sidebarChevronRecipe, sidebarDotRecipe, sidebarFootRecipe, sidebarGroupRecipe, sidebarHeadRecipe, sidebarIconRecipe, sidebarItemRecipe, sidebarLabelRecipe, sidebarMarkRecipe, sidebarMobileBarRecipe, sidebarMobileEyebrowRecipe, sidebarMobileHeadingsRecipe, sidebarMobileTitleRecipe, sidebarNavRecipe, sidebarOverlayBackdropRecipe, sidebarOverlayBodyRecipe, sidebarOverlayBrandRecipe, sidebarOverlayHeadRecipe, sidebarOverlayItemActive, sidebarOverlayNavRecipe, sidebarOverlayPanelRecipe, sidebarOverlayPositionerRecipe, sidebarOverlayScopeRecipe, sidebarOverlaySeparatorRecipe, sidebarRecipe, sidebarScopeRecipe, sidebarSubRecipe, sidebarSwitchRecipe, sidebarToggleRecipe, sidebarTravel, sidebarWordmarkRecipe };
|
|
249
|
+
export { sidebarAnatomy, sidebarBrandRecipe, sidebarBrandStackRecipe, sidebarBrandSubtitleRecipe, sidebarChevronRecipe, sidebarDotRecipe, sidebarFootRecipe, sidebarGroupRecipe, sidebarHeadRecipe, sidebarIconRecipe, sidebarItemRecipe, sidebarLabelRecipe, sidebarMarkRecipe, sidebarMobileBarRecipe, sidebarMobileEyebrowRecipe, sidebarMobileHeadingsRecipe, sidebarMobileTitleRecipe, sidebarNavRecipe, sidebarOverlayBackdropRecipe, sidebarOverlayBodyRecipe, sidebarOverlayBrandRecipe, sidebarOverlayHeadRecipe, sidebarOverlayItemActive, sidebarOverlayNavRecipe, sidebarOverlayPanelRecipe, sidebarOverlayPositionerRecipe, sidebarOverlayScopeRecipe, sidebarOverlaySeparatorRecipe, sidebarRecipe, sidebarScopeRecipe, sidebarSubRecipe, sidebarSwitchRecipe, sidebarToggleRecipe, sidebarTravel, sidebarWordmarkRecipe };
|
|
127
250
|
|
|
128
251
|
//# sourceMappingURL=sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","names":[],"sources":["../../src/recipes/sidebar.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { controlInert, controlPress, controlReach } from '#parts/control'\nimport { eyebrowLead } from '#parts/eyebrow'\nimport { surfaceLifted, surfacePanel } from '#parts/surface'\n\nimport { collapseMotion, drawerMotion, railCollapse, railMorph, scrimMirrorMotion } from './motion'\n\nconst CHILD_INSET = 'pl-11'\n\nconst ROW_STRIDE = `calc(var(--spacing-tf-control-md) + var(--spacing))`\n\nconst RAIL_STRIDE = `calc(var(--spacing-tf-control-md) + var(--spacing))`\n\nconst sidebarTravel = (index: number, rail: boolean): string => {\n const step = String(index)\n\n if (rail) {\n return `0 calc(${RAIL_STRIDE} * ${step})`\n }\n return `0 calc(${ROW_STRIDE} * ${step})`\n}\n\nconst MORPHS = railMorph\n\nconst ITEM = [\n 'group relative flex flex-none items-center rounded-tf-control',\n 'text-tf-body text-tf-muted',\n 'interactive:hovered:text-tf-fg aria-[current=page]:text-tf-on-accent',\n 'not-aria-[current=page]:interactive:hovered:bg-tf-panel-hi',\n `cursor-pointer ${MORPHS}`,\n ...controlReach,\n ...controlPress,\n ...controlInert,\n]\n\nconst sidebarRecipe = cva([\n 'sticky top-0 z-tf-dropdown hidden h-dvh min-h-0 flex-none flex-col gap-6 py-6 lg:flex',\n 'w-tf-sidebar data-rail:w-tf-rail',\n 'border-r border-tf-line-2 bg-tf-glass backdrop-blur-tf-glass',\n 'tf-icons font-tf-body text-tf-fg',\n MORPHS,\n])\n\nconst sidebarScopeRecipe = cva('flex-none px-3')\n\nconst sidebarMobileBarRecipe = cva([\n 'fixed inset-x-0 top-0 z-tf-dropdown flex items-center gap-3 px-4 lg:hidden',\n 'h-tf-control-lg border-b border-tf-line-2 bg-tf-panel-2 backdrop-blur-tf-panel',\n 'tf-icons font-tf-body text-tf-fg',\n])\n\nconst sidebarMobileHeadingsRecipe = cva('flex min-w-0 flex-1 flex-col gap-0')\n\nconst sidebarMobileEyebrowRecipe = cva(['truncate', eyebrowLead])\n\nconst sidebarMobileTitleRecipe = cva(\n 'truncate font-tf-display text-tf-h4 font-bold tracking-tf-tight text-tf-fg',\n)\n\nconst sidebarOverlayBackdropRecipe = cva([\n 'fixed inset-0 z-tf-modal bg-tf-scrim backdrop-blur-tf-scrim',\n ...scrimMirrorMotion,\n 'motion-reduce:animate-none',\n])\n\nconst sidebarOverlayPositionerRecipe = cva('fixed inset-0 z-tf-modal flex flex-col font-tf-body')\n\nconst sidebarOverlayPanelRecipe = cva([\n ...surfacePanel,\n ...surfaceLifted,\n 'flex h-full w-full flex-col overflow-hidden rounded-tf-none',\n 'text-tf-body-sm font-medium text-tf-fg',\n ...drawerMotion,\n 'motion-reduce:animate-none',\n])\n\nconst sidebarOverlayHeadRecipe = cva(\n 'relative flex flex-none items-center gap-5 border-b border-tf-line-2 px-4 py-3',\n)\n\nconst sidebarOverlayBrandRecipe = cva([\n 'flex min-w-0 items-center gap-3',\n '[&_svg]:size-tf-icon-solo-sm [&_svg]:shrink-0',\n])\n\nconst sidebarOverlayScopeRecipe = cva('ml-auto truncate text-tf-body-sm font-medium text-tf-fg')\n\nconst sidebarOverlayBodyRecipe = cva([\n 'flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4',\n 'tf-scroll-thin tf-scroll-faded',\n '[--tf-fade-foot:calc(var(--spacing)*2)] [--tf-fade-head:calc(var(--spacing)*2)]',\n])\n\nconst sidebarOverlayNavRecipe = cva('flex flex-none flex-col gap-1')\n\nconst sidebarOverlaySeparatorRecipe = cva('h-px w-full flex-none bg-tf-line-2')\n\nconst sidebarOverlayItemActive =\n 'aria-[current=page]:bg-tf-blend aria-[current=page]:blend-tf-accent'\n\nconst sidebarHeadRecipe = cva(['flex flex-none items-center gap-3 px-3', MORPHS])\n\nconst sidebarBrandRecipe = cva([\n 'flex min-w-0 items-center gap-3 pl-3',\n 'in-data-rail:gap-0 in-data-rail:pl-4',\n '[&_svg]:size-tf-icon-solo-sm [&_svg]:shrink-0',\n MORPHS,\n])\n\nconst sidebarBrandStackRecipe = cva(['flex flex-col gap-px', railCollapse])\n\nconst sidebarWordmarkRecipe = cva(['truncate font-tf-display text-tf-lead tracking-tf-tight'])\n\nconst sidebarBrandSubtitleRecipe = cva('truncate text-tf-caption-sm text-tf-muted')\n\nconst sidebarToggleRecipe = cva('flex-none [&_svg]:size-tf-icon-solo-sm')\n\nconst sidebarSwitchRecipe = cva([\n 'flex flex-none items-center justify-end in-data-rail:pr-2',\n MORPHS,\n])\n\nconst FADED = [\n 'tf-scroll-faded tf-scroll-thin',\n '[--tf-fade-head:calc(var(--spacing)*2)] [--tf-fade-foot:calc(var(--spacing)*2)]',\n 'outline-hidden focused:outline-2 focused:-outline-offset-2 focused:outline-tf-accent-hi',\n].join(' ')\n\nconst sidebarNavRecipe = cva([\n 'relative flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-3 py-2',\n FADED,\n])\n\nconst sidebarMarkRecipe = cva([\n 'pointer-events-none absolute inset-x-3 top-2 h-tf-control-md rounded-tf-control',\n 'in-data-rail:inset-x-4',\n 'bg-tf-blend blend-tf-accent',\n `tf-slides-settle ${MORPHS}`,\n])\n\nconst sidebarGroupRecipe = cva('flex flex-none flex-col')\n\nconst sidebarItemRecipe = cva(\n [\n ...ITEM,\n 'h-tf-control-md min-h-tf-control-md w-full text-left',\n '[&>svg]:size-tf-icon-sm [&>svg]:shrink-0',\n ],\n {\n defaultVariants: { level: 'top' },\n variants: {\n level: {\n child: `${CHILD_INSET} pr-3`,\n top: [\n 'gap-3 px-3',\n 'in-data-rail:gap-0',\n 'in-data-rail:px-[calc((var(--spacing-tf-rail)-var(--spacing)*6-var(--spacing-tf-icon-md))/2)]',\n ].join(' '),\n },\n },\n },\n)\n\nconst sidebarIconRecipe = cva([\n 'relative inline-flex size-tf-icon-md flex-none [&_svg]:size-tf-icon-md',\n '[&_svg]:shrink-0',\n MORPHS,\n])\n\nconst sidebarLabelRecipe = cva(['truncate text-left tf-text-trim', railCollapse])\n\nconst sidebarChevronRecipe = cva([\n 'w-tf-icon-sm flex-none overflow-hidden in-data-rail:w-0 in-data-rail:opacity-0',\n 'group-aria-expanded:rotate-180',\n MORPHS,\n])\n\nconst sidebarDotRecipe = cva([\n 'pointer-events-none absolute -right-1 -bottom-1',\n 'size-1 rounded-tf-pill bg-current opacity-0 in-data-rail:opacity-100',\n MORPHS,\n])\n\nconst sidebarSubRecipe = cva(['flex flex-col gap-1 pt-1', ...collapseMotion])\n\nconst sidebarFootRecipe = cva('relative mt-auto flex flex-none flex-col gap-1 px-3')\n\nexport {\n sidebarBrandRecipe,\n sidebarBrandStackRecipe,\n sidebarBrandSubtitleRecipe,\n sidebarChevronRecipe,\n sidebarDotRecipe,\n sidebarFootRecipe,\n sidebarGroupRecipe,\n sidebarHeadRecipe,\n sidebarIconRecipe,\n sidebarItemRecipe,\n sidebarLabelRecipe,\n sidebarMarkRecipe,\n sidebarMobileBarRecipe,\n sidebarMobileEyebrowRecipe,\n sidebarMobileHeadingsRecipe,\n sidebarMobileTitleRecipe,\n sidebarNavRecipe,\n sidebarOverlayBackdropRecipe,\n sidebarOverlayBodyRecipe,\n sidebarOverlayBrandRecipe,\n sidebarOverlayHeadRecipe,\n sidebarOverlayItemActive,\n sidebarOverlayNavRecipe,\n sidebarOverlayPanelRecipe,\n sidebarOverlayPositionerRecipe,\n sidebarOverlayScopeRecipe,\n sidebarOverlaySeparatorRecipe,\n sidebarRecipe,\n sidebarScopeRecipe,\n sidebarSubRecipe,\n sidebarSwitchRecipe,\n sidebarToggleRecipe,\n sidebarTravel,\n sidebarWordmarkRecipe,\n}\n"],"mappings":";;;;;;AAQA,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,MAAM,cAAc;AAEpB,MAAM,iBAAiB,OAAe,SAA0B;CAC9D,MAAM,OAAO,OAAO,KAAK;CAEzB,IAAI,MACF,OAAO,UAAU,YAAY,KAAK,KAAK;CAEzC,OAAO,UAAU,WAAW,KAAK,KAAK;AACxC;AAEA,MAAM,SAAS;AAEf,MAAM,OAAO;CACX;CACA;CACA;CACA;CACA,kBAAkB;CAClB,GAAG;CACH,GAAG;CACH,GAAG;AACL;AAEA,MAAM,gBAAgB,IAAI;CACxB;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,qBAAqB,IAAI,gBAAgB;AAE/C,MAAM,yBAAyB,IAAI;CACjC;CACA;CACA;AACF,CAAC;AAED,MAAM,8BAA8B,IAAI,oCAAoC;AAE5E,MAAM,6BAA6B,IAAI,CAAC,YAAY,WAAW,CAAC;AAEhE,MAAM,2BAA2B,IAC/B,4EACF;AAEA,MAAM,+BAA+B,IAAI;CACvC;CACA,GAAG;CACH;AACF,CAAC;AAED,MAAM,iCAAiC,IAAI,qDAAqD;AAEhG,MAAM,4BAA4B,IAAI;CACpC,GAAG;CACH,GAAG;CACH;CACA;CACA,GAAG;CACH;AACF,CAAC;AAED,MAAM,2BAA2B,IAC/B,gFACF;AAEA,MAAM,4BAA4B,IAAI,CACpC,mCACA,+CACF,CAAC;AAED,MAAM,4BAA4B,IAAI,yDAAyD;AAE/F,MAAM,2BAA2B,IAAI;CACnC;CACA;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.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { anatomy } from '#anatomy'\nimport { controlInert, controlPress, controlReach } from '#parts/control'\nimport { eyebrowLead } from '#parts/eyebrow'\nimport { surfaceLifted, surfacePanel } from '#parts/surface'\n\nimport { collapseMotion, drawerMotion, railCollapse, railMorph, scrimMirrorMotion } from './motion'\n\nconst CHILD_INSET = 'pl-11'\n\nconst ROW_STRIDE = `calc(var(--spacing-tf-control-md) + var(--spacing))`\n\nconst RAIL_STRIDE = `calc(var(--spacing-tf-control-md) + var(--spacing))`\n\nconst sidebarTravel = (index: number, rail: boolean): string => {\n const step = String(index)\n\n if (rail) {\n return `0 calc(${RAIL_STRIDE} * ${step})`\n }\n return `0 calc(${ROW_STRIDE} * ${step})`\n}\n\nconst MORPHS = railMorph\n\nconst ITEM = [\n 'group relative flex flex-none items-center rounded-tf-control',\n 'text-tf-body text-tf-muted',\n 'interactive:hovered:text-tf-fg aria-[current=page]:text-tf-on-accent',\n 'not-aria-[current=page]:interactive:hovered:bg-tf-panel-hi',\n `cursor-pointer ${MORPHS}`,\n ...controlReach,\n ...controlPress,\n ...controlInert,\n]\n\nconst sidebarRecipe = cva([\n 'sticky top-0 z-tf-dropdown hidden h-dvh min-h-0 flex-none flex-col gap-6 py-6 lg:flex',\n 'w-tf-sidebar data-rail:w-tf-rail',\n 'border-r border-tf-line-2 bg-tf-glass backdrop-blur-tf-glass',\n 'tf-icons font-tf-body text-tf-fg',\n MORPHS,\n])\n\nconst sidebarScopeRecipe = cva('flex-none px-3')\n\nconst sidebarMobileBarRecipe = cva([\n 'fixed inset-x-0 top-0 z-tf-dropdown flex items-center gap-3 px-4 lg:hidden',\n 'h-tf-control-lg border-b border-tf-line-2 bg-tf-panel-2 backdrop-blur-tf-panel',\n 'tf-icons font-tf-body text-tf-fg',\n])\n\nconst sidebarMobileHeadingsRecipe = cva('flex min-w-0 flex-1 flex-col gap-0')\n\nconst sidebarMobileEyebrowRecipe = cva(['truncate', eyebrowLead])\n\nconst sidebarMobileTitleRecipe = cva(\n 'truncate font-tf-display text-tf-h4 font-bold tracking-tf-tight text-tf-fg',\n)\n\nconst sidebarOverlayBackdropRecipe = cva([\n 'fixed inset-0 z-tf-modal bg-tf-scrim backdrop-blur-tf-scrim',\n ...scrimMirrorMotion,\n 'motion-reduce:animate-none',\n])\n\nconst sidebarOverlayPositionerRecipe = cva('fixed inset-0 z-tf-modal flex flex-col font-tf-body')\n\nconst sidebarOverlayPanelRecipe = cva([\n ...surfacePanel,\n ...surfaceLifted,\n 'flex h-full w-full flex-col overflow-hidden rounded-tf-none',\n 'text-tf-body-sm font-medium text-tf-fg',\n ...drawerMotion,\n 'motion-reduce:animate-none',\n])\n\nconst sidebarOverlayHeadRecipe = cva(\n 'relative flex flex-none items-center gap-5 border-b border-tf-line-2 px-4 py-3',\n)\n\nconst sidebarOverlayBrandRecipe = cva([\n 'flex min-w-0 items-center gap-3',\n '[&_svg]:size-tf-icon-solo-sm [&_svg]:shrink-0',\n])\n\nconst sidebarOverlayScopeRecipe = cva('ml-auto truncate text-tf-body-sm font-medium text-tf-fg')\n\nconst sidebarOverlayBodyRecipe = cva([\n 'flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4',\n 'tf-scroll-thin tf-scroll-faded',\n '[--tf-fade-foot:calc(var(--spacing)*2)] [--tf-fade-head:calc(var(--spacing)*2)]',\n])\n\nconst sidebarOverlayNavRecipe = cva('flex flex-none flex-col gap-1')\n\nconst sidebarOverlaySeparatorRecipe = cva('h-px w-full flex-none bg-tf-line-2')\n\nconst sidebarOverlayItemActive =\n 'aria-[current=page]:bg-tf-blend aria-[current=page]:blend-tf-accent'\n\nconst sidebarHeadRecipe = cva(['flex flex-none items-center gap-3 px-3', MORPHS])\n\nconst sidebarBrandRecipe = cva([\n 'flex min-w-0 items-center gap-3 pl-3',\n 'in-data-rail:gap-0 in-data-rail:pl-4',\n '[&_svg]:size-tf-icon-solo-sm [&_svg]:shrink-0',\n MORPHS,\n])\n\nconst sidebarBrandStackRecipe = cva(['flex flex-col gap-px', railCollapse])\n\nconst sidebarWordmarkRecipe = cva(['truncate font-tf-display text-tf-lead tracking-tf-tight'])\n\nconst sidebarBrandSubtitleRecipe = cva('truncate text-tf-caption-sm text-tf-muted')\n\nconst sidebarToggleRecipe = cva('flex-none [&_svg]:size-tf-icon-solo-sm')\n\nconst sidebarSwitchRecipe = cva([\n 'flex flex-none items-center justify-end in-data-rail:pr-2',\n MORPHS,\n])\n\nconst FADED = [\n 'tf-scroll-faded tf-scroll-thin',\n '[--tf-fade-head:calc(var(--spacing)*2)] [--tf-fade-foot:calc(var(--spacing)*2)]',\n 'outline-hidden focused:outline-2 focused:-outline-offset-2 focused:outline-tf-accent-hi',\n].join(' ')\n\nconst sidebarNavRecipe = cva([\n 'relative flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-3 py-2',\n FADED,\n])\n\nconst sidebarMarkRecipe = cva([\n 'pointer-events-none absolute inset-x-3 top-2 h-tf-control-md rounded-tf-control',\n 'in-data-rail:inset-x-4',\n 'bg-tf-blend blend-tf-accent',\n `tf-slides-settle ${MORPHS}`,\n])\n\nconst sidebarGroupRecipe = cva('flex flex-none flex-col')\n\nconst sidebarItemRecipe = cva(\n [\n ...ITEM,\n 'h-tf-control-md min-h-tf-control-md w-full text-left',\n '[&>svg]:size-tf-icon-sm [&>svg]:shrink-0',\n ],\n {\n defaultVariants: { level: 'top' },\n variants: {\n level: {\n child: `${CHILD_INSET} pr-3`,\n top: [\n 'gap-3 px-3',\n 'in-data-rail:gap-0',\n 'in-data-rail:px-[calc((var(--spacing-tf-rail)-var(--spacing)*6-var(--spacing-tf-icon-md))/2)]',\n ].join(' '),\n },\n },\n },\n)\n\nconst sidebarIconRecipe = cva([\n 'relative inline-flex size-tf-icon-md flex-none [&_svg]:size-tf-icon-md',\n '[&_svg]:shrink-0',\n MORPHS,\n])\n\nconst sidebarLabelRecipe = cva(['truncate text-left tf-text-trim', railCollapse])\n\nconst sidebarChevronRecipe = cva([\n 'w-tf-icon-sm flex-none overflow-hidden in-data-rail:w-0 in-data-rail:opacity-0',\n 'group-aria-expanded:rotate-180',\n MORPHS,\n])\n\nconst sidebarDotRecipe = cva([\n 'pointer-events-none absolute -right-1 -bottom-1',\n 'size-1 rounded-tf-pill bg-current opacity-0 in-data-rail:opacity-100',\n MORPHS,\n])\n\nconst sidebarSubRecipe = cva(['flex flex-col gap-1 pt-1', ...collapseMotion])\n\nconst sidebarFootRecipe = cva('relative mt-auto flex flex-none flex-col gap-1 px-3')\n\nconst sidebarAnatomy = anatomy({\n brand: { part: 'brand', recipe: sidebarBrandRecipe, required: true },\n brandStack: { part: 'brand-stack', recipe: sidebarBrandStackRecipe, required: true },\n brandSubtitle: { part: 'brand-subtitle', recipe: sidebarBrandSubtitleRecipe, required: false },\n child: { part: 'child', recipe: sidebarItemRecipe, required: false },\n dot: { part: 'dot', recipe: sidebarDotRecipe, required: false },\n foot: { part: 'foot', recipe: sidebarFootRecipe, required: true },\n head: { part: 'head', recipe: sidebarHeadRecipe, required: true },\n item: { part: 'item', recipe: sidebarItemRecipe, required: false },\n label: { part: 'label', recipe: sidebarLabelRecipe, required: true },\n mark: { part: 'mark', recipe: sidebarMarkRecipe, required: true },\n mobileBar: { part: 'mobile-bar', recipe: sidebarMobileBarRecipe, required: true },\n mobileEyebrow: { part: 'mobile-eyebrow', recipe: sidebarMobileEyebrowRecipe, required: false },\n mobileHeadings: {\n part: 'mobile-headings',\n recipe: sidebarMobileHeadingsRecipe,\n required: false,\n },\n mobileTitle: { part: 'mobile-title', recipe: sidebarMobileTitleRecipe, required: false },\n nav: { part: 'nav', recipe: sidebarNavRecipe, required: true },\n overlayBody: { part: 'overlay-body', recipe: sidebarOverlayBodyRecipe, required: true },\n overlayBrand: { part: 'overlay-brand', recipe: sidebarOverlayBrandRecipe, required: true },\n overlayHead: { part: 'overlay-head', recipe: sidebarOverlayHeadRecipe, required: true },\n overlayScope: { part: 'overlay-scope', recipe: sidebarOverlayScopeRecipe, required: false },\n root: { part: 'sidebar', recipe: sidebarRecipe, required: true },\n scope: { part: 'scope', recipe: sidebarScopeRecipe, required: false },\n separator: { part: 'separator', recipe: sidebarOverlaySeparatorRecipe, required: true },\n switch: { part: 'switch', recipe: sidebarSwitchRecipe, required: true },\n wordmark: { part: 'wordmark', recipe: sidebarWordmarkRecipe, required: true },\n})\n\nexport {\n sidebarAnatomy,\n sidebarBrandRecipe,\n sidebarBrandStackRecipe,\n sidebarBrandSubtitleRecipe,\n sidebarChevronRecipe,\n sidebarDotRecipe,\n sidebarFootRecipe,\n sidebarGroupRecipe,\n sidebarHeadRecipe,\n sidebarIconRecipe,\n sidebarItemRecipe,\n sidebarLabelRecipe,\n sidebarMarkRecipe,\n sidebarMobileBarRecipe,\n sidebarMobileEyebrowRecipe,\n sidebarMobileHeadingsRecipe,\n sidebarMobileTitleRecipe,\n sidebarNavRecipe,\n sidebarOverlayBackdropRecipe,\n sidebarOverlayBodyRecipe,\n sidebarOverlayBrandRecipe,\n sidebarOverlayHeadRecipe,\n sidebarOverlayItemActive,\n sidebarOverlayNavRecipe,\n sidebarOverlayPanelRecipe,\n sidebarOverlayPositionerRecipe,\n sidebarOverlayScopeRecipe,\n sidebarOverlaySeparatorRecipe,\n sidebarRecipe,\n sidebarScopeRecipe,\n sidebarSubRecipe,\n sidebarSwitchRecipe,\n sidebarToggleRecipe,\n sidebarTravel,\n sidebarWordmarkRecipe,\n}\n"],"mappings":";;;;;;;AASA,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,MAAM,cAAc;AAEpB,MAAM,iBAAiB,OAAe,SAA0B;CAC9D,MAAM,OAAO,OAAO,KAAK;CAEzB,IAAI,MACF,OAAO,UAAU,YAAY,KAAK,KAAK;CAEzC,OAAO,UAAU,WAAW,KAAK,KAAK;AACxC;AAEA,MAAM,SAAS;AAEf,MAAM,OAAO;CACX;CACA;CACA;CACA;CACA,kBAAkB;CAClB,GAAG;CACH,GAAG;CACH,GAAG;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M;EAAkB,QAAQ;EAA4B,UAAU;CAAM;CAC7F,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA,aAAa;EAAE,MAAM;EAAgB,QAAQ;EAA0B,UAAU;CAAM;CACvF,KAAK;EAAE,MAAM;EAAO,QAAQ;EAAkB,UAAU;CAAK;CAC7D,aAAa;EAAE,MAAM;EAAgB,QAAQ;EAA0B,UAAU;CAAK;CACtF,cAAc;EAAE,MAAM;EAAiB,QAAQ;EAA2B,UAAU;CAAK;CACzF,aAAa;EAAE,MAAM;EAAgB,QAAQ;EAA0B,UAAU;CAAK;CACtF,cAAc;EAAE,MAAM;EAAiB,QAAQ;EAA2B,UAAU;CAAM;CAC1F,MAAM;EAAE,MAAM;EAAW,QAAQ;EAAe,UAAU;CAAK;CAC/D,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAoB,UAAU;CAAM;CACpE,WAAW;EAAE,MAAM;EAAa,QAAQ;EAA+B,UAAU;CAAK;CACtF,QAAQ;EAAE,MAAM;EAAU,QAAQ;EAAqB,UAAU;CAAK;CACtE,UAAU;EAAE,MAAM;EAAY,QAAQ;EAAuB,UAAU;CAAK;AAC9E,CAAC"}
|
package/dist/recipes/sky.d.ts
CHANGED
|
@@ -15,6 +15,36 @@ declare const starRecipe: (props?: import("class-variance-authority/types").Clas
|
|
|
15
15
|
declare const contentRecipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
16
16
|
declare const starLayers: (count: number, seed: string) => StarLayer[];
|
|
17
17
|
declare const cloudDrift: (seed: string) => Cloud;
|
|
18
|
+
declare const skyAnatomy: {
|
|
19
|
+
readonly content: {
|
|
20
|
+
readonly part: "content";
|
|
21
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
readonly nebula: {
|
|
25
|
+
readonly part: "nebula";
|
|
26
|
+
readonly recipe: (props?: ({
|
|
27
|
+
origin?: "top" | "top-right" | "right" | "bottom-right" | "bottom" | "bottom-left" | "left" | "top-left" | null | undefined;
|
|
28
|
+
tone?: "accent" | "success" | "warning" | "info" | "danger" | null | undefined;
|
|
29
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
30
|
+
readonly required: true;
|
|
31
|
+
};
|
|
32
|
+
readonly root: {
|
|
33
|
+
readonly part: "sky";
|
|
34
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
35
|
+
readonly required: true;
|
|
36
|
+
};
|
|
37
|
+
readonly star: {
|
|
38
|
+
readonly part: "star";
|
|
39
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
40
|
+
readonly required: true;
|
|
41
|
+
};
|
|
42
|
+
readonly stars: {
|
|
43
|
+
readonly part: "stars";
|
|
44
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
45
|
+
readonly required: true;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
18
48
|
//#endregion
|
|
19
|
-
export { type Cloud, type StarLayer, cloudDrift, contentRecipe, driftRecipe, skyRecipe, starLayers, starRecipe };
|
|
49
|
+
export { type Cloud, type StarLayer, cloudDrift, contentRecipe, driftRecipe, skyAnatomy, skyRecipe, starLayers, starRecipe };
|
|
20
50
|
//# sourceMappingURL=sky.d.ts.map
|
package/dist/recipes/sky.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { anatomy } from "../anatomy.js";
|
|
2
|
+
import { nebulaRecipe } from "./nebula.js";
|
|
1
3
|
import { cva } from "class-variance-authority";
|
|
2
4
|
//#region src/recipes/sky.ts
|
|
3
5
|
const DIM = 1;
|
|
@@ -121,7 +123,34 @@ const cloudDrift = (seed) => {
|
|
|
121
123
|
shift: `${String(across)}% ${String(down)}%`
|
|
122
124
|
};
|
|
123
125
|
};
|
|
126
|
+
const skyAnatomy = anatomy({
|
|
127
|
+
content: {
|
|
128
|
+
part: "content",
|
|
129
|
+
recipe: contentRecipe,
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
nebula: {
|
|
133
|
+
part: "nebula",
|
|
134
|
+
recipe: nebulaRecipe,
|
|
135
|
+
required: true
|
|
136
|
+
},
|
|
137
|
+
root: {
|
|
138
|
+
part: "sky",
|
|
139
|
+
recipe: skyRecipe,
|
|
140
|
+
required: true
|
|
141
|
+
},
|
|
142
|
+
star: {
|
|
143
|
+
part: "star",
|
|
144
|
+
recipe: starRecipe,
|
|
145
|
+
required: true
|
|
146
|
+
},
|
|
147
|
+
stars: {
|
|
148
|
+
part: "stars",
|
|
149
|
+
recipe: driftRecipe,
|
|
150
|
+
required: true
|
|
151
|
+
}
|
|
152
|
+
});
|
|
124
153
|
//#endregion
|
|
125
|
-
export { cloudDrift, contentRecipe, driftRecipe, skyRecipe, starLayers, starRecipe };
|
|
154
|
+
export { cloudDrift, contentRecipe, driftRecipe, skyAnatomy, skyRecipe, starLayers, starRecipe };
|
|
126
155
|
|
|
127
156
|
//# sourceMappingURL=sky.js.map
|
package/dist/recipes/sky.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sky.js","names":[],"sources":["../../src/recipes/sky.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nconst DIM = 1\nconst MID = 2\nconst BRIGHT = 3\n\nconst FAINT = 28\nconst DUSKY = 40\nconst STEADY = 55\nconst CLEAR = 70\nconst KEEN = 95\n\nconst STAR_PX = [DIM, DIM, MID, MID, BRIGHT] as const\nconst STAR_GLOW = [FAINT, DUSKY, STEADY, CLEAR, KEEN] as const\n\nconst SEED_BASE = 7\nconst SEED_STEP = 131\nconst LEHMER_MULTIPLIER = 16_807\nconst LEHMER_MODULUS = 2_147_483_647\n\nconst FIRST = 0\nconst ORIGIN = 0\nconst ONE = 1\nconst EDGE = 4\nconst FIELD = 92\nconst CLOUD_SHIFT = 26\nconst HALF = 0.5\n\nconst LAYERS = 4\n\nconst HALO_AT = CLEAR\n\nconst HALO_SCALE = 5\n\nconst HALO_GLOW = 7\n\nconst CORE_EDGE = 99\n\ninterface Speck {\n across: number\n down: number\n glow: number\n px: number\n}\n\ninterface StarLayer {\n delay: string\n image: string\n position: string\n size: string\n}\n\ninterface Cloud {\n delay: string\n shift: string\n}\n\nconst skyRecipe = cva([\n 'relative isolate overflow-hidden',\n 'rounded-tf-card bg-tf-bg',\n 'font-tf-body text-tf-fg',\n])\n\nconst driftRecipe = cva([\n 'pointer-events-none absolute -inset-1/4',\n '[rotate:var(--tf-sweep)] tf-turning',\n '[animation-duration:calc(var(--tf-sweep-duration)*45)]',\n])\n\nconst starRecipe = cva('pointer-events-none absolute inset-0 tf-twinkling bg-no-repeat')\n\nconst contentRecipe = cva('relative')\n\nconst hashOf = (seed: string): number => {\n let value = SEED_BASE\n\n for (const letter of seed) {\n value = (value * SEED_STEP + (letter.codePointAt(FIRST) ?? ORIGIN)) % LEHMER_MODULUS\n }\n return value + ONE\n}\n\nconst streamFrom = (seed: string): (() => number) => {\n let state = hashOf(seed)\n\n return () => {\n state = (state * LEHMER_MULTIPLIER) % LEHMER_MODULUS\n return state / LEHMER_MODULUS\n }\n}\n\nconst pick = <Value>(choices: readonly Value[], roll: number, fallback: Value): Value =>\n choices[Math.floor(roll * choices.length)] ?? fallback\n\nconst glowOf = (strength: number): string =>\n `color-mix(in oklab, var(--color-tf-fg) ${String(strength)}%, transparent)`\n\nconst circleOf = (strength: number): string => {\n const ink = glowOf(strength)\n\n return `radial-gradient(circle closest-side, ${ink} 0, ${ink} ${String(CORE_EDGE)}%, transparent 100%)`\n}\n\nconst haloOf = (strength: number): string => {\n const ink = glowOf(strength)\n\n return `radial-gradient(circle closest-side, ${ink} 0, transparent 100%)`\n}\n\nconst speckFrom = (roll: () => number): Speck => {\n const step = roll()\n\n return {\n across: EDGE + roll() * FIELD,\n down: EDGE + roll() * FIELD,\n glow: pick(STAR_GLOW, step, FAINT),\n px: pick(STAR_PX, step, DIM),\n }\n}\n\nconst spotOf = (speck: Speck): string => `${String(speck.across)}% ${String(speck.down)}%`\n\nconst sizeOf = (across: number): string => `${String(across)}px ${String(across)}px`\n\ninterface Drawing {\n images: string[]\n positions: string[]\n sizes: string[]\n}\n\nconst draw = (sheet: Drawing, speck: Speck): void => {\n if (speck.glow >= HALO_AT) {\n sheet.images.push(haloOf(HALO_GLOW))\n sheet.positions.push(spotOf(speck))\n sheet.sizes.push(sizeOf(speck.px * HALO_SCALE))\n }\n sheet.images.push(circleOf(speck.glow))\n sheet.positions.push(spotOf(speck))\n sheet.sizes.push(sizeOf(speck.px))\n}\n\nconst starLayers = (count: number, seed: string): StarLayer[] => {\n const roll = streamFrom(seed)\n const sheets: Drawing[] = Array.from({ length: LAYERS }, () => ({\n images: [],\n positions: [],\n sizes: [],\n }))\n\n for (let drawn = ORIGIN; drawn < count; drawn += ONE) {\n const speck = speckFrom(roll)\n const sheet = sheets[Math.floor(roll() * LAYERS)] ?? sheets[FIRST]\n\n if (sheet) {\n draw(sheet, speck)\n }\n }\n return sheets.map((sheet, index) => ({\n delay: `calc(var(--tf-twinkle-duration) * -${String(index / LAYERS)})`,\n image: sheet.images.join(', '),\n position: sheet.positions.join(', '),\n size: sheet.sizes.join(', '),\n }))\n}\n\nconst cloudDrift = (seed: string): Cloud => {\n const roll = streamFrom(`cloud:${seed}`)\n const turn = roll()\n const across = (roll() - HALF) * CLOUD_SHIFT\n const down = (roll() - HALF) * CLOUD_SHIFT\n\n return {\n delay: `calc(var(--tf-sweep-duration) * -${String(turn)})`,\n shift: `${String(across)}% ${String(down)}%`,\n }\n}\n\nexport {\n type Cloud,\n type StarLayer,\n cloudDrift,\n contentRecipe,\n driftRecipe,\n skyRecipe,\n starLayers,\n starRecipe,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sky.js","names":[],"sources":["../../src/recipes/sky.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { anatomy } from '#anatomy'\n\nimport { nebulaRecipe } from './nebula'\n\nconst DIM = 1\nconst MID = 2\nconst BRIGHT = 3\n\nconst FAINT = 28\nconst DUSKY = 40\nconst STEADY = 55\nconst CLEAR = 70\nconst KEEN = 95\n\nconst STAR_PX = [DIM, DIM, MID, MID, BRIGHT] as const\nconst STAR_GLOW = [FAINT, DUSKY, STEADY, CLEAR, KEEN] as const\n\nconst SEED_BASE = 7\nconst SEED_STEP = 131\nconst LEHMER_MULTIPLIER = 16_807\nconst LEHMER_MODULUS = 2_147_483_647\n\nconst FIRST = 0\nconst ORIGIN = 0\nconst ONE = 1\nconst EDGE = 4\nconst FIELD = 92\nconst CLOUD_SHIFT = 26\nconst HALF = 0.5\n\nconst LAYERS = 4\n\nconst HALO_AT = CLEAR\n\nconst HALO_SCALE = 5\n\nconst HALO_GLOW = 7\n\nconst CORE_EDGE = 99\n\ninterface Speck {\n across: number\n down: number\n glow: number\n px: number\n}\n\ninterface StarLayer {\n delay: string\n image: string\n position: string\n size: string\n}\n\ninterface Cloud {\n delay: string\n shift: string\n}\n\nconst skyRecipe = cva([\n 'relative isolate overflow-hidden',\n 'rounded-tf-card bg-tf-bg',\n 'font-tf-body text-tf-fg',\n])\n\nconst driftRecipe = cva([\n 'pointer-events-none absolute -inset-1/4',\n '[rotate:var(--tf-sweep)] tf-turning',\n '[animation-duration:calc(var(--tf-sweep-duration)*45)]',\n])\n\nconst starRecipe = cva('pointer-events-none absolute inset-0 tf-twinkling bg-no-repeat')\n\nconst contentRecipe = cva('relative')\n\nconst hashOf = (seed: string): number => {\n let value = SEED_BASE\n\n for (const letter of seed) {\n value = (value * SEED_STEP + (letter.codePointAt(FIRST) ?? ORIGIN)) % LEHMER_MODULUS\n }\n return value + ONE\n}\n\nconst streamFrom = (seed: string): (() => number) => {\n let state = hashOf(seed)\n\n return () => {\n state = (state * LEHMER_MULTIPLIER) % LEHMER_MODULUS\n return state / LEHMER_MODULUS\n }\n}\n\nconst pick = <Value>(choices: readonly Value[], roll: number, fallback: Value): Value =>\n choices[Math.floor(roll * choices.length)] ?? fallback\n\nconst glowOf = (strength: number): string =>\n `color-mix(in oklab, var(--color-tf-fg) ${String(strength)}%, transparent)`\n\nconst circleOf = (strength: number): string => {\n const ink = glowOf(strength)\n\n return `radial-gradient(circle closest-side, ${ink} 0, ${ink} ${String(CORE_EDGE)}%, transparent 100%)`\n}\n\nconst haloOf = (strength: number): string => {\n const ink = glowOf(strength)\n\n return `radial-gradient(circle closest-side, ${ink} 0, transparent 100%)`\n}\n\nconst speckFrom = (roll: () => number): Speck => {\n const step = roll()\n\n return {\n across: EDGE + roll() * FIELD,\n down: EDGE + roll() * FIELD,\n glow: pick(STAR_GLOW, step, FAINT),\n px: pick(STAR_PX, step, DIM),\n }\n}\n\nconst spotOf = (speck: Speck): string => `${String(speck.across)}% ${String(speck.down)}%`\n\nconst sizeOf = (across: number): string => `${String(across)}px ${String(across)}px`\n\ninterface Drawing {\n images: string[]\n positions: string[]\n sizes: string[]\n}\n\nconst draw = (sheet: Drawing, speck: Speck): void => {\n if (speck.glow >= HALO_AT) {\n sheet.images.push(haloOf(HALO_GLOW))\n sheet.positions.push(spotOf(speck))\n sheet.sizes.push(sizeOf(speck.px * HALO_SCALE))\n }\n sheet.images.push(circleOf(speck.glow))\n sheet.positions.push(spotOf(speck))\n sheet.sizes.push(sizeOf(speck.px))\n}\n\nconst starLayers = (count: number, seed: string): StarLayer[] => {\n const roll = streamFrom(seed)\n const sheets: Drawing[] = Array.from({ length: LAYERS }, () => ({\n images: [],\n positions: [],\n sizes: [],\n }))\n\n for (let drawn = ORIGIN; drawn < count; drawn += ONE) {\n const speck = speckFrom(roll)\n const sheet = sheets[Math.floor(roll() * LAYERS)] ?? sheets[FIRST]\n\n if (sheet) {\n draw(sheet, speck)\n }\n }\n return sheets.map((sheet, index) => ({\n delay: `calc(var(--tf-twinkle-duration) * -${String(index / LAYERS)})`,\n image: sheet.images.join(', '),\n position: sheet.positions.join(', '),\n size: sheet.sizes.join(', '),\n }))\n}\n\nconst cloudDrift = (seed: string): Cloud => {\n const roll = streamFrom(`cloud:${seed}`)\n const turn = roll()\n const across = (roll() - HALF) * CLOUD_SHIFT\n const down = (roll() - HALF) * CLOUD_SHIFT\n\n return {\n delay: `calc(var(--tf-sweep-duration) * -${String(turn)})`,\n shift: `${String(across)}% ${String(down)}%`,\n }\n}\n\nconst skyAnatomy = anatomy({\n content: { part: 'content', recipe: contentRecipe, required: true },\n nebula: { part: 'nebula', recipe: nebulaRecipe, required: true },\n root: { part: 'sky', recipe: skyRecipe, required: true },\n star: { part: 'star', recipe: starRecipe, required: true },\n stars: { part: 'stars', recipe: driftRecipe, required: true },\n})\n\nexport {\n type Cloud,\n type StarLayer,\n cloudDrift,\n contentRecipe,\n driftRecipe,\n skyAnatomy,\n skyRecipe,\n starLayers,\n starRecipe,\n}\n"],"mappings":";;;;AAMA,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,MAAM,SAAS;AAEf,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,OAAO;AAEb,MAAM,UAAU;CAAC;CAAK;CAAK;CAAK;CAAK;AAAM;AAC3C,MAAM,YAAY;CAAC;CAAO;CAAO;CAAQ;CAAO;AAAI;AAEpD,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB;AAEvB,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,cAAc;AACpB,MAAM,OAAO;AAEb,MAAM,SAAS;AAEf,MAAM,UAAU;AAEhB,MAAM,aAAa;AAEnB,MAAM,YAAY;AAElB,MAAM,YAAY;AAqBlB,MAAM,YAAY,IAAI;CACpB;CACA;CACA;AACF,CAAC;AAED,MAAM,cAAc,IAAI;CACtB;CACA;CACA;AACF,CAAC;AAED,MAAM,aAAa,IAAI,gEAAgE;AAEvF,MAAM,gBAAgB,IAAI,UAAU;AAEpC,M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O;EAAE,MAAM;EAAS,QAAQ;EAAa,UAAU;CAAK;AAC9D,CAAC"}
|
package/dist/recipes/slider.d.ts
CHANGED
|
@@ -17,6 +17,20 @@ declare const sliderHintRecipe: (props?: ({
|
|
|
17
17
|
invalid?: boolean | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
declare const sliderBoundsRecipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
20
|
+
declare const sliderAnatomy: {
|
|
21
|
+
readonly bounds: {
|
|
22
|
+
readonly part: "bounds";
|
|
23
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
24
|
+
readonly required: true;
|
|
25
|
+
};
|
|
26
|
+
readonly root: {
|
|
27
|
+
readonly part: "slider";
|
|
28
|
+
readonly recipe: (props?: ({
|
|
29
|
+
fullWidth?: boolean | null | undefined;
|
|
30
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
31
|
+
readonly required: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
20
34
|
//#endregion
|
|
21
|
-
export { sliderBoundsRecipe, sliderControlRecipe, sliderFootRecipe, sliderHeadRecipe, sliderHintRecipe, sliderKnobSize, sliderLabelRecipe, sliderNotchRecipe, sliderNotchesRecipe, sliderRangeRecipe, sliderRecipe, sliderThumbRecipe, sliderTrackRecipe, sliderValueRecipe };
|
|
35
|
+
export { sliderAnatomy, sliderBoundsRecipe, sliderControlRecipe, sliderFootRecipe, sliderHeadRecipe, sliderHintRecipe, sliderKnobSize, sliderLabelRecipe, sliderNotchRecipe, sliderNotchesRecipe, sliderRangeRecipe, sliderRecipe, sliderThumbRecipe, sliderTrackRecipe, sliderValueRecipe };
|
|
22
36
|
//# sourceMappingURL=slider.d.ts.map
|
package/dist/recipes/slider.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { anatomy } from "../anatomy.js";
|
|
1
2
|
import { controlReach } from "../parts/control.js";
|
|
2
3
|
import { markKnob } from "../parts/mark.js";
|
|
3
4
|
import { cva } from "class-variance-authority";
|
|
@@ -62,7 +63,19 @@ const sliderHintRecipe = cva("text-tf-caption font-medium", {
|
|
|
62
63
|
} }
|
|
63
64
|
});
|
|
64
65
|
const sliderBoundsRecipe = cva("ms-auto shrink-0 text-tf-caption font-medium text-tf-muted tabular-nums");
|
|
66
|
+
const sliderAnatomy = anatomy({
|
|
67
|
+
bounds: {
|
|
68
|
+
part: "bounds",
|
|
69
|
+
recipe: sliderBoundsRecipe,
|
|
70
|
+
required: true
|
|
71
|
+
},
|
|
72
|
+
root: {
|
|
73
|
+
part: "slider",
|
|
74
|
+
recipe: sliderRecipe,
|
|
75
|
+
required: true
|
|
76
|
+
}
|
|
77
|
+
});
|
|
65
78
|
//#endregion
|
|
66
|
-
export { sliderBoundsRecipe, sliderControlRecipe, sliderFootRecipe, sliderHeadRecipe, sliderHintRecipe, sliderKnobSize, sliderLabelRecipe, sliderNotchRecipe, sliderNotchesRecipe, sliderRangeRecipe, sliderRecipe, sliderThumbRecipe, sliderTrackRecipe, sliderValueRecipe };
|
|
79
|
+
export { sliderAnatomy, sliderBoundsRecipe, sliderControlRecipe, sliderFootRecipe, sliderHeadRecipe, sliderHintRecipe, sliderKnobSize, sliderLabelRecipe, sliderNotchRecipe, sliderNotchesRecipe, sliderRangeRecipe, sliderRecipe, sliderThumbRecipe, sliderTrackRecipe, sliderValueRecipe };
|
|
67
80
|
|
|
68
81
|
//# sourceMappingURL=slider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","names":[],"sources":["../../src/recipes/slider.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { controlReach } from '#parts/control'\nimport { markKnob } from '#parts/mark'\n\nconst sliderKnobSize = 20\n\nconst sliderRecipe = cva(\n [\n 'flex w-full flex-col gap-2',\n 'font-tf-body',\n 'data-disabled:cursor-not-allowed',\n 'data-disabled:**:data-[part=value-text]:text-tf-muted',\n ],\n {\n defaultVariants: { fullWidth: false },\n variants: {\n fullWidth: { false: 'max-w-tf-panel', true: '' },\n },\n },\n)\n\nconst sliderHeadRecipe = cva('flex items-baseline justify-between gap-4')\n\nconst sliderLabelRecipe = cva('text-tf-body text-tf-fg data-disabled:text-tf-muted')\n\nconst sliderValueRecipe = cva([\n 'font-tf-display text-tf-h4 font-bold tracking-tf-tight tabular-nums',\n 'text-tf-fg in-data-dragging:text-tf-accent-hi in-data-focus:text-tf-accent-hi',\n 'tf-transition motion-reduce:transition-none',\n])\n\nconst sliderControlRecipe = cva([\n 'relative flex min-h-tf-target w-full items-center',\n 'not-data-readonly:interactive:cursor-pointer',\n 'data-readonly:cursor-default',\n])\n\nconst sliderTrackRecipe = cva([\n 'h-tf-mark-track w-full overflow-hidden rounded-tf-inline bg-tf-line',\n 'data-disabled:opacity-50',\n])\n\nconst sliderRangeRecipe = cva([\n 'h-tf-mark-track',\n 'bg-tf-blend-rise blend-tf-accent',\n 'data-invalid:blend-tf-danger',\n 'tf-transition not-data-dragging:tf-travels motion-reduce:transition-none',\n])\n\nconst sliderNotchesRecipe = cva('pointer-events-none absolute inset-0')\n\nconst sliderNotchRecipe = cva([\n 'h-full w-tf-hairline',\n 'data-[state=over-value]:bg-tf-line-hi data-[state=under-value]:bg-tf-shade-under',\n 'tf-transition motion-reduce:transition-none',\n])\n\nconst sliderThumbRecipe = cva([\n ...markKnob,\n 'size-tf-icon-solo-sm blend-tf-accent',\n 'inset-ring inset-ring-tf-line-hi',\n 'in-data-invalid:inset-ring-tf-danger-hi',\n 'tf-glow tf-fill-scale tf-settled-quiet',\n 'interactive:hovered:tf-raised',\n 'not-data-dragging:tf-travels',\n 'data-dragging:bg-tf-fg-held data-dragging:tf-raised',\n 'motion-safe:data-dragging:scale-112',\n 'data-disabled:opacity-50',\n ...controlReach,\n])\n\nconst sliderFootRecipe = cva('flex items-baseline justify-between gap-4')\n\nconst sliderHintRecipe = cva('text-tf-caption font-medium', {\n defaultVariants: { invalid: false },\n variants: {\n invalid: { false: 'text-tf-muted', true: 'text-tf-danger-hi tf-arrives' },\n },\n})\n\nconst sliderBoundsRecipe = cva(\n 'ms-auto shrink-0 text-tf-caption font-medium text-tf-muted tabular-nums',\n)\n\nexport {\n sliderBoundsRecipe,\n sliderControlRecipe,\n sliderFootRecipe,\n sliderHeadRecipe,\n sliderHintRecipe,\n sliderKnobSize,\n sliderLabelRecipe,\n sliderNotchRecipe,\n sliderNotchesRecipe,\n sliderRangeRecipe,\n sliderRecipe,\n sliderThumbRecipe,\n sliderTrackRecipe,\n sliderValueRecipe,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slider.js","names":[],"sources":["../../src/recipes/slider.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { anatomy } from '#anatomy'\nimport { controlReach } from '#parts/control'\nimport { markKnob } from '#parts/mark'\n\nconst sliderKnobSize = 20\n\nconst sliderRecipe = cva(\n [\n 'flex w-full flex-col gap-2',\n 'font-tf-body',\n 'data-disabled:cursor-not-allowed',\n 'data-disabled:**:data-[part=value-text]:text-tf-muted',\n ],\n {\n defaultVariants: { fullWidth: false },\n variants: {\n fullWidth: { false: 'max-w-tf-panel', true: '' },\n },\n },\n)\n\nconst sliderHeadRecipe = cva('flex items-baseline justify-between gap-4')\n\nconst sliderLabelRecipe = cva('text-tf-body text-tf-fg data-disabled:text-tf-muted')\n\nconst sliderValueRecipe = cva([\n 'font-tf-display text-tf-h4 font-bold tracking-tf-tight tabular-nums',\n 'text-tf-fg in-data-dragging:text-tf-accent-hi in-data-focus:text-tf-accent-hi',\n 'tf-transition motion-reduce:transition-none',\n])\n\nconst sliderControlRecipe = cva([\n 'relative flex min-h-tf-target w-full items-center',\n 'not-data-readonly:interactive:cursor-pointer',\n 'data-readonly:cursor-default',\n])\n\nconst sliderTrackRecipe = cva([\n 'h-tf-mark-track w-full overflow-hidden rounded-tf-inline bg-tf-line',\n 'data-disabled:opacity-50',\n])\n\nconst sliderRangeRecipe = cva([\n 'h-tf-mark-track',\n 'bg-tf-blend-rise blend-tf-accent',\n 'data-invalid:blend-tf-danger',\n 'tf-transition not-data-dragging:tf-travels motion-reduce:transition-none',\n])\n\nconst sliderNotchesRecipe = cva('pointer-events-none absolute inset-0')\n\nconst sliderNotchRecipe = cva([\n 'h-full w-tf-hairline',\n 'data-[state=over-value]:bg-tf-line-hi data-[state=under-value]:bg-tf-shade-under',\n 'tf-transition motion-reduce:transition-none',\n])\n\nconst sliderThumbRecipe = cva([\n ...markKnob,\n 'size-tf-icon-solo-sm blend-tf-accent',\n 'inset-ring inset-ring-tf-line-hi',\n 'in-data-invalid:inset-ring-tf-danger-hi',\n 'tf-glow tf-fill-scale tf-settled-quiet',\n 'interactive:hovered:tf-raised',\n 'not-data-dragging:tf-travels',\n 'data-dragging:bg-tf-fg-held data-dragging:tf-raised',\n 'motion-safe:data-dragging:scale-112',\n 'data-disabled:opacity-50',\n ...controlReach,\n])\n\nconst sliderFootRecipe = cva('flex items-baseline justify-between gap-4')\n\nconst sliderHintRecipe = cva('text-tf-caption font-medium', {\n defaultVariants: { invalid: false },\n variants: {\n invalid: { false: 'text-tf-muted', true: 'text-tf-danger-hi tf-arrives' },\n },\n})\n\nconst sliderBoundsRecipe = cva(\n 'ms-auto shrink-0 text-tf-caption font-medium text-tf-muted tabular-nums',\n)\n\nconst sliderAnatomy = anatomy({\n bounds: { part: 'bounds', recipe: sliderBoundsRecipe, required: true },\n root: { part: 'slider', recipe: sliderRecipe, required: true },\n})\n\nexport {\n sliderAnatomy,\n sliderBoundsRecipe,\n sliderControlRecipe,\n sliderFootRecipe,\n sliderHeadRecipe,\n sliderHintRecipe,\n sliderKnobSize,\n sliderLabelRecipe,\n sliderNotchRecipe,\n sliderNotchesRecipe,\n sliderRangeRecipe,\n sliderRecipe,\n sliderThumbRecipe,\n sliderTrackRecipe,\n sliderValueRecipe,\n}\n"],"mappings":";;;;;AAMA,MAAM,iBAAiB;AAEvB,MAAM,eAAe,IACnB;CACE;CACA;CACA;CACA;AACF,GACA;CACE,iBAAiB,EAAE,WAAW,MAAM;CACpC,UAAU,EACR,WAAW;EAAE,OAAO;EAAkB,MAAM;CAAG,EACjD;AACF,CACF;AAEA,MAAM,mBAAmB,IAAI,2CAA2C;AAExE,MAAM,oBAAoB,IAAI,qDAAqD;AAEnF,MAAM,oBAAoB,IAAI;CAC5B;CACA;CACA;AACF,CAAC;AAED,MAAM,sBAAsB,IAAI;CAC9B;CACA;CACA;AACF,CAAC;AAED,MAAM,oBAAoB,IAAI,CAC5B,uEACA,0BACF,CAAC;AAED,MAAM,oBAAoB,IAAI;CAC5B;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,sBAAsB,IAAI,sCAAsC;AAEtE,MAAM,oBAAoB,IAAI;CAC5B;CACA;CACA;AACF,CAAC;AAED,MAAM,oBAAoB,IAAI;CAC5B,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG;AACL,CAAC;AAED,MAAM,mBAAmB,IAAI,2CAA2C;AAExE,MAAM,mBAAmB,IAAI,+BAA+B;CAC1D,iBAAiB,EAAE,SAAS,MAAM;CAClC,UAAU,EACR,SAAS;EAAE,OAAO;EAAiB,MAAM;CAA+B,EAC1E;AACF,CAAC;AAED,MAAM,qBAAqB,IACzB,yEACF;AAEA,MAAM,gBAAgB,QAAQ;CAC5B,QAAQ;EAAE,MAAM;EAAU,QAAQ;EAAoB,UAAU;CAAK;CACrE,MAAM;EAAE,MAAM;EAAU,QAAQ;EAAc,UAAU;CAAK;AAC/D,CAAC"}
|
package/dist/recipes/stat.d.ts
CHANGED
|
@@ -24,6 +24,76 @@ declare const defaultStatSparkShape = "line";
|
|
|
24
24
|
declare const statSparkRecipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
25
25
|
declare const statChangeRecipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
26
26
|
declare const statTermRecipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
27
|
+
declare const statAnatomy: {
|
|
28
|
+
readonly badge: {
|
|
29
|
+
readonly part: "badge";
|
|
30
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
31
|
+
readonly required: false;
|
|
32
|
+
};
|
|
33
|
+
readonly change: {
|
|
34
|
+
readonly part: "change";
|
|
35
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
36
|
+
readonly required: false;
|
|
37
|
+
};
|
|
38
|
+
readonly counted: {
|
|
39
|
+
readonly part: "counted";
|
|
40
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
41
|
+
readonly required: true;
|
|
42
|
+
};
|
|
43
|
+
readonly figure: {
|
|
44
|
+
readonly part: "figure";
|
|
45
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
46
|
+
readonly required: true;
|
|
47
|
+
};
|
|
48
|
+
readonly hint: {
|
|
49
|
+
readonly part: "hint";
|
|
50
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
51
|
+
readonly required: false;
|
|
52
|
+
};
|
|
53
|
+
readonly label: {
|
|
54
|
+
readonly part: "label";
|
|
55
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
56
|
+
readonly required: true;
|
|
57
|
+
};
|
|
58
|
+
readonly root: {
|
|
59
|
+
readonly part: "stat";
|
|
60
|
+
readonly recipe: (props?: ({
|
|
61
|
+
accent?: "accent" | "success" | "warning" | "info" | "danger" | null | undefined;
|
|
62
|
+
surface?: "glass" | "flat" | null | undefined;
|
|
63
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
64
|
+
readonly required: true;
|
|
65
|
+
};
|
|
66
|
+
readonly spark: {
|
|
67
|
+
readonly part: "spark";
|
|
68
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
69
|
+
readonly required: false;
|
|
70
|
+
};
|
|
71
|
+
readonly stack: {
|
|
72
|
+
readonly part: "stack";
|
|
73
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
74
|
+
readonly required: true;
|
|
75
|
+
};
|
|
76
|
+
readonly term: {
|
|
77
|
+
readonly part: "term";
|
|
78
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
79
|
+
readonly required: false;
|
|
80
|
+
};
|
|
81
|
+
readonly unit: {
|
|
82
|
+
readonly part: "unit";
|
|
83
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
84
|
+
readonly required: false;
|
|
85
|
+
};
|
|
86
|
+
readonly value: {
|
|
87
|
+
readonly part: "value";
|
|
88
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
89
|
+
readonly required: true;
|
|
90
|
+
};
|
|
91
|
+
readonly way: {
|
|
92
|
+
readonly part: "way";
|
|
93
|
+
readonly recipe: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
94
|
+
readonly required: false;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
27
97
|
//#endregion
|
|
28
|
-
export { type StatAccent, type StatDirection, type StatSparkShape, type StatSurface, defaultStatAccent, defaultStatSparkShape, defaultStatSurface, statAccents, statChangeRecipe, statDirections, statFigureRecipe, statHintRecipe, statLabelRecipe, statRecipe, statSparkRecipe, statSparkShapes, statStackRecipe, statSurfaces, statTermRecipe, statUnitRecipe, statValueRecipe };
|
|
98
|
+
export { type StatAccent, type StatDirection, type StatSparkShape, type StatSurface, defaultStatAccent, defaultStatSparkShape, defaultStatSurface, statAccents, statAnatomy, statChangeRecipe, statDirections, statFigureRecipe, statHintRecipe, statLabelRecipe, statRecipe, statSparkRecipe, statSparkShapes, statStackRecipe, statSurfaces, statTermRecipe, statUnitRecipe, statValueRecipe };
|
|
29
99
|
//# sourceMappingURL=stat.d.ts.map
|
package/dist/recipes/stat.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultTone, tones } from "../parts/tone.js";
|
|
1
|
+
import { anatomy } from "../anatomy.js";
|
|
3
2
|
import { tileRoused } from "../parts/rouse.js";
|
|
3
|
+
import { defaultTone, tones } from "../parts/tone.js";
|
|
4
|
+
import { toneBlend } from "../tone.js";
|
|
4
5
|
import { cva } from "class-variance-authority";
|
|
5
6
|
//#region src/recipes/stat.ts
|
|
6
7
|
const statAccents = tones;
|
|
@@ -46,7 +47,76 @@ const statChangeRecipe = cva([
|
|
|
46
47
|
"tf-icons [&_svg]:size-tf-icon-sm [&_svg]:shrink-0"
|
|
47
48
|
]);
|
|
48
49
|
const statTermRecipe = cva("sr-only");
|
|
50
|
+
const statBadgeRecipe = cva("absolute top-4 right-4");
|
|
51
|
+
const statCountedRecipe = cva("");
|
|
52
|
+
const statAnatomy = anatomy({
|
|
53
|
+
badge: {
|
|
54
|
+
part: "badge",
|
|
55
|
+
recipe: statBadgeRecipe,
|
|
56
|
+
required: false
|
|
57
|
+
},
|
|
58
|
+
change: {
|
|
59
|
+
part: "change",
|
|
60
|
+
recipe: statChangeRecipe,
|
|
61
|
+
required: false
|
|
62
|
+
},
|
|
63
|
+
counted: {
|
|
64
|
+
part: "counted",
|
|
65
|
+
recipe: statCountedRecipe,
|
|
66
|
+
required: true
|
|
67
|
+
},
|
|
68
|
+
figure: {
|
|
69
|
+
part: "figure",
|
|
70
|
+
recipe: statFigureRecipe,
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
hint: {
|
|
74
|
+
part: "hint",
|
|
75
|
+
recipe: statHintRecipe,
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
label: {
|
|
79
|
+
part: "label",
|
|
80
|
+
recipe: statLabelRecipe,
|
|
81
|
+
required: true
|
|
82
|
+
},
|
|
83
|
+
root: {
|
|
84
|
+
part: "stat",
|
|
85
|
+
recipe: statRecipe,
|
|
86
|
+
required: true
|
|
87
|
+
},
|
|
88
|
+
spark: {
|
|
89
|
+
part: "spark",
|
|
90
|
+
recipe: statSparkRecipe,
|
|
91
|
+
required: false
|
|
92
|
+
},
|
|
93
|
+
stack: {
|
|
94
|
+
part: "stack",
|
|
95
|
+
recipe: statStackRecipe,
|
|
96
|
+
required: true
|
|
97
|
+
},
|
|
98
|
+
term: {
|
|
99
|
+
part: "term",
|
|
100
|
+
recipe: statTermRecipe,
|
|
101
|
+
required: false
|
|
102
|
+
},
|
|
103
|
+
unit: {
|
|
104
|
+
part: "unit",
|
|
105
|
+
recipe: statUnitRecipe,
|
|
106
|
+
required: false
|
|
107
|
+
},
|
|
108
|
+
value: {
|
|
109
|
+
part: "value",
|
|
110
|
+
recipe: statValueRecipe,
|
|
111
|
+
required: true
|
|
112
|
+
},
|
|
113
|
+
way: {
|
|
114
|
+
part: "way",
|
|
115
|
+
recipe: statTermRecipe,
|
|
116
|
+
required: false
|
|
117
|
+
}
|
|
118
|
+
});
|
|
49
119
|
//#endregion
|
|
50
|
-
export { defaultStatAccent, defaultStatSparkShape, defaultStatSurface, statAccents, statChangeRecipe, statDirections, statFigureRecipe, statHintRecipe, statLabelRecipe, statRecipe, statSparkRecipe, statSparkShapes, statStackRecipe, statSurfaces, statTermRecipe, statUnitRecipe, statValueRecipe };
|
|
120
|
+
export { defaultStatAccent, defaultStatSparkShape, defaultStatSurface, statAccents, statAnatomy, statChangeRecipe, statDirections, statFigureRecipe, statHintRecipe, statLabelRecipe, statRecipe, statSparkRecipe, statSparkShapes, statStackRecipe, statSurfaces, statTermRecipe, statUnitRecipe, statValueRecipe };
|
|
51
121
|
|
|
52
122
|
//# sourceMappingURL=stat.js.map
|
package/dist/recipes/stat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.js","names":[],"sources":["../../src/recipes/stat.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { tileRoused } from '#parts/rouse'\nimport { defaultTone, tones } from '#parts/tone'\nimport type { Tone } from '#tone'\nimport { toneBlend } from '#tone'\n\nconst statAccents = tones\n\ntype StatAccent = Tone\n\nconst statDirections = ['up', 'down'] as const\n\ntype StatDirection = (typeof statDirections)[number]\n\nconst defaultStatAccent = defaultTone\n\nconst BLEND = toneBlend\n\ntype StatSurface = 'glass' | 'flat'\n\nconst statSurfaces = ['glass', 'flat'] as const satisfies readonly StatSurface[]\n\nconst defaultStatSurface = 'glass' satisfies StatSurface\n\nconst statRecipe = cva(\n [\n '@container relative isolate flex min-w-0 grow items-center gap-5 p-6',\n 'font-tf-body text-tf-fg tf-transition',\n tileRoused,\n ],\n {\n defaultVariants: { accent: defaultStatAccent, surface: defaultStatSurface },\n variants: {\n accent: BLEND,\n surface: {\n flat: '',\n glass: [\n 'rounded-tf-card bg-tf-glass shadow-tf-float backdrop-blur-tf-glass',\n 'tf-edge-sweep',\n 'motion-safe:tf-lands',\n ].join(' '),\n } satisfies Record<StatSurface, string>,\n },\n },\n)\n\nconst statStackRecipe = cva('flex min-w-0 grow flex-wrap items-center gap-x-3 gap-y-1')\n\nconst statLabelRecipe = cva(['order-1 grow text-tf-body-sm font-medium text-tf-fg'])\n\nconst statFigureRecipe = cva('order-3 m-0 flex basis-full flex-nowrap items-baseline gap-2')\n\nconst statValueRecipe = cva([\n 'font-tf-display text-tf-figure font-bold tracking-tf-tight text-tf-fg',\n 'motion-safe:tf-tallies',\n])\n\nconst statUnitRecipe = cva('text-tf-unit font-tf-body font-medium text-tf-muted')\n\nconst statHintRecipe = cva('order-4 basis-full text-tf-caption-sm text-tf-muted')\n\nconst statSparkShapes = ['line', 'bars'] as const\n\ntype StatSparkShape = (typeof statSparkShapes)[number]\n\nconst defaultStatSparkShape = 'line' satisfies StatSparkShape\n\nconst statSparkRecipe = cva('order-5 mt-2 h-7 w-full basis-full')\n\nconst statChangeRecipe = cva([\n 'relative order-2 m-0 ml-auto inline-flex items-center gap-1',\n 'tf-edge-sweep rounded-tf-pill bg-tf-panel px-2 py-1 blend-tf-accent',\n 'text-tf-caption-sm font-normal whitespace-nowrap text-tf-accent-hi tabular-nums',\n 'tf-icons [&_svg]:size-tf-icon-sm [&_svg]:shrink-0',\n])\n\nconst statTermRecipe = cva('sr-only')\n\nexport {\n type StatAccent,\n type StatDirection,\n type StatSparkShape,\n type StatSurface,\n defaultStatAccent,\n defaultStatSparkShape,\n defaultStatSurface,\n statAccents,\n statChangeRecipe,\n statDirections,\n statFigureRecipe,\n statHintRecipe,\n statLabelRecipe,\n statRecipe,\n statSparkRecipe,\n statSparkShapes,\n statStackRecipe,\n statSurfaces,\n statTermRecipe,\n statUnitRecipe,\n statValueRecipe,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stat.js","names":[],"sources":["../../src/recipes/stat.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { anatomy } from '#anatomy'\nimport { tileRoused } from '#parts/rouse'\nimport { defaultTone, tones } from '#parts/tone'\nimport type { Tone } from '#tone'\nimport { toneBlend } from '#tone'\n\nconst statAccents = tones\n\ntype StatAccent = Tone\n\nconst statDirections = ['up', 'down'] as const\n\ntype StatDirection = (typeof statDirections)[number]\n\nconst defaultStatAccent = defaultTone\n\nconst BLEND = toneBlend\n\ntype StatSurface = 'glass' | 'flat'\n\nconst statSurfaces = ['glass', 'flat'] as const satisfies readonly StatSurface[]\n\nconst defaultStatSurface = 'glass' satisfies StatSurface\n\nconst statRecipe = cva(\n [\n '@container relative isolate flex min-w-0 grow items-center gap-5 p-6',\n 'font-tf-body text-tf-fg tf-transition',\n tileRoused,\n ],\n {\n defaultVariants: { accent: defaultStatAccent, surface: defaultStatSurface },\n variants: {\n accent: BLEND,\n surface: {\n flat: '',\n glass: [\n 'rounded-tf-card bg-tf-glass shadow-tf-float backdrop-blur-tf-glass',\n 'tf-edge-sweep',\n 'motion-safe:tf-lands',\n ].join(' '),\n } satisfies Record<StatSurface, string>,\n },\n },\n)\n\nconst statStackRecipe = cva('flex min-w-0 grow flex-wrap items-center gap-x-3 gap-y-1')\n\nconst statLabelRecipe = cva(['order-1 grow text-tf-body-sm font-medium text-tf-fg'])\n\nconst statFigureRecipe = cva('order-3 m-0 flex basis-full flex-nowrap items-baseline gap-2')\n\nconst statValueRecipe = cva([\n 'font-tf-display text-tf-figure font-bold tracking-tf-tight text-tf-fg',\n 'motion-safe:tf-tallies',\n])\n\nconst statUnitRecipe = cva('text-tf-unit font-tf-body font-medium text-tf-muted')\n\nconst statHintRecipe = cva('order-4 basis-full text-tf-caption-sm text-tf-muted')\n\nconst statSparkShapes = ['line', 'bars'] as const\n\ntype StatSparkShape = (typeof statSparkShapes)[number]\n\nconst defaultStatSparkShape = 'line' satisfies StatSparkShape\n\nconst statSparkRecipe = cva('order-5 mt-2 h-7 w-full basis-full')\n\nconst statChangeRecipe = cva([\n 'relative order-2 m-0 ml-auto inline-flex items-center gap-1',\n 'tf-edge-sweep rounded-tf-pill bg-tf-panel px-2 py-1 blend-tf-accent',\n 'text-tf-caption-sm font-normal whitespace-nowrap text-tf-accent-hi tabular-nums',\n 'tf-icons [&_svg]:size-tf-icon-sm [&_svg]:shrink-0',\n])\n\nconst statTermRecipe = cva('sr-only')\n\nconst statBadgeRecipe = cva('absolute top-4 right-4')\n\nconst statCountedRecipe = cva('')\n\nconst statAnatomy = anatomy({\n badge: { part: 'badge', recipe: statBadgeRecipe, required: false },\n change: { part: 'change', recipe: statChangeRecipe, required: false },\n counted: { part: 'counted', recipe: statCountedRecipe, required: true },\n figure: { part: 'figure', recipe: statFigureRecipe, required: true },\n hint: { part: 'hint', recipe: statHintRecipe, required: false },\n label: { part: 'label', recipe: statLabelRecipe, required: true },\n root: { part: 'stat', recipe: statRecipe, required: true },\n spark: { part: 'spark', recipe: statSparkRecipe, required: false },\n stack: { part: 'stack', recipe: statStackRecipe, required: true },\n term: { part: 'term', recipe: statTermRecipe, required: false },\n unit: { part: 'unit', recipe: statUnitRecipe, required: false },\n value: { part: 'value', recipe: statValueRecipe, required: true },\n way: { part: 'way', recipe: statTermRecipe, required: false },\n})\n\nexport {\n type StatAccent,\n type StatDirection,\n type StatSparkShape,\n type StatSurface,\n defaultStatAccent,\n defaultStatSparkShape,\n defaultStatSurface,\n statAccents,\n statAnatomy,\n statChangeRecipe,\n statDirections,\n statFigureRecipe,\n statHintRecipe,\n statLabelRecipe,\n statRecipe,\n statSparkRecipe,\n statSparkShapes,\n statStackRecipe,\n statSurfaces,\n statTermRecipe,\n statUnitRecipe,\n statValueRecipe,\n}\n"],"mappings":";;;;;;AAQA,MAAM,cAAc;AAIpB,MAAM,iBAAiB,CAAC,MAAM,MAAM;AAIpC,MAAM,oBAAoB;AAE1B,MAAM,QAAQ;AAId,MAAM,eAAe,CAAC,SAAS,MAAM;AAErC,MAAM,qBAAqB;AAE3B,MAAM,aAAa,IACjB;CACE;CACA;CACA;AACF,GACA;CACE,iBAAiB;EAAE,QAAQ;EAAmB,SAAS;CAAmB;CAC1E,UAAU;EACR,QAAQ;EACR,SAAS;GACP,MAAM;GACN,OAAO;IACL;IACA;IACA;GACF,CAAC,CAAC,KAAK,GAAG;EACZ;CACF;AACF,CACF;AAEA,MAAM,kBAAkB,IAAI,0DAA0D;AAEtF,MAAM,kBAAkB,IAAI,CAAC,qDAAqD,CAAC;AAEnF,MAAM,mBAAmB,IAAI,8DAA8D;AAE3F,MAAM,kBAAkB,IAAI,CAC1B,yEACA,wBACF,CAAC;AAED,MAAM,iBAAiB,IAAI,qDAAqD;AAEhF,MAAM,iBAAiB,IAAI,qDAAqD;AAEhF,MAAM,kBAAkB,CAAC,QAAQ,MAAM;AAIvC,MAAM,wBAAwB;AAE9B,MAAM,kBAAkB,IAAI,oCAAoC;AAEhE,MAAM,mBAAmB,IAAI;CAC3B;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,iBAAiB,IAAI,SAAS;AAEpC,MAAM,kBAAkB,IAAI,wBAAwB;AAEpD,MAAM,oBAAoB,IAAI,EAAE;AAEhC,MAAM,cAAc,QAAQ;CAC1B,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAiB,UAAU;CAAM;CACjE,QAAQ;EAAE,MAAM;EAAU,QAAQ;EAAkB,UAAU;CAAM;CACpE,SAAS;EAAE,MAAM;EAAW,QAAQ;EAAmB,UAAU;CAAK;CACtE,QAAQ;EAAE,MAAM;EAAU,QAAQ;EAAkB,UAAU;CAAK;CACnE,MAAM;EAAE,MAAM;EAAQ,QAAQ;EAAgB,UAAU;CAAM;CAC9D,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAiB,UAAU;CAAK;CAChE,MAAM;EAAE,MAAM;EAAQ,QAAQ;EAAY,UAAU;CAAK;CACzD,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAiB,UAAU;CAAM;CACjE,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAiB,UAAU;CAAK;CAChE,MAAM;EAAE,MAAM;EAAQ,QAAQ;EAAgB,UAAU;CAAM;CAC9D,MAAM;EAAE,MAAM;EAAQ,QAAQ;EAAgB,UAAU;CAAM;CAC9D,OAAO;EAAE,MAAM;EAAS,QAAQ;EAAiB,UAAU;CAAK;CAChE,KAAK;EAAE,MAAM;EAAO,QAAQ;EAAgB,UAAU;CAAM;AAC9D,CAAC"}
|
package/dist/recipes/switch.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ declare const switchTitleRecipe: (props?: import("class-variance-authority/types
|
|
|
15
15
|
declare const switchHintRecipe: (props?: ({
|
|
16
16
|
invalid?: boolean | null | undefined;
|
|
17
17
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
+
declare const switchAnatomy: {
|
|
19
|
+
readonly root: {
|
|
20
|
+
readonly part: "switch";
|
|
21
|
+
readonly recipe: (props?: ({
|
|
22
|
+
plate?: "full" | "snug" | "bare" | null | undefined;
|
|
23
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
|
+
readonly required: true;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
18
27
|
//#endregion
|
|
19
|
-
export { type SwitchAccent, defaultSwitchAccent, switchAccents, switchControlRecipe, switchHintRecipe, switchLabelRecipe, switchRecipe, switchThumbRecipe, switchTitleRecipe };
|
|
28
|
+
export { type SwitchAccent, defaultSwitchAccent, switchAccents, switchAnatomy, switchControlRecipe, switchHintRecipe, switchLabelRecipe, switchRecipe, switchThumbRecipe, switchTitleRecipe };
|
|
20
29
|
//# sourceMappingURL=switch.d.ts.map
|
package/dist/recipes/switch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { toneBlend } from "../tone.js";
|
|
1
|
+
import { anatomy } from "../anatomy.js";
|
|
3
2
|
import { defaultTone, tones } from "../parts/tone.js";
|
|
3
|
+
import { toneBlend } from "../tone.js";
|
|
4
|
+
import { defaultMarkPlate } from "../mark.js";
|
|
4
5
|
import { markFace, markKnob, markPlate, markPlated, markPress, markRow, markStack, markTitle } from "../parts/mark.js";
|
|
5
6
|
import { cva } from "class-variance-authority";
|
|
6
7
|
//#region src/recipes/switch.ts
|
|
@@ -54,7 +55,12 @@ const switchHintRecipe = cva("text-tf-caption font-medium", {
|
|
|
54
55
|
true: "text-tf-danger-hi tf-arrives"
|
|
55
56
|
} }
|
|
56
57
|
});
|
|
58
|
+
const switchAnatomy = anatomy({ root: {
|
|
59
|
+
part: "switch",
|
|
60
|
+
recipe: switchRecipe,
|
|
61
|
+
required: true
|
|
62
|
+
} });
|
|
57
63
|
//#endregion
|
|
58
|
-
export { defaultSwitchAccent, switchAccents, switchControlRecipe, switchHintRecipe, switchLabelRecipe, switchRecipe, switchThumbRecipe, switchTitleRecipe };
|
|
64
|
+
export { defaultSwitchAccent, switchAccents, switchAnatomy, switchControlRecipe, switchHintRecipe, switchLabelRecipe, switchRecipe, switchThumbRecipe, switchTitleRecipe };
|
|
59
65
|
|
|
60
66
|
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","names":[],"sources":["../../src/recipes/switch.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport type { MarkPlate } from '#mark'\nimport { defaultMarkPlate } from '#mark'\nimport {\n markFace,\n markKnob,\n markPlate,\n markPlated,\n markPress,\n markRow,\n markStack,\n markTitle,\n} from '#parts/mark'\nimport { defaultTone, tones } from '#parts/tone'\nimport type { Tone } from '#tone'\nimport { toneBlend } from '#tone'\n\nconst switchAccents = tones\n\ntype SwitchAccent = Tone\n\nconst defaultSwitchAccent = defaultTone\n\nconst TRACK = [\n 'box-border justify-start rounded-tf-control',\n 'w-[calc(var(--spacing-tf-icon-lg)*2)]',\n 'h-[calc(var(--spacing-tf-icon-md)+2*var(--spacing-tf-mark-inset))]',\n 'p-tf-mark-inset',\n]\n\nconst FILL = ['bg-tf-panel', 'tf-ramp']\n\nconst OFF = ['data-[state=unchecked]:interactive:not-data-readonly:hovered:bg-tf-panel-hi']\n\nconst ON = [\n 'data-[state=checked]:tf-mark-lit',\n 'data-[state=checked]:tf-mark-glowing',\n 'data-[state=checked]:bg-tf-blend',\n 'data-[state=checked]:interactive:not-data-readonly:hovered:tf-blended',\n]\n\nconst switchRecipe = cva([...markRow, 'justify-between gap-6'], {\n defaultVariants: { plate: defaultMarkPlate },\n variants: {\n plate: {\n bare: `${markPlate.bare} ${markPlated.bare}`,\n full: `${markPlate.full} ${markPlated.full}`,\n snug: `${markPlate.snug} ${markPlated.snug}`,\n } satisfies Record<MarkPlate, string>,\n },\n})\n\nconst switchControlRecipe = cva(\n [\n ...markFace,\n ...TRACK,\n ...FILL,\n ...OFF,\n ...ON,\n 'data-invalid:blend-tf-danger data-invalid:tf-mark-failed',\n ],\n {\n defaultVariants: { accent: defaultSwitchAccent },\n variants: { accent: toneBlend },\n },\n)\n\nconst switchThumbRecipe = cva([\n ...markKnob,\n 'size-tf-icon-md',\n 'data-[state=checked]:translate-x-tf-icon-sm',\n markPress,\n])\n\nconst switchLabelRecipe = cva(markStack)\n\nconst switchTitleRecipe = cva(markTitle)\n\nconst switchHintRecipe = cva('text-tf-caption font-medium', {\n defaultVariants: { invalid: false },\n variants: {\n invalid: { false: 'text-tf-muted', true: 'text-tf-danger-hi tf-arrives' },\n },\n})\n\nexport {\n type SwitchAccent,\n defaultSwitchAccent,\n switchAccents,\n switchControlRecipe,\n switchHintRecipe,\n switchLabelRecipe,\n switchRecipe,\n switchThumbRecipe,\n switchTitleRecipe,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"switch.js","names":[],"sources":["../../src/recipes/switch.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\n\nimport { anatomy } from '#anatomy'\nimport type { MarkPlate } from '#mark'\nimport { defaultMarkPlate } from '#mark'\nimport {\n markFace,\n markKnob,\n markPlate,\n markPlated,\n markPress,\n markRow,\n markStack,\n markTitle,\n} from '#parts/mark'\nimport { defaultTone, tones } from '#parts/tone'\nimport type { Tone } from '#tone'\nimport { toneBlend } from '#tone'\n\nconst switchAccents = tones\n\ntype SwitchAccent = Tone\n\nconst defaultSwitchAccent = defaultTone\n\nconst TRACK = [\n 'box-border justify-start rounded-tf-control',\n 'w-[calc(var(--spacing-tf-icon-lg)*2)]',\n 'h-[calc(var(--spacing-tf-icon-md)+2*var(--spacing-tf-mark-inset))]',\n 'p-tf-mark-inset',\n]\n\nconst FILL = ['bg-tf-panel', 'tf-ramp']\n\nconst OFF = ['data-[state=unchecked]:interactive:not-data-readonly:hovered:bg-tf-panel-hi']\n\nconst ON = [\n 'data-[state=checked]:tf-mark-lit',\n 'data-[state=checked]:tf-mark-glowing',\n 'data-[state=checked]:bg-tf-blend',\n 'data-[state=checked]:interactive:not-data-readonly:hovered:tf-blended',\n]\n\nconst switchRecipe = cva([...markRow, 'justify-between gap-6'], {\n defaultVariants: { plate: defaultMarkPlate },\n variants: {\n plate: {\n bare: `${markPlate.bare} ${markPlated.bare}`,\n full: `${markPlate.full} ${markPlated.full}`,\n snug: `${markPlate.snug} ${markPlated.snug}`,\n } satisfies Record<MarkPlate, string>,\n },\n})\n\nconst switchControlRecipe = cva(\n [\n ...markFace,\n ...TRACK,\n ...FILL,\n ...OFF,\n ...ON,\n 'data-invalid:blend-tf-danger data-invalid:tf-mark-failed',\n ],\n {\n defaultVariants: { accent: defaultSwitchAccent },\n variants: { accent: toneBlend },\n },\n)\n\nconst switchThumbRecipe = cva([\n ...markKnob,\n 'size-tf-icon-md',\n 'data-[state=checked]:translate-x-tf-icon-sm',\n markPress,\n])\n\nconst switchLabelRecipe = cva(markStack)\n\nconst switchTitleRecipe = cva(markTitle)\n\nconst switchHintRecipe = cva('text-tf-caption font-medium', {\n defaultVariants: { invalid: false },\n variants: {\n invalid: { false: 'text-tf-muted', true: 'text-tf-danger-hi tf-arrives' },\n },\n})\n\nconst switchAnatomy = anatomy({\n root: { part: 'switch', recipe: switchRecipe, required: true },\n})\n\nexport {\n type SwitchAccent,\n defaultSwitchAccent,\n switchAccents,\n switchAnatomy,\n switchControlRecipe,\n switchHintRecipe,\n switchLabelRecipe,\n switchRecipe,\n switchThumbRecipe,\n switchTitleRecipe,\n}\n"],"mappings":";;;;;;;AAmBA,MAAM,gBAAgB;AAItB,MAAM,sBAAsB;AAE5B,MAAM,QAAQ;CACZ;CACA;CACA;CACA;AACF;AAEA,MAAM,OAAO,CAAC,eAAe,SAAS;AAEtC,MAAM,MAAM,CAAC,6EAA6E;AAE1F,MAAM,KAAK;CACT;CACA;CACA;CACA;AACF;AAEA,MAAM,eAAe,IAAI,CAAC,GAAG,SAAS,uBAAuB,GAAG;CAC9D,iBAAiB,EAAE,OAAO,iBAAiB;CAC3C,UAAU,EACR,OAAO;EACL,MAAM,GAAG,UAAU,KAAK,GAAG,WAAW;EACtC,MAAM,GAAG,UAAU,KAAK,GAAG,WAAW;EACtC,MAAM,GAAG,UAAU,KAAK,GAAG,WAAW;CACxC,EACF;AACF,CAAC;AAED,MAAM,sBAAsB,IAC1B;CACE,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH;AACF,GACA;CACE,iBAAiB,EAAE,QAAQ,oBAAoB;CAC/C,UAAU,EAAE,QAAQ,UAAU;AAChC,CACF;AAEA,MAAM,oBAAoB,IAAI;CAC5B,GAAG;CACH;CACA;CACA;AACF,CAAC;AAED,MAAM,oBAAoB,IAAI,SAAS;AAEvC,MAAM,oBAAoB,IAAI,SAAS;AAEvC,MAAM,mBAAmB,IAAI,+BAA+B;CAC1D,iBAAiB,EAAE,SAAS,MAAM;CAClC,UAAU,EACR,SAAS;EAAE,OAAO;EAAiB,MAAM;CAA+B,EAC1E;AACF,CAAC;AAED,MAAM,gBAAgB,QAAQ,EAC5B,MAAM;CAAE,MAAM;CAAU,QAAQ;CAAc,UAAU;AAAK,EAC/D,CAAC"}
|