@plitzi/sdk-authoring 0.38.10 → 0.38.11
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/CHANGELOG.md +175 -0
- package/dist/index-src.js +4741 -4602
- package/dist/index.d.ts +82 -21
- package/dist/index.js +2 -2
- package/dist/node.d.ts +17 -7
- package/dist/node.js +1 -1
- package/package.json +7 -7
- package/skills/plitzi-authoring/CHEATSHEET.md +3 -1
- package/skills/plitzi-authoring/recipes/style-a-page.ts +1 -1
- package/skills/plitzi-authoring/reference/accessibility.md +1 -0
- package/skills/plitzi-authoring/reference/authoring-errors.md +5 -3
- package/skills/plitzi-authoring/reference/data-and-visibility.md +11 -10
- package/skills/plitzi-authoring/reference/flows.md +2 -2
- package/skills/plitzi-authoring/reference/layouts.md +1 -0
- package/skills/plitzi-authoring/reference/lists.md +1 -0
- package/skills/plitzi-authoring/reference/plugins.md +3 -2
- package/skills/plitzi-authoring/reference/realtime.md +4 -1
- package/skills/plitzi-authoring/reference/typed-sources.md +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -23,9 +23,9 @@ import { WheelEventHandler } from 'react';
|
|
|
23
23
|
/**
|
|
24
24
|
* Who may start a run this way. `'public'` and `'session'` are the two that carry nothing else.
|
|
25
25
|
*
|
|
26
|
-
* Required on every kind but `schedule`, and by the TYPE rather than by a check at run time: a trigger
|
|
27
|
-
* rule is refused by the runner, so the alternative is a way in that authors fine and answers `forbidden` to
|
|
28
|
-
* everybody. A clock has no caller and states none.
|
|
26
|
+
* Required on every kind but `schedule` and `later`, and by the TYPE rather than by a check at run time: a trigger
|
|
27
|
+
* with no rule is refused by the runner, so the alternative is a way in that authors fine and answers `forbidden` to
|
|
28
|
+
* everybody. A clock has no caller and states none, and a run set for later was let in by the run that set it.
|
|
29
29
|
*/
|
|
30
30
|
export declare type AccessSpec = ActionAccess | 'public' | 'session';
|
|
31
31
|
|
|
@@ -271,6 +271,14 @@ export declare type ActionTriggerSpec = (TriggerCommon & {
|
|
|
271
271
|
type: 'schedule';
|
|
272
272
|
cron: string;
|
|
273
273
|
timezone?: string;
|
|
274
|
+
})
|
|
275
|
+
/**
|
|
276
|
+
* Started by another run in so many seconds — `flow.later`, a function's `ctx.later` — on the server, whether or
|
|
277
|
+
* not a page is still open: a turn that runs out, a bot's move, a hold that lapses. Its `input` is what that run hands
|
|
278
|
+
* it.
|
|
279
|
+
*/
|
|
280
|
+
| (TriggerCommon & {
|
|
281
|
+
type: 'later';
|
|
274
282
|
});
|
|
275
283
|
|
|
276
284
|
/**
|
|
@@ -738,10 +746,15 @@ export declare const AUTHORING_CODES: {
|
|
|
738
746
|
readonly means: "a template in a page's `seoTitle`, `seoDescription` or `notFound` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read";
|
|
739
747
|
readonly fix: "read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own";
|
|
740
748
|
};
|
|
749
|
+
readonly 'declared-callback-target': {
|
|
750
|
+
readonly kind: "refused";
|
|
751
|
+
readonly means: "a `declaredCallback` target with a key beside `on` and `params` — read nowhere, so the step runs without it";
|
|
752
|
+
readonly fix: "the value in `params`: `{ on: 'calendar', params: { date } }`";
|
|
753
|
+
};
|
|
741
754
|
readonly 'folder-undeclared': {
|
|
742
755
|
readonly kind: "refused";
|
|
743
756
|
readonly means: "a page, a layout or a folder filed in a folder the space does not declare";
|
|
744
|
-
readonly fix: "declare the
|
|
757
|
+
readonly fix: "declare it on the space — `pageFolders: [{ id: 'docs', name: 'Docs' }]`, its slug starting its pages' addresses — or use the name it suggests";
|
|
745
758
|
};
|
|
746
759
|
readonly 'folder-cycle': {
|
|
747
760
|
readonly kind: "refused";
|
|
@@ -838,6 +851,11 @@ export declare const AUTHORING_CODES: {
|
|
|
838
851
|
readonly means: "a `slots` key the element type does not have — its class would dress nothing";
|
|
839
852
|
readonly fix: "one of the slots `plitzi explain <type>` lists; the element itself takes `class`";
|
|
840
853
|
};
|
|
854
|
+
readonly 'slot-not-class': {
|
|
855
|
+
readonly kind: "refused";
|
|
856
|
+
readonly means: "a `slots` entry that is not a class — rules written in place, or nothing — which a slot cannot wear";
|
|
857
|
+
readonly fix: "the rules as a `styles()` declaration, handed to the slot beside its other classes";
|
|
858
|
+
};
|
|
841
859
|
readonly 'class-conflict': {
|
|
842
860
|
readonly kind: "refused";
|
|
843
861
|
readonly means: "two different declarations for one class name";
|
|
@@ -851,7 +869,7 @@ export declare const AUTHORING_CODES: {
|
|
|
851
869
|
readonly 'class-and-css': {
|
|
852
870
|
readonly kind: "refused";
|
|
853
871
|
readonly means: "an element wearing a shared class AND `css` or `states` of its own — it has one base selector";
|
|
854
|
-
readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]`
|
|
872
|
+
readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]` — or into the class";
|
|
855
873
|
};
|
|
856
874
|
readonly 'class-and-selector': {
|
|
857
875
|
readonly kind: "refused";
|
|
@@ -863,11 +881,6 @@ export declare const AUTHORING_CODES: {
|
|
|
863
881
|
readonly means: "more than one set of rules in a class list";
|
|
864
882
|
readonly fix: "one set, after the classes: `class: [card, { opacity: '0.5', 'margin-top': '8px' }]`";
|
|
865
883
|
};
|
|
866
|
-
readonly 'modifier-without-id': {
|
|
867
|
-
readonly kind: "refused";
|
|
868
|
-
readonly means: "rules on top of a class on an element with no `id` — the id names the class they become";
|
|
869
|
-
readonly fix: "`id: 'hero-bg'`";
|
|
870
|
-
};
|
|
871
884
|
readonly 'selector-invalid': {
|
|
872
885
|
readonly kind: "refused";
|
|
873
886
|
readonly means: "a `selector` that is not a CSS class name";
|
|
@@ -1148,6 +1161,11 @@ export declare const AUTHORING_CODES: {
|
|
|
1148
1161
|
readonly means: "a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's";
|
|
1149
1162
|
readonly fix: "put the provider on the page, around the instance, and hand the component its rows as a prop";
|
|
1150
1163
|
};
|
|
1164
|
+
readonly 'template-in-value': {
|
|
1165
|
+
readonly kind: "refused";
|
|
1166
|
+
readonly means: "a `{{ }}` inside an attribute that is an object or a list — a provider's `input`, a list's `items`, a plugin's settings: only an attribute that is text is evaluated";
|
|
1167
|
+
readonly fix: "a binding on the attribute (`bindTemplate(name, source, template, { returns: 'value' })`); for a provider's `input`, nothing for a route or query param — the action is already handed them as `input.<name>`";
|
|
1168
|
+
};
|
|
1151
1169
|
readonly 'not-found-in-browser': {
|
|
1152
1170
|
readonly kind: "refused";
|
|
1153
1171
|
readonly means: "`notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status";
|
|
@@ -1955,7 +1973,7 @@ export declare type BindingTransformer = {
|
|
|
1955
1973
|
* container({ bind: [bindTemplate('width', 'state.progress', '{{ source }}%', { category: 'style' })] });
|
|
1956
1974
|
* ```
|
|
1957
1975
|
*/
|
|
1958
|
-
export declare const bindTemplate: (to: string, source:
|
|
1976
|
+
export declare const bindTemplate: (to: string, source: SourceName, template: string, options?: BindTemplateOptions) => BindingSpec;
|
|
1959
1977
|
|
|
1960
1978
|
export declare interface BindTemplateOptions {
|
|
1961
1979
|
/** Where the value goes: an attribute (the default), a style property (`style`), or element state. */
|
|
@@ -3641,6 +3659,7 @@ declare const elementDeclarations: {
|
|
|
3641
3659
|
readonly from: "";
|
|
3642
3660
|
readonly user: "";
|
|
3643
3661
|
readonly at: "";
|
|
3662
|
+
readonly echo: false;
|
|
3644
3663
|
};
|
|
3645
3664
|
};
|
|
3646
3665
|
readonly onJoin: {
|
|
@@ -3683,6 +3702,11 @@ declare const elementDeclarations: {
|
|
|
3683
3702
|
readonly defaultValue: "";
|
|
3684
3703
|
readonly type: "text";
|
|
3685
3704
|
};
|
|
3705
|
+
readonly echo: {
|
|
3706
|
+
readonly label: "Heard on this page too";
|
|
3707
|
+
readonly defaultValue: false;
|
|
3708
|
+
readonly type: "boolean";
|
|
3709
|
+
};
|
|
3686
3710
|
};
|
|
3687
3711
|
};
|
|
3688
3712
|
readonly setPresence: {
|
|
@@ -7992,6 +8016,15 @@ export declare const explanationText: (explanation: Explanation) => string;
|
|
|
7992
8016
|
/** A failed flow in one line, with the steps that failed under it. */
|
|
7993
8017
|
export declare const failedFlowText: (flow: DevToolsFlow) => string;
|
|
7994
8018
|
|
|
8019
|
+
/**
|
|
8020
|
+
* The family a page was written by, when it was: one object shared by its pages and no others. Carried unseen — a
|
|
8021
|
+
* page spec is the author's, and what it says is all a document is made of.
|
|
8022
|
+
*/
|
|
8023
|
+
export declare const familyOf: (page: PageSpec) => object | undefined;
|
|
8024
|
+
|
|
8025
|
+
/** The operators that ask about the field alone — whether it holds anything — and so compare it with no value. */
|
|
8026
|
+
declare type FieldOnlyOperator = 'empty' | 'notEmpty';
|
|
8027
|
+
|
|
7995
8028
|
/** The lint codes `fixSpace` knows how to settle: what the builder offers to fix, and what the server will fix. */
|
|
7996
8029
|
export declare const FIXABLE_CODES: ReadonlySet<string>;
|
|
7997
8030
|
|
|
@@ -8259,7 +8292,7 @@ export declare const hiddenParams: (provided: Record<string, unknown>, effective
|
|
|
8259
8292
|
* is a field per question whose only reason to exist is the missing word, and it puts "when is this hidden?" in
|
|
8260
8293
|
* whatever service produced the data rather than in the page that hides it. This inverts the value on the way in.
|
|
8261
8294
|
*/
|
|
8262
|
-
export declare const hiddenWhen: (source:
|
|
8295
|
+
export declare const hiddenWhen: (source: SourceName) => BindingSpec;
|
|
8263
8296
|
|
|
8264
8297
|
/**
|
|
8265
8298
|
* Asks the application AROUND this space to do something — open one of its screens, sign out, quit.
|
|
@@ -8653,6 +8686,12 @@ export declare const invalidParams: (provided: Record<string, unknown>, effectiv
|
|
|
8653
8686
|
/** An entry of an element's class list that is rules of its own rather than a class. */
|
|
8654
8687
|
export declare const isClassModifier: (entry: ClassRef | StyleSpec) => entry is StyleSpec;
|
|
8655
8688
|
|
|
8689
|
+
/**
|
|
8690
|
+
* Whether a value is a class at all — a name, or a `styles()` declaration. The types say a class list holds nothing
|
|
8691
|
+
* else, but a space written in JavaScript, or rebuilt from JSON, arrives without them.
|
|
8692
|
+
*/
|
|
8693
|
+
export declare const isClassRef: (value: unknown) => value is ClassRef;
|
|
8694
|
+
|
|
8656
8695
|
export declare const isCssProperty: (key: string) => boolean;
|
|
8657
8696
|
|
|
8658
8697
|
/**
|
|
@@ -10064,12 +10103,16 @@ export declare type PseudoSpec = CssSpec | PseudoRulesSpec;
|
|
|
10064
10103
|
export declare type PseudosSpec = Partial<Record<StylePseudo, PseudoSpec>>;
|
|
10065
10104
|
|
|
10066
10105
|
/**
|
|
10067
|
-
* Says something on a `channel`, by id: every page on its topic hears it — `onMessage`, and the channel's source.
|
|
10106
|
+
* Says something on a `channel`, by id: every OTHER page on its topic hears it — `onMessage`, and the channel's source.
|
|
10107
|
+
* The page that said it hears it too with `{ echo: true }` — a reaction, a chat line: what the sender shows the moment
|
|
10108
|
+
* it sends — once the server took it, its `from` the channel's `me`.
|
|
10068
10109
|
*
|
|
10069
10110
|
* `data` is what they receive: a template (`'{{ state.draft }}'`) or JSON text. `type` is yours to name — `chat`,
|
|
10070
10111
|
* `wave`, `move` — and a flow on `onMessage` tells them apart with `when({ field: '<step>.type', … })`.
|
|
10071
10112
|
*/
|
|
10072
|
-
export declare const publishOn: (target: string, type: string, data?: unknown
|
|
10113
|
+
export declare const publishOn: (target: string, type: string, data?: unknown, { echo }?: {
|
|
10114
|
+
echo?: boolean;
|
|
10115
|
+
}) => StepSpec;
|
|
10073
10116
|
|
|
10074
10117
|
/** The page's dev tools, read: the flows that ran and, when asked, the state, the sources and one element. */
|
|
10075
10118
|
export declare const readDevTools: (driver: DevToolsDriver, input: DevToolsInput) => Promise<DevToolsReport>;
|
|
@@ -10785,10 +10828,18 @@ export declare type SourcePath<T> = SourceBrand & (T extends readonly (infer Ite
|
|
|
10785
10828
|
readonly [Key in keyof T]-?: SourcePath<T[Key]>;
|
|
10786
10829
|
} : unknown);
|
|
10787
10830
|
|
|
10788
|
-
/**
|
|
10831
|
+
/**
|
|
10832
|
+
* The row of a list fed by a typed source: its item as the sample's item, its position as a number — both already the
|
|
10833
|
+
* full names a template reads (`` `{{ ${r.item.slug} }}` ``), and `inTemplate` the same names as text, as an untyped
|
|
10834
|
+
* row has them.
|
|
10835
|
+
*/
|
|
10789
10836
|
export declare interface SourceRow<Item> {
|
|
10790
10837
|
item: SourcePath<Item>;
|
|
10791
10838
|
index: SourcePath<number>;
|
|
10839
|
+
inTemplate: {
|
|
10840
|
+
item: string;
|
|
10841
|
+
index: string;
|
|
10842
|
+
};
|
|
10792
10843
|
}
|
|
10793
10844
|
|
|
10794
10845
|
/**
|
|
@@ -11686,10 +11737,11 @@ export declare type SuggestionCode = {
|
|
|
11686
11737
|
export declare const suggestSpace: ({ schema, style }: {
|
|
11687
11738
|
schema: Schema;
|
|
11688
11739
|
style: Style;
|
|
11689
|
-
},
|
|
11690
|
-
/** The CSS the pages load besides the space's own — its plugins' stylesheets: a token read there is read. */
|
|
11691
|
-
{ stylesheets }?: {
|
|
11740
|
+
}, { stylesheets, families }?: {
|
|
11741
|
+
/** The CSS the pages load besides the space's own — its plugins' stylesheets: a token read there is read. */
|
|
11692
11742
|
stylesheets?: readonly string[];
|
|
11743
|
+
/** The pages each `pageFamily` wrote, by id: what they share is written once, never a copy. */
|
|
11744
|
+
families?: readonly (readonly string[])[];
|
|
11693
11745
|
}) => Suggestion[];
|
|
11694
11746
|
|
|
11695
11747
|
/** The closest known transformer action to a mistyped one (substring match either way), so a wrong action like
|
|
@@ -12046,7 +12098,7 @@ declare type VariableName<Variables> = {
|
|
|
12046
12098
|
* declaration, the key cannot drift from the class it means. The value at `source` names the variant, or `template`
|
|
12047
12099
|
* turns it into one.
|
|
12048
12100
|
*/
|
|
12049
|
-
export declare const variantFrom: (cls: ClassRef, source:
|
|
12101
|
+
export declare const variantFrom: (cls: ClassRef, source: SourceName, options?: VariantFromOptions) => BindingSpec;
|
|
12050
12102
|
|
|
12051
12103
|
/** What {@link variantFrom} takes beyond the class and the source. */
|
|
12052
12104
|
export declare interface VariantFromOptions {
|
|
@@ -12110,7 +12162,7 @@ export declare type VisibleInput = Omit<VisibleCondition, 'source'> & {
|
|
|
12110
12162
|
* and getting it wrong writes a `visibility` attribute no element reads, so the element stays visible and nothing
|
|
12111
12163
|
* reports anything.
|
|
12112
12164
|
*/
|
|
12113
|
-
export declare const visibleWhen: (source:
|
|
12165
|
+
export declare const visibleWhen: (source: SourceName, template?: string) => BindingSpec;
|
|
12114
12166
|
|
|
12115
12167
|
export declare type WarningCode = {
|
|
12116
12168
|
[Code in AuthoringCode]: Codes[Code]['kind'] extends 'warned' ? Code : never;
|
|
@@ -12189,7 +12241,7 @@ export declare interface WebhookVerifySpec {
|
|
|
12189
12241
|
* Written out, a condition is a query-builder group: a combinator and a list of rules, four levels of nesting for
|
|
12190
12242
|
* "did that work?". Here it is the rule.
|
|
12191
12243
|
*/
|
|
12192
|
-
export declare const when: (rules:
|
|
12244
|
+
export declare const when: (rules: WhenRule | WhenRule[], step: StepSpec, combinator?: "and" | "or") => StepSpec;
|
|
12193
12245
|
|
|
12194
12246
|
/**
|
|
12195
12247
|
* Runs a step only if the named server action did NOT complete.
|
|
@@ -12202,6 +12254,15 @@ export declare const when: (rules: Rule | Rule[], step: StepSpec, combinator?: "
|
|
|
12202
12254
|
*/
|
|
12203
12255
|
export declare const whenFailed: (stepId: string, step: StepSpec) => StepSpec;
|
|
12204
12256
|
|
|
12257
|
+
/** A rule as {@link when} takes it: `{ field, operator: 'empty' }` needs no `value`, which nothing would read. */
|
|
12258
|
+
export declare type WhenRule = Rule | {
|
|
12259
|
+
id?: string;
|
|
12260
|
+
field: string;
|
|
12261
|
+
operator: FieldOnlyOperator;
|
|
12262
|
+
enabled?: boolean;
|
|
12263
|
+
isBinding?: false;
|
|
12264
|
+
};
|
|
12265
|
+
|
|
12205
12266
|
/**
|
|
12206
12267
|
* Runs a step only if the named server action completed.
|
|
12207
12268
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as GLOBAL_CALLBACK_BUILDERS, $i as
|
|
2
|
-
export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, t as BUILTIN_PARAM_TYPES, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_CALLBACK_BUILDERS, GLOBAL_SOURCES, t$1 as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_SPEC_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSource, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, answerAction, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace, space as blankSpaceSpec, blankTemplateFiles, blockHtml, blockJsx, buildHandles, button, cancelApi, cancelServerAction, carousel, carouselGoTo, carouselNext, carouselPause, carouselPlay, carouselPrevious, carouselTrack, catalogTemplateFiles, channel, className, classNames, classRefs, clearState, closeDialog, closeModal, closest, column, compactSvg, comparePictures, compareSpaces, compareTexts, component, container, copyToClipboard, createTw, css, cssNumberValue, cssProperties, cssPropertyName, cssShorthands, custom, cycleState, darkScheme, dataIssues, declaredCallback, declaredTrigger, defaultAttributes, defaultLabel, defineAction, defineElement, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, t$2 as elementDeclaration, elementDefaultAttributes, elementLeafTypes, elementPartTypes, elementSlots, elementSourceTypes, elementTriggers, elementTypeNames, elementsFromManifest, embed, space$1 as emptySpaceSpec, emptyTemplateFiles, expandShorthand, expandShorthandPatch, expandShorthandTraced, explain, explainKindOf, explainList, explanationText, failedFlowText, fixSpace, flagGateOf, flagSpecOf, flowStepIds, fontAwesome, form, formControl, o as getElementCallback, getGlobalCallback, getTransformer, getUtility, grid, groupBindings, hasVisibilityBinding, heading, n$1 as hiddenParams, hiddenWhen, hostAction, image, importProbe, importSlug, importedFiles, inferredLinkMode, inspectDocument, inspectPage, inspectRenders, instanceSelectorFor, s$1 as invalidParams, invalidateQueries, isClassModifier, isCssProperty, isCustomProperty, isRuleSetSpec, isStyleDeclaration, isSuggestionCode, link, lintSpace, list, listItem, loadImages, locate, locateClasses, locateElements, markdown, r$1 as missingRequiredParams, modalContainer, modifierClassName, moveState, named, navigate, nodeHtml, notificationsCss, on, onClick, onFlowEnd, onFlowError, onFlowProgress, onInterval, onKey, onLoad, onPageLoad, onPointerDown, onScreen, onScroll, onSubmit, openDialog, openModal, openPage, pageFamily, pageRegions, pageTexts, pagination, paragraph, pathForSlug, planFixes, pressShortcut, profilePictures, publishOn, readDevTools, readDevToolsInPage, c as reconcileParams, reference, refusalOf, reloadApi, removeState, resetForm, resolveSource, richText, row, runServerAction, sameBlocks, scope, scrollBy, scrollIntoView, scrollTo, selectorFor, setFieldValue, setState, shortcutKey, shorthandLonghands, singlePageSpace, slugify, source, e as spaceCallbacks, specFromSpace, specToSource, splitClassList, d as splitNotificationsCss, stepState, styles, suggestClassOverrides, suggestCssProperty, suggestSpace, suggestTransformer, summariseRenders, svg, tabContainer, tabContainerBody, tabContainerHeader, tabContainerItem, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$1 as toInteractionCallback, o$1 as toInteractionCallbacks, toPortableSource, toResponsive, toggleElement, toggleInState, toggleState, tokens, transformerCatalog, tw, twig, twigTemplate, typeCallbackDefinitions, typeTriggerDefinitions, unrollPage, unusedDeclarations, updateElement, validateSnippet, validateSpace, e$1 as valuesOf, variantFrom, video, visibleWhen, webHook, when, whenFailed, whenSucceeded, whileRunning, withElement, withNamedIds, withNotificationsCss, withPluginCatalogs, withVisibility, withoutQuieted };
|
|
1
|
+
import { $ as GLOBAL_CALLBACK_BUILDERS, $i as closest, $n as removeState, $r as carouselTrack, $t as css, A as unrollPage, Ai as component, An as named, Ar as onPageLoad, At as d, B as blankSpace, Bi as authorBinding, Bn as appendState, Br as scrollIntoView, Bt as grid, C as pageTexts, Ca as o, Ci as tabContainer, Cn as flagGateOf, Cr as onClick, Ct as unusedDeclarations, D as pageRegions, Da as r$1, Di as text, Dn as authorFlow, Dr as onInterval, Dt as pageFamily, E as diffPictures, Ea as n$1, Ei as tabContainerItem, En as defineAction, Er as onFlowProgress, Et as familyOf, F as readDevTools, Fi as inferredLinkMode, Fn as BUILTIN_UTILITIES, Fr as openModal, Ft as t$1, G as space$1, Gi as resolveSource, Gn as clearState, Gr as elementsFromManifest, Gt as isClassModifier, H as catalogTemplateFiles, Hi as groupBindings, Hn as authLogout, Hr as setFieldValue, Ht as className, I as readDevToolsInPage, Ii as COMPONENT_SOURCES, In as applyUtility, Ir as publishOn, It as tokens, J as importSlug, Ji as visibleWhen, Jn as delay, Jr as apiContainer, Jt as modifierClassName, K as space, Ki as toBindingSpecs, Kn as copyToClipboard, Kr as withPluginCatalogs, Kt as isClassRef, L as dataIssues, Li as GLOBAL_SOURCES, Ln as getUtility, Lr as reloadApi, Lt as createTw, M as inspectPage, Mi as defaultLabel, Mn as whenFailed, Mr as onScroll, Mt as FIXABLE_CODES, N as onScreen, Ni as defineElement, Nn as whenSucceeded, Nr as onSubmit, Nt as n, O as profilePictures, Oa as s$1, Oi as themeToggle, On as authorFlows, Or as onKey, Ot as notificationsCss, P as failedFlowText, Pi as element, Pn as whileRunning, Pr as openDialog, Pt as r, Q as EXPLAIN_KINDS, Qi as twig, Qn as navigate, Qr as carousel, Qt as STYLE_STATES, R as answerAction, Ri as activeOn, Rn as SET_STATE_TYPES, Rr as resetForm, Rt as tw, S as compareTexts, Sa as i$1, Si as svg, Sn as selectorFor, Sr as on, St as suggestClassOverrides, T as comparePictures, Ta as c, Ti as tabContainerHeader, Tn as authoringCodesTable, Tr as onFlowError, Tt as refusalOf, U as emptyTemplateFiles, Ui as hasVisibilityBinding, Un as authRefreshDetails, Ur as toggleElement, Ut as classNames, V as blankTemplateFiles, Vi as bindTemplate, Vn as authLogin, Vr as scrollTo, Vt as row, W as toPortableSource, Wi as hiddenWhen, Wn as cancelServerAction, Wr as updateElement, Wt as classRefs, X as importProbe, Xi as actionSource, Xn as invalidateQueries, Xr as blockJsx, Xt as styles, Y as importedFiles, Yi as withVisibility, Yn as hostAction, Yr as blockHtml, Yt as splitClassList, Z as BUILDER_NAMES, Zi as source, Zn as moveState, Zr as button, Zt as BREAKPOINTS, _ as shortcutKey, _a as typeTriggerDefinitions, _i as nodeHtml, _n as slugify, _r as carouselPrevious, _t as assertSnippetValid, a as locateClasses, aa as elementAncestorTypes, ai as dropdownPopup, an as expandShorthand, ar as twigTemplate, at as SPACE_FIELDS, b as summariseRenders, ba as elementAttributeNames, bi as reference, bn as locate, br as declaredCallback, bt as suggestSpace, c as validateSnippet, ca as elementCatalog, ci as form, cn as shorthandLonghands, cr as applyBuiltinCallback, ct as specFromSpace, d as i$2, da as elementPartTypes, di as image, dn as cssPropertyName, dr as announceOn, dt as actionToSource, ea as scope, ei as channel, en as isRuleSetSpec, er as runServerAction, et as explain, f as o$1, fa as elementSlots, fi as link, fn as isCssProperty, fr as cancelApi, ft as withNamedIds, g as pressShortcut, ga as typeCallbackDefinitions, gi as modalContainer, gn as digest, gr as carouselPlay, gt as transformerCatalog, h as withElement, ha as elementTypeNames, hi as markdown, hr as carouselPause, ht as suggestTransformer, i as lintSpace, ia as isSuggestionCode, ii as dropdown, in as cssShorthands, ir as toggleState, it as ELEMENT_FIELDS, j as inspectDocument, ji as defaultAttributes, jn as when, jr as onPointerDown, jt as i, k as loadImages, ka as t, ki as video, kn as flowStepIds, kr as onLoad, kt as withNotificationsCss, l as validateSpace, la as elementDefaultAttributes, li as formControl, ln as cssNumberValue, lr as getGlobalCallback, lt as compareSpaces, m as singlePageSpace, ma as elementTriggers, mi as listItem, mn as suggestCssProperty, mr as carouselNext, mt as getTransformer, n as authorSpace, na as AuthoringError, ni as custom, nn as toBlocks, nr as stepState, nt as explainList, o as locateElements, oa as elementAttributeValues, oi as embed, on as expandShorthandPatch, or as webHook, ot as specToSource, p as compactSvg, pa as elementSourceTypes, pi as list, pn as isCustomProperty, pr as carouselGoTo, pt as BUILTIN_TRANSFORMERS, q as darkScheme, qi as variantFrom, qn as cycleState, qt as isStyleDeclaration, r as fixSpace, ra as authoringCodeEntry, ri as dialogContainer, rn as toResponsive, rr as toggleInState, rt as explanationText, s as planFixes, sa as elementCallbacks, si as fontAwesome, sn as expandShorthandTraced, sr as BUILTIN_GLOBAL_CALLBACKS, st as SCHEMA_SETTINGS, t as authorSnippet, ta as AUTHORING_CODES, ti as container, tn as sameBlocks, tr as setState, tt as explainKindOf, u as a$1, ua as elementLeafTypes, ui as heading, un as cssProperties, ur as e, ut as actionSpecFromEntry, v as openPage, va as e$1, vi as pagination, vn as buildHandles, vr as closeDialog, vt as PAGE_SPEC_FIELDS, w as alignPictures, wa as s, wi as tabContainerBody, wn as flagSpecOf, wr as onFlowEnd, wt as SpaceRefusedError, x as PAGE_TEXT_LIMIT, xa as a, xi as richText, xn as pathForSlug, xr as declaredTrigger, xt as withoutQuieted, y as inspectRenders, ya as t$2, yi as paragraph, yn as instanceSelectorFor, yr as closeModal, yt as assertSpaceValid, z as CATALOG_TEMPLATE_IDENTITY, zi as activeWhen, zn as addNotification, zr as scrollBy, zt as column } from "./index-src.js";
|
|
2
|
+
export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, t as BUILTIN_PARAM_TYPES, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_CALLBACK_BUILDERS, GLOBAL_SOURCES, t$1 as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_SPEC_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSource, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, answerAction, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace, space as blankSpaceSpec, blankTemplateFiles, blockHtml, blockJsx, buildHandles, button, cancelApi, cancelServerAction, carousel, carouselGoTo, carouselNext, carouselPause, carouselPlay, carouselPrevious, carouselTrack, catalogTemplateFiles, channel, className, classNames, classRefs, clearState, closeDialog, closeModal, closest, column, compactSvg, comparePictures, compareSpaces, compareTexts, component, container, copyToClipboard, createTw, css, cssNumberValue, cssProperties, cssPropertyName, cssShorthands, custom, cycleState, darkScheme, dataIssues, declaredCallback, declaredTrigger, defaultAttributes, defaultLabel, defineAction, defineElement, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, t$2 as elementDeclaration, elementDefaultAttributes, elementLeafTypes, elementPartTypes, elementSlots, elementSourceTypes, elementTriggers, elementTypeNames, elementsFromManifest, embed, space$1 as emptySpaceSpec, emptyTemplateFiles, expandShorthand, expandShorthandPatch, expandShorthandTraced, explain, explainKindOf, explainList, explanationText, failedFlowText, familyOf, fixSpace, flagGateOf, flagSpecOf, flowStepIds, fontAwesome, form, formControl, o as getElementCallback, getGlobalCallback, getTransformer, getUtility, grid, groupBindings, hasVisibilityBinding, heading, n$1 as hiddenParams, hiddenWhen, hostAction, image, importProbe, importSlug, importedFiles, inferredLinkMode, inspectDocument, inspectPage, inspectRenders, instanceSelectorFor, s$1 as invalidParams, invalidateQueries, isClassModifier, isClassRef, isCssProperty, isCustomProperty, isRuleSetSpec, isStyleDeclaration, isSuggestionCode, link, lintSpace, list, listItem, loadImages, locate, locateClasses, locateElements, markdown, r$1 as missingRequiredParams, modalContainer, modifierClassName, moveState, named, navigate, nodeHtml, notificationsCss, on, onClick, onFlowEnd, onFlowError, onFlowProgress, onInterval, onKey, onLoad, onPageLoad, onPointerDown, onScreen, onScroll, onSubmit, openDialog, openModal, openPage, pageFamily, pageRegions, pageTexts, pagination, paragraph, pathForSlug, planFixes, pressShortcut, profilePictures, publishOn, readDevTools, readDevToolsInPage, c as reconcileParams, reference, refusalOf, reloadApi, removeState, resetForm, resolveSource, richText, row, runServerAction, sameBlocks, scope, scrollBy, scrollIntoView, scrollTo, selectorFor, setFieldValue, setState, shortcutKey, shorthandLonghands, singlePageSpace, slugify, source, e as spaceCallbacks, specFromSpace, specToSource, splitClassList, d as splitNotificationsCss, stepState, styles, suggestClassOverrides, suggestCssProperty, suggestSpace, suggestTransformer, summariseRenders, svg, tabContainer, tabContainerBody, tabContainerHeader, tabContainerItem, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$1 as toInteractionCallback, o$1 as toInteractionCallbacks, toPortableSource, toResponsive, toggleElement, toggleInState, toggleState, tokens, transformerCatalog, tw, twig, twigTemplate, typeCallbackDefinitions, typeTriggerDefinitions, unrollPage, unusedDeclarations, updateElement, validateSnippet, validateSpace, e$1 as valuesOf, variantFrom, video, visibleWhen, webHook, when, whenFailed, whenSucceeded, whileRunning, withElement, withNamedIds, withNotificationsCss, withPluginCatalogs, withVisibility, withoutQuieted };
|
package/dist/node.d.ts
CHANGED
|
@@ -145,10 +145,15 @@ declare const AUTHORING_CODES: {
|
|
|
145
145
|
readonly means: "a template in a page's `seoTitle`, `seoDescription` or `notFound` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read";
|
|
146
146
|
readonly fix: "read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own";
|
|
147
147
|
};
|
|
148
|
+
readonly 'declared-callback-target': {
|
|
149
|
+
readonly kind: "refused";
|
|
150
|
+
readonly means: "a `declaredCallback` target with a key beside `on` and `params` — read nowhere, so the step runs without it";
|
|
151
|
+
readonly fix: "the value in `params`: `{ on: 'calendar', params: { date } }`";
|
|
152
|
+
};
|
|
148
153
|
readonly 'folder-undeclared': {
|
|
149
154
|
readonly kind: "refused";
|
|
150
155
|
readonly means: "a page, a layout or a folder filed in a folder the space does not declare";
|
|
151
|
-
readonly fix: "declare the
|
|
156
|
+
readonly fix: "declare it on the space — `pageFolders: [{ id: 'docs', name: 'Docs' }]`, its slug starting its pages' addresses — or use the name it suggests";
|
|
152
157
|
};
|
|
153
158
|
readonly 'folder-cycle': {
|
|
154
159
|
readonly kind: "refused";
|
|
@@ -245,6 +250,11 @@ declare const AUTHORING_CODES: {
|
|
|
245
250
|
readonly means: "a `slots` key the element type does not have — its class would dress nothing";
|
|
246
251
|
readonly fix: "one of the slots `plitzi explain <type>` lists; the element itself takes `class`";
|
|
247
252
|
};
|
|
253
|
+
readonly 'slot-not-class': {
|
|
254
|
+
readonly kind: "refused";
|
|
255
|
+
readonly means: "a `slots` entry that is not a class — rules written in place, or nothing — which a slot cannot wear";
|
|
256
|
+
readonly fix: "the rules as a `styles()` declaration, handed to the slot beside its other classes";
|
|
257
|
+
};
|
|
248
258
|
readonly 'class-conflict': {
|
|
249
259
|
readonly kind: "refused";
|
|
250
260
|
readonly means: "two different declarations for one class name";
|
|
@@ -258,7 +268,7 @@ declare const AUTHORING_CODES: {
|
|
|
258
268
|
readonly 'class-and-css': {
|
|
259
269
|
readonly kind: "refused";
|
|
260
270
|
readonly means: "an element wearing a shared class AND `css` or `states` of its own — it has one base selector";
|
|
261
|
-
readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]`
|
|
271
|
+
readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]` — or into the class";
|
|
262
272
|
};
|
|
263
273
|
readonly 'class-and-selector': {
|
|
264
274
|
readonly kind: "refused";
|
|
@@ -270,11 +280,6 @@ declare const AUTHORING_CODES: {
|
|
|
270
280
|
readonly means: "more than one set of rules in a class list";
|
|
271
281
|
readonly fix: "one set, after the classes: `class: [card, { opacity: '0.5', 'margin-top': '8px' }]`";
|
|
272
282
|
};
|
|
273
|
-
readonly 'modifier-without-id': {
|
|
274
|
-
readonly kind: "refused";
|
|
275
|
-
readonly means: "rules on top of a class on an element with no `id` — the id names the class they become";
|
|
276
|
-
readonly fix: "`id: 'hero-bg'`";
|
|
277
|
-
};
|
|
278
283
|
readonly 'selector-invalid': {
|
|
279
284
|
readonly kind: "refused";
|
|
280
285
|
readonly means: "a `selector` that is not a CSS class name";
|
|
@@ -555,6 +560,11 @@ declare const AUTHORING_CODES: {
|
|
|
555
560
|
readonly means: "a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's";
|
|
556
561
|
readonly fix: "put the provider on the page, around the instance, and hand the component its rows as a prop";
|
|
557
562
|
};
|
|
563
|
+
readonly 'template-in-value': {
|
|
564
|
+
readonly kind: "refused";
|
|
565
|
+
readonly means: "a `{{ }}` inside an attribute that is an object or a list — a provider's `input`, a list's `items`, a plugin's settings: only an attribute that is text is evaluated";
|
|
566
|
+
readonly fix: "a binding on the attribute (`bindTemplate(name, source, template, { returns: 'value' })`); for a provider's `input`, nothing for a route or query param — the action is already handed them as `input.<name>`";
|
|
567
|
+
};
|
|
558
568
|
readonly 'not-found-in-browser': {
|
|
559
569
|
readonly kind: "refused";
|
|
560
570
|
readonly means: "`notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status";
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hn as e$1, n as authorSpace, p as compactSvg, qr as e } from "./index-src.js";
|
|
2
2
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
3
3
|
import m from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.11",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/index.js",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@microsoft/api-extractor": "^7.59.3",
|
|
56
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
57
|
-
"@plitzi/sdk-elements": "0.38.
|
|
58
|
-
"@plitzi/sdk-interactions": "0.38.
|
|
59
|
-
"@plitzi/sdk-schema": "0.38.
|
|
60
|
-
"@plitzi/sdk-shared": "0.38.
|
|
61
|
-
"@plitzi/sdk-style": "0.38.
|
|
56
|
+
"@plitzi/plitzi-ui": "^1.6.33",
|
|
57
|
+
"@plitzi/sdk-elements": "0.38.11",
|
|
58
|
+
"@plitzi/sdk-interactions": "0.38.11",
|
|
59
|
+
"@plitzi/sdk-schema": "0.38.11",
|
|
60
|
+
"@plitzi/sdk-shared": "0.38.11",
|
|
61
|
+
"@plitzi/sdk-style": "0.38.11",
|
|
62
62
|
"@types/react": "^19.3.0",
|
|
63
63
|
"eslint": "^9.39.5",
|
|
64
64
|
"prettier": "^3.9.9",
|
|
@@ -19,6 +19,7 @@ const space: SpaceSpec = {
|
|
|
19
19
|
pages: [{ id, name, slug: '', layout: { id: 'shell', slot: 'main' }, body: [] }] // slot: where the body goes
|
|
20
20
|
}; // slug '' is home; 'products/:slug' takes a param
|
|
21
21
|
pageFamily({ folder, layout, seoTitle, body: entry => [...] }, ENTRIES) // pages of one shape, from data; ids scoped per page
|
|
22
|
+
pageFolders: [{ id: 'docs', name: 'Docs' }] // on the space: a `folder` is declared here, /docs/…
|
|
22
23
|
const { schema, style, warnings, suggestions } = authorSpace(space, { plugins: [declaration] });
|
|
23
24
|
```
|
|
24
25
|
|
|
@@ -43,6 +44,7 @@ svg(svgFile(new URL('./logo.svg', import.meta.url))) // a file, compacted: svgF
|
|
|
43
44
|
fontAwesome({ icon: 'fa-solid fa-xmark' })
|
|
44
45
|
list({ id: 'rows', items: 'p.data.rows', row: 'row-card' }) // a <ul>; a component per row, its root an <li>
|
|
45
46
|
list({ id: 'rows', items: 'p.data.rows', row: r => listItem({ children: [text({ from: `${r.item}.title` })] }) })
|
|
47
|
+
// typed items (site.data.rows): r.item is a path — from: r.item.title
|
|
46
48
|
carousel({ id: 'hero', items: 'p.data.slides', autoplay: 5000, row: 'slide-card', children: [/* carouselNext('hero') arrows */] })
|
|
47
49
|
// rows follow their item's `id`, or `itemKey: 'slug'`
|
|
48
50
|
apiContainer({ id: 'p', query: '/data/x.json', cache: true, children }) // publishes p.data; no box of its own
|
|
@@ -63,7 +65,7 @@ const card = styles('card', { padding: 24, borderRadius: 16 }); // shorth
|
|
|
63
65
|
styles('title', { fontSize: { desktop: '48px', compact: '32px' }, fontWeight: 700 }); // one property per breakpoint
|
|
64
66
|
styles('card', { css: { desktop: { … }, compact: { … } }, states: { hover: { … } }, variants: { active: { … } } });
|
|
65
67
|
container({ class: card }); // a shared class…
|
|
66
|
-
container({
|
|
68
|
+
container({ class: [card, { opacity: '0.5' }] }); // …plus one thing
|
|
67
69
|
container({ css: { padding: '8px' } }); // rules of its own — never with `class`
|
|
68
70
|
```
|
|
69
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Style without copies: colours are tokens with a light and a dark value, a look used twice is a class, "this class
|
|
3
|
-
* plus one thing" is rules on top of it (`class: [card, { … }]
|
|
3
|
+
* plus one thing" is rules on top of it (`class: [card, { … }]`), and a rule for tablet AND phone
|
|
4
4
|
* is written once under `compact`.
|
|
5
5
|
*/
|
|
6
6
|
import { container, heading, styles, text } from '@plitzi/sdk-authoring';
|
|
@@ -38,6 +38,7 @@ image({ src: '/grain.png', decorative: true }) // an orname
|
|
|
38
38
|
image({ decorative: true, bind: { src: 'post.record.cover' } }) // a cover under its own headline adds nothing
|
|
39
39
|
image({ bind: { src: 'row.item.cover', alt: 'row.item.title' } }) // …unless it is alone in a link: then it names it
|
|
40
40
|
fontAwesome({ icon: 'fa-solid fa-triangle-exclamation', label: 'Overdue' }) // an icon that says something alone
|
|
41
|
+
svg(MARK, { class: logoMark }) // no `label`: an svg or an icon decorates
|
|
41
42
|
text('福', { decorative: true }) // a seal or a mark drawn for the look alone
|
|
42
43
|
list({ label: 'Kinds of capsule', … }) // a group of options is named, as a group
|
|
43
44
|
```
|
|
@@ -47,7 +47,7 @@ The space is not written until these are fixed.
|
|
|
47
47
|
| `channel-grant` | a topic of a private channel opened with no grant to it | the grant the message names, or a public channel |
|
|
48
48
|
| `channel-topic` | a `channel` element with no topic | a topic a channel of the space covers |
|
|
49
49
|
| `children-in-leaf` | children on a type that renders only its own attributes (`heading`, `text`, `image`…) | a `container` — for a heading made of parts, `container({ subType: 'h1', children })` |
|
|
50
|
-
| `class-and-css` | an element wearing a shared class AND `css` or `states` of its own — it has one base selector | the rules on top of the class: `class: [card, { opacity: '0.5' }]`
|
|
50
|
+
| `class-and-css` | an element wearing a shared class AND `css` or `states` of its own — it has one base selector | the rules on top of the class: `class: [card, { opacity: '0.5' }]` — or into the class |
|
|
51
51
|
| `class-and-selector` | an element with a shared class and a `selector` of its own | drop one: a shared class IS its selector |
|
|
52
52
|
| `class-conflict` | two different declarations for one class name | rename one, or make them agree |
|
|
53
53
|
| `class-listed-under-other-name` | a `styles()` declaration listed in `classes` under another name | list it under its own name |
|
|
@@ -64,6 +64,7 @@ The space is not written until these are fixed.
|
|
|
64
64
|
| `css-property-twice` | one property written twice in a rule set — `paddingTop` beside `'padding-top'` — so one would silently win | keep one |
|
|
65
65
|
| `css-property-unknown` | a CSS property that does not exist | the property it suggests; a custom property starts with `--` |
|
|
66
66
|
| `css-value` | an empty CSS value, or one with `;` or `{}` | one value per property; leave a property out instead of writing it empty |
|
|
67
|
+
| `declared-callback-target` | a `declaredCallback` target with a key beside `on` and `params` — read nowhere, so the step runs without it | the value in `params`: `{ on: 'calendar', params: { date } }` |
|
|
67
68
|
| `element-ids-target` | a step refreshing containers by id (`invalidateElements`, `invalidateQueries({ elements })`) naming one the space does not have, or one that is not an `apiContainer` | the id of the `apiContainer` whose data the step changes: `invalidateElements: ['posts']` |
|
|
68
69
|
| `element-load-strategy` | a `loadStrategy` the element does not take | one of the values the message lists |
|
|
69
70
|
| `element-rejected` | an element the schema refused to hold | the problem listed with it |
|
|
@@ -79,7 +80,7 @@ The space is not written until these are fixed.
|
|
|
79
80
|
| `flow-empty` | a flow with no steps | `[onClick(), setState({ … })]` |
|
|
80
81
|
| `flow-without-trigger` | a flow whose first step is not the event that runs it | `[onClick(), setState(…)]` |
|
|
81
82
|
| `folder-cycle` | a page folder inside itself | a `parent` that leads to the top |
|
|
82
|
-
| `folder-undeclared` | a page, a layout or a folder filed in a folder the space does not declare | declare the
|
|
83
|
+
| `folder-undeclared` | a page, a layout or a folder filed in a folder the space does not declare | declare it on the space — `pageFolders: [{ id: 'docs', name: 'Docs' }]`, its slug starting its pages' addresses — or use the name it suggests |
|
|
83
84
|
| `font-invalid` | a font the space cannot load as declared | the field the message names |
|
|
84
85
|
| `format-unknown` | an `as` that names no format of the space's `formats` | declare it once — `formats: { price: "{{ source\|currency('USD') }}" }` — or write the template in its place |
|
|
85
86
|
| `from-and-bind` | the main attribute bound twice, with `from` and in `bind` | keep `from`, and give `bind` the other attributes |
|
|
@@ -97,7 +98,6 @@ The space is not written until these are fixed.
|
|
|
97
98
|
| `list-without-items` | a controlled list with nothing to render | `items: [ … ]` or `bind: { items: 'provider.data.rows' }` |
|
|
98
99
|
| `loading-slot-unknown` | an `apiContainer`'s `loadingSlot` that is not the id of one of its children | the id of the child to show until the first answer — `loadingSlot: 'catalog-skeleton'` beside that child |
|
|
99
100
|
| `modifier-count` | more than one set of rules in a class list | one set, after the classes: `class: [card, { opacity: '0.5', 'margin-top': '8px' }]` |
|
|
100
|
-
| `modifier-without-id` | rules on top of a class on an element with no `id` — the id names the class they become | `id: 'hero-bg'` |
|
|
101
101
|
| `motion-invalid` | a `motion` with a preset, a trigger or a timing the page cannot play | `motion: { enter: 'fade-up', on: 'view' }` — the message lists the presets |
|
|
102
102
|
| `motion-no-tag` | a `motion` on an element with no tag of its own — nothing to move | the motion on what it wraps, or a `subType` on it |
|
|
103
103
|
| `no-pages` | a space with no pages | `pages: [{ id: 'home', name: 'Home', slug: '', body: [] }]` |
|
|
@@ -132,6 +132,7 @@ The space is not written until these are fixed.
|
|
|
132
132
|
| `server-provider-in-component` | a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's | put the provider on the page, around the instance, and hand the component its rows as a prop |
|
|
133
133
|
| `setting-misplaced` | `settings.computed` or `settings.channels` written inside `settings` | `computed` and `channels` at the top of the space |
|
|
134
134
|
| `slot-children` | children handed to an instance outside its slots | `children: { slotName: [ … ] }`; a component with no slots takes no children |
|
|
135
|
+
| `slot-not-class` | a `slots` entry that is not a class — rules written in place, or nothing — which a slot cannot wear | the rules as a `styles()` declaration, handed to the slot beside its other classes |
|
|
135
136
|
| `slot-unknown` | a component slot that is not an element of its tree | the id of an element inside the component — usually an empty container |
|
|
136
137
|
| `source-field-unknown` | a path into a typed source that its sample does not have | read a field the sample has, or add the field to the sample |
|
|
137
138
|
| `state-key-list` | `settings.transientState` / `paintedState` that is not a list of top-level state keys | `transientState: ['demoStep']` — a dotted path names its top key |
|
|
@@ -146,6 +147,7 @@ The space is not written until these are fixed.
|
|
|
146
147
|
| `style-pseudo-unknown` | a pseudo-element a class cannot dress | one of `before`, `after`, `marker`, `placeholder`, `first-letter`, `first-line`, `selection` — without the `::` |
|
|
147
148
|
| `style-state-unknown` | a state a selector does not react to | one of the states it lists (`hover`, `focus`, `active`…) |
|
|
148
149
|
| `svg-not-svg` | an `svg` whose `content` is not one `<svg>…</svg>` — it draws nothing | the SVG markup alone; HTML around it goes in a `blockHtml` |
|
|
150
|
+
| `template-in-value` | a `{{ }}` inside an attribute that is an object or a list — a provider's `input`, a list's `items`, a plugin's settings: only an attribute that is text is evaluated | a binding on the attribute (`bindTemplate(name, source, template, { returns: 'value' })`); for a provider's `input`, nothing for a route or query param — the action is already handed them as `input.<name>` |
|
|
149
151
|
| `template-short-source` | a source named without its prefix inside a template or a step | the full name: `apiContainer_stats`, `list_rows` |
|
|
150
152
|
| `template-source-out-of-scope` | a template reading the source of an element it is not inside | move the element inside it, or share the value through `state` |
|
|
151
153
|
| `template-text-into-value` | a template, which renders text, feeding an attribute that holds a list or an object | `bindTemplate('items', source, '{{ … }}', { returns: 'value' })` |
|
|
@@ -18,6 +18,8 @@ the value), or a format the space names once in `formats: { price: "{{ source|cu
|
|
|
18
18
|
`bindTemplate(to, source, template, { category?, returns? })` is the computed attribute — a template over the value
|
|
19
19
|
at `source`. `returns: 'value'` hands over what a single `{{ expression }}` evaluates to instead of its text: a list's
|
|
20
20
|
`items`, a number, a flag (see [lists](lists.md)).
|
|
21
|
+
A colour from data binds a custom property — `[{ to: '--who', source, category: 'style' }]` — that the class reads
|
|
22
|
+
(`var(--who, var(--muted))`); a value with `;` or braces is not written.
|
|
21
23
|
|
|
22
24
|
**A source names the id you gave the element** — `'posts.title'`, `'postList.item.cover'` — and the prefix is
|
|
23
25
|
completed from what the element publishes (`apiContainer_posts`, `list_postList`; a `form` publishes under
|
|
@@ -72,6 +74,8 @@ apiContainer({ id: 'board', runtime: 'server', action: 'queue-board' })
|
|
|
72
74
|
`"{{ source ? apiUrl ~ '/workspaces/' ~ source ~ '/stats' : '' }}"` with `source: 'state.workspace.id'`. A server
|
|
73
75
|
provider's bound `input` (`bindTemplate('input', 'state.c', '{{ { country: source } }}', { returns: 'value' })`)
|
|
74
76
|
asks again on every change; `reloadApi('p', { … })` asks once.
|
|
77
|
+
- An action is handed the page's route and query params as input (`r/:room` → `input.room`). A written `input` is
|
|
78
|
+
sent as is: a `{{ }}` in it is refused (`template-in-value`) — bind it.
|
|
75
79
|
- `isLoading` is true while it is asked again, in either runtime. A newer ask drops the older one; `cancelApi('p')` is a
|
|
76
80
|
STOP: what is shown stays.
|
|
77
81
|
- `runtime: 'server'` is resolved by the page server — server data is on unless a space says `rsc: { enabled: false }`.
|
|
@@ -106,9 +110,8 @@ server action answering only what is shown, its `access` checking who asks.
|
|
|
106
110
|
- **Refreshed by writes:** a `webHook` that is not a GET refreshes every request to its own site by default
|
|
107
111
|
(`invalidateQueries: 'origin'`); a `runServerAction` refreshes everything (`'all'`). Narrow it with
|
|
108
112
|
`'elements'` + `invalidateElements: ['orders']`, or stop it with `'none'`.
|
|
109
|
-
- **Say `'none'` when a refresh would move the page on.** A page that
|
|
110
|
-
|
|
111
|
-
goes, and skip the last step.
|
|
113
|
+
- **Say `'none'` when a refresh would move the page on.** A page that leaves on a provider's answer ("profile complete
|
|
114
|
+
→ leave") would leave in the middle of a multi-step form that saves as it goes.
|
|
112
115
|
|
|
113
116
|
## Visibility
|
|
114
117
|
|
|
@@ -156,10 +159,9 @@ Rules for a condition's template:
|
|
|
156
159
|
`'true'` or `'false'` is written as it says. A plain source, or a template that answers nothing (`''`), writes
|
|
157
160
|
nothing: the element stays as it started — hidden for `visible`, shown for a binding written by hand.
|
|
158
161
|
- **So a hiding flag is `visible: '!state.folded'`** (or a binding with no `visible`): on screen before anybody has set
|
|
159
|
-
it.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
visible wrapper still takes a slot in its parent's `gap`, and leaves a hole in the page.
|
|
162
|
+
it.
|
|
163
|
+
- **Hide the element itself**, not inside a wrapper left shown: an empty wrapper still takes a slot in its parent's
|
|
164
|
+
`gap`, a hole in the page.
|
|
163
165
|
|
|
164
166
|
### Loading, empty, error
|
|
165
167
|
|
|
@@ -183,9 +185,8 @@ shows on every load. Test for "arrived and empty" (`is defined and … is empty`
|
|
|
183
185
|
|
|
184
186
|
## Never ask the data for an opposite
|
|
185
187
|
|
|
186
|
-
Both sides of one question are `visible: 'x'` and `visible: '!x'`,
|
|
187
|
-
|
|
188
|
-
(`Boolean(post) && !canEdit`) still belongs where the data is made.
|
|
188
|
+
Both sides of one question are `visible: 'x'` and `visible: '!x'`, never a `notX` in the answer — `!` reads `"false"`
|
|
189
|
+
and `"0"` as false. A three-state condition still belongs where the data is made.
|
|
189
190
|
|
|
190
191
|
## State that outlives a reload
|
|
191
192
|
|
|
@@ -70,11 +70,11 @@ a row's button posts `{ jobId: '{{ list_jobRows.item.id }}' }` — the row that
|
|
|
70
70
|
|
|
71
71
|
**Pass objects, not JSON text.** `input: { title: '{{ form.values.title }}' }` rather than `input: '{"title": …}'`:
|
|
72
72
|
each value keeps its own type, and nothing depends on the quoting. (JSON text works — a value inside one of its strings
|
|
73
|
-
is escaped for it — but an object
|
|
73
|
+
is escaped for it — but an object needs no punctuation.)
|
|
74
74
|
|
|
75
75
|
**A field left empty is not in `values`.** A form sends what was typed, and a field nobody typed in sends nothing —
|
|
76
76
|
so `when({ field: 'sent.values.code', operator: '=', value: '' }, …)` never holds for it. Ask
|
|
77
|
-
`operator: 'empty'` / `'notEmpty'
|
|
77
|
+
`operator: 'empty'` / `'notEmpty'` (no `value`), which treat missing and `''` alike.
|
|
78
78
|
|
|
79
79
|
## Writes and what they refresh
|
|
80
80
|
|
|
@@ -25,6 +25,7 @@ export const docsLayout: LayoutSpec = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// in the space
|
|
28
|
+
pageFolders: [{ id: 'docs', name: 'Docs' }], // declared once: its slug (the id) starts its pages' addresses — /docs/quickstart
|
|
28
29
|
layouts: [appLayout, docsLayout],
|
|
29
30
|
pages: [{ name: 'Quickstart', slug: 'quickstart', folder: 'docs', layout: { id: 'docs-layout', slot: 'docs-slot' }, body: [ … ] }]
|
|
30
31
|
```
|
|
@@ -9,6 +9,7 @@ list bound to its records (see the provider in data-and-visibility).
|
|
|
9
9
|
```ts
|
|
10
10
|
list({ id: 'games', class: gameGrid, items: 'catalog.data.games', row: 'game-card' }) // a component per game
|
|
11
11
|
list({ id: 'games', items: 'catalog.data.games', row: r => listItem({ children: [text({ from: `${r.item}.title` })] }) })
|
|
12
|
+
// typed by a sample (`items: catalog.data.games`): `r.item` is a path — `from: r.item.title`, never `${r.item}.title`
|
|
12
13
|
list({ id: 'plans', items: ['Free', 'Pro'], children: [listItem({ children: [text({ from: 'plans.item' })] })] }) // fixed
|
|
13
14
|
```
|
|
14
15
|
|
|
@@ -83,8 +83,8 @@ import { elementChildren } from '@plitzi/plitzi-sdk';
|
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Never write `style` onto an element the plugin does not render: nothing promises to keep it. Its boxes share one
|
|
86
|
-
stacking context, the plugin's. `useDisplayMode()` names the breakpoint showing
|
|
87
|
-
|
|
86
|
+
stacking context, the plugin's. `useDisplayMode()` names the breakpoint showing (`desktop`, `tablet`, `mobile`) at the
|
|
87
|
+
space's widths; `useElementSize(ref)`, its own box (`undefined` until measured).
|
|
88
88
|
|
|
89
89
|
## Its own server code
|
|
90
90
|
|
|
@@ -108,6 +108,7 @@ import { useChannel } from '@plitzi/plitzi-sdk';
|
|
|
108
108
|
|
|
109
109
|
const room = useChannel(roomTopic, { onMessage: message => move(message.from, message.data) });
|
|
110
110
|
room.publish('pointer', { x, y }); // throttle it: ~20 a second, the latest position each time
|
|
111
|
+
room.publish('react', { emoji }, { echo: true }); // and heard here too
|
|
111
112
|
room.members; // who is here, with the state each announced
|
|
112
113
|
```
|
|
113
114
|
|