@wireweave/core 3.1.0-beta.8 → 3.1.0-beta.9
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/index.cjs +187 -3
- package/dist/index.d.cts +104 -3
- package/dist/index.d.ts +104 -3
- package/dist/index.js +184 -3
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/renderer.cjs +123 -3
- package/dist/renderer.d.cts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +123 -3
- package/dist/spec.cjs +21 -1
- package/dist/spec.js +21 -1
- package/dist/{types-DfiCKOPE.d.cts → types-vhPCZpAW.d.cts} +34 -2
- package/dist/{types-DfiCKOPE.d.ts → types-vhPCZpAW.d.ts} +34 -2
- package/package.json +1 -1
package/dist/spec.js
CHANGED
|
@@ -2124,6 +2124,11 @@ var ATTRIBUTE_SPECS = [
|
|
|
2124
2124
|
type: "string[]",
|
|
2125
2125
|
description: "Named state variants of this page \u2014 each one renders the page again as a screen of its own"
|
|
2126
2126
|
},
|
|
2127
|
+
{
|
|
2128
|
+
name: "when",
|
|
2129
|
+
type: "string[]",
|
|
2130
|
+
description: "Variant boards this element is drawn on \u2014 when=loading, or when=[loading, empty] for both"
|
|
2131
|
+
},
|
|
2127
2132
|
{
|
|
2128
2133
|
name: "id",
|
|
2129
2134
|
type: "string",
|
|
@@ -2169,6 +2174,13 @@ var BOX_ATTRIBUTES = [
|
|
|
2169
2174
|
// Guarded runtime outcomes
|
|
2170
2175
|
"visibleWhen",
|
|
2171
2176
|
"enabledWhen",
|
|
2177
|
+
// Build-time variant scope. Listed beside the guards because it reads like
|
|
2178
|
+
// them and is deliberately not one of them: a guard leaves the element in the
|
|
2179
|
+
// markup for the runtime to toggle, `when` decides whether the element is in
|
|
2180
|
+
// that board's markup at all. Every element takes it for the same reason
|
|
2181
|
+
// every element takes a guard — which boards a piece of a screen belongs to
|
|
2182
|
+
// is a property of the piece, not of what kind of piece it is.
|
|
2183
|
+
"when",
|
|
2172
2184
|
// Spacing
|
|
2173
2185
|
"p",
|
|
2174
2186
|
"px",
|
|
@@ -2231,7 +2243,15 @@ var COMPONENT_METADATA = {
|
|
|
2231
2243
|
// board that path renders *into* — nothing emits the attribute for it and
|
|
2232
2244
|
// nothing would toggle it, so declaring it would let an author write a
|
|
2233
2245
|
// guard on a page, pass `validate()`, and have the value silently dropped.
|
|
2234
|
-
|
|
2246
|
+
// `when` is filtered out alongside the guards, for a reason of its own: a
|
|
2247
|
+
// page *is* a board, so scoping one to a variant would be a board saying
|
|
2248
|
+
// which board it is drawn on. The axis a page declares is `variants`, and
|
|
2249
|
+
// `when` names positions along it — the two sit at different levels and a
|
|
2250
|
+
// page carrying both would be asking `expandVariants` to filter a page
|
|
2251
|
+
// against a name it is itself the source of.
|
|
2252
|
+
...BOX_ATTRIBUTES.filter(
|
|
2253
|
+
(name) => name !== "visibleWhen" && name !== "enabledWhen" && name !== "when"
|
|
2254
|
+
),
|
|
2235
2255
|
...CONTAINER_ATTRIBUTES,
|
|
2236
2256
|
"id",
|
|
2237
2257
|
"title",
|
|
@@ -95,7 +95,7 @@ interface AppearanceProps {
|
|
|
95
95
|
border?: boolean;
|
|
96
96
|
rounded?: boolean;
|
|
97
97
|
}
|
|
98
|
-
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps, GuardedOutcomeProps {
|
|
98
|
+
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps, GuardedOutcomeProps, VariantScopedProps {
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Interactive properties for components that can trigger actions.
|
|
@@ -121,6 +121,38 @@ interface GuardedOutcomeProps {
|
|
|
121
121
|
visibleWhen?: StateGuard;
|
|
122
122
|
enabledWhen?: StateGuard;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Which variant boards an element is drawn on — `when=loading`, `when=[a, b]`.
|
|
126
|
+
*
|
|
127
|
+
* Deliberately **not** a member of {@link GuardedOutcomeProps}, though the two
|
|
128
|
+
* read alike. A guarded outcome is a runtime fact: the element exists on every
|
|
129
|
+
* board, the renderer emits `data-wf-visible-when`, and the site runtime turns
|
|
130
|
+
* it on and off as state changes. `when` is a build-time fact: the element is
|
|
131
|
+
* *absent* from the markup of every board it does not name, so nothing can
|
|
132
|
+
* toggle it back and no state change reaches it.
|
|
133
|
+
*
|
|
134
|
+
* They are therefore orthogonal rather than alternatives, and one element may
|
|
135
|
+
* carry both — `section when=ready visibleWhen={ state=open, equals=true }`
|
|
136
|
+
* means "only on the ready board, and there only while `open`". Folding `when`
|
|
137
|
+
* into the guarded-outcome interface would say the two are one concept, and the
|
|
138
|
+
* first author to write both would find the pair collapsing into whichever the
|
|
139
|
+
* renderer read last.
|
|
140
|
+
*/
|
|
141
|
+
interface VariantScopedProps {
|
|
142
|
+
/**
|
|
143
|
+
* The variant name, or names, this element belongs to.
|
|
144
|
+
*
|
|
145
|
+
* A list is a disjunction: `when=[loading, empty]` draws the element on the
|
|
146
|
+
* loading board and on the empty board. That is the whole reason the list
|
|
147
|
+
* form exists — a `visibleWhen` guard has only `equals`, so a block two
|
|
148
|
+
* conditions share had to be written once per condition, and a header common
|
|
149
|
+
* to three states was three copies that could drift apart.
|
|
150
|
+
*
|
|
151
|
+
* Absent means "every board", which is what keeps documents that declare no
|
|
152
|
+
* variants rendering exactly as they did.
|
|
153
|
+
*/
|
|
154
|
+
when?: string | string[];
|
|
155
|
+
}
|
|
124
156
|
type InteractionEffect = {
|
|
125
157
|
kind: 'navigate';
|
|
126
158
|
target: string;
|
|
@@ -861,4 +893,4 @@ type LeafNode = TextContentNode | InputComponentNode | ButtonNode | DisplayNode
|
|
|
861
893
|
type AnyNode = ContainerNode | LeafNode;
|
|
862
894
|
type NodeType = 'Document' | 'Page' | 'Layout' | 'Component' | 'ComponentUse' | 'Slot' | 'Repeat' | 'Header' | 'Main' | 'Footer' | 'Sidebar' | 'Section' | 'Row' | 'Col' | 'Stack' | 'Relative' | 'Card' | 'Modal' | 'Drawer' | 'Accordion' | 'Text' | 'Title' | 'Link' | 'Input' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'Button' | 'Image' | 'Placeholder' | 'Avatar' | 'Badge' | 'Icon' | 'Table' | 'List' | 'Alert' | 'Toast' | 'Progress' | 'Spinner' | 'Tooltip' | 'Popover' | 'Dropdown' | 'Nav' | 'Tabs' | 'Breadcrumb' | 'Divider' | 'Marker' | 'Annotations' | 'AnnotationItem';
|
|
863
895
|
|
|
864
|
-
export type { IconNode as $, AccordionNode as A, BadgeNode as B, CardNode as C, ComponentInputValue as D, ComponentParameter as E, ComponentParameterType as F, ComponentSlotFill as G, ComponentUseNode as H, ContainerComponentNode as I, ContainerNode as J, DataNode as K, DefinitionNode as L, DirectionValue as M, DisplayNode as N, DividerComponentNode as O, DrawerNode as P, DrawerPosition as Q, DropdownItemNode as R, DropdownNode as S, FeedbackNode as T, FlexProps as U, FooterNode as V, GridNode as W, GridProps as X, GuardedOutcomeProps as Y, HeaderNode as Z, HeightValue as _, AlertNode as a, TextNode as a$, IconSize as a0, IconSizeToken as a1, ImageNode as a2, InputComponentNode as a3, InputNode as a4, InputType as a5, InteractionEffect as a6, InteractionHandler as a7, InteractiveProps as a8, JustifyValue as a9, RepeatNode as aA, RowNode as aB, SectionNode as aC, SelectNode as aD, SelectOption as aE, ShadowValue as aF, SidebarNode as aG, SizeProps as aH, SliderNode as aI, SlotNode as aJ, SourceLocation as aK, SpacingProps as aL, SpacingValue as aM, SpinnerNode as aN, SpinnerSize as aO, SpinnerSizeToken as aP, StackNode as aQ, StateDeclaration as aR, StateGuard as aS, StateValue as aT, StateValueType as aU, SwitchNode as aV, TabNode as aW, TableNode as aX, TabsNode as aY, TextAlign as aZ, TextContentNode as a_, LayoutDefinitionNode as aa, LayoutNode as ab, LeafNode as ac, LinkNode as ad, ListItemNode as ae, ListNode as af, MainNode as ag, MarkerColor as ah, MarkerNode as ai, ModalNode as aj, NavBlockItem as ak, NavChild as al, NavGroupNode as am, NavItem as an, NavNode as ao, NavigationNode as ap, NodeType as aq, OverlayNode as ar, PageNode as as, PlaceholderNode as at, PopoverNode as au, Position as av, PositionProps as aw, ProgressNode as ax, RadioNode as ay, RelativeNode as az, AlertVariant as b, TextSize as b0, TextSizeToken as b1, TextWeight as b2, TextareaNode as b3, TitleLevel as b4, TitleNode as b5, ToastNode as b6, ToastPosition as b7, TooltipNode as b8, TooltipPosition as b9, TopLevelNode as ba, ValueWithUnit as bb,
|
|
896
|
+
export type { IconNode as $, AccordionNode as A, BadgeNode as B, CardNode as C, ComponentInputValue as D, ComponentParameter as E, ComponentParameterType as F, ComponentSlotFill as G, ComponentUseNode as H, ContainerComponentNode as I, ContainerNode as J, DataNode as K, DefinitionNode as L, DirectionValue as M, DisplayNode as N, DividerComponentNode as O, DrawerNode as P, DrawerPosition as Q, DropdownItemNode as R, DropdownNode as S, FeedbackNode as T, FlexProps as U, FooterNode as V, GridNode as W, GridProps as X, GuardedOutcomeProps as Y, HeaderNode as Z, HeightValue as _, AlertNode as a, TextNode as a$, IconSize as a0, IconSizeToken as a1, ImageNode as a2, InputComponentNode as a3, InputNode as a4, InputType as a5, InteractionEffect as a6, InteractionHandler as a7, InteractiveProps as a8, JustifyValue as a9, RepeatNode as aA, RowNode as aB, SectionNode as aC, SelectNode as aD, SelectOption as aE, ShadowValue as aF, SidebarNode as aG, SizeProps as aH, SliderNode as aI, SlotNode as aJ, SourceLocation as aK, SpacingProps as aL, SpacingValue as aM, SpinnerNode as aN, SpinnerSize as aO, SpinnerSizeToken as aP, StackNode as aQ, StateDeclaration as aR, StateGuard as aS, StateValue as aT, StateValueType as aU, SwitchNode as aV, TabNode as aW, TableNode as aX, TabsNode as aY, TextAlign as aZ, TextContentNode as a_, LayoutDefinitionNode as aa, LayoutNode as ab, LeafNode as ac, LinkNode as ad, ListItemNode as ae, ListNode as af, MainNode as ag, MarkerColor as ah, MarkerNode as ai, ModalNode as aj, NavBlockItem as ak, NavChild as al, NavGroupNode as am, NavItem as an, NavNode as ao, NavigationNode as ap, NodeType as aq, OverlayNode as ar, PageNode as as, PlaceholderNode as at, PopoverNode as au, Position as av, PositionProps as aw, ProgressNode as ax, RadioNode as ay, RelativeNode as az, AlertVariant as b, TextSize as b0, TextSizeToken as b1, TextWeight as b2, TextareaNode as b3, TitleLevel as b4, TitleNode as b5, ToastNode as b6, ToastPosition as b7, TooltipNode as b8, TooltipPosition as b9, TopLevelNode as ba, ValueWithUnit as bb, VariantScopedProps as bc, WidthValue as bd, WireframeDocument as be, AlignValue as c, AnchorPosition as d, AnnotationItemNode as e, AnnotationNode as f, AnnotationsNode as g, AnyNode as h, AppearanceProps as i, AvatarNode as j, AvatarSize as k, AvatarSizeToken as l, BadgeSize as m, BadgeSizeToken as n, BadgeVariant as o, BaseNode as p, BreadcrumbItem as q, BreadcrumbNode as r, ButtonNode as s, ButtonSize as t, ButtonSizeToken as u, ButtonVariant as v, CheckboxNode as w, ColNode as x, CommonProps as y, ComponentDefinitionNode as z };
|
|
@@ -95,7 +95,7 @@ interface AppearanceProps {
|
|
|
95
95
|
border?: boolean;
|
|
96
96
|
rounded?: boolean;
|
|
97
97
|
}
|
|
98
|
-
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps, GuardedOutcomeProps {
|
|
98
|
+
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps, GuardedOutcomeProps, VariantScopedProps {
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Interactive properties for components that can trigger actions.
|
|
@@ -121,6 +121,38 @@ interface GuardedOutcomeProps {
|
|
|
121
121
|
visibleWhen?: StateGuard;
|
|
122
122
|
enabledWhen?: StateGuard;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Which variant boards an element is drawn on — `when=loading`, `when=[a, b]`.
|
|
126
|
+
*
|
|
127
|
+
* Deliberately **not** a member of {@link GuardedOutcomeProps}, though the two
|
|
128
|
+
* read alike. A guarded outcome is a runtime fact: the element exists on every
|
|
129
|
+
* board, the renderer emits `data-wf-visible-when`, and the site runtime turns
|
|
130
|
+
* it on and off as state changes. `when` is a build-time fact: the element is
|
|
131
|
+
* *absent* from the markup of every board it does not name, so nothing can
|
|
132
|
+
* toggle it back and no state change reaches it.
|
|
133
|
+
*
|
|
134
|
+
* They are therefore orthogonal rather than alternatives, and one element may
|
|
135
|
+
* carry both — `section when=ready visibleWhen={ state=open, equals=true }`
|
|
136
|
+
* means "only on the ready board, and there only while `open`". Folding `when`
|
|
137
|
+
* into the guarded-outcome interface would say the two are one concept, and the
|
|
138
|
+
* first author to write both would find the pair collapsing into whichever the
|
|
139
|
+
* renderer read last.
|
|
140
|
+
*/
|
|
141
|
+
interface VariantScopedProps {
|
|
142
|
+
/**
|
|
143
|
+
* The variant name, or names, this element belongs to.
|
|
144
|
+
*
|
|
145
|
+
* A list is a disjunction: `when=[loading, empty]` draws the element on the
|
|
146
|
+
* loading board and on the empty board. That is the whole reason the list
|
|
147
|
+
* form exists — a `visibleWhen` guard has only `equals`, so a block two
|
|
148
|
+
* conditions share had to be written once per condition, and a header common
|
|
149
|
+
* to three states was three copies that could drift apart.
|
|
150
|
+
*
|
|
151
|
+
* Absent means "every board", which is what keeps documents that declare no
|
|
152
|
+
* variants rendering exactly as they did.
|
|
153
|
+
*/
|
|
154
|
+
when?: string | string[];
|
|
155
|
+
}
|
|
124
156
|
type InteractionEffect = {
|
|
125
157
|
kind: 'navigate';
|
|
126
158
|
target: string;
|
|
@@ -861,4 +893,4 @@ type LeafNode = TextContentNode | InputComponentNode | ButtonNode | DisplayNode
|
|
|
861
893
|
type AnyNode = ContainerNode | LeafNode;
|
|
862
894
|
type NodeType = 'Document' | 'Page' | 'Layout' | 'Component' | 'ComponentUse' | 'Slot' | 'Repeat' | 'Header' | 'Main' | 'Footer' | 'Sidebar' | 'Section' | 'Row' | 'Col' | 'Stack' | 'Relative' | 'Card' | 'Modal' | 'Drawer' | 'Accordion' | 'Text' | 'Title' | 'Link' | 'Input' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'Button' | 'Image' | 'Placeholder' | 'Avatar' | 'Badge' | 'Icon' | 'Table' | 'List' | 'Alert' | 'Toast' | 'Progress' | 'Spinner' | 'Tooltip' | 'Popover' | 'Dropdown' | 'Nav' | 'Tabs' | 'Breadcrumb' | 'Divider' | 'Marker' | 'Annotations' | 'AnnotationItem';
|
|
863
895
|
|
|
864
|
-
export type { IconNode as $, AccordionNode as A, BadgeNode as B, CardNode as C, ComponentInputValue as D, ComponentParameter as E, ComponentParameterType as F, ComponentSlotFill as G, ComponentUseNode as H, ContainerComponentNode as I, ContainerNode as J, DataNode as K, DefinitionNode as L, DirectionValue as M, DisplayNode as N, DividerComponentNode as O, DrawerNode as P, DrawerPosition as Q, DropdownItemNode as R, DropdownNode as S, FeedbackNode as T, FlexProps as U, FooterNode as V, GridNode as W, GridProps as X, GuardedOutcomeProps as Y, HeaderNode as Z, HeightValue as _, AlertNode as a, TextNode as a$, IconSize as a0, IconSizeToken as a1, ImageNode as a2, InputComponentNode as a3, InputNode as a4, InputType as a5, InteractionEffect as a6, InteractionHandler as a7, InteractiveProps as a8, JustifyValue as a9, RepeatNode as aA, RowNode as aB, SectionNode as aC, SelectNode as aD, SelectOption as aE, ShadowValue as aF, SidebarNode as aG, SizeProps as aH, SliderNode as aI, SlotNode as aJ, SourceLocation as aK, SpacingProps as aL, SpacingValue as aM, SpinnerNode as aN, SpinnerSize as aO, SpinnerSizeToken as aP, StackNode as aQ, StateDeclaration as aR, StateGuard as aS, StateValue as aT, StateValueType as aU, SwitchNode as aV, TabNode as aW, TableNode as aX, TabsNode as aY, TextAlign as aZ, TextContentNode as a_, LayoutDefinitionNode as aa, LayoutNode as ab, LeafNode as ac, LinkNode as ad, ListItemNode as ae, ListNode as af, MainNode as ag, MarkerColor as ah, MarkerNode as ai, ModalNode as aj, NavBlockItem as ak, NavChild as al, NavGroupNode as am, NavItem as an, NavNode as ao, NavigationNode as ap, NodeType as aq, OverlayNode as ar, PageNode as as, PlaceholderNode as at, PopoverNode as au, Position as av, PositionProps as aw, ProgressNode as ax, RadioNode as ay, RelativeNode as az, AlertVariant as b, TextSize as b0, TextSizeToken as b1, TextWeight as b2, TextareaNode as b3, TitleLevel as b4, TitleNode as b5, ToastNode as b6, ToastPosition as b7, TooltipNode as b8, TooltipPosition as b9, TopLevelNode as ba, ValueWithUnit as bb,
|
|
896
|
+
export type { IconNode as $, AccordionNode as A, BadgeNode as B, CardNode as C, ComponentInputValue as D, ComponentParameter as E, ComponentParameterType as F, ComponentSlotFill as G, ComponentUseNode as H, ContainerComponentNode as I, ContainerNode as J, DataNode as K, DefinitionNode as L, DirectionValue as M, DisplayNode as N, DividerComponentNode as O, DrawerNode as P, DrawerPosition as Q, DropdownItemNode as R, DropdownNode as S, FeedbackNode as T, FlexProps as U, FooterNode as V, GridNode as W, GridProps as X, GuardedOutcomeProps as Y, HeaderNode as Z, HeightValue as _, AlertNode as a, TextNode as a$, IconSize as a0, IconSizeToken as a1, ImageNode as a2, InputComponentNode as a3, InputNode as a4, InputType as a5, InteractionEffect as a6, InteractionHandler as a7, InteractiveProps as a8, JustifyValue as a9, RepeatNode as aA, RowNode as aB, SectionNode as aC, SelectNode as aD, SelectOption as aE, ShadowValue as aF, SidebarNode as aG, SizeProps as aH, SliderNode as aI, SlotNode as aJ, SourceLocation as aK, SpacingProps as aL, SpacingValue as aM, SpinnerNode as aN, SpinnerSize as aO, SpinnerSizeToken as aP, StackNode as aQ, StateDeclaration as aR, StateGuard as aS, StateValue as aT, StateValueType as aU, SwitchNode as aV, TabNode as aW, TableNode as aX, TabsNode as aY, TextAlign as aZ, TextContentNode as a_, LayoutDefinitionNode as aa, LayoutNode as ab, LeafNode as ac, LinkNode as ad, ListItemNode as ae, ListNode as af, MainNode as ag, MarkerColor as ah, MarkerNode as ai, ModalNode as aj, NavBlockItem as ak, NavChild as al, NavGroupNode as am, NavItem as an, NavNode as ao, NavigationNode as ap, NodeType as aq, OverlayNode as ar, PageNode as as, PlaceholderNode as at, PopoverNode as au, Position as av, PositionProps as aw, ProgressNode as ax, RadioNode as ay, RelativeNode as az, AlertVariant as b, TextSize as b0, TextSizeToken as b1, TextWeight as b2, TextareaNode as b3, TitleLevel as b4, TitleNode as b5, ToastNode as b6, ToastPosition as b7, TooltipNode as b8, TooltipPosition as b9, TopLevelNode as ba, ValueWithUnit as bb, VariantScopedProps as bc, WidthValue as bd, WireframeDocument as be, AlignValue as c, AnchorPosition as d, AnnotationItemNode as e, AnnotationNode as f, AnnotationsNode as g, AnyNode as h, AppearanceProps as i, AvatarNode as j, AvatarSize as k, AvatarSizeToken as l, BadgeSize as m, BadgeSizeToken as n, BadgeVariant as o, BaseNode as p, BreadcrumbItem as q, BreadcrumbNode as r, ButtonNode as s, ButtonSize as t, ButtonSizeToken as u, ButtonVariant as v, CheckboxNode as w, ColNode as x, CommonProps as y, ComponentDefinitionNode as z };
|