@eldrajs/vite-plugin-theme 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +3 -2
- package/dist/{scan-DmmAzjZz.js → scan-B4nn0SQj.js} +344 -16
- package/dist/scan.d.ts +1 -1
- package/dist/scan.js +1 -1
- package/dist/{types-kcnroZCz.d.ts → types-d9173MhL.d.ts} +66 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
- **`formSeeds[].actions.subscribe.consentText` (WS-386).** A subscribe action may carry its consent
|
|
9
|
+
sentence per locale (`{ 'en-US': '… {shop} …' }`), validated like Core: locale tags, at most 500
|
|
10
|
+
characters each, plain text (no `<`, `>` or control characters), at least one locale when the key is
|
|
11
|
+
present. Left out, Core fills in its platform default on create, so existing seeds keep working.
|
|
12
|
+
|
|
13
|
+
- **Form seed field types `number` and `url` (WS-386).** `validateFormSeeds` and
|
|
14
|
+
`ManifestFormSeedFieldType` list every type Core accepts: `text`, `email`, `phone`, `textarea`,
|
|
15
|
+
`select`, `checkbox`, `consent`, `number`, `url`. `number` and `url` take `validation` like `text`.
|
|
16
|
+
|
|
17
|
+
- **`formSeeds` cannot reference an email template (WS-386).** Core now refuses a form action that
|
|
18
|
+
would send anything but a form design or the organisation's own custom template. A seed's
|
|
19
|
+
`notify`/`confirm` are flags and `subscribe` takes only `{ list }`, so a seed can only ever use the
|
|
20
|
+
platform form designs; `validateFormSeeds` rejects a `templateRef` (object in place of a flag, or an
|
|
21
|
+
unknown key) as a scan error. No behaviour change for valid seeds; the starter's seeds are unaffected.
|
|
22
|
+
- **`formSeeds`: the forms a site starts with (WS-386).** A new `eldra.formSeeds` option (and
|
|
23
|
+
`ScanOptions.formSeeds`) declares up to eight forms, `{ key, name, fields, actions, success }`, with a
|
|
24
|
+
label per locale on every field. `validateFormSeeds` (exported) refuses what Core refuses — a key
|
|
25
|
+
outside `^[a-z][a-z0-9-]{0,39}$` or the reserved `subscriptions`, duplicate keys or field ids, an
|
|
26
|
+
unknown field type, a `select` with no options, a bad `pattern`, `confirm`/`subscribe` without an
|
|
27
|
+
email field, an unknown key at any level — as scan errors. The manifest carries `formSeeds` only when
|
|
28
|
+
the theme declares some, so a theme that seeds none emits the manifest it always has. New types
|
|
29
|
+
`ManifestFormSeed`, `ManifestFormSeedField`, `ManifestFormSeedFieldType`, `DeclaredFormSeed`.
|
|
30
|
+
Needs a Core whose manifest ingest accepts `formSeeds` (contract 4.4.0).
|
|
8
31
|
- **Breaking:** a theme must declare its id in `package.json` under `eldra.themeId`
|
|
9
32
|
(`^[a-z][a-z0-9-]{1,48}$`, `catalog` reserved). The scanner emits it as `manifest.theme.id` and
|
|
10
33
|
`manifestVersion` is now `2` (`ThemeManifest.manifestVersion: 2`, `theme.id: string`). A missing
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as TemplateSeedLayout, C as ManifestTemplateRoles, D as ScanOptions, E as PageSeedTarget, F as ThemeMessages, M as TemplateSeedReusableNode, N as TemplateSeedSchemaApiId, O as ScanResult, P as ThemeManifest, S as ManifestRoute, T as ManifestTemplateSeedBlock, _ as ManifestFormSeedFieldType, a as DeclaredPageSeed, b as ManifestPageSeedEntry, c as DeclaredPageSeedRegion, d as DeclaredTemplateSeedBlock, f as DeclaredThemeCodePage, g as ManifestFormSeedField, h as ManifestFormSeed, i as DeclaredFormSeed, j as TemplateSeedLayoutNode, k as TemplateSeedBlockNode, l as DeclaredSeed, m as LegacyThemeTokens, n as BlockField, o as DeclaredPageSeedBlock, p as EldraThemeOptions, r as BlockMigration, s as DeclaredPageSeedEntry, t as BlockDefinition, u as DeclaredTemplateSeed, v as ManifestPageSeed, w as ManifestTemplateSeed, x as ManifestPageSeedRegion, y as ManifestPageSeedBlock } from "./types-d9173MhL.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
export default function eldraTheme(options?: EldraThemeOptions): Plugin;
|
|
@@ -6,6 +6,19 @@ export default function eldraTheme(options?: EldraThemeOptions): Plugin;
|
|
|
6
6
|
//#region src/blockTypes.d.ts
|
|
7
7
|
export declare function generateBlockTypes(blocks: BlockDefinition[], messages?: ThemeMessages): string;
|
|
8
8
|
//#endregion
|
|
9
|
+
//#region src/formSeeds.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Validates the declared `formSeeds`: the forms a site is created with, ingested by Core's
|
|
12
|
+
* `site_forms` seeding. It rejects an unknown key outright and enforces the wire contract
|
|
13
|
+
* agreed for WS-386 (key and field-id grammar, field types, option and length caps). It mirrors
|
|
14
|
+
* Core's `normalizeFormInput` exactly — anything Core refuses fails the whole manifest sync, so a
|
|
15
|
+
* rule changed on the Core side must be changed here too. A merchant-edited form is never
|
|
16
|
+
* overwritten by a later version of a seed (Core's `editedByMerchant` flag).
|
|
17
|
+
*
|
|
18
|
+
* Absent (`undefined`) and empty both mean "this theme seeds no forms".
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateFormSeeds(seeds: ReadonlyArray<DeclaredFormSeed> | undefined, errors: string[]): ManifestFormSeed[];
|
|
21
|
+
//#endregion
|
|
9
22
|
//#region src/templates.d.ts
|
|
10
23
|
/**
|
|
11
24
|
* The layout a seed gets when it declares none: one column of its blocks in
|
|
@@ -71,4 +84,4 @@ export declare function validatePageSeeds(seeds: ReadonlyArray<DeclaredSeed>, bl
|
|
|
71
84
|
*/
|
|
72
85
|
export declare function validateTemplateRoles(roles: ManifestTemplateRoles | undefined, blocks: ReadonlyArray<Record<string, unknown>>, templates: ReadonlyArray<ManifestTemplateSeed>, errors: string[]): ManifestTemplateRoles | undefined;
|
|
73
86
|
//#endregion
|
|
74
|
-
export type { BlockDefinition, BlockField, BlockMigration, DeclaredPageSeed, DeclaredPageSeedBlock, DeclaredPageSeedEntry, DeclaredPageSeedRegion, DeclaredSeed, DeclaredTemplateSeed, DeclaredTemplateSeedBlock, DeclaredThemeCodePage, EldraThemeOptions, LegacyThemeTokens, ManifestPageSeed, ManifestPageSeedBlock, ManifestPageSeedEntry, ManifestPageSeedRegion, ManifestRoute, ManifestTemplateRoles, ManifestTemplateSeed, ManifestTemplateSeedBlock, PageSeedTarget, ScanOptions, ScanResult, TemplateSeedBlockNode, TemplateSeedLayout, TemplateSeedLayoutNode, TemplateSeedReusableNode, TemplateSeedSchemaApiId, ThemeManifest, ThemeMessages };
|
|
87
|
+
export type { BlockDefinition, BlockField, BlockMigration, DeclaredFormSeed, DeclaredPageSeed, DeclaredPageSeedBlock, DeclaredPageSeedEntry, DeclaredPageSeedRegion, DeclaredSeed, DeclaredTemplateSeed, DeclaredTemplateSeedBlock, DeclaredThemeCodePage, EldraThemeOptions, LegacyThemeTokens, ManifestFormSeed, ManifestFormSeedField, ManifestFormSeedFieldType, ManifestPageSeed, ManifestPageSeedBlock, ManifestPageSeedEntry, ManifestPageSeedRegion, ManifestRoute, ManifestTemplateRoles, ManifestTemplateSeed, ManifestTemplateSeedBlock, PageSeedTarget, ScanOptions, ScanResult, TemplateSeedBlockNode, TemplateSeedLayout, TemplateSeedLayoutNode, TemplateSeedReusableNode, TemplateSeedSchemaApiId, ThemeManifest, ThemeMessages };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as validateTemplateRoles, i as validatePageSeeds, n as scanTheme, o as validateTemplateSeeds, r as seedLayout, t as readPreviousManifest } from "./scan-
|
|
1
|
+
import { a as validateTemplateRoles, i as validatePageSeeds, n as scanTheme, o as validateTemplateSeeds, r as seedLayout, s as validateFormSeeds, t as readPreviousManifest } from "./scan-B4nn0SQj.js";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
4
|
import { generateDesignTokenCss, generateTailwindThemeCss, normalizeThemeDesignTokens } from "@eldrajs/theme-core/design-tokens";
|
|
@@ -249,6 +249,7 @@ function eldraTheme(options = {}) {
|
|
|
249
249
|
customPages: options.customPages,
|
|
250
250
|
templates: options.templates,
|
|
251
251
|
templateRoles: options.templateRoles,
|
|
252
|
+
formSeeds: options.formSeeds,
|
|
252
253
|
breakpoints: options.breakpoints
|
|
253
254
|
});
|
|
254
255
|
scan.errors.unshift(...historyErrors);
|
|
@@ -449,4 +450,4 @@ function findJsonStringEnd(text, start) {
|
|
|
449
450
|
return i;
|
|
450
451
|
}
|
|
451
452
|
//#endregion
|
|
452
|
-
export { eldraTheme as default, generateBlockTypes, seedLayout, validatePageSeeds, validateTemplateRoles, validateTemplateSeeds };
|
|
453
|
+
export { eldraTheme as default, generateBlockTypes, seedLayout, validateFormSeeds, validatePageSeeds, validateTemplateRoles, validateTemplateSeeds };
|
|
@@ -8,7 +8,7 @@ import { RESERVED_THEME_IDS, RICH_TEXT_TOOLBAR_CONTROLS, THEME_ID_PATTERN, parse
|
|
|
8
8
|
import { safeLinkHref } from "@eldrajs/theme-core/links";
|
|
9
9
|
//#region src/blockSchema.ts
|
|
10
10
|
const API_ID_PATTERN = "^[a-z][a-z0-9-]{1,48}$";
|
|
11
|
-
const FIELD_ID_PATTERN = "^[a-z][a-zA-Z0-9]{0,48}$";
|
|
11
|
+
const FIELD_ID_PATTERN$1 = "^[a-z][a-zA-Z0-9]{0,48}$";
|
|
12
12
|
const blockJsonSchema = {
|
|
13
13
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
14
14
|
type: "object",
|
|
@@ -60,7 +60,7 @@ const blockJsonSchema = {
|
|
|
60
60
|
properties: {
|
|
61
61
|
groupId: {
|
|
62
62
|
type: "string",
|
|
63
|
-
pattern: FIELD_ID_PATTERN
|
|
63
|
+
pattern: FIELD_ID_PATTERN$1
|
|
64
64
|
},
|
|
65
65
|
name: {
|
|
66
66
|
type: "string",
|
|
@@ -101,11 +101,11 @@ const blockJsonSchema = {
|
|
|
101
101
|
properties: {
|
|
102
102
|
from: {
|
|
103
103
|
type: "string",
|
|
104
|
-
pattern: FIELD_ID_PATTERN
|
|
104
|
+
pattern: FIELD_ID_PATTERN$1
|
|
105
105
|
},
|
|
106
106
|
to: {
|
|
107
107
|
type: "string",
|
|
108
|
-
pattern: FIELD_ID_PATTERN
|
|
108
|
+
pattern: FIELD_ID_PATTERN$1
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -124,11 +124,11 @@ const blockJsonSchema = {
|
|
|
124
124
|
properties: {
|
|
125
125
|
from: {
|
|
126
126
|
type: "string",
|
|
127
|
-
pattern: FIELD_ID_PATTERN
|
|
127
|
+
pattern: FIELD_ID_PATTERN$1
|
|
128
128
|
},
|
|
129
129
|
to: {
|
|
130
130
|
type: "string",
|
|
131
|
-
pattern: FIELD_ID_PATTERN
|
|
131
|
+
pattern: FIELD_ID_PATTERN$1
|
|
132
132
|
},
|
|
133
133
|
shape: {
|
|
134
134
|
type: "string",
|
|
@@ -136,15 +136,15 @@ const blockJsonSchema = {
|
|
|
136
136
|
},
|
|
137
137
|
label: {
|
|
138
138
|
type: "string",
|
|
139
|
-
pattern: FIELD_ID_PATTERN
|
|
139
|
+
pattern: FIELD_ID_PATTERN$1
|
|
140
140
|
},
|
|
141
141
|
url: {
|
|
142
142
|
type: "string",
|
|
143
|
-
pattern: FIELD_ID_PATTERN
|
|
143
|
+
pattern: FIELD_ID_PATTERN$1
|
|
144
144
|
},
|
|
145
145
|
group: {
|
|
146
146
|
type: "string",
|
|
147
|
-
pattern: FIELD_ID_PATTERN
|
|
147
|
+
pattern: FIELD_ID_PATTERN$1
|
|
148
148
|
},
|
|
149
149
|
children: {
|
|
150
150
|
type: "object",
|
|
@@ -153,19 +153,19 @@ const blockJsonSchema = {
|
|
|
153
153
|
properties: {
|
|
154
154
|
from: {
|
|
155
155
|
type: "string",
|
|
156
|
-
pattern: FIELD_ID_PATTERN
|
|
156
|
+
pattern: FIELD_ID_PATTERN$1
|
|
157
157
|
},
|
|
158
158
|
label: {
|
|
159
159
|
type: "string",
|
|
160
|
-
pattern: FIELD_ID_PATTERN
|
|
160
|
+
pattern: FIELD_ID_PATTERN$1
|
|
161
161
|
},
|
|
162
162
|
url: {
|
|
163
163
|
type: "string",
|
|
164
|
-
pattern: FIELD_ID_PATTERN
|
|
164
|
+
pattern: FIELD_ID_PATTERN$1
|
|
165
165
|
},
|
|
166
166
|
group: {
|
|
167
167
|
type: "string",
|
|
168
|
-
pattern: FIELD_ID_PATTERN
|
|
168
|
+
pattern: FIELD_ID_PATTERN$1
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -185,7 +185,7 @@ const blockJsonSchema = {
|
|
|
185
185
|
properties: {
|
|
186
186
|
fieldId: {
|
|
187
187
|
type: "string",
|
|
188
|
-
pattern: FIELD_ID_PATTERN
|
|
188
|
+
pattern: FIELD_ID_PATTERN$1
|
|
189
189
|
},
|
|
190
190
|
name: {
|
|
191
191
|
type: "string",
|
|
@@ -210,7 +210,7 @@ const blockJsonSchema = {
|
|
|
210
210
|
properties: {
|
|
211
211
|
field: {
|
|
212
212
|
type: "string",
|
|
213
|
-
pattern: FIELD_ID_PATTERN
|
|
213
|
+
pattern: FIELD_ID_PATTERN$1
|
|
214
214
|
},
|
|
215
215
|
in: {
|
|
216
216
|
type: "array",
|
|
@@ -831,6 +831,332 @@ function validLinkTarget(target, kind) {
|
|
|
831
831
|
return keys.every((key) => LINK_SLUG_KEYS.has(key)) && LINK_SLUG_TYPES.has(kind) && typeof target.slug === "string" && target.slug.trim() !== "";
|
|
832
832
|
}
|
|
833
833
|
//#endregion
|
|
834
|
+
//#region src/formSeeds.ts
|
|
835
|
+
const MAX_FORM_SEEDS = 8;
|
|
836
|
+
const MAX_FIELDS = 30;
|
|
837
|
+
const MAX_OPTIONS = 50;
|
|
838
|
+
const MAX_NAME_LENGTH = 80;
|
|
839
|
+
const MAX_TEXT_LENGTH = 200;
|
|
840
|
+
const MAX_MESSAGE_LENGTH = 1e3;
|
|
841
|
+
/** Core's cap on a subscribe action's consent sentence, per locale. */
|
|
842
|
+
const MAX_CONSENT_TEXT_LENGTH = 500;
|
|
843
|
+
/** Core's form key rule: a URL segment, and never the reserved `subscriptions` route. */
|
|
844
|
+
const FORM_KEY_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
|
|
845
|
+
const RESERVED_FORM_KEY = "subscriptions";
|
|
846
|
+
/** A field id is the key of a submission value, so it stays a plain identifier. */
|
|
847
|
+
const FIELD_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{0,39}$/;
|
|
848
|
+
const OPTION_VALUE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/;
|
|
849
|
+
const LOCALE_TAG_PATTERN$1 = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/;
|
|
850
|
+
const LIST_KEY_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
|
|
851
|
+
/** A field id Core reserves (it names the whole submission in its own routes). */
|
|
852
|
+
const RESERVED_FIELD_ID = "all";
|
|
853
|
+
/** Core's cap on `minLength` / `maxLength`. */
|
|
854
|
+
const MAX_VALIDATION_LENGTH = 8e3;
|
|
855
|
+
/** The field types that take a `validation` block; Core refuses it on the rest. */
|
|
856
|
+
const VALIDATION_TYPES = /* @__PURE__ */ new Set([
|
|
857
|
+
"text",
|
|
858
|
+
"email",
|
|
859
|
+
"phone",
|
|
860
|
+
"textarea",
|
|
861
|
+
"number",
|
|
862
|
+
"url"
|
|
863
|
+
]);
|
|
864
|
+
const FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
865
|
+
"text",
|
|
866
|
+
"email",
|
|
867
|
+
"phone",
|
|
868
|
+
"textarea",
|
|
869
|
+
"select",
|
|
870
|
+
"checkbox",
|
|
871
|
+
"consent",
|
|
872
|
+
"number",
|
|
873
|
+
"url"
|
|
874
|
+
]);
|
|
875
|
+
const SEED_KEYS = /* @__PURE__ */ new Set([
|
|
876
|
+
"key",
|
|
877
|
+
"name",
|
|
878
|
+
"fields",
|
|
879
|
+
"actions",
|
|
880
|
+
"success"
|
|
881
|
+
]);
|
|
882
|
+
const FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
883
|
+
"id",
|
|
884
|
+
"type",
|
|
885
|
+
"required",
|
|
886
|
+
"label",
|
|
887
|
+
"placeholder",
|
|
888
|
+
"options",
|
|
889
|
+
"validation"
|
|
890
|
+
]);
|
|
891
|
+
const ACTION_KEYS = /* @__PURE__ */ new Set([
|
|
892
|
+
"notify",
|
|
893
|
+
"confirm",
|
|
894
|
+
"subscribe"
|
|
895
|
+
]);
|
|
896
|
+
const SUCCESS_KEYS = /* @__PURE__ */ new Set(["message", "redirect"]);
|
|
897
|
+
const VALIDATION_KEYS = /* @__PURE__ */ new Set([
|
|
898
|
+
"minLength",
|
|
899
|
+
"maxLength",
|
|
900
|
+
"pattern"
|
|
901
|
+
]);
|
|
902
|
+
function unknownKeys(at, value, allowed, errors) {
|
|
903
|
+
for (const key of Object.keys(value)) if (!allowed.has(key)) errors.push(`${at}.${key} — unknown key`);
|
|
904
|
+
}
|
|
905
|
+
/** A `{ <locale>: text }` map: at least one locale, every tag well-formed, every text non-empty. */
|
|
906
|
+
function localizedText(at, value, maxLength, errors) {
|
|
907
|
+
if (!isRecord(value) || Object.keys(value).length === 0) {
|
|
908
|
+
errors.push(`${at} — must map at least one locale tag to text`);
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
const out = {};
|
|
912
|
+
for (const [locale, text] of Object.entries(value)) {
|
|
913
|
+
if (!LOCALE_TAG_PATTERN$1.test(locale)) {
|
|
914
|
+
errors.push(`${at}.${locale} — not a locale tag (expected something like "en-US")`);
|
|
915
|
+
continue;
|
|
916
|
+
}
|
|
917
|
+
const clean = stripPlainTextControls(text).trim();
|
|
918
|
+
if (clean === "" || codePointLength(clean) > maxLength) {
|
|
919
|
+
errors.push(`${at}.${locale} — must contain 1..${maxLength} characters`);
|
|
920
|
+
continue;
|
|
921
|
+
}
|
|
922
|
+
out[locale] = clean;
|
|
923
|
+
}
|
|
924
|
+
return out;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Core compiles `pattern` as RE2 (`^(?:pattern)$`), which has no lookaround and no
|
|
928
|
+
* backreferences; a JS `RegExp` accepts both, so they are refused here by scanning for them
|
|
929
|
+
* outside character classes and escapes. Returns what was found, or `null`.
|
|
930
|
+
*/
|
|
931
|
+
function nonRe2Construct(pattern) {
|
|
932
|
+
let inClass = false;
|
|
933
|
+
for (let i = 0; i < pattern.length; i += 1) {
|
|
934
|
+
const char = pattern[i];
|
|
935
|
+
if (char === "\\") {
|
|
936
|
+
const next = pattern[i + 1] ?? "";
|
|
937
|
+
if (!inClass && (/[1-9]/.test(next) || next === "k")) return "a backreference";
|
|
938
|
+
i += 1;
|
|
939
|
+
} else if (inClass) {
|
|
940
|
+
if (char === "]") inClass = false;
|
|
941
|
+
} else if (char === "[") {
|
|
942
|
+
inClass = true;
|
|
943
|
+
if (pattern[i + 1] === "^") i += 1;
|
|
944
|
+
if (pattern[i + 1] === "]") i += 1;
|
|
945
|
+
} else if (char === "(" && pattern[i + 1] === "?") {
|
|
946
|
+
const rest = pattern.slice(i + 2, i + 4);
|
|
947
|
+
if (rest.startsWith("=") || rest.startsWith("!") || rest === "<=" || rest === "<!") return "a lookaround";
|
|
948
|
+
if (rest.startsWith(">")) return "an atomic group";
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
return null;
|
|
952
|
+
}
|
|
953
|
+
function validateField(at, entry, errors) {
|
|
954
|
+
if (!isRecord(entry)) {
|
|
955
|
+
errors.push(`${at} — must be a field object`);
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
unknownKeys(at, entry, FIELD_KEYS, errors);
|
|
959
|
+
const id = typeof entry.id === "string" ? entry.id : "";
|
|
960
|
+
if (id.toLowerCase() === RESERVED_FIELD_ID) errors.push(`${at}.id — "${RESERVED_FIELD_ID}" is reserved`);
|
|
961
|
+
else if (!FIELD_ID_PATTERN.test(id)) errors.push(`${at}.id — invalid id ${JSON.stringify(entry.id)} (expected ${FIELD_ID_PATTERN.source})`);
|
|
962
|
+
const type = typeof entry.type === "string" ? entry.type : "";
|
|
963
|
+
if (!FIELD_TYPES.has(type)) errors.push(`${at}.type — must be one of ${[...FIELD_TYPES].join(", ")}`);
|
|
964
|
+
if (typeof entry.required !== "boolean") errors.push(`${at}.required — must be true or false`);
|
|
965
|
+
const label = localizedText(`${at}.label`, entry.label, MAX_TEXT_LENGTH, errors);
|
|
966
|
+
const field = {
|
|
967
|
+
id,
|
|
968
|
+
type,
|
|
969
|
+
required: entry.required === true,
|
|
970
|
+
label: label ?? {}
|
|
971
|
+
};
|
|
972
|
+
if (entry.placeholder !== void 0) {
|
|
973
|
+
const placeholder = localizedText(`${at}.placeholder`, entry.placeholder, MAX_TEXT_LENGTH, errors);
|
|
974
|
+
if (placeholder !== null) field.placeholder = placeholder;
|
|
975
|
+
}
|
|
976
|
+
if (type === "select") {
|
|
977
|
+
const options = Array.isArray(entry.options) ? entry.options : [];
|
|
978
|
+
if (options.length < 1 || options.length > MAX_OPTIONS) errors.push(`${at}.options — a select declares 1..${MAX_OPTIONS} options`);
|
|
979
|
+
const seen = /* @__PURE__ */ new Set();
|
|
980
|
+
field.options = [];
|
|
981
|
+
for (const [index, option] of options.slice(0, MAX_OPTIONS).entries()) {
|
|
982
|
+
const optionAt = `${at}.options[${index}]`;
|
|
983
|
+
if (!isRecord(option)) {
|
|
984
|
+
errors.push(`${optionAt} — must be { value, label }`);
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
unknownKeys(optionAt, option, /* @__PURE__ */ new Set(["value", "label"]), errors);
|
|
988
|
+
const value = typeof option.value === "string" ? option.value : "";
|
|
989
|
+
if (!OPTION_VALUE_PATTERN.test(value)) errors.push(`${optionAt}.value — invalid value ${JSON.stringify(option.value)}`);
|
|
990
|
+
else if (seen.has(value)) errors.push(`${optionAt}.value — duplicate value ${JSON.stringify(value)}`);
|
|
991
|
+
seen.add(value);
|
|
992
|
+
const optionLabel = localizedText(`${optionAt}.label`, option.label, MAX_TEXT_LENGTH, errors);
|
|
993
|
+
field.options.push({
|
|
994
|
+
value,
|
|
995
|
+
label: optionLabel ?? {}
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
} else if (entry.options !== void 0) errors.push(`${at}.options — only a select field takes options`);
|
|
999
|
+
if (entry.validation !== void 0) {
|
|
1000
|
+
if (!VALIDATION_TYPES.has(type)) errors.push(`${at}.validation — a ${type || "this"} field takes no validation`);
|
|
1001
|
+
else if (!isRecord(entry.validation)) errors.push(`${at}.validation — must be an object`);
|
|
1002
|
+
else {
|
|
1003
|
+
const rules = entry.validation;
|
|
1004
|
+
unknownKeys(`${at}.validation`, rules, VALIDATION_KEYS, errors);
|
|
1005
|
+
const validation = {};
|
|
1006
|
+
for (const key of ["minLength", "maxLength"]) {
|
|
1007
|
+
const value = rules[key];
|
|
1008
|
+
if (value === void 0) continue;
|
|
1009
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > MAX_VALIDATION_LENGTH) errors.push(`${at}.validation.${key} — must be an integer 0..${MAX_VALIDATION_LENGTH}`);
|
|
1010
|
+
else validation[key] = value;
|
|
1011
|
+
}
|
|
1012
|
+
if (validation.minLength !== void 0 && validation.maxLength !== void 0 && validation.minLength > validation.maxLength) errors.push(`${at}.validation — minLength exceeds maxLength`);
|
|
1013
|
+
if (rules.pattern !== void 0) {
|
|
1014
|
+
if (typeof rules.pattern !== "string" || rules.pattern.length > 200) errors.push(`${at}.validation.pattern — must be a regular expression of at most 200 characters`);
|
|
1015
|
+
else try {
|
|
1016
|
+
new RegExp(rules.pattern);
|
|
1017
|
+
const unsupported = nonRe2Construct(rules.pattern);
|
|
1018
|
+
if (unsupported === null) validation.pattern = rules.pattern;
|
|
1019
|
+
else errors.push(`${at}.validation.pattern — ${unsupported} is not supported (the platform matches with RE2)`);
|
|
1020
|
+
} catch {
|
|
1021
|
+
errors.push(`${at}.validation.pattern — not a valid regular expression`);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
field.validation = validation;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return field;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Validates the declared `formSeeds`: the forms a site is created with, ingested by Core's
|
|
1031
|
+
* `site_forms` seeding. It rejects an unknown key outright and enforces the wire contract
|
|
1032
|
+
* agreed for WS-386 (key and field-id grammar, field types, option and length caps). It mirrors
|
|
1033
|
+
* Core's `normalizeFormInput` exactly — anything Core refuses fails the whole manifest sync, so a
|
|
1034
|
+
* rule changed on the Core side must be changed here too. A merchant-edited form is never
|
|
1035
|
+
* overwritten by a later version of a seed (Core's `editedByMerchant` flag).
|
|
1036
|
+
*
|
|
1037
|
+
* Absent (`undefined`) and empty both mean "this theme seeds no forms".
|
|
1038
|
+
*/
|
|
1039
|
+
function validateFormSeeds(seeds, errors) {
|
|
1040
|
+
if (seeds === void 0) return [];
|
|
1041
|
+
if (!Array.isArray(seeds)) {
|
|
1042
|
+
errors.push("formSeeds — must be an array");
|
|
1043
|
+
return [];
|
|
1044
|
+
}
|
|
1045
|
+
if (seeds.length > MAX_FORM_SEEDS) errors.push(`formSeeds: contains ${seeds.length} seeds — exceeds ${MAX_FORM_SEEDS}`);
|
|
1046
|
+
const normalized = [];
|
|
1047
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1048
|
+
for (const [index, entry] of seeds.slice(0, MAX_FORM_SEEDS).entries()) {
|
|
1049
|
+
const at = `formSeeds[${index}]`;
|
|
1050
|
+
if (!isRecord(entry)) {
|
|
1051
|
+
errors.push(`${at} — must be a form seed object`);
|
|
1052
|
+
continue;
|
|
1053
|
+
}
|
|
1054
|
+
unknownKeys(at, entry, SEED_KEYS, errors);
|
|
1055
|
+
const key = typeof entry.key === "string" ? entry.key : "";
|
|
1056
|
+
if (!FORM_KEY_PATTERN.test(key) || key === RESERVED_FORM_KEY) errors.push(`${at}.key — invalid key ${JSON.stringify(entry.key)} (expected ${FORM_KEY_PATTERN.source}, and "${RESERVED_FORM_KEY}" is reserved)`);
|
|
1057
|
+
else if (keys.has(key)) errors.push(`${at}.key — duplicate key ${JSON.stringify(key)}`);
|
|
1058
|
+
else keys.add(key);
|
|
1059
|
+
const name = stripPlainTextControls(entry.name).trim();
|
|
1060
|
+
if (codePointLength(name) < 1 || codePointLength(name) > MAX_NAME_LENGTH) errors.push(`${at}.name — must contain 1..${MAX_NAME_LENGTH} characters`);
|
|
1061
|
+
const rawFields = Array.isArray(entry.fields) ? entry.fields : [];
|
|
1062
|
+
if (rawFields.length < 1 || rawFields.length > MAX_FIELDS) errors.push(`${at}.fields — must declare 1..${MAX_FIELDS} fields`);
|
|
1063
|
+
const fields = [];
|
|
1064
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1065
|
+
for (const [fieldIndex, rawField] of rawFields.slice(0, MAX_FIELDS).entries()) {
|
|
1066
|
+
const field = validateField(`${at}.fields[${fieldIndex}]`, rawField, errors);
|
|
1067
|
+
if (field === null) continue;
|
|
1068
|
+
if (ids.has(field.id.toLowerCase())) errors.push(`${at}.fields[${fieldIndex}].id — duplicate id ${JSON.stringify(field.id)} (ids are compared ignoring case)`);
|
|
1069
|
+
ids.add(field.id.toLowerCase());
|
|
1070
|
+
fields.push(field);
|
|
1071
|
+
}
|
|
1072
|
+
const actions = validateActions(at, entry.actions, fields, errors);
|
|
1073
|
+
const success = validateSuccess(at, entry.success, errors);
|
|
1074
|
+
normalized.push({
|
|
1075
|
+
key,
|
|
1076
|
+
name,
|
|
1077
|
+
fields,
|
|
1078
|
+
actions,
|
|
1079
|
+
success
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
return normalized;
|
|
1083
|
+
}
|
|
1084
|
+
function validateActions(at, value, fields, errors) {
|
|
1085
|
+
const actions = {
|
|
1086
|
+
notify: false,
|
|
1087
|
+
confirm: false
|
|
1088
|
+
};
|
|
1089
|
+
if (!isRecord(value)) {
|
|
1090
|
+
errors.push(`${at}.actions — must be an object`);
|
|
1091
|
+
return actions;
|
|
1092
|
+
}
|
|
1093
|
+
unknownKeys(`${at}.actions`, value, ACTION_KEYS, errors);
|
|
1094
|
+
const hasEmailField = fields.some((field) => field.type === "email");
|
|
1095
|
+
for (const key of ["notify", "confirm"]) {
|
|
1096
|
+
const flag = value[key];
|
|
1097
|
+
if (flag === void 0) continue;
|
|
1098
|
+
if (typeof flag !== "boolean") errors.push(`${at}.actions.${key} — must be true or false`);
|
|
1099
|
+
else actions[key] = flag;
|
|
1100
|
+
}
|
|
1101
|
+
if (actions.confirm && !hasEmailField) errors.push(`${at}.actions.confirm — needs an email field to send the confirmation to`);
|
|
1102
|
+
if (value.subscribe !== void 0) {
|
|
1103
|
+
const subscribe = value.subscribe;
|
|
1104
|
+
if (!isRecord(subscribe)) errors.push(`${at}.actions.subscribe — must be { list, consentText? }`);
|
|
1105
|
+
else {
|
|
1106
|
+
unknownKeys(`${at}.actions.subscribe`, subscribe, /* @__PURE__ */ new Set(["list", "consentText"]), errors);
|
|
1107
|
+
const list = typeof subscribe.list === "string" ? subscribe.list : "";
|
|
1108
|
+
if (!LIST_KEY_PATTERN.test(list)) errors.push(`${at}.actions.subscribe.list — invalid list ${JSON.stringify(subscribe.list)}`);
|
|
1109
|
+
else actions.subscribe = { list };
|
|
1110
|
+
if (subscribe.consentText !== void 0) {
|
|
1111
|
+
const consentText = consentSentence(`${at}.actions.subscribe.consentText`, subscribe.consentText, errors);
|
|
1112
|
+
if (consentText !== null && actions.subscribe !== void 0) actions.subscribe.consentText = consentText;
|
|
1113
|
+
}
|
|
1114
|
+
if (!hasEmailField) errors.push(`${at}.actions.subscribe — needs an email field to subscribe`);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return actions;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* A subscribe action's consent sentence: a locale map like any label, but plain text only (Core
|
|
1121
|
+
* refuses `<`, `>` and control characters rather than strip them, since the sentence is the proof of consent and must
|
|
1122
|
+
* be stored exactly as the visitor saw it) and up to 500 characters per locale.
|
|
1123
|
+
*/
|
|
1124
|
+
function consentSentence(at, value, errors) {
|
|
1125
|
+
if (isRecord(value)) {
|
|
1126
|
+
for (const [locale, text] of Object.entries(value)) if (typeof text === "string" && /[<>\u0000-\u001f\u007f]/.test(text.trim())) {
|
|
1127
|
+
errors.push(`${at}.${locale} — must be plain text (no < or > or control characters)`);
|
|
1128
|
+
return null;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return localizedText(at, value, MAX_CONSENT_TEXT_LENGTH, errors);
|
|
1132
|
+
}
|
|
1133
|
+
/** Core's `checkFormRedirect`: a site path, or an absolute http(s) URL. */
|
|
1134
|
+
function isFormRedirect(target) {
|
|
1135
|
+
if (target.startsWith("/")) return true;
|
|
1136
|
+
try {
|
|
1137
|
+
const url = new URL(target);
|
|
1138
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
1139
|
+
} catch {
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function validateSuccess(at, value, errors) {
|
|
1144
|
+
if (!isRecord(value)) {
|
|
1145
|
+
errors.push(`${at}.success — must be { message }`);
|
|
1146
|
+
return { message: {} };
|
|
1147
|
+
}
|
|
1148
|
+
unknownKeys(`${at}.success`, value, SUCCESS_KEYS, errors);
|
|
1149
|
+
const success = { message: localizedText(`${at}.success.message`, value.message, MAX_MESSAGE_LENGTH, errors) ?? {} };
|
|
1150
|
+
if (value.redirect !== void 0) {
|
|
1151
|
+
const redirect = localizedText(`${at}.success.redirect`, value.redirect, 500, errors);
|
|
1152
|
+
if (redirect !== null) {
|
|
1153
|
+
for (const [locale, target] of Object.entries(redirect)) if (!isFormRedirect(target)) errors.push(`${at}.success.redirect.${locale} — must be a path starting with "/" or an http(s) URL`);
|
|
1154
|
+
success.redirect = redirect;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return success;
|
|
1158
|
+
}
|
|
1159
|
+
//#endregion
|
|
834
1160
|
//#region src/templates.ts
|
|
835
1161
|
const MAX_TEMPLATES = 8;
|
|
836
1162
|
const MAX_PAGE_SEEDS = 16;
|
|
@@ -1529,6 +1855,7 @@ function scanTheme(opts) {
|
|
|
1529
1855
|
const templates = validateTemplateSeeds(opts.templates ?? [], blocks, errors);
|
|
1530
1856
|
const templateRoles = validateTemplateRoles(opts.templateRoles, blocks, templates, errors);
|
|
1531
1857
|
const pageSeeds = validatePageSeeds(opts.templates ?? [], blocks, templates, templateRoles, errors);
|
|
1858
|
+
const formSeeds = validateFormSeeds(opts.formSeeds, errors);
|
|
1532
1859
|
const messages = readMessages(themeDir, packageJson, errors);
|
|
1533
1860
|
const manifest = {
|
|
1534
1861
|
manifestVersion: 2,
|
|
@@ -1548,6 +1875,7 @@ function scanTheme(opts) {
|
|
|
1548
1875
|
...templates.length === 0 ? {} : { templates },
|
|
1549
1876
|
...templateRoles === void 0 ? {} : { templateRoles },
|
|
1550
1877
|
...pageSeeds.length === 0 ? {} : { pageSeeds },
|
|
1878
|
+
...formSeeds.length === 0 ? {} : { formSeeds },
|
|
1551
1879
|
tokens: readTokens(themeDir, errors),
|
|
1552
1880
|
...messages === void 0 ? {} : { messages }
|
|
1553
1881
|
};
|
|
@@ -2181,4 +2509,4 @@ function readPreviousManifest(themeDir, errors) {
|
|
|
2181
2509
|
return parsed === null ? void 0 : parsed;
|
|
2182
2510
|
}
|
|
2183
2511
|
//#endregion
|
|
2184
|
-
export { validateTemplateRoles as a, validatePageSeeds as i, scanTheme as n, validateTemplateSeeds as o, seedLayout as r, readPreviousManifest as t };
|
|
2512
|
+
export { validateTemplateRoles as a, validatePageSeeds as i, scanTheme as n, validateTemplateSeeds as o, seedLayout as r, validateFormSeeds as s, readPreviousManifest as t };
|
package/dist/scan.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as ScanOptions, O as ScanResult, P as ThemeManifest, S as ManifestRoute, u as DeclaredTemplateSeed, w as ManifestTemplateSeed } from "./types-d9173MhL.js";
|
|
2
2
|
//#region src/scan.d.ts
|
|
3
3
|
export declare function scanTheme(opts: ScanOptions): ScanResult;
|
|
4
4
|
export declare function readPreviousManifest(themeDir: string, errors: string[]): ThemeManifest | undefined;
|
package/dist/scan.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as scanTheme, t as readPreviousManifest } from "./scan-
|
|
1
|
+
import { n as scanTheme, t as readPreviousManifest } from "./scan-B4nn0SQj.js";
|
|
2
2
|
export { readPreviousManifest, scanTheme };
|
|
@@ -320,6 +320,9 @@ interface ThemeManifest {
|
|
|
320
320
|
* byte-identical to the one themes have always emitted. Absent rather than
|
|
321
321
|
* empty when the theme seeds no pages, for the same reason `templates` is. */
|
|
322
322
|
pageSeeds?: ManifestPageSeed[];
|
|
323
|
+
/** The forms the site is created with (`/site/v1/forms/{key}` serves them). Absent rather than
|
|
324
|
+
* empty when the theme seeds none, for the same reason `templates` is. */
|
|
325
|
+
formSeeds?: ManifestFormSeed[];
|
|
323
326
|
tokens: ThemeDesignTokens | LegacyThemeTokens;
|
|
324
327
|
/** The theme's own message catalogue, read from `i18n/<tag>.json` and
|
|
325
328
|
* flattened to dotted keys. Absent rather than empty when the theme ships
|
|
@@ -352,6 +355,62 @@ interface ScanResult {
|
|
|
352
355
|
* `.eldra/manifest.json`. Always resolved, independent of `errors`. */
|
|
353
356
|
breakpoints: LayoutBreakpoints;
|
|
354
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* The field types a seeded form field may take: the WS-386 set (`text`, `email`, `phone`,
|
|
360
|
+
* `textarea`, `select`, `checkbox`, `consent`, `number`, `url`), exactly what Core accepts. `consent` is a checkbox
|
|
361
|
+
* whose value is a boolean and whose `required` means it must be checked.
|
|
362
|
+
*/
|
|
363
|
+
type ManifestFormSeedFieldType = 'text' | 'email' | 'phone' | 'textarea' | 'select' | 'checkbox' | 'consent' | 'number' | 'url';
|
|
364
|
+
interface ManifestFormSeedField {
|
|
365
|
+
id: string;
|
|
366
|
+
type: ManifestFormSeedFieldType;
|
|
367
|
+
required: boolean;
|
|
368
|
+
/** One entry per locale tag, e.g. `{ 'en-US': 'Email', 'is-IS': 'Netfang' }`. */
|
|
369
|
+
label: Record<string, string>;
|
|
370
|
+
placeholder?: Record<string, string>;
|
|
371
|
+
/** A `select` field's options; absent on every other type. */
|
|
372
|
+
options?: Array<{
|
|
373
|
+
value: string;
|
|
374
|
+
label: Record<string, string>;
|
|
375
|
+
}>;
|
|
376
|
+
validation?: {
|
|
377
|
+
minLength?: number;
|
|
378
|
+
maxLength?: number;
|
|
379
|
+
pattern?: string;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* A form the site is created with (`formSeeds` in the manifest). Core creates it only when the
|
|
384
|
+
* key is absent; a seeded form the merchant never edited is refreshed on a theme version bump.
|
|
385
|
+
*/
|
|
386
|
+
interface ManifestFormSeed {
|
|
387
|
+
key: string;
|
|
388
|
+
name: string;
|
|
389
|
+
fields: ManifestFormSeedField[];
|
|
390
|
+
actions: {
|
|
391
|
+
/** Email the merchant's notification recipients on every submission. */
|
|
392
|
+
notify: boolean;
|
|
393
|
+
/** Email the visitor a copy (needs an email field). */
|
|
394
|
+
confirm: boolean;
|
|
395
|
+
/** Subscribe the visitor's email to a list, double opt-in (needs an email field). */
|
|
396
|
+
subscribe?: {
|
|
397
|
+
list: string;
|
|
398
|
+
/**
|
|
399
|
+
* The consent sentence shown beside the submit button, per locale, with a `{shop}`
|
|
400
|
+
* placeholder Core replaces with the shop name. It is sent to marketing as the proof of
|
|
401
|
+
* consent. Plain text, at most 500 characters per locale. Left out, Core fills in its
|
|
402
|
+
* platform default on create, so a seed without it keeps working.
|
|
403
|
+
*/
|
|
404
|
+
consentText?: Record<string, string>;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
success: {
|
|
408
|
+
message: Record<string, string>;
|
|
409
|
+
redirect?: Record<string, string>;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
/** What a theme declares; the same shape, validated by `validateFormSeeds` into `ManifestFormSeed`. */
|
|
413
|
+
type DeclaredFormSeed = ManifestFormSeed;
|
|
355
414
|
interface ScanOptions {
|
|
356
415
|
/** Last validated local manifest, advisory only; Core owns installed history. */
|
|
357
416
|
previousManifest?: ThemeManifest;
|
|
@@ -366,6 +425,8 @@ interface ScanOptions {
|
|
|
366
425
|
* `templates` layouts may reference. Required for a role once any template
|
|
367
426
|
* seed's layout places it. */
|
|
368
427
|
templateRoles?: ManifestTemplateRoles;
|
|
428
|
+
/** The forms a site is created with; see `ManifestFormSeed`. */
|
|
429
|
+
formSeeds?: DeclaredFormSeed[];
|
|
369
430
|
/** The theme's raw, as-configured breakpoints — validated and defaulted
|
|
370
431
|
* into the manifest's `breakpoints` by resolveLayoutBreakpoints (Core),
|
|
371
432
|
* not here. */
|
|
@@ -387,6 +448,10 @@ interface EldraThemeOptions {
|
|
|
387
448
|
* `templates` layouts may reference. Required for a role once any template
|
|
388
449
|
* seed's layout places it. */
|
|
389
450
|
templateRoles?: ManifestTemplateRoles;
|
|
451
|
+
/** The forms a site is created with on its first deploy (at most 8): fields with a label per
|
|
452
|
+
* locale, and which of notify/confirm/subscribe a submission triggers. Never overwrites a
|
|
453
|
+
* form the merchant has edited. */
|
|
454
|
+
formSeeds?: DeclaredFormSeed[];
|
|
390
455
|
/** Theme source root. Nuxt 4 sets Vite's root to app/, so adapters pass rootDir explicitly. */
|
|
391
456
|
themeDir?: string;
|
|
392
457
|
/** Opt in to the Tailwind v4 virtual theme module; false keeps Tailwind entirely optional. */
|
|
@@ -431,4 +496,4 @@ interface EldraThemeOptions {
|
|
|
431
496
|
resolveTokens?: (manifestTokens: ThemeDesignTokens | LegacyThemeTokens) => ThemeDesignTokens;
|
|
432
497
|
}
|
|
433
498
|
//#endregion
|
|
434
|
-
export {
|
|
499
|
+
export { TemplateSeedLayout as A, ManifestTemplateRoles as C, ScanOptions as D, PageSeedTarget as E, ThemeMessages as F, TemplateSeedReusableNode as M, TemplateSeedSchemaApiId as N, ScanResult as O, ThemeManifest as P, ManifestRoute as S, ManifestTemplateSeedBlock as T, ManifestFormSeedFieldType as _, DeclaredPageSeed as a, ManifestPageSeedEntry as b, DeclaredPageSeedRegion as c, DeclaredTemplateSeedBlock as d, DeclaredThemeCodePage as f, ManifestFormSeedField as g, ManifestFormSeed as h, DeclaredFormSeed as i, TemplateSeedLayoutNode as j, TemplateSeedBlockNode as k, DeclaredSeed as l, LegacyThemeTokens as m, BlockField as n, DeclaredPageSeedBlock as o, EldraThemeOptions as p, BlockMigration as r, DeclaredPageSeedEntry as s, BlockDefinition as t, DeclaredTemplateSeed as u, ManifestPageSeed as v, ManifestTemplateSeed as w, ManifestPageSeedRegion as x, ManifestPageSeedBlock as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/vite-plugin-theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Vite plugin for Eldra themes: scans blocks/*/block.json, validates them, emits the theme manifest and the virtual modules the runtime reads (blocks, manifest, block fields, breakpoints, tokens CSS).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"ajv": "^8.17.1",
|
|
44
|
-
"@eldrajs/theme-core": "^0.
|
|
44
|
+
"@eldrajs/theme-core": "^0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tailwindcss/vite": "^4.1.14",
|