@plitzi/sdk-authoring 0.38.10 → 0.38.12
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 +279 -0
- package/dist/index-declare.js +102 -0
- package/dist/index-src.js +5628 -6175
- package/dist/index.d.ts +3436 -4040
- package/dist/index.js +3 -2
- package/dist/node.d.ts +43 -14
- package/dist/node.js +16 -11
- package/package.json +12 -7
- package/skills/plitzi-authoring/CHEATSHEET.md +4 -2
- package/skills/plitzi-authoring/recipes/plugin.ts +9 -7
- 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 +8 -4
- package/skills/plitzi-authoring/reference/data-and-visibility.md +11 -10
- package/skills/plitzi-authoring/reference/elements-and-styles.md +1 -1
- package/skills/plitzi-authoring/reference/flows.md +6 -5
- 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 +43 -37
- package/skills/plitzi-authoring/reference/realtime.md +4 -1
- package/skills/plitzi-authoring/reference/rules.md +1 -1
- package/skills/plitzi-authoring/reference/typed-sources.md +6 -4
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { $ as GLOBAL_CALLBACK_BUILDERS, $i as
|
|
2
|
-
|
|
1
|
+
import { $ as GLOBAL_CALLBACK_BUILDERS, $i as source, $n as twigTemplate, $r as button, $t as css, A as unrollPage, Ai as themeToggle, An as getUtility, Ar as onKey, At as d, B as blankSpace, Bi as activeOn, Bn as cycleState, Br as resetForm, Bt as grid, C as pageTexts, Ca as o, Ci as richText, Cn as flagGateOf, Cr as declaredTrigger, Ct as unusedDeclarations, D as pageRegions, Da as r$2, Di as tabContainerHeader, Dn as taskAction, Dr as onFlowError, Dt as pageFamily, E as diffPictures, Ea as n$1, Ei as tabContainerBody, En as defineAction, Er as onFlowEnd, Et as familyOf, F as readDevTools, Fi as defineElement, Fn as authLogout, Fr as onSubmit, Ft as t$1, G as space$1, Gi as hasVisibilityBinding, Gn as navigate, Gr as toggleElement, Gt as isClassModifier, H as catalogTemplateFiles, Hi as authorBinding, Hn as hostAction, Hr as scrollIntoView, Ht as className, I as readDevToolsInPage, Ii as element, In as authRefreshDetails, Ir as openDialog, It as tokens, J as importSlug, Ji as toBindingSpecs, Jn as runServerActionOrNotify, Jr as withPluginCatalogs, Jt as modifierClassName, K as space, Ki as hiddenWhen, Kn as removeState, Kr as updateElement, Kt as isClassRef, L as dataIssues, Li as inferredLinkMode, Ln as cancelServerAction, Lr as openModal, Lt as createTw, M as inspectPage, Mi as component, Mn as addNotification, Mr as onPageLoad, Mt as FIXABLE_CODES, N as onScreen, Ni as defaultAttributes, Nn as appendState, Nr as onPointerDown, Nt as n, O as profilePictures, Oa as s$1, Oi as tabContainerItem, On as BUILTIN_UTILITIES, Or as onFlowProgress, Ot as notificationsCss, P as failedFlowText, Pi as defaultLabel, Pn as authLogin, Pr as onScroll, Pt as r, Q as EXPLAIN_KINDS, Qi as actionSource, Qn as toggleState, Qr as blockJsx, Qt as STYLE_STATES, R as answerAction, Ri as COMPONENT_SOURCES, Rn as clearState, Rr as publishOn, Rt as tw, S as compareTexts, Sa as i$1, Si as reference, Sn as selectorFor, Sr as declaredCallback, St as suggestClassOverrides, T as comparePictures, Ta as c, Ti as tabContainer, Tn as authoringCodesTable, Tr as onClick, Tt as refusalOf, U as emptyTemplateFiles, Ui as bindTemplate, Un as invalidateQueries, Ur as scrollTo, Ut as classNames, V as blankTemplateFiles, Vi as activeWhen, Vn as delay, Vr as scrollBy, Vt as row, W as toPortableSource, Wi as groupBindings, Wn as moveState, Wr as setFieldValue, Wt as classRefs, X as importProbe, Xi as visibleWhen, Xn as stepState, Xr as apiContainer, Xt as styles, Y as importedFiles, Yi as variantFrom, Yn as setState, Yt as splitClassList, Z as BUILDER_NAMES, Zi as withVisibility, Zn as toggleInState, Zr as blockHtml, Zt as BREAKPOINTS, _ as shortcutKey, _a as elementTypeNames, _i as markdown, _n as slugify, _r as carouselPause, _t as assertSnippetValid, a as locateClasses, aa as authoringCodeEntry, ai as dialogContainer, an as expandShorthand, ar as when, at as SPACE_FIELDS, b as summariseRenders, ba as elementAttributeNames, bi as pagination, bn as locate, br as closeDialog, bt as suggestSpace, c as validateSnippet, ca as elementAttributeValues, ci as embed, cn as shorthandLonghands, cr as whileRunning, ct as specFromSpace, d as i$2, da as elementDefaultAttributes, di as formControl, dn as cssPropertyName, dr as getGlobalCallback, dt as actionToSource, ea as twig, ei as carousel, en as isRuleSetSpec, er as webHook, et as explain, f as o$1, fa as elementLeafTypes, fi as heading, fn as isCssProperty, fr as e, ft as withNamedIds, g as pressShortcut, ga as elementTriggers, gi as listItem, gn as digest, gr as carouselNext, gt as transformerCatalog, h as withElement, ha as elementSourceTypes, hi as list, hr as carouselGoTo, ht as suggestTransformer, i as lintSpace, ia as AuthoringError, ii as custom, in as cssShorthands, ir as named, it as ELEMENT_FIELDS, j as inspectDocument, ji as video, jn as SET_STATE_TYPES, jr as onLoad, jt as i, k as loadImages, ka as t, ki as text, kn as applyUtility, kr as onInterval, kt as withNotificationsCss, l as validateSpace, la as elementCallbacks, li as fontAwesome, ln as cssNumberValue, lr as BUILTIN_GLOBAL_CALLBACKS, lt as compareSpaces, m as singlePageSpace, ma as elementSlots, mi as link, mn as suggestCssProperty, mr as cancelApi, mt as getTransformer, n as authorSpace, na as scope, ni as channel, nn as toBlocks, nr as authorFlows, nt as explainList, o as locateElements, oa as isSuggestionCode, oi as dropdown, on as expandShorthandPatch, or as whenFailed, ot as specToSource, p as compactSvg, pa as elementPartTypes, pi as image, pn as isCustomProperty, pr as announceOn, pt as BUILTIN_TRANSFORMERS, q as darkScheme, qi as resolveSource, qn as runServerAction, qr as elementsFromManifest, qt as isStyleDeclaration, r as fixSpace, ra as AUTHORING_CODES, ri as container, rn as toResponsive, rr as flowStepIds, rt as explanationText, s as planFixes, sa as elementAncestorTypes, si as dropdownPopup, sn as expandShorthandTraced, sr as whenSucceeded, st as SCHEMA_SETTINGS, t as authorSnippet, ta as closest, ti as carouselTrack, tn as sameBlocks, tr as authorFlow, tt as explainKindOf, u as a$2, ua as elementCatalog, ui as form, un as cssProperties, ur as applyBuiltinCallback, ut as actionSpecFromEntry, v as openPage, va as typeCallbackDefinitions, vi as modalContainer, vn as buildHandles, vr as carouselPlay, vt as PAGE_SPEC_FIELDS, w as alignPictures, wa as s, wi as svg, wn as flagSpecOf, wr as on, wt as SpaceRefusedError, x as PAGE_TEXT_LIMIT, xa as a, xi as paragraph, xn as pathForSlug, xr as closeModal, xt as withoutQuieted, y as inspectRenders, ya as typeTriggerDefinitions, yi as nodeHtml, yn as instanceSelectorFor, yr as carouselPrevious, yt as assertSpaceValid, z as CATALOG_TEMPLATE_IDENTITY, zi as GLOBAL_SOURCES, zn as copyToClipboard, zr as reloadApi, zt as column } from "./index-src.js";
|
|
2
|
+
import { n as e$1, r as r$1, t as a$1 } from "./index-declare.js";
|
|
3
|
+
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, a$1 as definePlugin, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, r$1 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$2 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, runServerActionOrNotify, 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, taskAction, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$2 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";
|
|
@@ -1007,9 +1017,19 @@ declare const AUTHORING_CODES: {
|
|
|
1007
1017
|
};
|
|
1008
1018
|
readonly 'repeated-shape': {
|
|
1009
1019
|
readonly kind: "suggested";
|
|
1010
|
-
readonly means: "the same structure written again and again with different words — cards, rows, tiles";
|
|
1020
|
+
readonly means: "the same structure written again and again with different words — cards, rows, tiles; copies that bind different data, read their own template or render on the server are controls, not repeats";
|
|
1011
1021
|
readonly fix: "a component with props (`components`, `component(id, { props })`), or one `list` when they are rows of data side by side — a few cards a person rewords on the canvas can stay cards";
|
|
1012
1022
|
};
|
|
1023
|
+
readonly 'element-color-inherited': {
|
|
1024
|
+
readonly kind: "suggested";
|
|
1025
|
+
readonly means: "`elements` giving a type — a heading, a text, a link — `color: inherit` or the page's own colour, which it takes by itself";
|
|
1026
|
+
readonly fix: "remove it, and name the colour once on `elements.page`: every element reads in the page’s colour, a link’s words included";
|
|
1027
|
+
};
|
|
1028
|
+
readonly 'plugin-custom-host': {
|
|
1029
|
+
readonly kind: "suggested";
|
|
1030
|
+
readonly means: "a `custom` element naming, by `renderType`, a plugin whose declaration the space was handed";
|
|
1031
|
+
readonly fix: "place it from its declaration — `const seatPicker = defineElement(declaration)`, then `seatPicker({ id, … })`: typed by what it declares (a `definePlugin` declaration carries its attributes), the element the builder adds too";
|
|
1032
|
+
};
|
|
1013
1033
|
readonly 'content-attribute': {
|
|
1014
1034
|
readonly kind: "suggested";
|
|
1015
1035
|
readonly means: "a button or a link whose children are only its words and an icon — a `text`, a `fontAwesome` — elements more than it needs";
|
|
@@ -1969,14 +1989,23 @@ declare interface PluginDeclarationData {
|
|
|
1969
1989
|
};
|
|
1970
1990
|
}
|
|
1971
1991
|
|
|
1992
|
+
/** The declaration of every plugin under `folder`, for `authorSpace`'s `plugins`: what each fires, answers and reads. */
|
|
1993
|
+
export declare const pluginDeclarations: (folder: string | URL) => Promise<PluginDeclarationData[]>;
|
|
1994
|
+
|
|
1995
|
+
/** A plugin of the project's own: the folder it is in — the name a space imports its declaration by — and what it declares. */
|
|
1996
|
+
export declare interface PluginFolder {
|
|
1997
|
+
/** The folder's name under the plugins folder: `StatCard`. */
|
|
1998
|
+
name: string;
|
|
1999
|
+
declaration: PluginDeclarationData;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1972
2002
|
/**
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
1977
|
-
* order, so the same folders always author the same space.
|
|
2003
|
+
* Every plugin under `folder` — `src/plugins/<Name>/declaration.ts`, its default export — with the folder it is in.
|
|
2004
|
+
* Found by folder, as the server finds the plugins themselves, so a plugin is declared by being there and no list can
|
|
2005
|
+
* forget one. A folder without the file is a component and nothing else; one whose default export is not a declaration
|
|
2006
|
+
* is refused, naming the file. In folder order, so the same folders always author the same space.
|
|
1978
2007
|
*/
|
|
1979
|
-
export declare const
|
|
2008
|
+
export declare const pluginFolders: (folder: string | URL) => Promise<PluginFolder[]>;
|
|
1980
2009
|
|
|
1981
2010
|
/** What a project `@plitzi/cli` writes checks its space against: the part of `authorSpace`'s options its files say. */
|
|
1982
2011
|
export declare type ProjectAuthoring = {
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Yr as e, hn as e$1, n as authorSpace, p as compactSvg } 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";
|
|
@@ -541,22 +541,27 @@ var publicData = (folder) => fileReader(folder, "/");
|
|
|
541
541
|
*/
|
|
542
542
|
var projectData = (folder) => fileReader(folder, e$1);
|
|
543
543
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* order, so the same folders always author the same space.
|
|
544
|
+
* Every plugin under `folder` — `src/plugins/<Name>/declaration.ts`, its default export — with the folder it is in.
|
|
545
|
+
* Found by folder, as the server finds the plugins themselves, so a plugin is declared by being there and no list can
|
|
546
|
+
* forget one. A folder without the file is a component and nothing else; one whose default export is not a declaration
|
|
547
|
+
* is refused, naming the file. In folder order, so the same folders always author the same space.
|
|
549
548
|
*/
|
|
550
|
-
var
|
|
549
|
+
var pluginFolders = async (folder) => {
|
|
551
550
|
const root = pathOf(folder);
|
|
552
|
-
const
|
|
553
|
-
return Promise.all(
|
|
551
|
+
const names = existsSync(root) ? readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(m.join(root, entry.name, "declaration.ts"))).map((entry) => entry.name).sort() : [];
|
|
552
|
+
return Promise.all(names.map(async (name) => {
|
|
553
|
+
const file = m.join(root, name, c$1);
|
|
554
554
|
const loaded = await importProjectModule(file, root);
|
|
555
555
|
const declaration = typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : void 0;
|
|
556
556
|
if (typeof declaration !== "object" || declaration === null || !("type" in declaration) || typeof declaration.type !== "string") throw new Error(`${file} exports no declaration by default: \`export default { type: '…', … }\`.`);
|
|
557
|
-
return
|
|
557
|
+
return {
|
|
558
|
+
name,
|
|
559
|
+
declaration
|
|
560
|
+
};
|
|
558
561
|
}));
|
|
559
562
|
};
|
|
563
|
+
/** The declaration of every plugin under `folder`, for `authorSpace`'s `plugins`: what each fires, answers and reads. */
|
|
564
|
+
var pluginDeclarations = async (folder) => (await pluginFolders(folder)).map(({ declaration }) => declaration);
|
|
560
565
|
/** The manifest of a plugin run as it was built, read; nothing when it cannot be — the layout check says why first. */
|
|
561
566
|
var manifestOf = (file) => {
|
|
562
567
|
try {
|
|
@@ -694,4 +699,4 @@ var authorProjectSpace = async () => {
|
|
|
694
699
|
return authorSpace(space, authoring);
|
|
695
700
|
};
|
|
696
701
|
//#endregion
|
|
697
|
-
export { ProjectModuleError, ProjectSpaceError, authorProjectSpace, compactSvg, moduleProblem, pluginDeclarations, projectAuthoring, projectAuthoringAt, projectData, projectSpace, projectSpaceAt, publicData, svgFile, svgFiles };
|
|
702
|
+
export { ProjectModuleError, ProjectSpaceError, authorProjectSpace, compactSvg, moduleProblem, pluginDeclarations, pluginFolders, projectAuthoring, projectAuthoringAt, projectData, projectSpace, projectSpaceAt, publicData, svgFile, svgFiles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.12",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/index.js",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/node.js",
|
|
25
25
|
"default": "./dist/node.js"
|
|
26
26
|
},
|
|
27
|
+
"./plugin": {
|
|
28
|
+
"types": "./dist/plugin.d.ts",
|
|
29
|
+
"import": "./dist/plugin.js",
|
|
30
|
+
"default": "./dist/plugin.js"
|
|
31
|
+
},
|
|
27
32
|
"./skills/*": "./skills/*",
|
|
28
33
|
"./package.json": "./package.json"
|
|
29
34
|
},
|
|
@@ -53,12 +58,12 @@
|
|
|
53
58
|
},
|
|
54
59
|
"devDependencies": {
|
|
55
60
|
"@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.
|
|
61
|
+
"@plitzi/plitzi-ui": "^1.6.33",
|
|
62
|
+
"@plitzi/sdk-elements": "0.38.12",
|
|
63
|
+
"@plitzi/sdk-interactions": "0.38.12",
|
|
64
|
+
"@plitzi/sdk-schema": "0.38.12",
|
|
65
|
+
"@plitzi/sdk-shared": "0.38.12",
|
|
66
|
+
"@plitzi/sdk-style": "0.38.12",
|
|
62
67
|
"@types/react": "^19.3.0",
|
|
63
68
|
"eslint": "^9.39.5",
|
|
64
69
|
"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
|
|
@@ -53,7 +55,7 @@ form({ id, managedByInteractions: true, flows, children })
|
|
|
53
55
|
formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]
|
|
54
56
|
modalContainer({ id, visible: false, title, children })
|
|
55
57
|
component('card', { props: { title }, children: { body: [ … ] } })
|
|
56
|
-
|
|
58
|
+
const seats = defineElement(seatsDeclaration); seats({ id }) // a plugin
|
|
57
59
|
```
|
|
58
60
|
|
|
59
61
|
## Styles
|
|
@@ -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
|
|
|
@@ -11,18 +11,20 @@ import {
|
|
|
11
11
|
onClick,
|
|
12
12
|
setState
|
|
13
13
|
} from '@plitzi/sdk-authoring';
|
|
14
|
+
import { definePlugin } from '@plitzi/sdk-authoring/plugin';
|
|
14
15
|
|
|
15
16
|
import type { PluginDeclarationData, SpaceSpec } from '@plitzi/sdk-authoring';
|
|
16
17
|
|
|
17
|
-
// In a project
|
|
18
|
-
const declaration = {
|
|
18
|
+
// In a project, `src/plugins/SeatPicker/declaration.ts` — `export default definePlugin<SeatPickerAttributes>()({ … })`.
|
|
19
|
+
const declaration = definePlugin<{ rows?: number }>()({
|
|
19
20
|
type: 'seatPicker',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
label: 'Seat Picker',
|
|
22
|
+
attributes: { rows: 10 },
|
|
23
|
+
triggers: { onPick: { preview: { seat: '' } } },
|
|
24
|
+
callbacks: { reset: {} }
|
|
25
|
+
});
|
|
24
26
|
|
|
25
|
-
const seatPicker = defineElement
|
|
27
|
+
const seatPicker = defineElement(declaration);
|
|
26
28
|
|
|
27
29
|
// `authorSpace(recipe, { plugins })` — in a project, every `src/plugins/<Name>/declaration.ts`, found by folder.
|
|
28
30
|
export const plugins: PluginDeclarationData[] = [declaration];
|
|
@@ -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' })` |
|
|
@@ -232,11 +234,13 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
|
|
|
232
234
|
| `custom-css-notifications` | the toasts or their icon, close button or progress bar dressed with `.Toastify__*` rules in `customCss` | `notifications: { font, fontSize, fontWeight, minHeight, iconSize, closeColor, progressHeight, … }` |
|
|
233
235
|
| `custom-css-sdk-default` | `customCss` repeating what the SDK already does for every space — less motion when asked, the theme toggle showing one icon | nothing: remove it |
|
|
234
236
|
| `custom-css-slot` | a part of a built-in element dressed in `customCss` by the SDK's markup — a form control's `<input>`, a pager's buttons, a heading inside a markdown | a class on the slot of that part — `slots: { field: input }`, `elements.<type>.slots` — with its states |
|
|
237
|
+
| `element-color-inherited` | `elements` giving a type — a heading, a text, a link — `color: inherit` or the page's own colour, which it takes by itself | remove it, and name the colour once on `elements.page`: every element reads in the page’s colour, a link’s words included |
|
|
235
238
|
| `heavy-animation` | keyframes animating what the browser repaints or lays out again on every frame — a size, a position, a blur, a shadow, or a colour in a loop — which stutters whenever the page is busy, most of all while it loads | `opacity` and `transform`: a size or a position is `translate`/`scale`, a blur or a shadow is the `opacity` of a layer carrying it; a loop that must animate anything else starts `paused` and runs under `[data-hydrated]` |
|
|
236
239
|
| `literal-colour` | a colour written out in a class where the space has a token of that value — it stays put in the dark scheme | `var(--token)` when it should follow the scheme; a token of one value of its own when it must stay the same in both |
|
|
237
240
|
| `not-found-page` | a space with no page of its own for an address no other page answers — a plain one was added, in the home page’s layout, sent with status 404 | a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }` |
|
|
241
|
+
| `plugin-custom-host` | a `custom` element naming, by `renderType`, a plugin whose declaration the space was handed | place it from its declaration — `const seatPicker = defineElement(declaration)`, then `seatPicker({ id, … })`: typed by what it declares (a `definePlugin` declaration carries its attributes), the element the builder adds too |
|
|
238
242
|
| `repeated-on-pages` | the same block — a header, a footer, a side panel — written into several pages | a layout holding it once (`layouts`, and `layout: { id, slot }` on each page) — a component when only some pages of a layout carry it; a link marks its own page with the `current` state |
|
|
239
|
-
| `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles | a component with props (`components`, `component(id, { props })`), or one `list` when they are rows of data side by side — a few cards a person rewords on the canvas can stay cards |
|
|
243
|
+
| `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles; copies that bind different data, read their own template or render on the server are controls, not repeats | a component with props (`components`, `component(id, { props })`), or one `list` when they are rows of data side by side — a few cards a person rewords on the canvas can stay cards |
|
|
240
244
|
| `unused-class` | a class declared in `classes` that no element, binding, flow or other class names | remove it from `classes` — or wear it where it was meant to go |
|
|
241
245
|
| `unused-component` | a component no page, layout or other component places | remove it from `components`, or place it where it was meant to go |
|
|
242
246
|
| `unused-token` | a token of `variables` no `var(--…)` reads — not a class, an element, `customCss` nor another token | remove it, or write it where its colour is written out |
|
|
@@ -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
|
|
|
@@ -73,7 +73,7 @@ indented with space below it: `{ margin: '0px', padding: '0px' }` on its class t
|
|
|
73
73
|
children sit in the parent's layout and a `class` on it styles nothing (`STYLE_WITHOUT_TAG`). Put the layout on the
|
|
74
74
|
parent, or give it `attributes: { subType: 'div' }`.
|
|
75
75
|
|
|
76
|
-
A plugin's type is authored the same way: `defineElement
|
|
76
|
+
A plugin's type is authored the same way: `defineElement(declaration)` — see [plugins](plugins.md).
|
|
77
77
|
|
|
78
78
|
**What a type takes:** `npx @plitzi/cli explain formControl`, or the exported catalogues ([validation.md](validation.md)).
|
|
79
79
|
|
|
@@ -69,12 +69,11 @@ A step's params are templates, evaluated in full (conditions, loops, filters). A
|
|
|
69
69
|
a row's button posts `{ jobId: '{{ list_jobRows.item.id }}' }` — the row that was clicked; the short name is refused.
|
|
70
70
|
|
|
71
71
|
**Pass objects, not JSON text.** `input: { title: '{{ form.values.title }}' }` rather than `input: '{"title": …}'`:
|
|
72
|
-
each value keeps its own type, and nothing depends on the quoting.
|
|
73
|
-
is escaped for it — but an object says the same without the punctuation.)
|
|
72
|
+
each value keeps its own type, and nothing depends on the quoting.
|
|
74
73
|
|
|
75
74
|
**A field left empty is not in `values`.** A form sends what was typed, and a field nobody typed in sends nothing —
|
|
76
75
|
so `when({ field: 'sent.values.code', operator: '=', value: '' }, …)` never holds for it. Ask
|
|
77
|
-
`operator: 'empty'` / `'notEmpty'
|
|
76
|
+
`operator: 'empty'` / `'notEmpty'` (no `value`), which treat missing and `''` alike.
|
|
78
77
|
|
|
79
78
|
## Writes and what they refresh
|
|
80
79
|
|
|
@@ -106,7 +105,7 @@ ticks while the element is mounted and the tab is in view, never in the builder
|
|
|
106
105
|
|
|
107
106
|
**A number that goes round, or stops:** `cycleState({ key: 'slide', length: 4 })` is "next" — after the last the first
|
|
108
107
|
— and `by: -1` "previous"; `stepState({ key: 'shown', by: 40, max: 'apiContainer_site.data.total' })` adds and stops
|
|
109
|
-
at the bound.
|
|
108
|
+
at the bound.
|
|
110
109
|
|
|
111
110
|
**Scrolling** is a step on the element whose box scrolls (`overflow-x: auto` on a row of cards): `scrollBy('cards',
|
|
112
111
|
{ x: '80%' })` moves it by most of what it shows (`'-80%'` back, `'240'` pixels), `scrollTo('cards', { x: 'end' })`
|
|
@@ -165,6 +164,8 @@ Pages that see each other — cursors, presence, a shared board — talk over a
|
|
|
165
164
|
asks it. `appendState({ key, value, withId: true })` stores `{ id, value }` — bind `.value`, address by `.id`.
|
|
166
165
|
`whenFailed` matches every outcome that is not `completed` (also `skipped`, `aborted`). A failed run gives `reason`,
|
|
167
166
|
and `error` only when the server or a step wrote one for the caller (a task throwing `ActionRefusal`, `flow.fail` with
|
|
168
|
-
`tellCaller`) — so show `{{ saved.error ? saved.error : "…" }}`, never the bare `error`.
|
|
167
|
+
`tellCaller`) — so show `{{ saved.error ? saved.error : "…" }}`, never the bare `error`. That pair is one call:
|
|
168
|
+
`...runServerActionOrNotify('saved', { actionId, input }, 'Could not save')` — the named run, then that toast
|
|
169
|
+
(`{ appearance, placement }` fourth).
|
|
169
170
|
|
|
170
171
|
`when(rule, step)` around a step that already has a `when` adds to it: both must hold.
|
|
@@ -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
|
|