@webround/core 0.1.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-css.d.ts +8 -0
- package/dist/base-css.js +19 -0
- package/dist/components/WrAltcha.d.ts +5 -0
- package/dist/components/WrAltcha.js +7 -0
- package/dist/components/WrButton.js +19 -0
- package/dist/components/WrForm.d.ts +7 -0
- package/dist/components/WrForm.js +15 -0
- package/dist/components/WrFormPrivacy.d.ts +4 -0
- package/dist/components/WrFormPrivacy.js +6 -0
- package/dist/components/WrFormSuccess.d.ts +4 -0
- package/dist/components/WrFormSuccess.js +6 -0
- package/dist/components/WrIframe.d.ts +8 -0
- package/dist/components/WrIframe.js +13 -0
- package/dist/components/WrImage.d.ts +9 -0
- package/dist/components/WrImage.js +13 -0
- package/dist/components/WrInput.d.ts +8 -0
- package/dist/components/WrInput.js +10 -0
- package/dist/components/WrLangSelector.d.ts +17 -0
- package/dist/components/WrLangSelector.js +27 -0
- package/dist/components/WrLangSync.d.ts +6 -0
- package/dist/components/WrLangSync.js +12 -0
- package/dist/components/WrLink.js +23 -0
- package/dist/components/WrNav.d.ts +26 -0
- package/dist/components/WrNav.js +15 -0
- package/dist/{WrSection.d.ts → components/WrSection.d.ts} +3 -3
- package/dist/components/WrShared.d.ts +22 -0
- package/dist/components/WrShared.js +18 -0
- package/dist/components/WrText.d.ts +11 -0
- package/dist/components/WrText.js +14 -0
- package/dist/components/WrThemeToggle.d.ts +9 -0
- package/dist/components/WrThemeToggle.js +43 -0
- package/dist/components/WrVideo.js +61 -0
- package/dist/context/WrAppContext.d.ts +40 -0
- package/dist/context/WrAppContext.js +95 -0
- package/dist/context/WrLayout.d.ts +23 -0
- package/dist/context/WrLayout.js +18 -0
- package/dist/context/WrPageContext.d.ts +10 -0
- package/dist/context/WrPageContext.js +13 -0
- package/dist/form-react.d.ts +82 -0
- package/dist/form-react.js +165 -0
- package/dist/form.d.ts +83 -0
- package/dist/form.js +175 -0
- package/dist/index.css +651 -0
- package/dist/index.d.ts +20 -8
- package/dist/index.js +20 -8
- package/dist/kinds.d.ts +109 -0
- package/dist/kinds.js +35 -0
- package/dist/lang-codes.d.ts +366 -0
- package/dist/lang-codes.js +166 -0
- package/dist/localized.d.ts +36 -0
- package/dist/localized.js +71 -0
- package/dist/not-found.d.ts +9 -0
- package/dist/not-found.js +13 -0
- package/dist/routing.d.ts +122 -0
- package/dist/routing.js +198 -0
- package/dist/seo-react.d.ts +20 -0
- package/dist/seo-react.js +37 -0
- package/dist/seo.d.ts +167 -0
- package/dist/seo.js +221 -0
- package/dist/site-env.d.ts +25 -0
- package/dist/site-env.js +37 -0
- package/dist/style.d.ts +456 -0
- package/dist/style.js +1081 -0
- package/dist/text-react.d.ts +11 -0
- package/dist/text-react.js +5 -0
- package/dist/theme.d.ts +22 -0
- package/dist/theme.js +45 -0
- package/dist/types.d.ts +37 -21
- package/package.json +93 -7
- package/dist/WrButton.d.ts.map +0 -1
- package/dist/WrButton.js +0 -7
- package/dist/WrButton.js.map +0 -1
- package/dist/WrImage.d.ts +0 -8
- package/dist/WrImage.d.ts.map +0 -1
- package/dist/WrImage.js +0 -7
- package/dist/WrImage.js.map +0 -1
- package/dist/WrLink.d.ts.map +0 -1
- package/dist/WrLink.js +0 -15
- package/dist/WrLink.js.map +0 -1
- package/dist/WrPageContext.d.ts +0 -8
- package/dist/WrPageContext.d.ts.map +0 -1
- package/dist/WrPageContext.js +0 -11
- package/dist/WrPageContext.js.map +0 -1
- package/dist/WrSection.d.ts.map +0 -1
- package/dist/WrSection.js.map +0 -1
- package/dist/WrText.d.ts +0 -11
- package/dist/WrText.d.ts.map +0 -1
- package/dist/WrText.js +0 -7
- package/dist/WrText.js.map +0 -1
- package/dist/WrVideo.d.ts.map +0 -1
- package/dist/WrVideo.js +0 -42
- package/dist/WrVideo.js.map +0 -1
- package/dist/bridge.d.ts +0 -2
- package/dist/bridge.d.ts.map +0 -1
- package/dist/bridge.js +0 -110
- package/dist/bridge.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{WrButton.d.ts → components/WrButton.d.ts} +0 -0
- /package/dist/{WrLink.d.ts → components/WrLink.d.ts} +0 -0
- /package/dist/{WrSection.js → components/WrSection.js} +0 -0
- /package/dist/{WrVideo.d.ts → components/WrVideo.d.ts} +0 -0
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
export interface WrBreakpoint {
|
|
2
|
+
id: 'base' | 'mobile' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
/** The Tailwind prefix (`md:`); none for base. */
|
|
4
|
+
variant: string;
|
|
5
|
+
/** From this width (px) up; base is every screen. */
|
|
6
|
+
minWidth: number;
|
|
7
|
+
label: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
/** Mobile first: a value at a breakpoint holds from that width up, until a wider breakpoint says otherwise. */
|
|
11
|
+
export declare const WR_BREAKPOINTS: readonly WrBreakpoint[];
|
|
12
|
+
export type WrBreakpointId = WrBreakpoint['id'];
|
|
13
|
+
export declare const WR_BREAKPOINT_IDS: ("base" | "sm" | "mobile" | "md" | "lg" | "xl")[];
|
|
14
|
+
/**
|
|
15
|
+
* What a breakpoint inherits from, own first: mobile first, so a width counts the narrower ones (md: base, sm, md). Mobile is the exception: it holds BELOW md (`max-md:`), so it only
|
|
16
|
+
* has the base to fall back on, and no other width counts it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function wrStyleCascade(breakpoint: WrBreakpointId): WrBreakpointId[];
|
|
19
|
+
export type WrStyleGroup = 'spacing' | 'size' | 'text' | 'color' | 'border' | 'effects' | 'motion' | 'layout';
|
|
20
|
+
export declare const WR_STYLE_GROUPS: Record<WrStyleGroup, string>;
|
|
21
|
+
/**
|
|
22
|
+
* A state an element can be in, and what it looks like then: a value of a property that can change with it is written with the state's variant (`hover:bg-accent`; at a breakpoint
|
|
23
|
+
* `md:hover:bg-accent`). Only some properties can (see `WrStyleProperty.states`): the ones that make sense to change while the pointer is over it, or it has the keyboard's focus.
|
|
24
|
+
*/
|
|
25
|
+
export interface WrState {
|
|
26
|
+
id: 'hover' | 'focus' | 'active';
|
|
27
|
+
/** The Tailwind variant. */
|
|
28
|
+
variant: string;
|
|
29
|
+
label: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const WR_STATES: readonly WrState[];
|
|
33
|
+
export type WrStateId = WrState['id'];
|
|
34
|
+
export declare const WR_STATE_IDS: readonly WrStateId[];
|
|
35
|
+
/** One value a property can have: its name, the class that says it, and what it means in CSS. */
|
|
36
|
+
export interface WrStyleValue {
|
|
37
|
+
/** What it is called everywhere (a number of the scale, a token, an option): this is what is read and written. */
|
|
38
|
+
value: string;
|
|
39
|
+
/** The Tailwind class, without the breakpoint (`px-4`). */
|
|
40
|
+
class: string;
|
|
41
|
+
label: string;
|
|
42
|
+
/** What it comes to, in CSS terms (`1rem (16px)`). */
|
|
43
|
+
css?: string;
|
|
44
|
+
/** For a color: how it looks (a CSS color), when the project's stylesheet says it. */
|
|
45
|
+
swatch?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface WrStyleProperty {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
/** One sentence, in plain words. */
|
|
51
|
+
description: string;
|
|
52
|
+
group: WrStyleGroup;
|
|
53
|
+
/** How the control looks: a step of a scale, a color of the theme, one of a few options. */
|
|
54
|
+
control: 'scale' | 'color' | 'options';
|
|
55
|
+
values: readonly WrStyleValue[];
|
|
56
|
+
/** The properties that are parts of this one: setting this replaces them (padding replaces padding-x, padding-top…). */
|
|
57
|
+
includes?: readonly string[];
|
|
58
|
+
/** Prefix of the classes that mean a value outside the table (`w-[320px]`): read and replaced, never written. */
|
|
59
|
+
customPrefix?: string;
|
|
60
|
+
/** Values that are not in `values` but that Tailwind writes all the same (`px-27`): the numbers of the scale, whole pixels, fractions. */
|
|
61
|
+
free?: WrStyleFree;
|
|
62
|
+
/** The multi-side model this property is a part of (padding, margin, gap): the panel shows it through the model, not as a row of its own. */
|
|
63
|
+
compound?: string;
|
|
64
|
+
/** It can be set for a state too (hover, focus, pressed). */
|
|
65
|
+
states?: true;
|
|
66
|
+
/** A color: the class prefix of one picked on the fly (`bg` makes `bg-[#22c55e]`), outside the theme's. */
|
|
67
|
+
hex?: string;
|
|
68
|
+
/** The values people reach for most (ids of `values`), in the order to offer them: what a quick control puts a click away. */
|
|
69
|
+
shortcuts?: readonly string[];
|
|
70
|
+
/** Variants every class of it carries after the screen and the state (`motion-safe` for an animation: it does not run for who asked their system for less motion). */
|
|
71
|
+
variants?: readonly string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A property that takes any number, not only the ones of the list (Tailwind 4 writes `px-27`, `w-3/7`, `border-3` on demand): what is accepted, and what it comes to.
|
|
75
|
+
* `values` keeps the useful ones (the steps people use, the keywords) as suggestions.
|
|
76
|
+
*/
|
|
77
|
+
export interface WrStyleFree {
|
|
78
|
+
/** `step`: any number of the spacing scale, a step being a quarter of a rem (`px-27` is 6.75rem, 108px; `p-1.25`); `integer`: a whole number of pixels (`border-3`). */
|
|
79
|
+
kind: 'step' | 'integer';
|
|
80
|
+
/** The class prefix: `px` in `px-27`. */
|
|
81
|
+
prefix: string;
|
|
82
|
+
max: number;
|
|
83
|
+
/** A negative number too (`-mt-4`). */
|
|
84
|
+
negative?: boolean;
|
|
85
|
+
/** A fraction of the parent too (`w-3/7`). */
|
|
86
|
+
fractions?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface WrStyleOptions {
|
|
89
|
+
/** The colors the project's theme names (`accent`, `fg`…); the default ones when not given. */
|
|
90
|
+
colorTokens?: readonly string[];
|
|
91
|
+
/** How each of them looks (a CSS color), for the ones the stylesheet says. */
|
|
92
|
+
colorSwatches?: Readonly<Record<string, string>>;
|
|
93
|
+
}
|
|
94
|
+
/** The semantic colors of the starter site's theme (index.css `@theme`): the project's own list replaces it (see `WrStyleOptions`). */
|
|
95
|
+
export declare const WR_DEFAULT_COLOR_TOKENS: readonly string[];
|
|
96
|
+
/** What a value of a property is: one of its list, or (when the property is free) any number it accepts. null when it is neither. */
|
|
97
|
+
export declare function wrStyleParseValue(property: {
|
|
98
|
+
values: readonly WrStyleValue[];
|
|
99
|
+
free?: WrStyleFree;
|
|
100
|
+
hex?: string | true;
|
|
101
|
+
}, text: string): WrStyleValue | null;
|
|
102
|
+
/** What a free property accepts, in words: for the field that takes it and for an error that refuses it. */
|
|
103
|
+
export declare function wrStyleFreeHint(free: WrStyleFree): string;
|
|
104
|
+
/**
|
|
105
|
+
* The entry animations (fade in, slide up, zoom in) are not Tailwind's own: they need their keyframes in the theme (`--animate-*` in an `@theme`, which Tailwind 4 turns into the class
|
|
106
|
+
* `animate-fade-in`). This is the ONE text of them: the operations write it into `theme.css` the first time one is used, and the tests compile it. The three built in (pulse, bounce, spin,
|
|
107
|
+
* ping) need nothing.
|
|
108
|
+
*/
|
|
109
|
+
export declare const WR_ENTRY_ANIMATIONS: readonly string[];
|
|
110
|
+
export declare const WR_ENTRY_ANIMATIONS_CSS: Readonly<Record<string, {
|
|
111
|
+
value: string;
|
|
112
|
+
keyframes: string;
|
|
113
|
+
}>>;
|
|
114
|
+
/** Every property the panel, the operations and the API speak of, in the order they are shown. */
|
|
115
|
+
export declare function wrStyleProperties(options?: WrStyleOptions): readonly WrStyleProperty[];
|
|
116
|
+
export interface WrClassToken {
|
|
117
|
+
raw: string;
|
|
118
|
+
/** `['md', 'hover']` for `md:hover:underline`. */
|
|
119
|
+
variants: string[];
|
|
120
|
+
/** What is left: `underline`, `-mt-4`, `!p-4`, `w-[calc(100%-2rem)]`. */
|
|
121
|
+
utility: string;
|
|
122
|
+
}
|
|
123
|
+
/** Splits a className into its classes; a `:` inside `[…]` is part of a value (`bg-[url(http://x)]`), not a variant. */
|
|
124
|
+
export declare function wrParseClassName(className: string): WrClassToken[];
|
|
125
|
+
export interface WrStyleEntry {
|
|
126
|
+
property: string;
|
|
127
|
+
breakpoint: WrBreakpointId;
|
|
128
|
+
/** The value of the table; null when the class is outside it (see `custom`). */
|
|
129
|
+
value: string | null;
|
|
130
|
+
/** The class as it is written in the code, breakpoint included (`md:px-6`). */
|
|
131
|
+
class: string;
|
|
132
|
+
/** The class is a value the table does not offer (`w-[320px]`, `p-13`): it is kept as it is until the property is set again at that breakpoint. */
|
|
133
|
+
custom?: true;
|
|
134
|
+
/** The state it holds in (hover, focus, pressed); none: always. */
|
|
135
|
+
state?: WrStateId;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Everything a className says about the properties of the table, at the breakpoints it names. Several classes for one property: the last one is what is read. `state`: what it says for that
|
|
139
|
+
* state (`hover:bg-accent`); without it, only what holds always (the classes of a state are not mixed in).
|
|
140
|
+
*/
|
|
141
|
+
export declare function wrStyleRead(className: string, options?: WrStyleOptions, state?: WrStateId): WrStyleEntry[];
|
|
142
|
+
/** The classes the table does not read: `dark:` and other variants (what the table reads of `hover:`, `focus:` and `active:` is the state of a property that can have one), `!important`, what is not about a property of the table, the project's own classes. They are never touched. */
|
|
143
|
+
export declare function wrStyleUnmanaged(className: string, options?: WrStyleOptions): string[];
|
|
144
|
+
/** What a property is at a breakpoint once the narrower screens are counted: its own value, or the nearest smaller breakpoint's. */
|
|
145
|
+
export declare function wrStyleEffective(entries: readonly WrStyleEntry[], property: string, breakpoint: WrBreakpointId): {
|
|
146
|
+
value: string | null;
|
|
147
|
+
from: WrBreakpointId;
|
|
148
|
+
custom?: true;
|
|
149
|
+
} | null;
|
|
150
|
+
export interface WrStyleChange {
|
|
151
|
+
property: string;
|
|
152
|
+
breakpoint: WrBreakpointId;
|
|
153
|
+
/** A value of the property (see `wrStyleProperties`), or null to take it away at that breakpoint. */
|
|
154
|
+
value: string | null;
|
|
155
|
+
/** The state it is for (hover, focus, pressed); none: always. Only the properties that can have one (`WrStyleProperty.states`). */
|
|
156
|
+
state?: WrStateId;
|
|
157
|
+
}
|
|
158
|
+
export type WrStyleErrorCode = 'unknown-property' | 'unknown-breakpoint' | 'invalid-value' | 'unknown-state' | 'invalid-state';
|
|
159
|
+
export declare class WrStyleError extends Error {
|
|
160
|
+
readonly code: WrStyleErrorCode;
|
|
161
|
+
constructor(code: WrStyleErrorCode, message: string);
|
|
162
|
+
}
|
|
163
|
+
/** The className once every change is made, in order. A value that is not the property's, a property or a breakpoint that does not exist: a `WrStyleError` that says what there is. */
|
|
164
|
+
export declare function wrStyleApply(className: string, changes: readonly WrStyleChange[], options?: WrStyleOptions): string;
|
|
165
|
+
/**
|
|
166
|
+
* The classes of one screen put on another (`to` a breakpoint), or on every screen at once (`to: 'all'`). The classes are copied as they are written, so what the table does not offer
|
|
167
|
+
* (`w-[320px]`) goes too; only the style classes move: hover:, dark: and the project's own stay where they are.
|
|
168
|
+
* - to a breakpoint: for each property `from` says, `to` says the same; the same properties are replaced (a wider one takes out the narrower it includes: p replaces px), the rest of
|
|
169
|
+
* `to` stays. What `from` inherits from narrower screens is not copied: it is not written there.
|
|
170
|
+
* - to 'all': one clean list. The look `from` has once the narrower screens are counted becomes what every screen has; every class of another breakpoint is taken away. From "All screens"
|
|
171
|
+
* that is only taking the overrides away.
|
|
172
|
+
* `only`: just these properties (and the ones they include or are included by: padding and padding-x say the same thing); every other class stays as it is. `state`: the classes of that state
|
|
173
|
+
* (hover…) and no others; without it, the ones that hold always. Pure; an unknown breakpoint or state is a `WrStyleError`.
|
|
174
|
+
*/
|
|
175
|
+
export declare function wrStyleCopyTo(className: string, from: WrBreakpointId, to: WrBreakpointId | 'all', options?: WrStyleOptions, only?: readonly string[], state?: WrStateId): string;
|
|
176
|
+
/**
|
|
177
|
+
* Makes changes hold on every screen: each is made at the breakpoint it names, and then what the element looks like there, for those properties only, becomes what every screen has (the
|
|
178
|
+
* overrides of the other screens for them are taken away). A change that takes a value away (`null`) takes it away from every screen. What the changes do not touch keeps its overrides.
|
|
179
|
+
* This is what "All screens" does in the editor: you set it where you are looking, and it holds everywhere. Pure.
|
|
180
|
+
*/
|
|
181
|
+
export declare function wrStyleApplyEverywhere(className: string, changes: readonly WrStyleChange[], options?: WrStyleOptions): string;
|
|
182
|
+
/**
|
|
183
|
+
* Two groups of classes put together, `over` winning where both say something: what an element looks like when a shared style (`under`) is written out on it and the element has classes
|
|
184
|
+
* of its own (`over`). A class of `under` is left out when `over` says the same property at the same breakpoint, or a wider property that includes it there (p over px); everything else
|
|
185
|
+
* of `under` stays, then all of `over`. Pure.
|
|
186
|
+
*/
|
|
187
|
+
export declare function wrStyleLayer(under: string, over: string, options?: WrStyleOptions): string;
|
|
188
|
+
/** A style entry in words: what a person reads in the panel and an AI or a tool reads in an answer. */
|
|
189
|
+
export interface WrStyleDescription {
|
|
190
|
+
property: string;
|
|
191
|
+
propertyLabel: string;
|
|
192
|
+
breakpoint: WrBreakpointId;
|
|
193
|
+
breakpointLabel: string;
|
|
194
|
+
value: string | null;
|
|
195
|
+
valueLabel: string;
|
|
196
|
+
css?: string;
|
|
197
|
+
class: string;
|
|
198
|
+
custom?: true;
|
|
199
|
+
/** The state it is for (hover…), and its name. */
|
|
200
|
+
state?: WrStateId;
|
|
201
|
+
stateLabel?: string;
|
|
202
|
+
sentence: string;
|
|
203
|
+
}
|
|
204
|
+
export declare function wrStyleDescribe(entries: readonly WrStyleEntry[], options?: WrStyleOptions): WrStyleDescription[];
|
|
205
|
+
/** How finely a multi-side property is said: one value for all, one per pair, one for each side. */
|
|
206
|
+
export type WrStyleSidesMode = 'all' | 'axis' | 'sides';
|
|
207
|
+
export interface WrStyleCompoundPart {
|
|
208
|
+
property: string;
|
|
209
|
+
label: string;
|
|
210
|
+
/** The finest parts this one says at once (the whole, a pair, or just itself): what makes a switch from a mode to another lossless or not. */
|
|
211
|
+
covers: string[];
|
|
212
|
+
}
|
|
213
|
+
export interface WrStyleCompoundMode {
|
|
214
|
+
id: WrStyleSidesMode;
|
|
215
|
+
label: string;
|
|
216
|
+
description: string;
|
|
217
|
+
parts: WrStyleCompoundPart[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A property that is said by sides (padding, margin) or by axes (gap): the panel shows it through ONE model with a mode, instead of one row per property:
|
|
221
|
+
* all at once, a pair at a time (top and bottom, left and right), or each one by itself. The modes, which properties each is made of and what each covers are
|
|
222
|
+
* written here, once.
|
|
223
|
+
*/
|
|
224
|
+
export interface WrStyleCompound {
|
|
225
|
+
id: string;
|
|
226
|
+
label: string;
|
|
227
|
+
description: string;
|
|
228
|
+
group: WrStyleGroup;
|
|
229
|
+
modes: WrStyleCompoundMode[];
|
|
230
|
+
}
|
|
231
|
+
export declare const WR_STYLE_COMPOUNDS: readonly WrStyleCompound[];
|
|
232
|
+
type Own = Pick<WrStyleEntry, 'property' | 'breakpoint' | 'value'> & {
|
|
233
|
+
custom?: true;
|
|
234
|
+
};
|
|
235
|
+
/** The mode that shows what an element has at a breakpoint: the finest one with something set in it (the panel opens there). */
|
|
236
|
+
export declare function wrStyleCompoundMode(compound: WrStyleCompound, entries: readonly Own[], breakpoint: WrBreakpointId): WrStyleSidesMode;
|
|
237
|
+
export interface WrStyleCompoundValue {
|
|
238
|
+
/** What the part comes to (null: nothing sets it). */
|
|
239
|
+
value: string | null;
|
|
240
|
+
/** The part has a value of its own at this breakpoint (a cross can take it away); otherwise it is what a coarser part, or a narrower screen, says. */
|
|
241
|
+
own: boolean;
|
|
242
|
+
/** Where it comes from: this breakpoint, or the nearest narrower one that says something. */
|
|
243
|
+
from: WrBreakpointId;
|
|
244
|
+
/** The part joins sides that come to different values (it cannot be said as one). */
|
|
245
|
+
mixed: boolean;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* What a part of a multi-side model comes to at a breakpoint once everything that says something about it is counted: its own value, the coarser part that covers it (`padding`
|
|
249
|
+
* for `padding-top`), and the narrower screens (mobile first). So in "each side" mode a side that has no class of its own shows what the whole says.
|
|
250
|
+
*/
|
|
251
|
+
export declare function wrStyleCompoundValue(compound: WrStyleCompound, entries: readonly Own[], breakpoint: WrBreakpointId, part: WrStyleCompoundPart): WrStyleCompoundValue;
|
|
252
|
+
export type WrStyleSwitch = {
|
|
253
|
+
ok: true;
|
|
254
|
+
changes: WrStyleChange[];
|
|
255
|
+
} | {
|
|
256
|
+
ok: false;
|
|
257
|
+
reason: string;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* What changing the mode of a multi-side property asks for, so that the element looks the same: going to a finer mode copies the value to the parts (and takes the
|
|
261
|
+
* coarser ones away); going to a coarser one needs the parts it joins to agree (to be the same value, or all none), and says why when they do not. A value outside the table
|
|
262
|
+
* (`px-[3px]`) cannot be copied: it is said, not lost.
|
|
263
|
+
*/
|
|
264
|
+
export declare function wrStyleCompoundSwitch(compound: WrStyleCompound, entries: readonly Own[], breakpoint: WrBreakpointId, to: WrStyleSidesMode): WrStyleSwitch;
|
|
265
|
+
/** Everything there is to say, as plain data: what `style-catalog` answers, and what the editor's panel is drawn from. */
|
|
266
|
+
export interface WrStyleCatalog {
|
|
267
|
+
breakpoints: {
|
|
268
|
+
id: WrBreakpointId;
|
|
269
|
+
label: string;
|
|
270
|
+
description: string;
|
|
271
|
+
minWidth: number;
|
|
272
|
+
}[];
|
|
273
|
+
note: string;
|
|
274
|
+
groups: Record<WrStyleGroup, string>;
|
|
275
|
+
/** The states a property that can have one can be set for. */
|
|
276
|
+
states: {
|
|
277
|
+
id: WrStateId;
|
|
278
|
+
label: string;
|
|
279
|
+
description: string;
|
|
280
|
+
}[];
|
|
281
|
+
colorTokens: string[];
|
|
282
|
+
properties: {
|
|
283
|
+
id: string;
|
|
284
|
+
label: string;
|
|
285
|
+
description: string;
|
|
286
|
+
group: WrStyleGroup;
|
|
287
|
+
control: WrStyleProperty['control'];
|
|
288
|
+
includes?: string[];
|
|
289
|
+
includesNote?: string;
|
|
290
|
+
/** Any number is accepted too (and what a number is): see `WrStyleFree`. The field takes it; `hint` says it in words. */
|
|
291
|
+
free?: WrStyleFree & {
|
|
292
|
+
hint: string;
|
|
293
|
+
};
|
|
294
|
+
/** The multi-side model it is a part of. */
|
|
295
|
+
compound?: string;
|
|
296
|
+
/** It can be set for a state (hover, focus, pressed) too. */
|
|
297
|
+
states?: true;
|
|
298
|
+
/** A color can also be picked on the fly (a hex color), outside the theme's. */
|
|
299
|
+
hex?: true;
|
|
300
|
+
/** The values people reach for most, in the order to offer them. */
|
|
301
|
+
shortcuts?: string[];
|
|
302
|
+
values: {
|
|
303
|
+
value: string;
|
|
304
|
+
label: string;
|
|
305
|
+
css?: string;
|
|
306
|
+
class: string;
|
|
307
|
+
swatch?: string;
|
|
308
|
+
}[];
|
|
309
|
+
}[];
|
|
310
|
+
compounds: WrStyleCompound[];
|
|
311
|
+
}
|
|
312
|
+
export declare function wrStyleCatalog(options?: WrStyleOptions): WrStyleCatalog;
|
|
313
|
+
/** Whether the panel offers a control for this kind of element (`text`, `section`, `image`…). `item` is a property id, or a model's (`padding`). */
|
|
314
|
+
export declare function wrStyleOffered(item: string, kind: string | undefined): boolean;
|
|
315
|
+
/** An edge of an element that can be dragged to change a property: the right one for the width, the bottom one for the height. */
|
|
316
|
+
export interface WrStyleHandle {
|
|
317
|
+
property: 'width' | 'height';
|
|
318
|
+
edge: 'right' | 'bottom';
|
|
319
|
+
/** What the handle is for, in words (its accessible name). */
|
|
320
|
+
label: string;
|
|
321
|
+
}
|
|
322
|
+
export declare const wrStyleHandles: (kind: string | undefined) => readonly WrStyleHandle[];
|
|
323
|
+
/**
|
|
324
|
+
* What the quick bar on the selected element offers. The few things people do most, and which of them make sense for the kind of element: a box has its size, its room around and inside,
|
|
325
|
+
* the gap between its children, a background and where they sit; an image has a size and a margin; a text written in the editor has its own toolbar, so only its size and margin. The
|
|
326
|
+
* panel is for the rest. One table: what the bar shows for a component is said here and nowhere else.
|
|
327
|
+
*/
|
|
328
|
+
export type WrQuickItem = 'width' | 'height' | 'padding' | 'margin' | 'gap' | 'background-color' | 'align' | 'duplicate' | 'delete';
|
|
329
|
+
export declare const wrStyleQuick: (kind: string | undefined) => readonly WrQuickItem[];
|
|
330
|
+
/** A side of an element's padding or margin that can be dragged on the page. */
|
|
331
|
+
export interface WrStyleSpaceHandle {
|
|
332
|
+
/** The property a drag writes (`padding-top`). */
|
|
333
|
+
property: 'padding-top' | 'padding-right' | 'padding-bottom' | 'padding-left' | 'margin-top' | 'margin-right' | 'margin-bottom' | 'margin-left';
|
|
334
|
+
kind: 'padding' | 'margin';
|
|
335
|
+
side: 'top' | 'right' | 'bottom' | 'left';
|
|
336
|
+
/** The property that says all four sides at once (what Shift writes). */
|
|
337
|
+
all: 'padding' | 'margin';
|
|
338
|
+
/** What it is, in words (its accessible name). */
|
|
339
|
+
label: string;
|
|
340
|
+
}
|
|
341
|
+
export declare const wrStyleSpaceHandles: (kind: string | undefined) => readonly WrStyleSpaceHandle[];
|
|
342
|
+
export interface WrStyleSpaceResult {
|
|
343
|
+
/** What `style-set` takes (`4`). */
|
|
344
|
+
value: string;
|
|
345
|
+
class: string;
|
|
346
|
+
/** For the person: `pt-4 · 16px`. */
|
|
347
|
+
label: string;
|
|
348
|
+
/** The CSS that shows it now, before it is written (`1rem`). */
|
|
349
|
+
css: string;
|
|
350
|
+
px: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* What a padding or a margin dragged to `px` comes to: a whole step of the spacing scale (a quarter of a rem, 4px: nothing finer is asked of a hand), never negative (a drag does not make a
|
|
354
|
+
* negative margin). `property` is the side (`padding-top`) or all of them (`padding`). null for a property that is not one of these. Pure, like `wrStyleDrag`.
|
|
355
|
+
*/
|
|
356
|
+
export declare function wrStyleSpaceDrag(property: string, px: number, rem?: number): WrStyleSpaceResult | null;
|
|
357
|
+
export interface WrStyleDragContext {
|
|
358
|
+
/** The width the parent leaves for the element, in px: the width snaps to a fraction of it (`1/2`, `3/4`) or all of it (`full`) when it comes close. */
|
|
359
|
+
parent?: number;
|
|
360
|
+
/** The size of 1rem in px (16 unless the site says otherwise). */
|
|
361
|
+
rem?: number;
|
|
362
|
+
/** Whether a width snaps to a fraction of the parent (true unless it is false): a hand wants it, an arrow key that moves one step at a time does not (it would never leave the fraction). */
|
|
363
|
+
fractions?: boolean;
|
|
364
|
+
/** The smallest the element can be where it is, in px (what the page measured): a size under it is a size the page would not show, so it is not offered. */
|
|
365
|
+
floor?: number;
|
|
366
|
+
}
|
|
367
|
+
/** The smallest step number (`w-N`) that is not under `floor` px: the number a field takes as its minimum. 0 when there is no floor. */
|
|
368
|
+
export declare const wrStyleFloorStep: (floor: number | undefined, rem?: number) => number;
|
|
369
|
+
export interface WrStyleDragResult {
|
|
370
|
+
/** What `style-set` takes (`64`, `3/4`, `full`). */
|
|
371
|
+
value: string;
|
|
372
|
+
class: string;
|
|
373
|
+
/** For the person: `w-64 · 256px`. */
|
|
374
|
+
label: string;
|
|
375
|
+
/** The CSS that shows it now, before it is written (`16rem`, `75%`). */
|
|
376
|
+
css: string;
|
|
377
|
+
px: number;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* What a size dragged to `px` comes to: a whole step of the spacing scale (a quarter of a rem, 4px: nothing finer is asked of a hand), or, for a width, a fraction of the parent when
|
|
381
|
+
* it comes close to one. null for a property that is not a size. Pure, so the same answer is given for the person dragging and for a test.
|
|
382
|
+
*/
|
|
383
|
+
export declare function wrStyleDrag(property: 'width' | 'height', px: number, context?: WrStyleDragContext): WrStyleDragResult | null;
|
|
384
|
+
/** Where the children of a box sit along an axis. */
|
|
385
|
+
export type WrStyleAlignSide = 'start' | 'center' | 'end';
|
|
386
|
+
export declare const WR_STYLE_ALIGN_SIDES: readonly WrStyleAlignSide[];
|
|
387
|
+
/** The kinds of element whose children can be aligned like this: the boxes (a text, a button, an image have no children to place). */
|
|
388
|
+
export declare const wrStyleCanAlign: (kind: string | undefined) => boolean;
|
|
389
|
+
export type WrStyleAlignment = {
|
|
390
|
+
ok: true;
|
|
391
|
+
horizontal: WrStyleAlignSide | null;
|
|
392
|
+
vertical: WrStyleAlignSide | null; /** There is no height: a vertical alignment has no room to move in. */
|
|
393
|
+
needsHeight: boolean;
|
|
394
|
+
} | {
|
|
395
|
+
ok: false;
|
|
396
|
+
reason: string;
|
|
397
|
+
};
|
|
398
|
+
/** Where the children sit now (the cell of the grid that is on), or why this box cannot be aligned. */
|
|
399
|
+
export declare function wrStyleAlignRead(entries: readonly Own[], breakpoint: WrBreakpointId): WrStyleAlignment;
|
|
400
|
+
/**
|
|
401
|
+
* What to write to put the children at a place of the grid (horizontal × vertical), ALL at once: the layout that makes it work (a plain box becomes a flex column: its
|
|
402
|
+
* children stack as before) and both alignments, whichever axis each is on. Written separately these pieces do nothing (`items-center` on a block box does not move anything), which
|
|
403
|
+
* is why they are one change.
|
|
404
|
+
*/
|
|
405
|
+
export declare function wrStyleAlignSet(entries: readonly Own[], breakpoint: WrBreakpointId, horizontal: WrStyleAlignSide, vertical: WrStyleAlignSide): {
|
|
406
|
+
ok: true;
|
|
407
|
+
changes: WrStyleChange[];
|
|
408
|
+
} | {
|
|
409
|
+
ok: false;
|
|
410
|
+
reason: string;
|
|
411
|
+
};
|
|
412
|
+
/** What to write to take the alignment away at a breakpoint (the box stays as it is laid out). */
|
|
413
|
+
export declare const wrStyleAlignClear: (breakpoint: WrBreakpointId) => WrStyleChange[];
|
|
414
|
+
/** A way a box lays its children out: a column, a row, columns, a grid. */
|
|
415
|
+
export interface WrStyleLayout {
|
|
416
|
+
id: string;
|
|
417
|
+
label: string;
|
|
418
|
+
description: string;
|
|
419
|
+
/** What it is made of: the layout properties it sets, at each screen width (all responsive: columns become one on a phone). */
|
|
420
|
+
recipe: readonly {
|
|
421
|
+
property: string;
|
|
422
|
+
breakpoint: WrBreakpointId;
|
|
423
|
+
value: string;
|
|
424
|
+
}[];
|
|
425
|
+
/** The gap it gives the box when it has none. */
|
|
426
|
+
gap: string | null;
|
|
427
|
+
}
|
|
428
|
+
/** The layouts, in the order they are offered: the one table that the panel, the quick menu, the API and the tools read. */
|
|
429
|
+
export declare const WR_STYLE_LAYOUTS: readonly WrStyleLayout[];
|
|
430
|
+
/** The kinds of element that can change layout: the boxes (they hold other elements). */
|
|
431
|
+
export declare const wrStyleCanLayout: (kind: string | undefined) => boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Which layout a box has: the id of the one it matches exactly (only its layout properties count, not the gap or the alignment), `null` when it has none of those set, `'custom'`
|
|
434
|
+
* when it has something that is none of the layouts.
|
|
435
|
+
*/
|
|
436
|
+
export declare function wrStyleLayoutRead(entries: readonly Own[]): string | 'custom' | null;
|
|
437
|
+
/**
|
|
438
|
+
* What to write to turn a box into a layout, ALL at once and at every screen width: what the old layout set is taken away (a row's `md:flex-row` must not survive into columns), the
|
|
439
|
+
* new one is written, and a gap is given if the box had none (columns glued together are not columns). One change list: one undo.
|
|
440
|
+
*/
|
|
441
|
+
export declare function wrStyleLayoutSet(entries: readonly Own[], layoutId: string): {
|
|
442
|
+
ok: true;
|
|
443
|
+
changes: WrStyleChange[];
|
|
444
|
+
} | {
|
|
445
|
+
ok: false;
|
|
446
|
+
reason: string;
|
|
447
|
+
};
|
|
448
|
+
/** Every CSS property a preview may touch: what a page is asked to show is limited to these, whatever is asked. */
|
|
449
|
+
export declare const WR_STYLE_PREVIEW_CSS: ReadonlySet<string>;
|
|
450
|
+
/**
|
|
451
|
+
* The CSS that shows a value of a number property now (`padding-top` at 6 is `padding-top: 1.5rem`), for a page to wear while the value is dragged: nothing is written, and the
|
|
452
|
+
* page gives it back. null when it cannot be shown that way (the value is written without a preview). The same table as the classes: a step is a quarter of a rem.
|
|
453
|
+
*/
|
|
454
|
+
export declare function wrStylePreviewCss(property: string, value: string): Record<string, string> | null;
|
|
455
|
+
export {};
|
|
456
|
+
//# sourceMappingURL=style.d.ts.map
|