@plitzi/sdk-authoring 0.38.11 → 0.38.13
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 +110 -0
- package/dist/index-declare.js +102 -0
- package/dist/index-src.js +781 -1467
- package/dist/index.d.ts +3361 -4026
- package/dist/index.js +3 -2
- package/dist/node.d.ts +26 -7
- package/dist/node.js +16 -11
- package/dist/plugin.d.ts +861 -0
- package/dist/plugin.js +2 -0
- package/package.json +13 -6
- package/skills/plitzi-authoring/CHEATSHEET.md +1 -1
- package/skills/plitzi-authoring/recipes/plugin.ts +9 -7
- package/skills/plitzi-authoring/reference/authoring-errors.md +3 -1
- package/skills/plitzi-authoring/reference/elements-and-styles.md +1 -1
- package/skills/plitzi-authoring/reference/flows.md +5 -4
- package/skills/plitzi-authoring/reference/plugins.md +40 -35
- package/skills/plitzi-authoring/reference/rules.md +1 -1
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
|
@@ -1017,9 +1017,19 @@ declare const AUTHORING_CODES: {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
readonly 'repeated-shape': {
|
|
1019
1019
|
readonly kind: "suggested";
|
|
1020
|
-
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";
|
|
1021
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";
|
|
1022
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
|
+
};
|
|
1023
1033
|
readonly 'content-attribute': {
|
|
1024
1034
|
readonly kind: "suggested";
|
|
1025
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";
|
|
@@ -1979,14 +1989,23 @@ declare interface PluginDeclarationData {
|
|
|
1979
1989
|
};
|
|
1980
1990
|
}
|
|
1981
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
|
+
|
|
1982
2002
|
/**
|
|
1983
|
-
*
|
|
1984
|
-
*
|
|
1985
|
-
*
|
|
1986
|
-
*
|
|
1987
|
-
* 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.
|
|
1988
2007
|
*/
|
|
1989
|
-
export declare const
|
|
2008
|
+
export declare const pluginFolders: (folder: string | URL) => Promise<PluginFolder[]>;
|
|
1990
2009
|
|
|
1991
2010
|
/** What a project `@plitzi/cli` writes checks its space against: the part of `authorSpace`'s options its files say. */
|
|
1992
2011
|
export declare type ProjectAuthoring = {
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hn as e$1, n as authorSpace, p as compactSvg
|
|
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 };
|