@forumone/throughline-design-system 0.0.0 → 1.0.0-next.2
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 +182 -0
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/bin/check-block-props.mjs +51 -0
- package/bin/stub-styles.mjs +28 -0
- package/dist/admin/BlockGuidance.d.ts +13 -0
- package/dist/admin/BlockGuidance.d.ts.map +1 -0
- package/dist/admin/BlockGuidance.js +13 -0
- package/dist/admin/BlockGuidance.js.map +1 -0
- package/dist/admin/BlockSummary.d.ts +10 -0
- package/dist/admin/BlockSummary.d.ts.map +1 -0
- package/dist/admin/BlockSummary.js +73 -0
- package/dist/admin/BlockSummary.js.map +1 -0
- package/dist/admin/RowSummary.d.ts +15 -0
- package/dist/admin/RowSummary.d.ts.map +1 -0
- package/dist/admin/RowSummary.js +16 -0
- package/dist/admin/RowSummary.js.map +1 -0
- package/dist/admin/summary.d.ts +18 -0
- package/dist/admin/summary.d.ts.map +1 -0
- package/dist/admin/summary.js +48 -0
- package/dist/admin/summary.js.map +1 -0
- package/dist/altText.d.ts +16 -0
- package/dist/altText.d.ts.map +1 -0
- package/dist/altText.js +54 -0
- package/dist/altText.js.map +1 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -0
- package/dist/contract/index.d.ts +5 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +4 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/lint.d.ts +38 -0
- package/dist/contract/lint.d.ts.map +1 -0
- package/dist/contract/lint.js +110 -0
- package/dist/contract/lint.js.map +1 -0
- package/dist/contract/loader.d.ts +49 -0
- package/dist/contract/loader.d.ts.map +1 -0
- package/dist/contract/loader.js +95 -0
- package/dist/contract/loader.js.map +1 -0
- package/dist/contract/manifest.d.ts +454 -0
- package/dist/contract/manifest.d.ts.map +1 -0
- package/dist/contract/manifest.js +29 -0
- package/dist/contract/manifest.js.map +1 -0
- package/dist/contract/schema.d.ts +334 -0
- package/dist/contract/schema.d.ts.map +1 -0
- package/dist/contract/schema.js +224 -0
- package/dist/contract/schema.js.map +1 -0
- package/dist/generate/blocks.d.ts +79 -0
- package/dist/generate/blocks.d.ts.map +1 -0
- package/dist/generate/blocks.js +118 -0
- package/dist/generate/blocks.js.map +1 -0
- package/dist/generate/fields.d.ts +60 -0
- package/dist/generate/fields.d.ts.map +1 -0
- package/dist/generate/fields.js +478 -0
- package/dist/generate/fields.js.map +1 -0
- package/dist/generate/guidance.d.ts +5 -0
- package/dist/generate/guidance.d.ts.map +1 -0
- package/dist/generate/guidance.js +29 -0
- package/dist/generate/guidance.js.map +1 -0
- package/dist/generate/index.d.ts +13 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +9 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/generate/labels.d.ts +42 -0
- package/dist/generate/labels.d.ts.map +1 -0
- package/dist/generate/labels.js +226 -0
- package/dist/generate/labels.js.map +1 -0
- package/dist/generate/layout.d.ts +42 -0
- package/dist/generate/layout.d.ts.map +1 -0
- package/dist/generate/layout.js +252 -0
- package/dist/generate/layout.js.map +1 -0
- package/dist/generate/selectOptionSnapshot.d.ts +26 -0
- package/dist/generate/selectOptionSnapshot.d.ts.map +1 -0
- package/dist/generate/selectOptionSnapshot.js +47 -0
- package/dist/generate/selectOptionSnapshot.js.map +1 -0
- package/dist/generate/selectOptions.d.ts +64 -0
- package/dist/generate/selectOptions.d.ts.map +1 -0
- package/dist/generate/selectOptions.js +145 -0
- package/dist/generate/selectOptions.js.map +1 -0
- package/dist/overrides.d.ts +71 -0
- package/dist/overrides.d.ts.map +1 -0
- package/dist/overrides.js +16 -0
- package/dist/overrides.js.map +1 -0
- package/dist/render/RenderBlocks.d.ts +67 -0
- package/dist/render/RenderBlocks.d.ts.map +1 -0
- package/dist/render/RenderBlocks.js +31 -0
- package/dist/render/RenderBlocks.js.map +1 -0
- package/dist/render/coerce.d.ts +78 -0
- package/dist/render/coerce.d.ts.map +1 -0
- package/dist/render/coerce.js +243 -0
- package/dist/render/coerce.js.map +1 -0
- package/dist/render/index.d.ts +5 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +3 -0
- package/dist/render/index.js.map +1 -0
- package/dist/testing/checkBlockProps.d.ts +66 -0
- package/dist/testing/checkBlockProps.d.ts.map +1 -0
- package/dist/testing/checkBlockProps.js +241 -0
- package/dist/testing/checkBlockProps.js.map +1 -0
- package/dist/testing/checkBlockPropsCli.d.ts +12 -0
- package/dist/testing/checkBlockPropsCli.d.ts.map +1 -0
- package/dist/testing/checkBlockPropsCli.js +86 -0
- package/dist/testing/checkBlockPropsCli.js.map +1 -0
- package/dist/testing/contractDefaults.d.ts +21 -0
- package/dist/testing/contractDefaults.d.ts.map +1 -0
- package/dist/testing/contractDefaults.js +65 -0
- package/dist/testing/contractDefaults.js.map +1 -0
- package/dist/testing/describeBlockInvariants.d.ts +39 -0
- package/dist/testing/describeBlockInvariants.d.ts.map +1 -0
- package/dist/testing/describeBlockInvariants.js +71 -0
- package/dist/testing/describeBlockInvariants.js.map +1 -0
- package/dist/testing/index.d.ts +18 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/untouchedBlocks.d.ts +48 -0
- package/dist/testing/untouchedBlocks.d.ts.map +1 -0
- package/dist/testing/untouchedBlocks.js +155 -0
- package/dist/testing/untouchedBlocks.js.map +1 -0
- package/package.json +108 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/generate/fields.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAkB,MAAM,i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O,CAAC,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAwB,EAAE,GAAiB,EAAE,UAAkB;IACvF,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,UAAU,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AACzF,CAAC;AAED,SAAS,WAAW,CAClB,QAAwB,EACxB,GAAiB,EACjB,UAAkB,EAClB,SAAS,GAAG,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC;IAEvD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IAEhE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,SAAS,IAAI,UAAU,oDAAoD;YAChF,4DAA4D,CAC/D,CAAA;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The first sentence of `intent`, with component names as the picker shows them. */
|
|
2
|
+
export declare function blockGuidance(intent: string, componentNames: Iterable<string>): string;
|
|
3
|
+
/** `CollageHero` → `Collage Hero`. The same rule the block labels use. */
|
|
4
|
+
export declare function humanize(name: string): string;
|
|
5
|
+
//# sourceMappingURL=guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../src/generate/guidance.ts"],"names":[],"mappings":"AAkBA,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAMtF;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
What a block is for, in the one sentence an author reads before filling it in.
|
|
3
|
+
|
|
4
|
+
Every contract's `intent` starts with a sentence written for exactly this —
|
|
5
|
+
"Use once per page as the strongest possible prompt, normally just above the
|
|
6
|
+
footer." — and none of it reached the admin. The picker shows a thumbnail and a
|
|
7
|
+
name, so an author choosing between CTA, High Impact CTA and Assurance CTA had
|
|
8
|
+
the names to go on and nothing else.
|
|
9
|
+
|
|
10
|
+
The rest of the intent is for the composer: when to choose this over that,
|
|
11
|
+
what it must not sit next to. Useful, but a paragraph above every block is a
|
|
12
|
+
paragraph nobody reads, so only the first sentence is shown.
|
|
13
|
+
|
|
14
|
+
A sentence that names another component names it the way code does —
|
|
15
|
+
"Use exactly where you would use ImageHero" — so each manifest name is written
|
|
16
|
+
the way the picker labels it.
|
|
17
|
+
*/
|
|
18
|
+
/** The first sentence of `intent`, with component names as the picker shows them. */
|
|
19
|
+
export function blockGuidance(intent, componentNames) {
|
|
20
|
+
const first = intent.trim().split(/(?<=[.!?])\s+(?=[A-Z"“])/)[0] ?? '';
|
|
21
|
+
const names = new Set(componentNames);
|
|
22
|
+
return first.replace(/\b[A-Z][a-z0-9]+(?:[A-Z][A-Za-z0-9]*)+\b/g, word => names.has(word) ? humanize(word) : word);
|
|
23
|
+
}
|
|
24
|
+
/** `CollageHero` → `Collage Hero`. The same rule the block labels use. */
|
|
25
|
+
export function humanize(name) {
|
|
26
|
+
const spaced = name.replace(/([a-z0-9])([A-Z])/g, '$1 $2');
|
|
27
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=guidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../src/generate/guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;EAgBE;AAEF,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,cAAgC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACtE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAA;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,2CAA2C,EAAE,IAAI,CAAC,EAAE,CACvE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CACxC,CAAA;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAA;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { generateBlock, generateBlocks, isBlockCandidate } from './blocks.js';
|
|
2
|
+
export type { GenerateOptions, GeneratedBlock, ManifestComponent, ManifestLike } from './blocks.js';
|
|
3
|
+
export { linkField, toPayloadField } from './fields.js';
|
|
4
|
+
export type { ContentField, FieldContext } from './fields.js';
|
|
5
|
+
export { arrange } from './layout.js';
|
|
6
|
+
export type { ArrangeOptions } from './layout.js';
|
|
7
|
+
export { humanizeField, labelFor, pairTitle } from './labels.js';
|
|
8
|
+
export { collectSelectOptions } from './selectOptionSnapshot.js';
|
|
9
|
+
export type { SelectOptionSnapshot } from './selectOptionSnapshot.js';
|
|
10
|
+
export { SelectOptionResolver } from './selectOptions.js';
|
|
11
|
+
export { fieldOverride } from '../overrides.js';
|
|
12
|
+
export type { ComponentOverride, FieldOverride, Overrides } from '../overrides.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC7E,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACvD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { generateBlock, generateBlocks, isBlockCandidate } from './blocks.js';
|
|
2
|
+
export { linkField, toPayloadField } from './fields.js';
|
|
3
|
+
export { arrange } from './layout.js';
|
|
4
|
+
export { humanizeField, labelFor, pairTitle } from './labels.js';
|
|
5
|
+
export { collectSelectOptions } from './selectOptionSnapshot.js';
|
|
6
|
+
export { SelectOptionResolver } from './selectOptions.js';
|
|
7
|
+
// Per-site overrides for generated blocks, which were the 0.x package's root.
|
|
8
|
+
export { fieldOverride } from '../overrides.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEzD,8EAA8E;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ContentField } from './fields.js';
|
|
2
|
+
/** `ctaLabel` → `CTA label`, `imageAlt` → `Image alt text`, `viewAllHref` → `View all link`. */
|
|
3
|
+
export declare function humanizeField(name: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* The label for one generated field.
|
|
6
|
+
*
|
|
7
|
+
* `src` is the one word whose meaning depends on the field's type rather than
|
|
8
|
+
* its name: an upload called `src` is the image, or the video, that its group
|
|
9
|
+
* is about, and "Src" is the attribute that happens to carry it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function labelFor(field: Pick<ContentField, 'name' | 'type'>): string;
|
|
12
|
+
/**
|
|
13
|
+
* The heading over a label and the link it names, from the prefix they share.
|
|
14
|
+
*
|
|
15
|
+
* `cta` → "Call to action", `primaryCta` → "Primary call to action",
|
|
16
|
+
* `viewAll` → "View all link", `register` → "Register link". A prefix that
|
|
17
|
+
* already ends in "link" is not given a second one.
|
|
18
|
+
*/
|
|
19
|
+
export declare function pairTitle(prefix: string): string;
|
|
20
|
+
/** The label for one select option's value. */
|
|
21
|
+
export declare function optionLabel(value: string, vocabulary?: Readonly<Record<string, string>>): string;
|
|
22
|
+
/** A picker shelf's name, with the same acronyms field labels use: `cta` → `CTA`. */
|
|
23
|
+
export declare function groupLabel(group: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* A select's description without the sentences that only restate its options.
|
|
26
|
+
*
|
|
27
|
+
* Contracts describe a select's values in prose — "h2 | h3 | h4. Defaults to
|
|
28
|
+
* h3. Match the page outline." — because the manifest carries no options and
|
|
29
|
+
* the prose is also what the components MCP server hands to a composing model,
|
|
30
|
+
* which does want the list. In the admin the options are labelled, so those
|
|
31
|
+
* sentences are noise and the guidance after them is kept.
|
|
32
|
+
*
|
|
33
|
+
* Except for one fact they carry. A generated select has no `defaultValue` —
|
|
34
|
+
* the component's own default applies to an unset prop — so the dropdown opens
|
|
35
|
+
* empty, and "Defaults to h3" is the only place an author learns what empty
|
|
36
|
+
* means. A dropped sentence that named a default is replaced by that fact in
|
|
37
|
+
* the options' own words: "Leave empty for Heading 3."
|
|
38
|
+
*
|
|
39
|
+
* `undefined` when nothing is left.
|
|
40
|
+
*/
|
|
41
|
+
export declare function selectDescription(description: string | undefined, values: readonly string[], label?: (value: string) => string): string | undefined;
|
|
42
|
+
//# sourceMappingURL=labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/generate/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA2E/C,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAc3E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMhD;AAsCD,+CAA+C;AAC/C,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAAG,MAAM,CAKpG;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAKD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAoC,GAC7D,MAAM,GAAG,SAAS,CAkDpB"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/*
|
|
2
|
+
What an author reads above a field, derived from the name a developer gave it.
|
|
3
|
+
|
|
4
|
+
Payload's own fallback title-cases the camelCase name, which is how the editor
|
|
5
|
+
came to ask for a "Cta Href" and an "Image Alt": three words an author has to
|
|
6
|
+
translate before they can type anything, one of them an HTML attribute. So
|
|
7
|
+
every generated field gets an explicit label, made the same way Payload makes
|
|
8
|
+
one but in sentence case and through a short vocabulary of the words that
|
|
9
|
+
mean something only to the person who wrote the component.
|
|
10
|
+
|
|
11
|
+
A name that humanizes badly *and* does not decompose into better words is
|
|
12
|
+
spelled out in `NAMES`. That table is global rather than per-component on
|
|
13
|
+
purpose: `isOpen` means "open when the page loads" in every accordion that has
|
|
14
|
+
one, and a label that differed between two of them would be a second thing for
|
|
15
|
+
an author to learn.
|
|
16
|
+
*/
|
|
17
|
+
/** Whole names that read badly however their words are translated. */
|
|
18
|
+
const NAMES = {
|
|
19
|
+
children: 'Text',
|
|
20
|
+
isOpen: 'Open on page load',
|
|
21
|
+
numCols: 'Columns',
|
|
22
|
+
hasFacade: 'Load the player only on click',
|
|
23
|
+
subHeading: 'Subheading',
|
|
24
|
+
metaParts: 'Details',
|
|
25
|
+
part: 'Detail',
|
|
26
|
+
newTab: 'Open in a new tab',
|
|
27
|
+
imageOne: 'First image',
|
|
28
|
+
imageTwo: 'Second image',
|
|
29
|
+
poster: 'Poster image',
|
|
30
|
+
videoSrc: 'Background video',
|
|
31
|
+
chipLabel: 'Format',
|
|
32
|
+
displayWord: 'Decorative word',
|
|
33
|
+
bleed: 'Bleed edge',
|
|
34
|
+
breakout: 'Break out of the column',
|
|
35
|
+
surface: 'Background',
|
|
36
|
+
submitLabel: 'Button text',
|
|
37
|
+
applyLabel: 'Apply link text',
|
|
38
|
+
pendingMessage: 'Message while sending',
|
|
39
|
+
invalidMessage: 'Message when a field needs fixing',
|
|
40
|
+
copyUrl: 'URL to copy',
|
|
41
|
+
copiedLabel: 'Copied confirmation',
|
|
42
|
+
copyErrorLabel: 'Copy failed message',
|
|
43
|
+
playLabel: 'Play button label',
|
|
44
|
+
pauseLabel: 'Pause button label',
|
|
45
|
+
};
|
|
46
|
+
/** Single words that are code, abbreviations, or a brand's own spelling. */
|
|
47
|
+
const WORDS = {
|
|
48
|
+
cta: 'CTA',
|
|
49
|
+
href: 'link',
|
|
50
|
+
url: 'URL',
|
|
51
|
+
id: 'ID',
|
|
52
|
+
alt: 'alt text',
|
|
53
|
+
faq: 'FAQ',
|
|
54
|
+
faqs: 'FAQs',
|
|
55
|
+
linkedin: 'LinkedIn',
|
|
56
|
+
};
|
|
57
|
+
function words(name) {
|
|
58
|
+
return name
|
|
59
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
60
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
61
|
+
.split(/[\s_-]+/)
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.map(word => word.toLowerCase());
|
|
64
|
+
}
|
|
65
|
+
function sentence(parts) {
|
|
66
|
+
const text = parts.join(' ');
|
|
67
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
68
|
+
}
|
|
69
|
+
/** `ctaLabel` → `CTA label`, `imageAlt` → `Image alt text`, `viewAllHref` → `View all link`. */
|
|
70
|
+
export function humanizeField(name) {
|
|
71
|
+
const named = NAMES[name];
|
|
72
|
+
if (named)
|
|
73
|
+
return named;
|
|
74
|
+
return sentence(words(name).map(word => WORDS[word] ?? word));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The label for one generated field.
|
|
78
|
+
*
|
|
79
|
+
* `src` is the one word whose meaning depends on the field's type rather than
|
|
80
|
+
* its name: an upload called `src` is the image, or the video, that its group
|
|
81
|
+
* is about, and "Src" is the attribute that happens to carry it.
|
|
82
|
+
*/
|
|
83
|
+
export function labelFor(field) {
|
|
84
|
+
const parts = words(field.name);
|
|
85
|
+
if (parts[parts.length - 1] === 'src' && !NAMES[field.name]) {
|
|
86
|
+
const rest = parts.slice(0, -1);
|
|
87
|
+
const noun = field.type === 'video' ? 'video' : 'image';
|
|
88
|
+
// A bare video `src` is a provider's embed address, not a file.
|
|
89
|
+
if (rest.length === 0 && noun === 'video')
|
|
90
|
+
return 'Video URL';
|
|
91
|
+
// `videoSrc` is "Video", not "Video video".
|
|
92
|
+
if (rest.length === 0 || rest[rest.length - 1] === noun) {
|
|
93
|
+
return sentence(rest.length === 0 ? [noun] : rest.map(word => WORDS[word] ?? word));
|
|
94
|
+
}
|
|
95
|
+
return sentence([...rest.map(word => WORDS[word] ?? word), noun]);
|
|
96
|
+
}
|
|
97
|
+
return humanizeField(field.name);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The heading over a label and the link it names, from the prefix they share.
|
|
101
|
+
*
|
|
102
|
+
* `cta` → "Call to action", `primaryCta` → "Primary call to action",
|
|
103
|
+
* `viewAll` → "View all link", `register` → "Register link". A prefix that
|
|
104
|
+
* already ends in "link" is not given a second one.
|
|
105
|
+
*/
|
|
106
|
+
export function pairTitle(prefix) {
|
|
107
|
+
const parts = words(prefix);
|
|
108
|
+
const last = parts[parts.length - 1];
|
|
109
|
+
if (last === 'cta')
|
|
110
|
+
return sentence([...parts.slice(0, -1).map(w => WORDS[w] ?? w), 'call to action']);
|
|
111
|
+
const translated = parts.map(word => WORDS[word] ?? word);
|
|
112
|
+
return sentence(last === 'link' ? translated : [...translated, 'link']);
|
|
113
|
+
}
|
|
114
|
+
/*
|
|
115
|
+
What an author reads in a dropdown.
|
|
116
|
+
|
|
117
|
+
Generated options were bare strings, so Payload showed the value: an author
|
|
118
|
+
chose between `text-image` and `two-image`, `h2` and `h3`, `aside` and `band`,
|
|
119
|
+
and the field's description had to make up for it in code voice — "h2 | h3 |
|
|
120
|
+
h4. Defaults to h3." So every option now carries a label, from, in order:
|
|
121
|
+
|
|
122
|
+
1. the host's own vocabulary, for values whose meaning is particular to its
|
|
123
|
+
design system (`text-image` is "Text and image" only because of what that
|
|
124
|
+
component draws — `GenerateOptions.optionLabels`);
|
|
125
|
+
2. `VALUES` below, for the values that mean the same thing in any design
|
|
126
|
+
system — a heading level, an HTML element, a form input type;
|
|
127
|
+
3. the value's own words, sentence-cased the way field names are.
|
|
128
|
+
|
|
129
|
+
A ratio is left as it is written. "16:9" is the word for it.
|
|
130
|
+
*/
|
|
131
|
+
/** Values that are code, and mean the same thing wherever they appear. */
|
|
132
|
+
const VALUES = {
|
|
133
|
+
h1: 'Heading 1',
|
|
134
|
+
h2: 'Heading 2',
|
|
135
|
+
h3: 'Heading 3',
|
|
136
|
+
h4: 'Heading 4',
|
|
137
|
+
h5: 'Heading 5',
|
|
138
|
+
h6: 'Heading 6',
|
|
139
|
+
p: 'Paragraph',
|
|
140
|
+
div: 'Block',
|
|
141
|
+
li: 'List item',
|
|
142
|
+
span: 'Inline',
|
|
143
|
+
tel: 'Phone number',
|
|
144
|
+
textarea: 'Long text',
|
|
145
|
+
select: 'Dropdown',
|
|
146
|
+
radio: 'Radio buttons',
|
|
147
|
+
};
|
|
148
|
+
/** The label for one select option's value. */
|
|
149
|
+
export function optionLabel(value, vocabulary = {}) {
|
|
150
|
+
const own = vocabulary[value] ?? VALUES[value];
|
|
151
|
+
if (own)
|
|
152
|
+
return own;
|
|
153
|
+
if (/^\d+:\d+$/.test(value))
|
|
154
|
+
return value;
|
|
155
|
+
return sentence(words(value).map(word => WORDS[word] ?? word));
|
|
156
|
+
}
|
|
157
|
+
/** A picker shelf's name, with the same acronyms field labels use: `cta` → `CTA`. */
|
|
158
|
+
export function groupLabel(group) {
|
|
159
|
+
const parts = words(group).map(word => WORDS[word] ?? word);
|
|
160
|
+
return parts.map(part => part.charAt(0).toUpperCase() + part.slice(1)).join(' ');
|
|
161
|
+
}
|
|
162
|
+
/** Words a sentence that only lists a select's values is made of, besides the values. */
|
|
163
|
+
const LISTING_WORDS = new Set(['default', 'defaults', 'to', 'or', 'and', 'one', 'of', 'optional']);
|
|
164
|
+
/**
|
|
165
|
+
* A select's description without the sentences that only restate its options.
|
|
166
|
+
*
|
|
167
|
+
* Contracts describe a select's values in prose — "h2 | h3 | h4. Defaults to
|
|
168
|
+
* h3. Match the page outline." — because the manifest carries no options and
|
|
169
|
+
* the prose is also what the components MCP server hands to a composing model,
|
|
170
|
+
* which does want the list. In the admin the options are labelled, so those
|
|
171
|
+
* sentences are noise and the guidance after them is kept.
|
|
172
|
+
*
|
|
173
|
+
* Except for one fact they carry. A generated select has no `defaultValue` —
|
|
174
|
+
* the component's own default applies to an unset prop — so the dropdown opens
|
|
175
|
+
* empty, and "Defaults to h3" is the only place an author learns what empty
|
|
176
|
+
* means. A dropped sentence that named a default is replaced by that fact in
|
|
177
|
+
* the options' own words: "Leave empty for Heading 3."
|
|
178
|
+
*
|
|
179
|
+
* `undefined` when nothing is left.
|
|
180
|
+
*/
|
|
181
|
+
export function selectDescription(description, values, label = value => optionLabel(value)) {
|
|
182
|
+
if (!description)
|
|
183
|
+
return undefined;
|
|
184
|
+
const byLength = [...values].sort((a, b) => b.length - a.length);
|
|
185
|
+
const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
186
|
+
const valuePattern = (value) => new RegExp(`(?<![\\w-])${escape(value.toLowerCase())}(?![\\w-])`, 'g');
|
|
187
|
+
const listsOnly = (part) => {
|
|
188
|
+
let rest = ` ${part.toLowerCase()} `;
|
|
189
|
+
for (const value of byLength)
|
|
190
|
+
rest = rest.replace(valuePattern(value), ' ');
|
|
191
|
+
return rest
|
|
192
|
+
.replace(/['"“”‘’()|,.;:]/g, ' ')
|
|
193
|
+
.split(/\s+/)
|
|
194
|
+
.every(word => word === '' || LISTING_WORDS.has(word));
|
|
195
|
+
};
|
|
196
|
+
const namedDefault = (part) => {
|
|
197
|
+
const lower = part.toLowerCase();
|
|
198
|
+
return byLength.find(value => {
|
|
199
|
+
const v = escape(value.toLowerCase());
|
|
200
|
+
return (new RegExp(`defaults? to ['"“‘]?${v}(?![\\w-])`).test(lower) ||
|
|
201
|
+
new RegExp(`(?<![\\w-])${v}['"”’]? \\(default\\)`).test(lower));
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
// Sentences, not splitting after "e.g." or "i.e.", which end in a full stop
|
|
205
|
+
// and are followed by the example they introduce.
|
|
206
|
+
const parts = description.split(/(?<!\b(?:e\.g|i\.e)\.)(?<=[.;])\s+/);
|
|
207
|
+
let fallback;
|
|
208
|
+
const kept = parts.filter(part => {
|
|
209
|
+
if (!listsOnly(part))
|
|
210
|
+
return true;
|
|
211
|
+
fallback ??= namedDefault(part);
|
|
212
|
+
return false;
|
|
213
|
+
});
|
|
214
|
+
const text = [
|
|
215
|
+
...(fallback ? [`Leave empty for ${label(fallback)}.`] : []),
|
|
216
|
+
...kept.map((part, i) =>
|
|
217
|
+
// A clause that followed a semicolon starts lowercase.
|
|
218
|
+
i === 0 || /[.!?]$/.test(kept[i - 1] ?? '') ? part.charAt(0).toUpperCase() + part.slice(1) : part),
|
|
219
|
+
]
|
|
220
|
+
.join(' ')
|
|
221
|
+
.trim()
|
|
222
|
+
// A kept clause whose second half was a dropped list ends on its semicolon.
|
|
223
|
+
.replace(/;$/, '.');
|
|
224
|
+
return text === '' ? undefined : text;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../../src/generate/labels.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;EAeE;AAEF,sEAAsE;AACtE,MAAM,KAAK,GAA2B;IACpC,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,mBAAmB;IAC3B,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,+BAA+B;IAC1C,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,mBAAmB;IAC3B,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,QAAQ;IACnB,WAAW,EAAE,iBAAiB;IAC9B,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,yBAAyB;IACnC,OAAO,EAAE,YAAY;IACrB,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,iBAAiB;IAC7B,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,mCAAmC;IACnD,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,qBAAqB;IACrC,SAAS,EAAE,mBAAmB;IAC9B,UAAU,EAAE,oBAAoB;CACjC,CAAA;AAED,4EAA4E;AAC5E,MAAM,KAAK,GAA2B;IACpC,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACrB,CAAA;AAED,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI;SACR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KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAClG;KACF;SACE,IAAI,CAAC,GAAG,CAAC;SACT,IAAI,EAAE;QACP,4EAA4E;SAC3E,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAErB,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;AACvC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Field } from 'payload';
|
|
2
|
+
import type { ContentField } from './fields.js';
|
|
3
|
+
export interface ArrangeOptions {
|
|
4
|
+
/** Gather settings and `advanced` fields into a collapsed section. Top level only. */
|
|
5
|
+
disclose: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* One level's generated fields, in the order and grouping an author reads them.
|
|
9
|
+
*
|
|
10
|
+
* `generated[i]` is the Payload field for `contract[i]`, or null where the
|
|
11
|
+
* contract field is not authorable. Nulls are dropped here, so the caller does
|
|
12
|
+
* not have to.
|
|
13
|
+
*/
|
|
14
|
+
export declare function arrange(contract: ContentField[], generated: (Field | null)[], options: ArrangeOptions): Field[];
|
|
15
|
+
/**
|
|
16
|
+
* An array row's fields, on one line when they are all short single-line text.
|
|
17
|
+
*
|
|
18
|
+
* Widths are each field's share of the row's combined `maxLength`, floored so
|
|
19
|
+
* a 12-character figure beside a 60-character label is still a box somebody
|
|
20
|
+
* can type into.
|
|
21
|
+
*/
|
|
22
|
+
export declare function oneLine(fields: Field[]): Field[];
|
|
23
|
+
/**
|
|
24
|
+
* Which of an array row's fields name it in its header, by contract name.
|
|
25
|
+
*
|
|
26
|
+
* `generated[i]` is the Payload field for `contract[i]`, as `arrange` takes
|
|
27
|
+
* it — so an omitted field, or a text field an override turned into a select,
|
|
28
|
+
* is judged by what it became rather than by what the contract says.
|
|
29
|
+
*/
|
|
30
|
+
export declare function summaryFields(contract: ContentField[], generated: (Field | null)[], limit?: number): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Which one field names a block in its collapsed header, by contract name.
|
|
33
|
+
*
|
|
34
|
+
* One rather than `summaryFields`' two: a block's header already carries its
|
|
35
|
+
* number and the pill naming its type, and a heading is the name a reader
|
|
36
|
+
* would give it. So the block's `heading` or `title` when it has one — an
|
|
37
|
+
* eyebrow comes first in a hero's contract and says less — and otherwise its
|
|
38
|
+
* first short text field, which for a statement or a testimonial is the text
|
|
39
|
+
* itself. `[]` for a block with no text of its own.
|
|
40
|
+
*/
|
|
41
|
+
export declare function blockSummaryFields(contract: ContentField[], generated: (Field | null)[]): string[];
|
|
42
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/generate/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA4C/C,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,QAAQ,EAAE,OAAO,CAAA;CAClB;AA2ED;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,YAAY,EAAE,EACxB,SAAS,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAC3B,OAAO,EAAE,cAAc,GACtB,KAAK,EAAE,CAsCT;AA0BD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAuChD;AAKD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,YAAY,EAAE,EACxB,SAAS,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAC3B,KAAK,GAAE,MAAuB,GAC7B,MAAM,EAAE,CAmBV;AAKD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,SAAS,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAC1B,MAAM,EAAE,CAIV"}
|