@motion-proto/live-tokens 0.3.9 → 0.6.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/README.md +47 -4
- package/package.json +18 -12
- package/src/component-editor/BadgeEditor.svelte +24 -22
- package/src/component-editor/CalloutEditor.svelte +3 -3
- package/src/component-editor/CardEditor.svelte +25 -21
- package/src/component-editor/CollapsibleSectionEditor.svelte +27 -25
- package/src/component-editor/CornerBadgeEditor.svelte +37 -35
- package/src/component-editor/DialogEditor.svelte +26 -24
- package/src/component-editor/ImageEditor.svelte +11 -9
- package/src/component-editor/InlineEditActionsEditor.svelte +17 -15
- package/src/component-editor/NotificationEditor.svelte +32 -30
- package/src/component-editor/ProgressBarEditor.svelte +3 -3
- package/src/component-editor/RadioButtonEditor.svelte +31 -29
- package/src/component-editor/SectionDividerEditor.svelte +30 -28
- package/src/component-editor/SegmentedControlEditor.svelte +29 -25
- package/src/component-editor/StandardButtonsEditor.svelte +42 -38
- package/src/component-editor/TabBarEditor.svelte +20 -18
- package/src/component-editor/TableEditor.svelte +4 -4
- package/src/component-editor/TooltipEditor.svelte +11 -9
- package/src/component-editor/registry.ts +2 -2
- package/src/component-editor/scaffolding/AngleDial.svelte +20 -19
- package/src/component-editor/scaffolding/ComponentEditorBase.svelte +44 -20
- package/src/component-editor/scaffolding/ComponentFileManager.svelte +262 -38
- package/src/component-editor/scaffolding/ComponentFileMenu.svelte +41 -29
- package/src/component-editor/scaffolding/ComponentsTab.svelte +7 -3
- package/src/component-editor/scaffolding/CopyFromMenu.svelte +21 -12
- package/src/component-editor/scaffolding/DemoHeader.svelte +13 -4
- package/src/component-editor/scaffolding/DividerEditor.svelte +27 -14
- package/src/component-editor/scaffolding/FieldsetWrapper.svelte +10 -4
- package/src/component-editor/scaffolding/GradientCard.svelte +25 -20
- package/src/component-editor/scaffolding/LinkageChart.svelte +43 -34
- package/src/component-editor/scaffolding/LinkedBlock.svelte +24 -21
- package/src/component-editor/scaffolding/NonStylableConfig.svelte +6 -1
- package/src/component-editor/scaffolding/SaveAsDialog.svelte +39 -35
- package/src/component-editor/scaffolding/ShadowBackdrop.svelte +21 -9
- package/src/component-editor/scaffolding/ShadowBackdropControls.svelte +8 -3
- package/src/component-editor/scaffolding/StateBlock.svelte +30 -13
- package/src/component-editor/scaffolding/TokenLayout.svelte +46 -30
- package/src/component-editor/scaffolding/TypeEditor.svelte +52 -26
- package/src/component-editor/scaffolding/VariantGroup.svelte +81 -48
- package/src/component-editor/scaffolding/componentSectionType.ts +2 -2
- package/src/components/Badge.svelte +45 -26
- package/src/components/Button.svelte +44 -21
- package/src/components/Callout.svelte +17 -12
- package/src/components/Card.svelte +23 -11
- package/src/components/CollapsibleSection.svelte +56 -27
- package/src/components/CornerBadge.svelte +32 -18
- package/src/components/Dialog.svelte +55 -31
- package/src/components/Image.svelte +14 -5
- package/src/components/InlineEditActions.svelte +22 -10
- package/src/components/Notification.svelte +39 -19
- package/src/components/ProgressBar.svelte +27 -17
- package/src/components/RadioButton.svelte +27 -10
- package/src/components/SectionDivider.svelte +34 -26
- package/src/components/SegmentedControl.svelte +23 -9
- package/src/components/TabBar.svelte +23 -10
- package/src/components/Table.svelte +8 -3
- package/src/components/Tooltip.svelte +15 -5
- package/src/lib/ColumnsOverlay.svelte +3 -3
- package/src/lib/LiveEditorOverlay.svelte +57 -36
- package/src/pages/ComponentEditorPage.svelte +25 -14
- package/src/pages/Editor.svelte +8 -2
- package/src/pages/EditorShell.svelte +24 -20
- package/src/styles/site.css +138 -0
- package/src/styles/tokens.css +78 -76
- package/src/styles/ui-form-controls.css +186 -0
- package/src/ui/BezierCurveEditor.svelte +59 -43
- package/src/ui/ColorEditPanel.svelte +71 -44
- package/src/ui/EditorViewSwitcher.svelte +9 -5
- package/src/ui/FontStackEditor.svelte +17 -16
- package/src/ui/GradientEditor.svelte +42 -33
- package/src/ui/GradientStopPicker.svelte +18 -29
- package/src/ui/PaletteEditor.svelte +238 -212
- package/src/ui/PresetFileManager.svelte +20 -18
- package/src/ui/ProjectFontsSection.svelte +34 -34
- package/src/ui/SurfacesTab.svelte +3 -3
- package/src/ui/TextTab.svelte +2 -2
- package/src/ui/ThemeFileManager.svelte +38 -35
- package/src/ui/Toggle.svelte +11 -9
- package/src/ui/UICopyPopover.svelte +19 -15
- package/src/ui/UIDialog.svelte +48 -30
- package/src/ui/UIFontFamilySelector.svelte +104 -78
- package/src/ui/UIFontSizeSelector.svelte +38 -20
- package/src/ui/UIFontWeightSelector.svelte +33 -13
- package/src/ui/UILineHeightSelector.svelte +33 -13
- package/src/ui/UILinkToggle.svelte +7 -6
- package/src/ui/UIOptionItem.svelte +21 -7
- package/src/ui/UIOptionList.svelte +9 -3
- package/src/ui/UIPaddingSelector.svelte +108 -82
- package/src/ui/UIPaletteSelector.svelte +186 -161
- package/src/ui/UIRadio.svelte +23 -8
- package/src/ui/UIRadioGroup.svelte +9 -8
- package/src/ui/UIRelinkConfirmPopover.svelte +26 -16
- package/src/ui/UITokenSelector.svelte +112 -68
- package/src/ui/UIVariantSelector.svelte +79 -57
- package/src/ui/VariablesTab.svelte +15 -15
- package/src/ui/palette/GradientStopEditor.svelte +45 -26
- package/src/ui/palette/OverridesPanel.svelte +85 -49
- package/src/ui/palette/PaletteBase.svelte +60 -32
- package/src/ui/palette/ScaleCurveEditor.svelte +25 -10
- package/src/ui/sections/ColumnsSection.svelte +13 -13
- package/src/ui/sections/GradientsSection.svelte +12 -9
- package/src/ui/sections/OverlaysSection.svelte +50 -47
- package/src/ui/sections/ShadowsSection.svelte +110 -104
- package/src/ui/sections/TokenScaleTable.svelte +38 -22
- package/src/ui/sections/tokenScales.ts +2 -2
- package/src/styles/form-controls.css +0 -188
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Token } from './scaffolding/types';
|
|
3
3
|
|
|
4
4
|
export const component = 'inlineeditactions';
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
import { editorState } from '../lib/editorStore';
|
|
46
46
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
let visibleStatesByButton = $derived((btn: Button) => Object.fromEntries(
|
|
51
51
|
Object.entries(buttonStates(btn)).map(([name, list]) => [name, withLinkedDisabled(list, linked.varSet)]),
|
|
52
|
-
) as Record<string, Token[]
|
|
52
|
+
) as Record<string, Token[]>);
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<ComponentEditorBase {component} title="Inline Edit Actions" description="Confirm/cancel button pair for inline editing. Import from <code>components/InlineEditActions.svelte</code>" tokens={allTokens} {linked}>
|
|
@@ -59,18 +59,20 @@
|
|
|
59
59
|
title={btn === 'save' ? 'Save button' : 'Cancel button'}
|
|
60
60
|
states={visibleStatesByButton(btn)}
|
|
61
61
|
{component}
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
>
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
{#snippet children({ activeState })}
|
|
65
|
+
{@const forceClass = activeState === 'hover' ? 'force-hover' : ''}
|
|
66
|
+
<div class="inline-edit-demo-row">
|
|
67
|
+
<span style="color: var(--text-secondary);">Editing value...</span>
|
|
68
|
+
<InlineEditActions
|
|
69
|
+
onSave={() => {}}
|
|
70
|
+
onCancel={() => {}}
|
|
71
|
+
class={forceClass}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
{/snippet}
|
|
75
|
+
</VariantGroup>
|
|
74
76
|
{/each}
|
|
75
77
|
</ComponentEditorBase>
|
|
76
78
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -95,47 +95,49 @@
|
|
|
95
95
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
96
96
|
import { buildSiblings } from './scaffolding/siblings';
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
99
|
+
let visibleVariantTokens = $derived((v: Variant) => withLinkedDisabled(variantTokens(v), linked.varSet));
|
|
100
100
|
|
|
101
101
|
import type { NotificationActions } from '../components/types';
|
|
102
102
|
|
|
103
|
-
let dismissible = false;
|
|
104
|
-
let rightOption: ButtonVariantOption = 'none';
|
|
105
|
-
let leftOption: ButtonVariantOption = 'none';
|
|
106
|
-
|
|
103
|
+
let dismissible = $state(false);
|
|
104
|
+
let rightOption: ButtonVariantOption = $state('none');
|
|
105
|
+
let leftOption: ButtonVariantOption = $state('none');
|
|
106
|
+
let actions = $derived(((): NotificationActions => {
|
|
107
107
|
const a: NotificationActions = {};
|
|
108
108
|
const right = toVariant(rightOption);
|
|
109
109
|
const left = toVariant(leftOption);
|
|
110
110
|
if (right) a.right = { label: 'Confirm', variant: right, onClick: () => {} };
|
|
111
111
|
if (left) a.left = { label: 'Cancel', variant: left, onClick: () => {} };
|
|
112
112
|
return a;
|
|
113
|
-
})();
|
|
113
|
+
})());
|
|
114
114
|
</script>
|
|
115
115
|
|
|
116
116
|
<ComponentEditorBase {component} title="Notification" description="Contextual feedback notifications with multiple variants. Import from <code>components/Notification.svelte</code>" tokens={allTokens} {linked} variants={variantOptions}>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
117
|
+
{#snippet config()}
|
|
118
|
+
|
|
119
|
+
<label>
|
|
120
|
+
<input type="checkbox" bind:checked={dismissible} />
|
|
121
|
+
<span>Dismissible</span>
|
|
122
|
+
</label>
|
|
123
|
+
<label>
|
|
124
|
+
<span>Right button</span>
|
|
125
|
+
<select class="ui-form-select" bind:value={rightOption}>
|
|
126
|
+
{#each BUTTON_VARIANT_OPTIONS as v}
|
|
127
|
+
<option value={v}>{variantLabel(v)}</option>
|
|
128
|
+
{/each}
|
|
129
|
+
</select>
|
|
130
|
+
</label>
|
|
131
|
+
<label>
|
|
132
|
+
<span>Left button</span>
|
|
133
|
+
<select class="ui-form-select" bind:value={leftOption}>
|
|
134
|
+
{#each BUTTON_VARIANT_OPTIONS as v}
|
|
135
|
+
<option value={v}>{variantLabel(v)}</option>
|
|
136
|
+
{/each}
|
|
137
|
+
</select>
|
|
138
|
+
</label>
|
|
139
|
+
|
|
140
|
+
{/snippet}
|
|
139
141
|
{#each variants as v}
|
|
140
142
|
<VariantGroup
|
|
141
143
|
name={v}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
84
84
|
import { buildSiblings } from './scaffolding/siblings';
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
87
|
+
let visibleVariantTokens = $derived((v: Variant) => withLinkedDisabled(variantTokens(v), linked.varSet));
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
90
|
<ComponentEditorBase {component} title="Progress Bar" description="Animated progress bar with variants. Import from <code>components/ProgressBar.svelte</code>" tokens={allTokens} {linked} variants={variantOptions}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -88,13 +88,13 @@
|
|
|
88
88
|
import { editorState } from '../lib/editorStore';
|
|
89
89
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
90
90
|
|
|
91
|
-
let selectedRadio = 'option-b';
|
|
91
|
+
let selectedRadio = $state('option-b');
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
let visibleStates = $derived(Object.fromEntries(
|
|
96
96
|
Object.entries(states).map(([name, list]) => [name, withLinkedDisabled(list, linked.varSet)]),
|
|
97
|
-
) as Record<string, Token[]
|
|
97
|
+
) as Record<string, Token[]>);
|
|
98
98
|
</script>
|
|
99
99
|
|
|
100
100
|
<ComponentEditorBase {component} title="Radio Button" description="Styled radio buttons with icon and color support. Import from <code>components/RadioButton.svelte</code>" tokens={allTokens} {linked}>
|
|
@@ -104,31 +104,33 @@
|
|
|
104
104
|
states={visibleStates}
|
|
105
105
|
{typeGroups}
|
|
106
106
|
{component}
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
>
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
{#snippet children({ activeState })}
|
|
110
|
+
{@const forceClass = activeState === 'hover' ? 'force-hover' : ''}
|
|
111
|
+
{@const forceActive = activeState === 'active'}
|
|
112
|
+
<div class="radio-demo-row">
|
|
113
|
+
<RadioButton
|
|
114
|
+
label="Defense"
|
|
115
|
+
active={forceActive || selectedRadio === 'option-a'}
|
|
116
|
+
class={forceClass}
|
|
117
|
+
on:click={() => (selectedRadio = 'option-a')}
|
|
118
|
+
/>
|
|
119
|
+
<RadioButton
|
|
120
|
+
label="Economy"
|
|
121
|
+
active={forceActive || selectedRadio === 'option-b'}
|
|
122
|
+
class={forceClass}
|
|
123
|
+
on:click={() => (selectedRadio = 'option-b')}
|
|
124
|
+
/>
|
|
125
|
+
<RadioButton
|
|
126
|
+
label="Loyalty"
|
|
127
|
+
active={forceActive || selectedRadio === 'option-c'}
|
|
128
|
+
class={forceClass}
|
|
129
|
+
on:click={() => (selectedRadio = 'option-c')}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
{/snippet}
|
|
133
|
+
</VariantGroup>
|
|
132
134
|
</ComponentEditorBase>
|
|
133
135
|
|
|
134
136
|
<style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildSiblings } from './scaffolding/siblings';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -133,9 +133,9 @@
|
|
|
133
133
|
import { setCssVar } from '../lib/cssVarSync';
|
|
134
134
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
135
135
|
|
|
136
|
-
let testTitle = 'Section Title';
|
|
137
|
-
let showDescription = true;
|
|
138
|
-
let descriptionText = 'This text is meant to provide additional context or meaning.';
|
|
136
|
+
let testTitle = $state('Section Title');
|
|
137
|
+
let showDescription = $state(true);
|
|
138
|
+
let descriptionText = $state('This text is meant to provide additional context or meaning.');
|
|
139
139
|
|
|
140
140
|
const bgVar = '--backdrop-sectiondivider-surface';
|
|
141
141
|
|
|
@@ -145,34 +145,36 @@
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
149
149
|
// The gradient tokens are owned by GradientCard, so the property grid only
|
|
150
150
|
// shows the frame tokens (padding/radius/outline). Gradient tokens still
|
|
151
151
|
// live in `allTokens` so they participate in reset and the registry.
|
|
152
|
-
|
|
152
|
+
let visibleVariantTokens = $derived((v: Variant) => withLinkedDisabled(frameTokens(v), linked.varSet));
|
|
153
153
|
</script>
|
|
154
154
|
|
|
155
155
|
<ComponentEditorBase {component} title="Section Divider" description="Full-width section banner with display font and palette variants. Import from <code>components/SectionDivider.svelte</code>" tokens={allTokens} {linked} variants={variantOptions}>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
156
|
+
{#snippet config()}
|
|
157
|
+
|
|
158
|
+
<label class="text-field">
|
|
159
|
+
<span>Test title</span>
|
|
160
|
+
<input type="text" bind:value={testTitle} placeholder="Section Title" />
|
|
161
|
+
</label>
|
|
162
|
+
<label class="checkbox-field">
|
|
163
|
+
<input type="checkbox" bind:checked={showDescription} />
|
|
164
|
+
<span>Show description</span>
|
|
165
|
+
</label>
|
|
166
|
+
<label class="text-field text-field-wide">
|
|
167
|
+
<span>Description text</span>
|
|
168
|
+
<input type="text" bind:value={descriptionText} placeholder="Description text" />
|
|
169
|
+
</label>
|
|
170
|
+
<label class="backdrop-config">
|
|
171
|
+
<span>Sample background</span>
|
|
172
|
+
<div class="picker-slot">
|
|
173
|
+
<UIPaletteSelector variable={bgVar} />
|
|
174
|
+
</div>
|
|
175
|
+
</label>
|
|
176
|
+
|
|
177
|
+
{/snippet}
|
|
176
178
|
{#each variants as v}
|
|
177
179
|
<VariantGroup
|
|
178
180
|
name={v.key}
|
|
@@ -194,10 +196,10 @@
|
|
|
194
196
|
description={showDescription ? descriptionText : undefined}
|
|
195
197
|
/>
|
|
196
198
|
</ShadowBackdrop>
|
|
197
|
-
|
|
199
|
+
{#snippet compositeControls(_stateName)}
|
|
198
200
|
<span class="gradient-section-label">Gradient</span>
|
|
199
201
|
<GradientCard {component} prefix={`--sectiondivider-${v.key}`} />
|
|
200
|
-
|
|
202
|
+
{/snippet}
|
|
201
203
|
</VariantGroup>
|
|
202
204
|
{/each}
|
|
203
205
|
</ComponentEditorBase>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupTokens, buildTypeGroupShareableContexts } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -113,42 +113,46 @@
|
|
|
113
113
|
{ value: 'option-2', label: 'Option 2', icon: 'fas fa-check' },
|
|
114
114
|
{ value: 'option-3', label: 'Option 3', icon: 'fas fa-heart' },
|
|
115
115
|
];
|
|
116
|
-
let showIcons = true;
|
|
117
|
-
|
|
116
|
+
let showIcons = $state(true);
|
|
117
|
+
let previewSegments = $derived(showIcons ? segments : segments.map((s) => ({ ...s, icon: undefined })));
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
let visibleStates = $derived(Object.fromEntries(
|
|
122
122
|
Object.entries(states).map(([name, list]) => [name, withLinkedDisabled(list, linked.varSet)]),
|
|
123
|
-
) as Record<string, Token[]
|
|
123
|
+
) as Record<string, Token[]>);
|
|
124
124
|
</script>
|
|
125
125
|
|
|
126
126
|
<ComponentEditorBase {component} title="Segmented Control" description="A connected set of buttons for toggling between mutually exclusive options." tokens={allTokens} {linked}>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
{#snippet config()}
|
|
128
|
+
|
|
129
|
+
<label>
|
|
130
|
+
<input type="checkbox" bind:checked={showIcons} />
|
|
131
|
+
<span>Show icons</span>
|
|
132
|
+
</label>
|
|
133
|
+
|
|
134
|
+
{/snippet}
|
|
133
135
|
<VariantGroup
|
|
134
136
|
name="segmentedcontrol"
|
|
135
137
|
title="Segmented Control"
|
|
136
138
|
states={visibleStates}
|
|
137
139
|
{typeGroups}
|
|
138
140
|
{component}
|
|
139
|
-
|
|
141
|
+
|
|
140
142
|
>
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
{#snippet children({ activeState })}
|
|
144
|
+
{@const previewValue = activeState === 'selected option' ? 'option-2' : ''}
|
|
145
|
+
{@const previewForceHover = activeState === 'hover option' ? 'option-1' : null}
|
|
146
|
+
{@const previewDisabled = activeState === 'disabled option'}
|
|
147
|
+
<div>
|
|
148
|
+
<SegmentedControl
|
|
149
|
+
segments={previewSegments}
|
|
150
|
+
value={previewValue}
|
|
151
|
+
forceHoverValue={previewForceHover}
|
|
152
|
+
disabled={previewDisabled}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
{/snippet}
|
|
156
|
+
</VariantGroup>
|
|
153
157
|
</ComponentEditorBase>
|
|
154
158
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildSiblings } from './scaffolding/siblings';
|
|
3
3
|
import type { Token } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -75,27 +75,29 @@
|
|
|
75
75
|
import { editorState, setComponentAlias } from '../lib/editorStore';
|
|
76
76
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
let shimmerRef = $derived($editorState.components.button?.aliases['--button-shimmer']);
|
|
79
|
+
let shimmerEnabled = $derived(!(shimmerRef?.kind === 'token' && shimmerRef.name === '--shimmer-off'));
|
|
80
80
|
|
|
81
|
-
function handleShimmerChange(
|
|
82
|
-
setComponentAlias('button', '--button-shimmer', { kind: 'token', name:
|
|
81
|
+
function handleShimmerChange(checked: boolean) {
|
|
82
|
+
setComponentAlias('button', '--button-shimmer', { kind: 'token', name: checked ? '--shimmer-on' : '--shimmer-off' });
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
let visibleVariantStates = $derived((v: Variant) => Object.fromEntries(
|
|
88
88
|
Object.entries(variantStates(v)).map(([name, list]) => [name, withLinkedDisabled(list, linked.varSet)]),
|
|
89
|
-
) as Record<string, Token[]
|
|
89
|
+
) as Record<string, Token[]>);
|
|
90
90
|
</script>
|
|
91
91
|
|
|
92
92
|
<ComponentEditorBase {component} title="Button" description="Reusable button component with multiple variants and sizes. Import from <code>components/Button.svelte</code>" tokens={allTokens} {linked} variants={variantOptions}>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
{#snippet config()}
|
|
94
|
+
|
|
95
|
+
<label>
|
|
96
|
+
<span>Hover shimmer</span>
|
|
97
|
+
<Toggle checked={shimmerEnabled} onchange={handleShimmerChange} />
|
|
98
|
+
</label>
|
|
99
|
+
|
|
100
|
+
{/snippet}
|
|
99
101
|
{#each variants as v}
|
|
100
102
|
<VariantGroup
|
|
101
103
|
name={v}
|
|
@@ -104,36 +106,38 @@
|
|
|
104
106
|
{component}
|
|
105
107
|
columns={2}
|
|
106
108
|
siblings={buildSiblings(variants, v, variantStates)}
|
|
107
|
-
|
|
109
|
+
|
|
108
110
|
>
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<div class="size-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
<div class="button-showcase-
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<
|
|
111
|
+
{#snippet children({ activeState })}
|
|
112
|
+
{@const forceClass = activeState === 'hover' ? 'force-hover' : ''}
|
|
113
|
+
{@const isDisabled = activeState === 'disabled'}
|
|
114
|
+
<div class="size-row">
|
|
115
|
+
<div class="size-section">
|
|
116
|
+
<span class="size-label">size="default"</span>
|
|
117
|
+
<div class="button-showcase-grid">
|
|
118
|
+
<div class="button-showcase-item">
|
|
119
|
+
<Button variant={v} disabled={isDisabled} class={forceClass}>{v.charAt(0).toUpperCase() + v.slice(1)}</Button>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="button-showcase-item">
|
|
122
|
+
<Button variant={v} icon="fas fa-star" iconPosition="left" disabled={isDisabled} class={forceClass}>With Icon</Button>
|
|
123
|
+
</div>
|
|
120
124
|
</div>
|
|
121
125
|
</div>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
<div class="size-divider"></div>
|
|
127
|
+
<div class="size-section">
|
|
128
|
+
<span class="size-label">size="small"</span>
|
|
129
|
+
<div class="button-showcase-grid">
|
|
130
|
+
<div class="button-showcase-item">
|
|
131
|
+
<Button variant={v} size="small" disabled={isDisabled} class={forceClass}>{v.charAt(0).toUpperCase() + v.slice(1)}</Button>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="button-showcase-item">
|
|
134
|
+
<Button variant={v} size="small" icon="fas fa-star" iconPosition="left" disabled={isDisabled} class={forceClass}>With Icon</Button>
|
|
135
|
+
</div>
|
|
132
136
|
</div>
|
|
133
137
|
</div>
|
|
134
138
|
</div>
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
{/snippet}
|
|
140
|
+
</VariantGroup>
|
|
137
141
|
{/each}
|
|
138
142
|
</ComponentEditorBase>
|
|
139
143
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
4
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
import { editorState } from '../lib/editorStore';
|
|
88
88
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
89
89
|
|
|
90
|
-
let selectedDemoTab = 'overview';
|
|
90
|
+
let selectedDemoTab = $state('overview');
|
|
91
91
|
const demoTabs = [
|
|
92
92
|
{ id: 'overview', label: 'Overview', icon: 'fas fa-home' },
|
|
93
93
|
{ id: 'details', label: 'Details', icon: 'fas fa-info-circle' },
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
{ id: 'disabled', label: 'Disabled', icon: 'fas fa-ban', disabled: true },
|
|
96
96
|
];
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
let visibleStates = $derived(Object.fromEntries(
|
|
101
101
|
Object.entries(states).map(([name, list]) => [name, withLinkedDisabled(list, linked.varSet)]),
|
|
102
|
-
) as Record<string, Token[]
|
|
102
|
+
) as Record<string, Token[]>);
|
|
103
103
|
</script>
|
|
104
104
|
|
|
105
105
|
<ComponentEditorBase {component} title="Tab Bar" description="Tab navigation with icon support and disabled state. Import from <code>components/TabBar.svelte</code>" tokens={allTokens} {linked}>
|
|
@@ -109,20 +109,22 @@
|
|
|
109
109
|
states={visibleStates}
|
|
110
110
|
{typeGroups}
|
|
111
111
|
{component}
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
>
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
{#snippet children({ activeState })}
|
|
115
|
+
{@const forceClass = activeState === 'hover tab' ? 'force-hover' : ''}
|
|
116
|
+
<TabBar tabs={demoTabs} selectedTab={selectedDemoTab} class={forceClass} on:tabChange={(e) => (selectedDemoTab = e.detail)} />
|
|
117
|
+
<div class="tab-content-demo">
|
|
118
|
+
{#if selectedDemoTab === 'overview'}
|
|
119
|
+
<p style="margin: 0;">Overview tab content</p>
|
|
120
|
+
{:else if selectedDemoTab === 'details'}
|
|
121
|
+
<p style="margin: 0;">Details tab content</p>
|
|
122
|
+
{:else if selectedDemoTab === 'settings'}
|
|
123
|
+
<p style="margin: 0;">Settings tab content</p>
|
|
124
|
+
{/if}
|
|
125
|
+
</div>
|
|
126
|
+
{/snippet}
|
|
127
|
+
</VariantGroup>
|
|
126
128
|
</ComponentEditorBase>
|
|
127
129
|
|
|
128
130
|
<style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
3
3
|
|
|
4
4
|
export const component = 'table';
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
import { editorState } from '../lib/editorStore';
|
|
100
100
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
103
|
+
let visibleStates = $derived(Object.fromEntries(
|
|
104
104
|
Object.entries(states).map(([state, tokens]) => [state, withLinkedDisabled(tokens, linked.varSet)]),
|
|
105
|
-
) as Record<string, Token[]
|
|
105
|
+
) as Record<string, Token[]>);
|
|
106
106
|
</script>
|
|
107
107
|
|
|
108
108
|
<ComponentEditorBase {component} title="Table" description="Styled wrapper around <code><table></code> with horizontal scroll on narrow viewports. Import from <code>components/Table.svelte</code>" tokens={allTokens} {linked}>
|