@motion-proto/live-tokens 0.6.2 → 0.7.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/README.md +14 -13
- package/dist-plugin/index.cjs +147 -136
- package/dist-plugin/index.d.cts +1 -1
- package/dist-plugin/index.d.ts +1 -1
- package/dist-plugin/index.js +145 -135
- package/package.json +25 -40
- package/src/{component-editor → editor/component-editor}/BadgeEditor.svelte +8 -82
- package/src/{component-editor → editor/component-editor}/CalloutEditor.svelte +4 -4
- package/src/{component-editor → editor/component-editor}/CardEditor.svelte +28 -76
- package/src/{component-editor → editor/component-editor}/CollapsibleSectionEditor.svelte +3 -3
- package/src/{component-editor → editor/component-editor}/CornerBadgeEditor.svelte +31 -93
- package/src/{component-editor → editor/component-editor}/DialogEditor.svelte +60 -57
- package/src/editor/component-editor/ImageEditor.svelte +30 -0
- package/src/{component-editor → editor/component-editor}/InlineEditActionsEditor.svelte +6 -4
- package/src/editor/component-editor/MenuSelectEditor.svelte +160 -0
- package/src/{component-editor → editor/component-editor}/NotificationEditor.svelte +64 -37
- package/src/{component-editor → editor/component-editor}/ProgressBarEditor.svelte +5 -4
- package/src/{component-editor → editor/component-editor}/RadioButtonEditor.svelte +3 -3
- package/src/{component-editor → editor/component-editor}/SectionDividerEditor.svelte +57 -84
- package/src/{component-editor → editor/component-editor}/SegmentedControlEditor.svelte +2 -2
- package/src/{component-editor → editor/component-editor}/StandardButtonsEditor.svelte +16 -20
- package/src/{component-editor → editor/component-editor}/TabBarEditor.svelte +9 -14
- package/src/{component-editor → editor/component-editor}/TableEditor.svelte +9 -18
- package/src/{component-editor → editor/component-editor}/TooltipEditor.svelte +11 -47
- package/src/{component-editor → editor/component-editor}/registry.ts +28 -18
- package/src/{component-editor → editor/component-editor}/scaffolding/AngleDial.svelte +2 -2
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentEditorBase.svelte +3 -51
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentFileManager.svelte +144 -416
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentFileMenu.svelte +18 -170
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentsTab.svelte +2 -2
- package/src/{component-editor → editor/component-editor}/scaffolding/CopyFromMenu.svelte +44 -4
- package/src/{component-editor → editor/component-editor}/scaffolding/DividerEditor.svelte +1 -1
- package/src/{component-editor → editor/component-editor}/scaffolding/FieldsetWrapper.svelte +1 -1
- package/src/{component-editor → editor/component-editor}/scaffolding/GradientCard.svelte +6 -6
- package/src/{component-editor → editor/component-editor}/scaffolding/LinkageChart.svelte +6 -6
- package/src/{component-editor → editor/component-editor}/scaffolding/LinkedBlock.svelte +6 -11
- package/src/editor/component-editor/scaffolding/NonStylableConfig.svelte +38 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/SaveAsDialog.svelte +66 -12
- package/src/editor/component-editor/scaffolding/ShadowBackdrop.svelte +72 -0
- package/src/editor/component-editor/scaffolding/ShadowBackdropControls.svelte +132 -0
- package/src/editor/component-editor/scaffolding/StateBlock.svelte +257 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/TokenLayout.svelte +9 -7
- package/src/editor/component-editor/scaffolding/VariantGroup.svelte +644 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/editorContext.ts +19 -9
- package/src/{component-editor → editor/component-editor}/scaffolding/linkedBlock.ts +2 -2
- package/src/{component-editor → editor/component-editor}/scaffolding/types.ts +14 -0
- package/src/{lib → editor/core/components}/componentConfigService.ts +2 -2
- package/src/{lib → editor/core/components}/componentPersist.ts +5 -5
- package/src/editor/core/flashStatus.ts +30 -0
- package/src/{lib → editor/core/fonts}/fontLoader.ts +2 -2
- package/src/{lib → editor/core/fonts}/fontMigration.ts +4 -4
- package/src/{lib → editor/core/fonts}/fontParse.ts +1 -1
- package/src/editor/core/manifests/manifestService.ts +116 -0
- package/src/{lib → editor/core/palettes}/paletteDerivation.ts +2 -2
- package/src/{lib → editor/core/palettes}/tokenRegistry.ts +5 -5
- package/src/editor/core/productionPulse.ts +37 -0
- package/src/{lib → editor/core/routing}/router.ts +1 -1
- package/src/{lib/files/versionedFileResource.ts → editor/core/storage/files/versionedFileResourceClient.ts} +8 -1
- package/src/{lib → editor/core/store}/editorCore.ts +24 -8
- package/src/{lib → editor/core/store}/editorPersistence.ts +3 -3
- package/src/{lib → editor/core/store}/editorRenderer.ts +2 -2
- package/src/{lib → editor/core/store}/editorStore.ts +17 -17
- package/src/{lib → editor/core/store}/editorTypes.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/columns.ts +2 -2
- package/src/{lib → editor/core/themes}/slices/components.ts +2 -2
- package/src/{lib → editor/core/themes}/slices/fonts.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/gradients.ts +2 -2
- package/src/{lib → editor/core/themes}/slices/overlays.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/palettes.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/shadows.ts +3 -3
- package/src/{lib → editor/core/themes}/themeInit.ts +6 -6
- package/src/{lib → editor/core/themes}/themeService.ts +6 -6
- package/src/{lib → editor/core/themes}/themeTypes.ts +11 -7
- package/src/editor/index.ts +69 -0
- package/src/{lib → editor/overlay}/LiveEditorOverlay.svelte +79 -125
- package/src/{lib → editor/overlay}/columnsOverlay.ts +2 -2
- package/src/{pages → editor/pages}/ComponentEditorPage.svelte +12 -12
- package/src/{pages → editor/pages}/Editor.svelte +4 -4
- package/src/{pages → editor/pages}/EditorShell.svelte +18 -36
- package/src/{styles → editor/styles}/ui-editor.css +41 -21
- package/src/{styles → editor/styles}/ui-form-controls.css +8 -8
- package/src/{ui → editor/ui}/BezierCurveEditor.svelte +8 -8
- package/src/{ui → editor/ui}/ColorEditPanel.svelte +13 -13
- package/src/{ui → editor/ui}/EditorViewSwitcher.svelte +8 -6
- package/src/editor/ui/FileLoadList.svelte +350 -0
- package/src/editor/ui/FilePill.svelte +80 -0
- package/src/{ui → editor/ui}/FontStackEditor.svelte +7 -7
- package/src/{ui → editor/ui}/GradientEditor.svelte +11 -11
- package/src/{ui → editor/ui}/GradientStopPicker.svelte +1 -1
- package/src/editor/ui/ManifestFileManager.svelte +371 -0
- package/src/{ui → editor/ui}/PaletteEditor.svelte +132 -598
- package/src/{ui → editor/ui}/ProjectFontsSection.svelte +102 -144
- package/src/{ui → editor/ui}/SurfacesTab.svelte +3 -3
- package/src/{ui → editor/ui}/TextTab.svelte +3 -3
- package/src/{ui → editor/ui}/ThemeFileManager.svelte +286 -519
- package/src/{ui → editor/ui}/UICopyPopover.svelte +4 -4
- package/src/{ui → editor/ui}/UIFontFamilySelector.svelte +6 -6
- package/src/{ui → editor/ui}/UIFontSizeSelector.svelte +1 -1
- package/src/editor/ui/UIInfoPopover.svelte +244 -0
- package/src/{ui → editor/ui}/UILineHeightSelector.svelte +5 -5
- package/src/{ui → editor/ui}/UILinkToggle.svelte +2 -2
- package/src/{ui → editor/ui}/UIPaddingSelector.svelte +6 -6
- package/src/{ui → editor/ui}/UIPaletteSelector.svelte +26 -26
- package/src/editor/ui/UIPillButton.svelte +138 -0
- package/src/{ui → editor/ui}/UIRadio.svelte +2 -2
- package/src/{ui → editor/ui}/UIRelinkConfirmPopover.svelte +4 -4
- package/src/editor/ui/UISquareButton.svelte +172 -0
- package/src/{ui → editor/ui}/UITokenSelector.svelte +10 -10
- package/src/{ui → editor/ui}/UIVariantSelector.svelte +1 -1
- package/src/{ui → editor/ui}/VariablesTab.svelte +31 -8
- package/src/{ui → editor/ui}/palette/GradientStopEditor.svelte +13 -13
- package/src/{ui → editor/ui}/palette/OverridesPanel.svelte +13 -13
- package/src/{ui → editor/ui}/palette/PaletteBase.svelte +8 -5
- package/src/{ui → editor/ui}/palette/paletteEditorState.ts +1 -1
- package/src/editor/ui/palette/paletteMath.ts +275 -0
- package/src/{ui → editor/ui}/sections/ColumnsSection.svelte +137 -17
- package/src/{ui → editor/ui}/sections/GradientsSection.svelte +7 -7
- package/src/{ui → editor/ui}/sections/OverlaysSection.svelte +17 -17
- package/src/{ui → editor/ui}/sections/ShadowsSection.svelte +22 -22
- package/src/{ui → editor/ui}/sections/TokenScaleTable.svelte +3 -3
- package/src/{components → system/components}/Badge.svelte +0 -36
- package/src/{components → system/components}/Card.svelte +8 -62
- package/src/{components → system/components}/CornerBadge.svelte +8 -24
- package/src/{components → system/components}/Dialog.svelte +1 -1
- package/src/system/components/FloatingTokenTags.css +256 -0
- package/src/system/components/FloatingTokenTags.svelte +592 -0
- package/src/{components → system/components}/InlineEditActions.svelte +6 -4
- package/src/system/components/MenuSelect.svelte +229 -0
- package/src/{components → system/components}/ProgressBar.svelte +29 -11
- package/src/{components → system/components}/SegmentedControl.svelte +49 -43
- package/src/{components → system/components}/TabBar.svelte +81 -65
- package/src/{components → system/components}/Table.svelte +17 -3
- package/src/{components → system/components}/Tooltip.svelte +6 -4
- package/src/system/styles/CONVENTIONS.md +178 -0
- package/src/{styles → system/styles}/fonts.css +6 -3
- package/src/{styles → system/styles}/tokens.css +149 -29
- package/src/component-editor/ImageEditor.svelte +0 -74
- package/src/component-editor/scaffolding/NonStylableConfig.svelte +0 -62
- package/src/component-editor/scaffolding/ShadowBackdrop.svelte +0 -37
- package/src/component-editor/scaffolding/ShadowBackdropControls.svelte +0 -61
- package/src/component-editor/scaffolding/StateBlock.svelte +0 -132
- package/src/component-editor/scaffolding/VariantGroup.svelte +0 -310
- package/src/data/google-fonts.json +0 -75
- package/src/lib/index.ts +0 -68
- package/src/lib/presetService.ts +0 -214
- package/src/lib/productionPulse.ts +0 -32
- package/src/ui/PresetFileManager.svelte +0 -1116
- package/src/ui/UnsavedComponentsDialog.svelte +0 -315
- /package/src/{styles → app}/site.css +0 -0
- /package/src/{component-editor → editor/component-editor}/index.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/DemoHeader.svelte +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/TypeEditor.svelte +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/buildTypeGroupTokens.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/componentSectionType.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/componentSources.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/defaultSections.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/siblings.ts +0 -0
- /package/src/{lib → editor/core/components}/componentConfigKeys.ts +0 -0
- /package/src/{lib → editor/core}/cssVarSync.ts +0 -0
- /package/src/{lib → editor/core/palettes}/oklch.ts +0 -0
- /package/src/{lib → editor/core/routing}/navLinkTypes.ts +0 -0
- /package/src/{lib → editor/core/routing}/parentRouteStore.ts +0 -0
- /package/src/{lib → editor/core/storage}/storage.ts +0 -0
- /package/src/{lib → editor/core/store}/editorConfig.ts +0 -0
- /package/src/{lib → editor/core/store}/editorConfigStore.ts +0 -0
- /package/src/{lib → editor/core/store}/editorKeybindings.ts +0 -0
- /package/src/{lib → editor/core/store}/editorViewStore.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-24-component-prefix-and-suffix-renames.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-24-legacy-keys-and-bg-to-canvas.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-27-segmentedcontrol-disabled-flatten.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-08-collapsiblesection-frame-and-cleanup.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-08-collapsiblesection-variant-namespace.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-10-sectiondivider-gradient-stops.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-13-primary-to-brand.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/index.ts +0 -0
- /package/src/{lib → editor/core/themes}/parsers/globalRootBlock.ts +0 -0
- /package/src/{lib → editor/core/themes}/slices/domainVars.ts +0 -0
- /package/src/{lib → editor/overlay}/ColumnsOverlay.svelte +0 -0
- /package/src/{lib → editor/overlay}/overlayState.ts +0 -0
- /package/src/{pages → editor/pages}/ComponentEditorPage.svelte.d.ts +0 -0
- /package/src/{pages → editor/pages}/Editor.svelte.d.ts +0 -0
- /package/src/{ui → editor/ui}/Toggle.svelte +0 -0
- /package/src/{ui → editor/ui}/UIDialog.svelte +0 -0
- /package/src/{ui → editor/ui}/UIFontWeightSelector.svelte +0 -0
- /package/src/{ui → editor/ui}/UIOptionItem.svelte +0 -0
- /package/src/{ui → editor/ui}/UIOptionList.svelte +0 -0
- /package/src/{ui → editor/ui}/UIRadioGroup.svelte +0 -0
- /package/src/{lib → editor/ui}/copyPopover.ts +0 -0
- /package/src/{ui → editor/ui}/curveEngine.ts +0 -0
- /package/src/{ui → editor/ui}/index.ts +0 -0
- /package/src/{ui → editor/ui}/keepInViewport.ts +0 -0
- /package/src/{ui → editor/ui}/palette/ScaleCurveEditor.svelte +0 -0
- /package/src/{lib → editor/ui}/scrollSection.ts +0 -0
- /package/src/{ui → editor/ui}/sections/tokenScales.ts +0 -0
- /package/src/{ui → editor/ui}/variantScales.ts +0 -0
- /package/src/{assets → system/assets}/newspaper.webp +0 -0
- /package/src/{assets → system/assets}/offering.webp +0 -0
- /package/src/{components → system/components}/Button.svelte +0 -0
- /package/src/{components → system/components}/Callout.svelte +0 -0
- /package/src/{components → system/components}/CollapsibleSection.svelte +0 -0
- /package/src/{components → system/components}/Image.svelte +0 -0
- /package/src/{components → system/components}/Notification.svelte +0 -0
- /package/src/{components → system/components}/RadioButton.svelte +0 -0
- /package/src/{components → system/components}/SectionDivider.svelte +0 -0
- /package/src/{components → system/components}/types.ts +0 -0
- /package/src/{styles → system/styles}/_padding.scss +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-italic-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-italic-latin.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-roman-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-roman-latin.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Manrope/Manrope-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Manrope/Manrope-latin.woff2 +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
|
-
import { badgeVariants } from '
|
|
4
|
+
import { badgeVariants } from '../../system/components/Badge.svelte';
|
|
5
5
|
|
|
6
6
|
export const component = 'badge';
|
|
7
7
|
const variants = badgeVariants;
|
|
@@ -59,56 +59,18 @@
|
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<script lang="ts">
|
|
62
|
-
import Badge from '
|
|
62
|
+
import Badge from '../../system/components/Badge.svelte';
|
|
63
63
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
64
64
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
65
|
-
import { editorState } from '../
|
|
65
|
+
import { editorState } from '../core/store/editorStore';
|
|
66
66
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
67
67
|
import { buildSiblings } from './scaffolding/siblings';
|
|
68
|
-
import ShadowBackdrop from './scaffolding/ShadowBackdrop.svelte';
|
|
69
|
-
import ShadowBackdropControls from './scaffolding/ShadowBackdropControls.svelte';
|
|
70
|
-
import UIRadioGroup from '../ui/UIRadioGroup.svelte';
|
|
71
68
|
|
|
72
69
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
73
70
|
let visibleVariantTokens = $derived((v: Variant) => withLinkedDisabled(variantTokens(v), linked.varSet));
|
|
74
|
-
|
|
75
|
-
let bgMode: 'image' | 'color' = $state('image');
|
|
76
|
-
const bgVar = '--backdrop-badge-surface';
|
|
77
|
-
|
|
78
|
-
// Preview-only props for Badge's floating/anchor/flush features (not persisted).
|
|
79
|
-
// For corner-anchored use, prefer the dedicated CornerBadge component; Badge.floating
|
|
80
|
-
// is the low-level escape hatch for off-corner floating placements.
|
|
81
|
-
let floating: boolean = $state(false);
|
|
82
|
-
let flush: boolean = $state(false);
|
|
83
|
-
let anchor: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' = $state('bottom-right');
|
|
84
|
-
const anchorOptions = [
|
|
85
|
-
{ value: 'top-left' as const, label: 'TL' },
|
|
86
|
-
{ value: 'top-right' as const, label: 'TR' },
|
|
87
|
-
{ value: 'bottom-left' as const, label: 'BL' },
|
|
88
|
-
{ value: 'bottom-right' as const, label: 'BR' },
|
|
89
|
-
];
|
|
90
71
|
</script>
|
|
91
72
|
|
|
92
|
-
<ComponentEditorBase {component} title="Badge" description="Pill-shaped badges with color variants.
|
|
93
|
-
{#snippet config()}
|
|
94
|
-
|
|
95
|
-
<ShadowBackdropControls bind:mode={bgMode} colorVariable={bgVar} />
|
|
96
|
-
<label class="float-toggle">
|
|
97
|
-
<input type="checkbox" bind:checked={floating} />
|
|
98
|
-
<span>Floating preview</span>
|
|
99
|
-
</label>
|
|
100
|
-
{#if floating}
|
|
101
|
-
<label class="float-toggle">
|
|
102
|
-
<input type="checkbox" bind:checked={flush} />
|
|
103
|
-
<span>Flush corner</span>
|
|
104
|
-
</label>
|
|
105
|
-
<div class="anchor-control">
|
|
106
|
-
<span>Anchor</span>
|
|
107
|
-
<UIRadioGroup bind:value={anchor} name="badge-anchor" options={anchorOptions} />
|
|
108
|
-
</div>
|
|
109
|
-
{/if}
|
|
110
|
-
|
|
111
|
-
{/snippet}
|
|
73
|
+
<ComponentEditorBase {component} title="Badge" description="Pill-shaped badges with color variants." tokens={allTokens} {linked} variants={variantOptions}>
|
|
112
74
|
{#each variants as v}
|
|
113
75
|
<VariantGroup
|
|
114
76
|
name={v}
|
|
@@ -118,18 +80,10 @@
|
|
|
118
80
|
{component}
|
|
119
81
|
siblings={buildSiblings(variants, v, (sv) => ({ [sv]: variantTokens(sv) }), (sv) => ({ [sv]: variantTypeGroups(sv) }))}
|
|
120
82
|
>
|
|
121
|
-
<
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</div>
|
|
126
|
-
{:else}
|
|
127
|
-
<div class="badge-showcase-grid">
|
|
128
|
-
<Badge variant={v}>{v.charAt(0).toUpperCase() + v.slice(1)}</Badge>
|
|
129
|
-
<Badge variant={v} icon="fa-solid fa-dice-d20">With Icon</Badge>
|
|
130
|
-
</div>
|
|
131
|
-
{/if}
|
|
132
|
-
</ShadowBackdrop>
|
|
83
|
+
<div class="badge-showcase-grid">
|
|
84
|
+
<Badge variant={v}>{v.charAt(0).toUpperCase() + v.slice(1)}</Badge>
|
|
85
|
+
<Badge variant={v} icon="fa-solid fa-dice-d20">With Icon</Badge>
|
|
86
|
+
</div>
|
|
133
87
|
</VariantGroup>
|
|
134
88
|
{/each}
|
|
135
89
|
</ComponentEditorBase>
|
|
@@ -141,32 +95,4 @@
|
|
|
141
95
|
gap: var(--space-8);
|
|
142
96
|
align-items: center;
|
|
143
97
|
}
|
|
144
|
-
|
|
145
|
-
/* Anchor parent for floating-preview mode — gives the badge a positioned ancestor
|
|
146
|
-
and a visible surface so blur/offset/flush are observable. */
|
|
147
|
-
.floating-stage {
|
|
148
|
-
position: relative;
|
|
149
|
-
width: 100%;
|
|
150
|
-
min-height: 160px;
|
|
151
|
-
border-radius: var(--ui-radius-md);
|
|
152
|
-
background: rgba(0, 0, 0, 0.15);
|
|
153
|
-
overflow: hidden;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.float-toggle {
|
|
157
|
-
display: inline-flex;
|
|
158
|
-
align-items: center;
|
|
159
|
-
gap: var(--ui-space-4);
|
|
160
|
-
font-size: var(--ui-font-size-sm);
|
|
161
|
-
color: var(--ui-text-secondary);
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.anchor-control {
|
|
166
|
-
display: inline-flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
gap: var(--ui-space-8);
|
|
169
|
-
font-size: var(--ui-font-size-sm);
|
|
170
|
-
color: var(--ui-text-secondary);
|
|
171
|
-
}
|
|
172
98
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
|
-
import { calloutVariants } from '
|
|
4
|
+
import { calloutVariants } from '../../system/components/Callout.svelte';
|
|
5
5
|
|
|
6
6
|
export const component = 'callout';
|
|
7
7
|
const variants = calloutVariants;
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<script lang="ts">
|
|
72
|
-
import Callout from '
|
|
72
|
+
import Callout from '../../system/components/Callout.svelte';
|
|
73
73
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
74
74
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
75
|
-
import { editorState } from '../
|
|
75
|
+
import { editorState } from '../core/store/editorStore';
|
|
76
76
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
77
77
|
import { buildSiblings } from './scaffolding/siblings';
|
|
78
78
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
};
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
|
-
<ComponentEditorBase {component} title="Callout" description="Bordered callout box with semantic info / success / warning / danger variants, label + message text.
|
|
90
|
+
<ComponentEditorBase {component} title="Callout" description="Bordered callout box with semantic info / success / warning / danger variants, label + message text." tokens={allTokens} {linked} variants={variantOptions}>
|
|
91
91
|
{#each variants as v}
|
|
92
92
|
<VariantGroup
|
|
93
93
|
name={v}
|
|
@@ -4,41 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
export const component = 'card';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// Within each state we keep object shape props (surface/border/border-width/radius/padding/shadow) together.
|
|
9
|
-
// Title and body are nested elements with their own typography.
|
|
7
|
+
// Hover overrides only border + shadow; rest inherits default. `element` groups tokens by frame/header/body.
|
|
10
8
|
const states: Record<string, Token[]> = {
|
|
11
9
|
default: [
|
|
12
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--card-default-surface' },
|
|
13
|
-
{ label: '
|
|
14
|
-
{ label: 'border
|
|
15
|
-
{ label: '
|
|
16
|
-
{ label: '
|
|
17
|
-
{ label: '
|
|
18
|
-
{ label: '
|
|
19
|
-
{ label: '
|
|
20
|
-
{ label: '
|
|
21
|
-
{ label: '
|
|
10
|
+
{ label: 'surface color', groupKey: 'surface', variable: '--card-default-surface', element: 'frame' },
|
|
11
|
+
{ label: 'border color', groupKey: 'border', variable: '--card-default-border', element: 'frame' },
|
|
12
|
+
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--card-default-border-width', element: 'frame' },
|
|
13
|
+
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--card-default-radius', element: 'frame' },
|
|
14
|
+
{ label: 'card shadow', canBeLinked: true, groupKey: 'shadow', variable: '--card-default-shadow', element: 'frame' },
|
|
15
|
+
{ label: 'background blur', canBeLinked: true, groupKey: 'blur', variable: '--card-default-blur', element: 'frame' },
|
|
16
|
+
{ label: 'header color', groupKey: 'surface', variable: '--card-default-header-surface', element: 'header' },
|
|
17
|
+
{ label: 'header padding', canBeLinked: true, groupKey: 'header-padding', variable: '--card-default-header-padding', element: 'header' },
|
|
18
|
+
{ label: 'icon size', canBeLinked: true, groupKey: 'icon-size', variable: '--card-default-icon-size', element: 'header' },
|
|
19
|
+
{ label: 'body padding', canBeLinked: true, groupKey: 'body-padding', variable: '--card-default-body-padding', element: 'body' },
|
|
22
20
|
],
|
|
23
21
|
hover: [
|
|
24
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--card-hover-surface' },
|
|
25
|
-
{ label: 'header color', groupKey: 'surface', variable: '--card-hover-header-surface' },
|
|
26
22
|
{ label: 'border color', groupKey: 'border', variable: '--card-hover-border' },
|
|
27
|
-
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--card-hover-border-width' },
|
|
28
|
-
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--card-hover-radius' },
|
|
29
|
-
{ label: 'header padding', canBeLinked: true, groupKey: 'header-padding', variable: '--card-hover-header-padding' },
|
|
30
|
-
{ label: 'body padding', canBeLinked: true, groupKey: 'body-padding', variable: '--card-hover-body-padding' },
|
|
31
23
|
{ label: 'card shadow', canBeLinked: true, groupKey: 'shadow', variable: '--card-hover-shadow' },
|
|
32
|
-
{ label: 'background blur', canBeLinked: true, groupKey: 'blur', variable: '--card-hover-blur' },
|
|
33
|
-
{ label: 'icon size', canBeLinked: true, groupKey: 'icon-size', variable: '--card-hover-icon-size' },
|
|
34
24
|
],
|
|
35
25
|
};
|
|
36
26
|
|
|
37
|
-
//
|
|
27
|
+
// Typography shared across states (no hover overrides).
|
|
38
28
|
const typeGroups: Record<string, TypeGroupConfig[]> = {
|
|
39
29
|
default: [
|
|
40
30
|
{
|
|
41
|
-
legend: '
|
|
31
|
+
legend: 'title',
|
|
32
|
+
element: 'header',
|
|
42
33
|
colorVariable: '--card-default-title',
|
|
43
34
|
familyVariable: '--card-default-title-font-family',
|
|
44
35
|
sizeVariable: '--card-default-title-font-size',
|
|
@@ -46,7 +37,8 @@
|
|
|
46
37
|
lineHeightVariable: '--card-default-title-line-height',
|
|
47
38
|
},
|
|
48
39
|
{
|
|
49
|
-
legend: '
|
|
40
|
+
legend: 'body',
|
|
41
|
+
element: 'body',
|
|
50
42
|
colorVariable: '--card-default-body',
|
|
51
43
|
familyVariable: '--card-default-body-font-family',
|
|
52
44
|
sizeVariable: '--card-default-body-font-size',
|
|
@@ -54,46 +46,19 @@
|
|
|
54
46
|
lineHeightVariable: '--card-default-body-line-height',
|
|
55
47
|
},
|
|
56
48
|
],
|
|
57
|
-
hover: [
|
|
58
|
-
{
|
|
59
|
-
legend: 'card title',
|
|
60
|
-
colorVariable: '--card-hover-title',
|
|
61
|
-
familyVariable: '--card-hover-title-font-family',
|
|
62
|
-
sizeVariable: '--card-hover-title-font-size',
|
|
63
|
-
weightVariable: '--card-hover-title-font-weight',
|
|
64
|
-
lineHeightVariable: '--card-hover-title-line-height',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
legend: 'card body',
|
|
68
|
-
colorVariable: '--card-hover-body',
|
|
69
|
-
familyVariable: '--card-hover-body-font-family',
|
|
70
|
-
sizeVariable: '--card-hover-body-font-size',
|
|
71
|
-
weightVariable: '--card-hover-body-font-weight',
|
|
72
|
-
lineHeightVariable: '--card-hover-body-line-height',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
49
|
};
|
|
76
50
|
|
|
77
|
-
// Title type tokens (linked across states, but title and body are different objects so they don't link to each other).
|
|
78
51
|
const typeGroupTokens: Token[] = [
|
|
79
52
|
{ label: 'font family', canBeLinked: true, groupKey: 'title-font-family', variable: '--card-default-title-font-family' },
|
|
80
|
-
{ label: 'font family', canBeLinked: true, groupKey: 'title-font-family', variable: '--card-hover-title-font-family' },
|
|
81
53
|
{ label: 'font size', canBeLinked: true, groupKey: 'title-font-size', variable: '--card-default-title-font-size' },
|
|
82
|
-
{ label: 'font size', canBeLinked: true, groupKey: 'title-font-size', variable: '--card-hover-title-font-size' },
|
|
83
54
|
{ label: 'font weight', canBeLinked: true, groupKey: 'title-font-weight', variable: '--card-default-title-font-weight' },
|
|
84
|
-
{ label: 'font weight', canBeLinked: true, groupKey: 'title-font-weight', variable: '--card-hover-title-font-weight' },
|
|
85
55
|
{ label: 'line height', canBeLinked: true, groupKey: 'title-line-height', variable: '--card-default-title-line-height' },
|
|
86
|
-
{ label: 'line height', canBeLinked: true, groupKey: 'title-line-height', variable: '--card-hover-title-line-height' },
|
|
87
56
|
{ label: 'font family', canBeLinked: true, groupKey: 'body-font-family', variable: '--card-default-body-font-family' },
|
|
88
|
-
{ label: 'font family', canBeLinked: true, groupKey: 'body-font-family', variable: '--card-hover-body-font-family' },
|
|
89
57
|
{ label: 'font size', canBeLinked: true, groupKey: 'body-font-size', variable: '--card-default-body-font-size' },
|
|
90
|
-
{ label: 'font size', canBeLinked: true, groupKey: 'body-font-size', variable: '--card-hover-body-font-size' },
|
|
91
58
|
{ label: 'font weight', canBeLinked: true, groupKey: 'body-font-weight', variable: '--card-default-body-font-weight' },
|
|
92
|
-
{ label: 'font weight', canBeLinked: true, groupKey: 'body-font-weight', variable: '--card-hover-body-font-weight' },
|
|
93
59
|
{ label: 'line height', canBeLinked: true, groupKey: 'body-line-height', variable: '--card-default-body-line-height' },
|
|
94
|
-
{ label: 'line height', canBeLinked: true, groupKey: 'body-line-height', variable: '--card-hover-body-line-height' },
|
|
95
60
|
];
|
|
96
|
-
// Cross-state linked block
|
|
61
|
+
// Cross-state linked block; linkable props sourced from default state.
|
|
97
62
|
const linkableContexts = new Map<string, string>([
|
|
98
63
|
['--card-default-border-width', 'card'],
|
|
99
64
|
['--card-default-radius', 'card'],
|
|
@@ -119,14 +84,11 @@
|
|
|
119
84
|
</script>
|
|
120
85
|
|
|
121
86
|
<script lang="ts">
|
|
122
|
-
import Card from '
|
|
87
|
+
import Card from '../../system/components/Card.svelte';
|
|
123
88
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
124
89
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
125
|
-
import { editorState } from '../
|
|
90
|
+
import { editorState } from '../core/store/editorStore';
|
|
126
91
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
127
|
-
import ShadowBackdrop from './scaffolding/ShadowBackdrop.svelte';
|
|
128
|
-
import ShadowBackdropControls from './scaffolding/ShadowBackdropControls.svelte';
|
|
129
|
-
|
|
130
92
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
131
93
|
|
|
132
94
|
let visibleStates = $derived(Object.fromEntries(
|
|
@@ -134,23 +96,15 @@
|
|
|
134
96
|
) as Record<string, Token[]>);
|
|
135
97
|
|
|
136
98
|
let hoverEnabled = $state(true);
|
|
137
|
-
let bgMode: 'image' | 'color' = $state('image');
|
|
138
|
-
const bgVar = '--backdrop-card-surface';
|
|
139
99
|
</script>
|
|
140
100
|
|
|
141
|
-
<ComponentEditorBase {component} title="Card" description="Generic card with icon, title, and slotted body.
|
|
142
|
-
{#snippet config()}
|
|
143
|
-
|
|
144
|
-
<ShadowBackdropControls bind:mode={bgMode} colorVariable={bgVar} />
|
|
145
|
-
|
|
146
|
-
{/snippet}
|
|
101
|
+
<ComponentEditorBase {component} title="Card" description="Generic card with icon, title, and slotted body." tokens={allTokens} {linked}>
|
|
147
102
|
<VariantGroup
|
|
148
103
|
name="card"
|
|
149
104
|
title="Card"
|
|
150
105
|
states={visibleStates}
|
|
151
106
|
{typeGroups}
|
|
152
107
|
{component}
|
|
153
|
-
|
|
154
108
|
>
|
|
155
109
|
{#snippet stateActions(stateName)}
|
|
156
110
|
{#if stateName === 'hover'}
|
|
@@ -161,16 +115,14 @@
|
|
|
161
115
|
{/if}
|
|
162
116
|
{/snippet}
|
|
163
117
|
{#snippet children({ activeState })}
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{/snippet}
|
|
173
|
-
</VariantGroup>
|
|
118
|
+
{@const previewClass = activeState === 'hover' ? 'force-hover' : (hoverEnabled ? '' : 'no-hover')}
|
|
119
|
+
<div class="card-demo">
|
|
120
|
+
<Card title="Card title" class={previewClass}>
|
|
121
|
+
<p style="margin: 0;">Slotted body content. Hover the card (or switch the editor to the Hover state) to preview hover styling.</p>
|
|
122
|
+
</Card>
|
|
123
|
+
</div>
|
|
124
|
+
{/snippet}
|
|
125
|
+
</VariantGroup>
|
|
174
126
|
</ComponentEditorBase>
|
|
175
127
|
|
|
176
128
|
<style>
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
</script>
|
|
119
119
|
|
|
120
120
|
<script lang="ts">
|
|
121
|
-
import CollapsibleSection from '
|
|
121
|
+
import CollapsibleSection from '../../system/components/CollapsibleSection.svelte';
|
|
122
122
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
123
123
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
124
124
|
import { buildSiblings } from './scaffolding/siblings';
|
|
125
|
-
import { editorState } from '../
|
|
125
|
+
import { editorState } from '../core/store/editorStore';
|
|
126
126
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
127
127
|
|
|
128
128
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
) as Record<string, Token[]>);
|
|
133
133
|
</script>
|
|
134
134
|
|
|
135
|
-
<ComponentEditorBase {component} title="Collapsible Section" description="Expandable section with chevron toggle. Variants: chromeless, divider, container.
|
|
135
|
+
<ComponentEditorBase {component} title="Collapsible Section" description="Expandable section with chevron toggle. Variants: chromeless, divider, container." tokens={allTokens} {linked} variants={variantOptions}>
|
|
136
136
|
{#each VARIANTS as v}
|
|
137
137
|
<VariantGroup
|
|
138
138
|
name={v}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Token } from './scaffolding/types';
|
|
3
|
-
import { badgeVariants } from '
|
|
3
|
+
import { badgeVariants } from '../../system/components/Badge.svelte';
|
|
4
4
|
|
|
5
5
|
export const component = 'cornerbadge';
|
|
6
6
|
|
|
7
|
-
// One state per
|
|
8
|
-
// every token has a role-specific groupKey so the LinkedBlock groups
|
|
9
|
-
// "outer-radius" across variants (not against inner/h-axis/v-axis). Changing
|
|
10
|
-
// a variant's outer corner radius propagates to the same role on every other
|
|
11
|
-
// variant when linked; roles within a variant stay independent.
|
|
7
|
+
// One state per variant; role-specific groupKeys link the same role across variants while keeping roles independent within a variant.
|
|
12
8
|
function variantTokens(v: typeof badgeVariants[number]): Token[] {
|
|
13
9
|
return [
|
|
14
10
|
{ label: 'offset from corner', canBeLinked: true, groupKey: 'margin', variable: `--corner-badge-${v}-margin` },
|
|
@@ -17,12 +13,7 @@
|
|
|
17
13
|
{ label: 'horizontal-axis radius', canBeLinked: true, groupKey: 'h-axis-radius', variable: `--corner-badge-${v}-h-axis-radius` },
|
|
18
14
|
{ label: 'vertical-axis radius', canBeLinked: true, groupKey: 'v-axis-radius', variable: `--corner-badge-${v}-v-axis-radius` },
|
|
19
15
|
{ label: 'padding', canBeLinked: true, groupKey: 'padding', variable: `--corner-badge-${v}-padding` },
|
|
20
|
-
//
|
|
21
|
-
// padding. Declared (hidden) so the schema sees them as siblings across
|
|
22
|
-
// variants — `padding-top` on primary links to `padding-top` on accent, etc.
|
|
23
|
-
// The themed-padding mixin in CornerBadge.svelte reads them via
|
|
24
|
-
// `var(--corner-badge-${v}-padding-top, fallback)`; no `:root` default is
|
|
25
|
-
// needed (test skips `hidden: true` tokens by design — see editorTokens.test.ts).
|
|
16
|
+
// Hidden per-side overrides for UIPaddingSelector split mode; declared so siblings link across variants.
|
|
26
17
|
{ label: 'padding-top', canBeLinked: true, groupKey: 'padding-top', variable: `--corner-badge-${v}-padding-top`, hidden: true },
|
|
27
18
|
{ label: 'padding-right', canBeLinked: true, groupKey: 'padding-right', variable: `--corner-badge-${v}-padding-right`, hidden: true },
|
|
28
19
|
{ label: 'padding-bottom', canBeLinked: true, groupKey: 'padding-bottom', variable: `--corner-badge-${v}-padding-bottom`, hidden: true },
|
|
@@ -33,15 +24,9 @@
|
|
|
33
24
|
{ label: 'line height', canBeLinked: true, groupKey: 'text-line-height', variable: `--corner-badge-${v}-text-line-height` },
|
|
34
25
|
];
|
|
35
26
|
}
|
|
36
|
-
const
|
|
37
|
-
badgeVariants.map((v) => [v, variantTokens(v)]),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export const allTokens: Token[] = Object.values(states).flat();
|
|
27
|
+
export const allTokens: Token[] = badgeVariants.flatMap((v) => variantTokens(v));
|
|
41
28
|
|
|
42
|
-
//
|
|
43
|
-
// when ≥2 variants currently agree on an alias for the same groupKey. Variant
|
|
44
|
-
// name is the context label so the chart rows mirror the variant tab strip.
|
|
29
|
+
// Linkable vars across variants; variant name as context label so chart rows mirror the tab strip.
|
|
45
30
|
const linkableContexts = new Map<string, string>(
|
|
46
31
|
badgeVariants.flatMap((v) =>
|
|
47
32
|
variantTokens(v)
|
|
@@ -49,34 +34,21 @@
|
|
|
49
34
|
.map((t) => [t.variable, v] as [string, string]),
|
|
50
35
|
),
|
|
51
36
|
);
|
|
37
|
+
|
|
38
|
+
const variantOptions = badgeVariants.map((v) => ({ value: v, label: v.charAt(0).toUpperCase() + v.slice(1) }));
|
|
52
39
|
</script>
|
|
53
40
|
|
|
54
41
|
<script lang="ts">
|
|
55
|
-
import {
|
|
56
|
-
import CornerBadge, { type CornerAnchor } from '../components/CornerBadge.svelte';
|
|
57
|
-
import type { BadgeVariant } from '../components/Badge.svelte';
|
|
42
|
+
import CornerBadge, { type CornerAnchor } from '../../system/components/CornerBadge.svelte';
|
|
58
43
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
59
44
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
60
|
-
import
|
|
61
|
-
import UIRadioGroup from '../ui/UIRadioGroup.svelte';
|
|
62
|
-
import UIPaletteSelector from '../ui/UIPaletteSelector.svelte';
|
|
63
|
-
import { setCssVar } from '../lib/cssVarSync';
|
|
64
|
-
import { editorState } from '../lib/editorStore';
|
|
45
|
+
import { editorState } from '../core/store/editorStore';
|
|
65
46
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
66
|
-
import
|
|
47
|
+
import { buildSiblings } from './scaffolding/siblings';
|
|
48
|
+
import demoImageUrl from '../../system/assets/newspaper.webp';
|
|
67
49
|
|
|
68
50
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
69
|
-
let
|
|
70
|
-
badgeVariants.map((v) => [v, withLinkedDisabled(variantTokens(v), linked.varSet)]),
|
|
71
|
-
) as Record<string, Token[]>);
|
|
72
|
-
|
|
73
|
-
const bgVar = '--backdrop-cornerbadge-surface';
|
|
74
|
-
|
|
75
|
-
onMount(() => {
|
|
76
|
-
if (!document.documentElement.style.getPropertyValue(bgVar)) {
|
|
77
|
-
setCssVar(bgVar, 'var(--surface-canvas)');
|
|
78
|
-
}
|
|
79
|
-
});
|
|
51
|
+
let visibleVariantTokens = $derived((v: typeof badgeVariants[number]) => withLinkedDisabled(variantTokens(v), linked.varSet));
|
|
80
52
|
|
|
81
53
|
let anchor: CornerAnchor = $state('bottom-right');
|
|
82
54
|
const anchorGrid: ReadonlyArray<{ value: CornerAnchor; icon: string; label: string }> = [
|
|
@@ -85,22 +57,19 @@
|
|
|
85
57
|
{ value: 'bottom-left', icon: 'fas fa-arrow-down-left', label: 'Bottom left' },
|
|
86
58
|
{ value: 'bottom-right', icon: 'fas fa-arrow-down-right', label: 'Bottom right' },
|
|
87
59
|
];
|
|
88
|
-
|
|
89
|
-
let variant: BadgeVariant = $state('accent');
|
|
90
|
-
const variantOptions = badgeVariants.map((v) => ({ value: v, label: v.charAt(0).toUpperCase() + v.slice(1) }));
|
|
91
60
|
</script>
|
|
92
61
|
|
|
93
|
-
<ComponentEditorBase {component} title="Corner Badge" description="Badge pinned flush to a corner of a positioned ancestor. Composes <code>Badge</code>; adds offset + inner-radius tokens.
|
|
94
|
-
{#
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<span>Anchor</span>
|
|
62
|
+
<ComponentEditorBase {component} title="Corner Badge" description="Badge pinned flush to a corner of a positioned ancestor. Composes <code>Badge</code>; adds offset + inner-radius tokens." tokens={allTokens} {linked} variants={variantOptions}>
|
|
63
|
+
{#each badgeVariants as v}
|
|
64
|
+
<VariantGroup
|
|
65
|
+
name={v}
|
|
66
|
+
title={v.charAt(0).toUpperCase() + v.slice(1)}
|
|
67
|
+
states={{ [v]: visibleVariantTokens(v) }}
|
|
68
|
+
{component}
|
|
69
|
+
siblings={buildSiblings(badgeVariants, v, (sv) => ({ [sv]: variantTokens(sv) }))}
|
|
70
|
+
>
|
|
71
|
+
{#snippet canvasToolbarExtras()}
|
|
72
|
+
<span class="canvas-toolbar-eyebrow">Anchor</span>
|
|
104
73
|
<div class="anchor-grid" role="radiogroup" aria-label="Corner badge anchor">
|
|
105
74
|
{#each anchorGrid as opt (opt.value)}
|
|
106
75
|
<button
|
|
@@ -117,36 +86,25 @@
|
|
|
117
86
|
</button>
|
|
118
87
|
{/each}
|
|
119
88
|
</div>
|
|
120
|
-
|
|
121
|
-
<div class="control-row">
|
|
122
|
-
<span>Variant</span>
|
|
123
|
-
<UIRadioGroup bind:value={variant} name="corner-badge-variant" options={variantOptions} />
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
{/snippet}
|
|
127
|
-
<VariantGroup name="cornerbadge" title="Corner Badge" states={visibleStates} {component}>
|
|
128
|
-
<ShadowBackdrop mode="color" colorVariable={bgVar}>
|
|
89
|
+
{/snippet}
|
|
129
90
|
<div class="corner-stage-wrap">
|
|
130
91
|
<div class="corner-stage">
|
|
131
92
|
<img src={demoImageUrl} alt="" class="corner-stage-image" />
|
|
132
|
-
<CornerBadge {
|
|
93
|
+
<CornerBadge variant={v} {anchor}>{v.charAt(0).toUpperCase() + v.slice(1)}</CornerBadge>
|
|
133
94
|
</div>
|
|
134
95
|
</div>
|
|
135
|
-
</
|
|
136
|
-
|
|
96
|
+
</VariantGroup>
|
|
97
|
+
{/each}
|
|
137
98
|
</ComponentEditorBase>
|
|
138
99
|
|
|
139
100
|
<style>
|
|
140
|
-
/* Center
|
|
101
|
+
/* Center stage so it doesn't stretch full-width. */
|
|
141
102
|
.corner-stage-wrap {
|
|
142
103
|
display: grid;
|
|
143
104
|
place-items: center;
|
|
144
105
|
}
|
|
145
106
|
|
|
146
|
-
/*
|
|
147
|
-
actually pins to a corner, and a visible surface so offset/radius are observable. */
|
|
148
|
-
/* No overflow:hidden here — the badge needs to be able to extend past the stage
|
|
149
|
-
(e.g. when the offset is 0 or negative). Rounded corners live on the image. */
|
|
107
|
+
/* Positioned ancestor for CornerBadge; no overflow:hidden so badge can extend past edges. */
|
|
150
108
|
.corner-stage {
|
|
151
109
|
position: relative;
|
|
152
110
|
width: 380px;
|
|
@@ -159,26 +117,6 @@
|
|
|
159
117
|
border-radius: var(--ui-radius-md);
|
|
160
118
|
}
|
|
161
119
|
|
|
162
|
-
.control-row {
|
|
163
|
-
display: inline-flex;
|
|
164
|
-
align-items: center;
|
|
165
|
-
gap: var(--ui-space-8);
|
|
166
|
-
font-size: var(--ui-font-size-sm);
|
|
167
|
-
color: var(--ui-text-secondary);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.backdrop-config {
|
|
171
|
-
display: inline-flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
gap: var(--ui-space-8);
|
|
174
|
-
}
|
|
175
|
-
.picker-slot {
|
|
176
|
-
min-width: 8rem;
|
|
177
|
-
}
|
|
178
|
-
.picker-slot :global(.ui-token-selector) {
|
|
179
|
-
width: 100%;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
120
|
.anchor-grid {
|
|
183
121
|
display: grid;
|
|
184
122
|
grid-template-columns: repeat(2, 1.5rem);
|
|
@@ -189,7 +127,7 @@
|
|
|
189
127
|
display: grid;
|
|
190
128
|
place-items: center;
|
|
191
129
|
padding: 0;
|
|
192
|
-
border: 1px solid var(--ui-border-
|
|
130
|
+
border: 1px solid var(--ui-border-low, rgba(255, 255, 255, 0.1));
|
|
193
131
|
border-radius: var(--ui-radius-sm);
|
|
194
132
|
background: transparent;
|
|
195
133
|
color: var(--ui-text-tertiary);
|
|
@@ -204,6 +142,6 @@
|
|
|
204
142
|
.anchor-btn.checked {
|
|
205
143
|
background: var(--ui-surface-active, rgba(255, 255, 255, 0.12));
|
|
206
144
|
color: var(--ui-text-primary);
|
|
207
|
-
border-color: var(--ui-border-
|
|
145
|
+
border-color: var(--ui-border-higher, rgba(255, 255, 255, 0.25));
|
|
208
146
|
}
|
|
209
147
|
</style>
|