@ikas/component-cli 1.4.0-beta.2 → 1.4.0-beta.200
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/dist/build-tools.d.ts +37 -0
- package/dist/build-tools.d.ts.map +1 -0
- package/dist/build-tools.js +36 -0
- package/dist/build-tools.js.map +1 -0
- package/dist/commands/add-sections-to-page.d.ts +3 -0
- package/dist/commands/add-sections-to-page.d.ts.map +1 -0
- package/dist/commands/add-sections-to-page.js +39 -0
- package/dist/commands/add-sections-to-page.js.map +1 -0
- package/dist/commands/add-to-page.d.ts +3 -0
- package/dist/commands/add-to-page.d.ts.map +1 -0
- package/dist/commands/add-to-page.js +41 -0
- package/dist/commands/add-to-page.js.map +1 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +11 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +5 -165
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/config.d.ts +35 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1235 -228
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/create-design-tokens.d.ts +24 -0
- package/dist/commands/create-design-tokens.d.ts.map +1 -0
- package/dist/commands/create-design-tokens.js +327 -0
- package/dist/commands/create-design-tokens.js.map +1 -0
- package/dist/commands/create-global-variable.d.ts +3 -0
- package/dist/commands/create-global-variable.d.ts.map +1 -0
- package/dist/commands/create-global-variable.js +73 -0
- package/dist/commands/create-global-variable.js.map +1 -0
- package/dist/commands/create-page.d.ts +3 -0
- package/dist/commands/create-page.d.ts.map +1 -0
- package/dist/commands/create-page.js +31 -0
- package/dist/commands/create-page.js.map +1 -0
- package/dist/commands/delete-page.d.ts +3 -0
- package/dist/commands/delete-page.d.ts.map +1 -0
- package/dist/commands/delete-page.js +28 -0
- package/dist/commands/delete-page.js.map +1 -0
- package/dist/commands/delete-theme-globals.d.ts +4 -0
- package/dist/commands/delete-theme-globals.d.ts.map +1 -0
- package/dist/commands/delete-theme-globals.js +48 -0
- package/dist/commands/delete-theme-globals.js.map +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +398 -53
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/enable-builtin-pages.d.ts +3 -0
- package/dist/commands/enable-builtin-pages.d.ts.map +1 -0
- package/dist/commands/enable-builtin-pages.js +27 -0
- package/dist/commands/enable-builtin-pages.js.map +1 -0
- package/dist/commands/get-component-props.d.ts +3 -0
- package/dist/commands/get-component-props.d.ts.map +1 -0
- package/dist/commands/get-component-props.js +32 -0
- package/dist/commands/get-component-props.js.map +1 -0
- package/dist/commands/get-page-by-type.d.ts +3 -0
- package/dist/commands/get-page-by-type.d.ts.map +1 -0
- package/dist/commands/get-page-by-type.js +25 -0
- package/dist/commands/get-page-by-type.js.map +1 -0
- package/dist/commands/get-section-values.d.ts +3 -0
- package/dist/commands/get-section-values.d.ts.map +1 -0
- package/dist/commands/get-section-values.js +39 -0
- package/dist/commands/get-section-values.js.map +1 -0
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +25 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/list-builtin-pages.d.ts +3 -0
- package/dist/commands/list-builtin-pages.d.ts.map +1 -0
- package/dist/commands/list-builtin-pages.js +28 -0
- package/dist/commands/list-builtin-pages.js.map +1 -0
- package/dist/commands/list-entities.d.ts +3 -0
- package/dist/commands/list-entities.d.ts.map +1 -0
- package/dist/commands/list-entities.js +32 -0
- package/dist/commands/list-entities.js.map +1 -0
- package/dist/commands/list-imported.d.ts +3 -0
- package/dist/commands/list-imported.d.ts.map +1 -0
- package/dist/commands/list-imported.js +25 -0
- package/dist/commands/list-imported.js.map +1 -0
- package/dist/commands/list-page-sections.d.ts +3 -0
- package/dist/commands/list-page-sections.d.ts.map +1 -0
- package/dist/commands/list-page-sections.js +31 -0
- package/dist/commands/list-page-sections.js.map +1 -0
- package/dist/commands/list-pages.d.ts +3 -0
- package/dist/commands/list-pages.d.ts.map +1 -0
- package/dist/commands/list-pages.js +21 -0
- package/dist/commands/list-pages.js.map +1 -0
- package/dist/commands/list-theme-globals.d.ts +3 -0
- package/dist/commands/list-theme-globals.d.ts.map +1 -0
- package/dist/commands/list-theme-globals.js +22 -0
- package/dist/commands/list-theme-globals.js.map +1 -0
- package/dist/commands/move-page-section.d.ts +3 -0
- package/dist/commands/move-page-section.d.ts.map +1 -0
- package/dist/commands/move-page-section.js +62 -0
- package/dist/commands/move-page-section.js.map +1 -0
- package/dist/commands/publish-theme.d.ts +3 -0
- package/dist/commands/publish-theme.d.ts.map +1 -0
- package/dist/commands/publish-theme.js +29 -0
- package/dist/commands/publish-theme.js.map +1 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +54 -3
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/remove-page-section.d.ts +3 -0
- package/dist/commands/remove-page-section.d.ts.map +1 -0
- package/dist/commands/remove-page-section.js +40 -0
- package/dist/commands/remove-page-section.js.map +1 -0
- package/dist/commands/search-products.d.ts +3 -0
- package/dist/commands/search-products.d.ts.map +1 -0
- package/dist/commands/search-products.js +40 -0
- package/dist/commands/search-products.js.map +1 -0
- package/dist/commands/update-builtin-page-prop.d.ts +3 -0
- package/dist/commands/update-builtin-page-prop.d.ts.map +1 -0
- package/dist/commands/update-builtin-page-prop.js +49 -0
- package/dist/commands/update-builtin-page-prop.js.map +1 -0
- package/dist/commands/update-global-variable.d.ts +3 -0
- package/dist/commands/update-global-variable.d.ts.map +1 -0
- package/dist/commands/update-global-variable.js +70 -0
- package/dist/commands/update-global-variable.js.map +1 -0
- package/dist/commands/update-page-sections.d.ts +3 -0
- package/dist/commands/update-page-sections.d.ts.map +1 -0
- package/dist/commands/update-page-sections.js +39 -0
- package/dist/commands/update-page-sections.js.map +1 -0
- package/dist/commands/update-section-prop.d.ts +3 -0
- package/dist/commands/update-section-prop.d.ts.map +1 -0
- package/dist/commands/update-section-prop.js +76 -0
- package/dist/commands/update-section-prop.js.map +1 -0
- package/dist/commands/upload-image.d.ts +3 -0
- package/dist/commands/upload-image.d.ts.map +1 -0
- package/dist/commands/upload-image.js +38 -0
- package/dist/commands/upload-image.js.map +1 -0
- package/dist/commands/upload-images.d.ts +3 -0
- package/dist/commands/upload-images.d.ts.map +1 -0
- package/dist/commands/upload-images.js +48 -0
- package/dist/commands/upload-images.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +52 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/compile.d.ts +17 -2
- package/dist/utils/compile.d.ts.map +1 -1
- package/dist/utils/compile.js +750 -117
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/component-helpers.d.ts +148 -3
- package/dist/utils/component-helpers.d.ts.map +1 -1
- package/dist/utils/component-helpers.js +376 -29
- package/dist/utils/component-helpers.js.map +1 -1
- package/dist/utils/css-import-resolver.d.ts +4 -1
- package/dist/utils/css-import-resolver.d.ts.map +1 -1
- package/dist/utils/css-import-resolver.js +9 -1
- package/dist/utils/css-import-resolver.js.map +1 -1
- package/dist/utils/editor-action-client.d.ts +29 -0
- package/dist/utils/editor-action-client.d.ts.map +1 -0
- package/dist/utils/editor-action-client.js +137 -0
- package/dist/utils/editor-action-client.js.map +1 -0
- package/dist/utils/esm-transform.d.ts +30 -0
- package/dist/utils/esm-transform.d.ts.map +1 -1
- package/dist/utils/esm-transform.js +169 -2
- package/dist/utils/esm-transform.js.map +1 -1
- package/dist/utils/find-component-for-file.d.ts +12 -0
- package/dist/utils/find-component-for-file.d.ts.map +1 -0
- package/dist/utils/find-component-for-file.js +24 -0
- package/dist/utils/find-component-for-file.js.map +1 -0
- package/dist/utils/forbid-deep-imports.d.ts +3 -0
- package/dist/utils/forbid-deep-imports.d.ts.map +1 -0
- package/dist/utils/forbid-deep-imports.js +54 -0
- package/dist/utils/forbid-deep-imports.js.map +1 -0
- package/dist/utils/forbid-external-packages.d.ts +26 -0
- package/dist/utils/forbid-external-packages.d.ts.map +1 -0
- package/dist/utils/forbid-external-packages.js +99 -0
- package/dist/utils/forbid-external-packages.js.map +1 -0
- package/dist/utils/load-image.d.ts +16 -0
- package/dist/utils/load-image.d.ts.map +1 -0
- package/dist/utils/load-image.js +50 -0
- package/dist/utils/load-image.js.map +1 -0
- package/dist/utils/vendor-storefront.d.ts +13 -0
- package/dist/utils/vendor-storefront.d.ts.map +1 -0
- package/dist/utils/vendor-storefront.js +91 -0
- package/dist/utils/vendor-storefront.js.map +1 -0
- package/dist/utils/websocket-server.d.ts +134 -3
- package/dist/utils/websocket-server.d.ts.map +1 -1
- package/dist/utils/websocket-server.js +279 -24
- package/dist/utils/websocket-server.js.map +1 -1
- package/package.json +17 -2
- package/templates/add/section.css +11 -0
- package/dist/commands/create.d.ts +0 -9
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -9
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -39
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -212
- package/dist/commands/proxy.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
const VALID_TYPES = [
|
|
4
|
+
"TEXT",
|
|
5
|
+
"RICH_TEXT",
|
|
6
|
+
"IMAGE",
|
|
7
|
+
"COLOR",
|
|
8
|
+
"NUMBER",
|
|
9
|
+
"BOOLEAN",
|
|
10
|
+
"BORDER",
|
|
11
|
+
"SHADOW",
|
|
12
|
+
"ENUM",
|
|
13
|
+
];
|
|
14
|
+
function parseValue(raw) {
|
|
15
|
+
if (raw == null)
|
|
16
|
+
return undefined;
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(raw);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return raw;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function runUpdateGlobalVariable(options) {
|
|
25
|
+
if (!options.name) {
|
|
26
|
+
printErrorAndExit(new Error("--name is required (the variable's runtime key, from list-theme-globals)"));
|
|
27
|
+
}
|
|
28
|
+
if (options.type && !VALID_TYPES.includes(options.type)) {
|
|
29
|
+
printErrorAndExit(new Error(`--type must be one of: ${VALID_TYPES.join(", ")}`));
|
|
30
|
+
}
|
|
31
|
+
// `--enum-type-id` alone re-points an existing ENUM global; with a type it must be ENUM.
|
|
32
|
+
if (options.enumTypeId && options.type && options.type !== "ENUM") {
|
|
33
|
+
printErrorAndExit(new Error("--enum-type-id is only valid for ENUM globals (--type ENUM, or omit --type)"));
|
|
34
|
+
}
|
|
35
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
36
|
+
try {
|
|
37
|
+
const result = await runEditorAction("update-global-variable", {
|
|
38
|
+
name: options.name,
|
|
39
|
+
...(options.displayName !== undefined
|
|
40
|
+
? { displayName: options.displayName }
|
|
41
|
+
: {}),
|
|
42
|
+
...(options.type !== undefined ? { type: options.type } : {}),
|
|
43
|
+
...(options.value !== undefined
|
|
44
|
+
? { value: parseValue(options.value) }
|
|
45
|
+
: {}),
|
|
46
|
+
...(options.enumTypeId !== undefined
|
|
47
|
+
? { enumTypeId: options.enumTypeId }
|
|
48
|
+
: {}),
|
|
49
|
+
}, port ? { port } : {});
|
|
50
|
+
printResultAndExit(result);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
printErrorAndExit(e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function createUpdateGlobalVariableCommand() {
|
|
57
|
+
const cmd = new Command("update-global-variable");
|
|
58
|
+
cmd
|
|
59
|
+
.description("Update a global variable's value, display name, type and/or enum in the connected editor. " +
|
|
60
|
+
"Changing the type or enum of a global that props are bound to is rejected — unbind them first.")
|
|
61
|
+
.requiredOption("--name <key>", "The variable's runtime key (from `list-theme-globals`)")
|
|
62
|
+
.option("--display-name <name>", "New human-facing label")
|
|
63
|
+
.option("--type <type>", `New value type: ${VALID_TYPES.join(" | ")}`)
|
|
64
|
+
.option("--value <json>", "New value (JSON for objects/null; plain string also accepted). ENUM: one of the enum's option VALUES, not a label")
|
|
65
|
+
.option("--enum-type-id <id>", "ENUM only: id of the project enum to select from (from `list-theme-globals` → enumTypes[]); may be passed without --type")
|
|
66
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
67
|
+
.action(runUpdateGlobalVariable);
|
|
68
|
+
return cmd;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=update-global-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-global-variable.js","sourceRoot":"","sources":["../../src/commands/update-global-variable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAClB,MAAM;IACN,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,MAAM;CACP,CAAC;AAWF,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,OAAoC;IAEpC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,iBAAiB,CACf,IAAI,KAAK,CACP,0EAA0E,CAC3E,CACF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,IAA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CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iCAAiC;IAC/C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAClD,GAAG;SACA,WAAW,CACV,4FAA4F;QAC1F,gGAAgG,CACnG;SACA,cAAc,CACb,cAAc,EACd,wDAAwD,CACzD;SACA,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;SACzD,MAAM,CAAC,eAAe,EAAE,mBAAmB,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SACrE,MAAM,CACL,gBAAgB,EAChB,mHAAmH,CACpH;SACA,MAAM,CACL,qBAAqB,EACrB,0HAA0H,CAC3H;SACA,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-page-sections.d.ts","sourceRoot":"","sources":["../../src/commands/update-page-sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiDpC,wBAAgB,+BAA+B,IAAI,OAAO,CAczD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runUpdatePageSections(options) {
|
|
4
|
+
if (!options.pageId || typeof options.pageId !== "string") {
|
|
5
|
+
printErrorAndExit(new Error("--page-id is required (use `ikas-component list-pages`)"));
|
|
6
|
+
}
|
|
7
|
+
if (options.sections === undefined) {
|
|
8
|
+
printErrorAndExit(new Error('--sections is required: a JSON array, e.g. \'[{"elementId":"<id>","updates":[{"propName":"heading","value":{"value":"Hi"}}]}]\''));
|
|
9
|
+
}
|
|
10
|
+
let sections;
|
|
11
|
+
try {
|
|
12
|
+
sections = JSON.parse(options.sections);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
printErrorAndExit(new Error(`--sections must be valid JSON. Received: ${options.sections}`));
|
|
16
|
+
}
|
|
17
|
+
if (!Array.isArray(sections) || sections.length === 0) {
|
|
18
|
+
printErrorAndExit(new Error('--sections must be a non-empty JSON array of { elementId, updates: [...] } objects.'));
|
|
19
|
+
}
|
|
20
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
21
|
+
try {
|
|
22
|
+
const result = await runEditorAction("update-page-sections", { pageId: options.pageId, sections }, { ...(port ? { port } : {}), timeoutMs: 30_000 });
|
|
23
|
+
printResultAndExit(result);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
printErrorAndExit(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function createUpdatePageSectionsCommand() {
|
|
30
|
+
const cmd = new Command("update-page-sections");
|
|
31
|
+
cmd
|
|
32
|
+
.description("Fill MANY placed sections of a page in one call. --sections is a JSON array of { elementId, updates: [{ propId|propName, value }] }, each value using the same per-type shape as update-section-prop. All-or-nothing across the whole page: every value is resolved and validated before any is written. A COMMON (global) section among them — the theme's header/footer — is written to its one theme-wide record on the INDEX (Home) page, so it changes on every page (see the result's `common` block); a header/footer that is missing from the INDEX page rejects the whole call.")
|
|
33
|
+
.requiredOption("--page-id <id>", "Page id (from `ikas-component list-pages`)")
|
|
34
|
+
.requiredOption("--sections <json>", 'JSON array, e.g. \'[{"elementId":"<id>","updates":[{"propName":"heading","value":{"value":"Hi"}}]}]\'')
|
|
35
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
36
|
+
.action(runUpdatePageSections);
|
|
37
|
+
return cmd;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=update-page-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-page-sections.js","sourceRoot":"","sources":["../../src/commands/update-page-sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAQ1C,KAAK,UAAU,qBAAqB,CAAC,OAAkC;IACrE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1D,iBAAiB,CAAC,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,iBAAiB,CACf,IAAI,KAAK,CACP,iIAAiI,CAClI,CACF,CAAC;IACJ,CAAC;IACD,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB,CAAC,IAAI,KAAK,CAAC,4CAA4C,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC/F,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,iBAAiB,CACf,IAAI,KAAK,CAAC,qFAAqF,CAAC,CACjG,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,sBAAsB,EACtB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EACpC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CACjD,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChD,GAAG;SACA,WAAW,CACV,0jBAA0jB,CAC3jB;SACA,cAAc,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SAC9E,cAAc,CACb,mBAAmB,EACnB,uGAAuG,CACxG;SACA,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-section-prop.d.ts","sourceRoot":"","sources":["../../src/commands/update-section-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6EpC,wBAAgB,8BAA8B,IAAI,OAAO,CA0BxD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runUpdateSectionProp(options) {
|
|
4
|
+
if (!options.pageId || typeof options.pageId !== "string") {
|
|
5
|
+
printErrorAndExit(new Error("--page-id is required (use `ikas-component list-pages` to discover ids)"));
|
|
6
|
+
}
|
|
7
|
+
if (!options.elementId || typeof options.elementId !== "string") {
|
|
8
|
+
printErrorAndExit(new Error("--element-id is required (use `ikas-component list-page-sections` to discover ids)"));
|
|
9
|
+
}
|
|
10
|
+
if (!options.propId && !options.propName) {
|
|
11
|
+
printErrorAndExit(new Error("Provide --prop-id or --prop-name (see `ikas-component list-page-sections`)"));
|
|
12
|
+
}
|
|
13
|
+
if (options.value === undefined && !options.bindGlobal) {
|
|
14
|
+
printErrorAndExit(new Error("Provide --value (JSON, e.g. '{\"value\":\"Hello\"}') or --bind-global <name> to bind a global variable"));
|
|
15
|
+
}
|
|
16
|
+
let value;
|
|
17
|
+
if (options.value !== undefined) {
|
|
18
|
+
try {
|
|
19
|
+
value = JSON.parse(options.value);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
printErrorAndExit(new Error(`--value must be valid JSON (e.g. '{"value":"Hello"}'). Received: ${options.value}`));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let listPath;
|
|
26
|
+
if (options.listPath !== undefined) {
|
|
27
|
+
try {
|
|
28
|
+
listPath = JSON.parse(options.listPath);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
printErrorAndExit(new Error(`--list-path must be valid JSON. Received: ${options.listPath}`));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
35
|
+
try {
|
|
36
|
+
const result = await runEditorAction("update-section-prop", {
|
|
37
|
+
pageId: options.pageId,
|
|
38
|
+
elementId: options.elementId,
|
|
39
|
+
...(options.propId ? { propId: options.propId } : {}),
|
|
40
|
+
...(options.propName ? { propName: options.propName } : {}),
|
|
41
|
+
...(options.bindGlobal
|
|
42
|
+
? { bindGlobal: options.bindGlobal, ...(listPath ? { listPath } : {}) }
|
|
43
|
+
: { value }),
|
|
44
|
+
}, port ? { port } : {});
|
|
45
|
+
printResultAndExit(result);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
printErrorAndExit(e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function createUpdateSectionPropCommand() {
|
|
52
|
+
const cmd = new Command("update-section-prop");
|
|
53
|
+
cmd
|
|
54
|
+
.description([
|
|
55
|
+
"Change a single prop value of a section placed on a page. Target the placement by its elementId (from `ikas-component list-page-sections`) and the prop by --prop-id or --prop-name.",
|
|
56
|
+
"--value is the JSON-encoded prop value. Shape depends on the prop type:",
|
|
57
|
+
" Scalars (TEXT/RICH_TEXT/BOOLEAN/NUMBER/COLOR/ENUM/DATE) are { \"value\": <scalar> } — e.g. '{\"value\":\"Hello\"}', '{\"value\":true}', '{\"value\":\"#FF0000\"}'.",
|
|
58
|
+
" Object props are NOT wrapped: IMAGE/VIDEO/SVG = '{\"id\":\"<asset-id>\",\"altText\":\"...\"}' (get id via `ikas-component upload-image`); PRODUCT = '{\"productId\":\"...\"}'.",
|
|
59
|
+
" LINK = a single link object needing id + linkType + label + subLinks: PAGE = '{\"id\":\"<unique>\",\"linkType\":\"PAGE\",\"label\":\"Home\",\"pageId\":\"<id>\",\"pageType\":\"INDEX\",\"subLinks\":[]}'; EXTERNAL = '{\"id\":\"<unique>\",\"linkType\":\"EXTERNAL\",\"label\":\"Docs\",\"externalLink\":\"https://...\",\"subLinks\":[]}'. (pageId/pageType from `list-pages`.) LIST_OF_LINK = '{\"links\":[<link>,...]}'.",
|
|
60
|
+
" COMPONENT_LIST = '{\"components\":[{\"id\":\"<unique>\",\"codeComponentId\":\"<child-id>\",\"propValues\":{\"<childProp>\":<value>}}]}' (single COMPONENT = one such entry). Each entry needs a unique id and codeComponentId (or componentId); child propValues use the same per-type shapes recursively.",
|
|
61
|
+
" The value REPLACES the whole prop — to edit a COMPONENT_LIST, read the current value from `list-page-sections` and resend the entire array. Wrong shapes are rejected with an error, not stored silently.",
|
|
62
|
+
"COMMON (global) sections — the theme's header/footer — share ONE set of prop values across every page, stored on the INDEX (Home) page's placement: the write lands there whatever --page-id you pass and changes that section on ALL pages (the result's `common` block says so, and the echoed value is read back from that canonical placement). Read the current values first (`get-section-values`) and change only what you mean to; if the INDEX page has no placement of the section, add it there first — otherwise the write is rejected.",
|
|
63
|
+
"Instead of --value, use --bind-global <name> to bind the prop to a project GLOBAL variable (Theme Setting) as a live dynamic value — pass the global's `name` (variableName) from `ikas-component list-theme-globals`. Add --list-path to bind a prop of a COMPONENT_LIST child (then --prop-id is the child's prop id).",
|
|
64
|
+
].join("\n"))
|
|
65
|
+
.requiredOption("--page-id <id>", "Page id (from `ikas-component list-pages`)")
|
|
66
|
+
.requiredOption("--element-id <id>", "Placed section elementId (from `ikas-component list-page-sections`)")
|
|
67
|
+
.option("--prop-id <id>", "Blueprint prop id to update")
|
|
68
|
+
.option("--prop-name <name>", "Blueprint prop name to update (alternative to --prop-id)")
|
|
69
|
+
.option("--value <json>", 'JSON-encoded prop value, e.g. \'{"value":"Hello"}\' (omit when using --bind-global)')
|
|
70
|
+
.option("--bind-global <name>", "Bind the prop to a global variable (its name/variableName from list-theme-globals) instead of a static value")
|
|
71
|
+
.option("--list-path <json>", 'JSON [{ "propId", "index" }, ...] targeting a COMPONENT_LIST child when using --bind-global')
|
|
72
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
73
|
+
.action(runUpdateSectionProp);
|
|
74
|
+
return cmd;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=update-section-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-section-prop.js","sourceRoot":"","sources":["../../src/commands/update-section-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAa1C,KAAK,UAAU,oBAAoB,CAAC,OAAiC;IACnE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1D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AI,CAAC,CACb;SACA,cAAc,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SAC9E,cAAc,CAAC,mBAAmB,EAAE,qEAAqE,CAAC;SAC1G,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;SACvD,MAAM,CAAC,oBAAoB,EAAE,0DAA0D,CAAC;SACxF,MAAM,CAAC,gBAAgB,EAAE,qFAAqF,CAAC;SAC/G,MAAM,CAAC,sBAAsB,EAAE,8GAA8G,CAAC;SAC9I,MAAM,CAAC,oBAAoB,EAAE,6FAA6F,CAAC;SAC3H,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-image.d.ts","sourceRoot":"","sources":["../../src/commands/upload-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyCpC,wBAAgB,wBAAwB,IAAI,OAAO,CAYlD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
import { loadImageSource } from "../utils/load-image.js";
|
|
4
|
+
async function runUploadImage(options) {
|
|
5
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
6
|
+
if (!options.file && !options.url) {
|
|
7
|
+
printErrorAndExit(new Error("Provide --file <path> or --url <url>"));
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const { base64, mimeType, fileName } = await loadImageSource({ file: options.file, url: options.url });
|
|
11
|
+
const result = await runEditorAction("upload-image", {
|
|
12
|
+
base64,
|
|
13
|
+
mimeType,
|
|
14
|
+
fileName,
|
|
15
|
+
...(options.alt ? { altText: options.alt } : {}),
|
|
16
|
+
isVideo: false,
|
|
17
|
+
},
|
|
18
|
+
// Uploads carry the full image payload and round-trip to the host, so give
|
|
19
|
+
// them a far more generous timeout than the default 10s.
|
|
20
|
+
{ ...(port ? { port } : {}), timeoutMs: 60_000 });
|
|
21
|
+
printResultAndExit(result);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
printErrorAndExit(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function createUploadImageCommand() {
|
|
28
|
+
const cmd = new Command("upload-image");
|
|
29
|
+
cmd
|
|
30
|
+
.description("Upload an image to the connected editor's project and return its image id. Supply the image with --file (local path) or --url. The returned id can be used as the `id` of an IMAGE prop value via `ikas-component update-section-prop`. Requires the editor to be embedded in the ikas admin panel (the host performs the actual upload).")
|
|
31
|
+
.option("--file <path>", "Local image file path (.png, .jpg, .jpeg, .webp, .gif)")
|
|
32
|
+
.option("--url <url>", "Image URL to fetch and upload")
|
|
33
|
+
.option("--alt <text>", "Alt text for the image")
|
|
34
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
35
|
+
.action(runUploadImage);
|
|
36
|
+
return cmd;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=upload-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-image.js","sourceRoot":"","sources":["../../src/commands/upload-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASzD,KAAK,UAAU,cAAc,CAAC,OAA2B;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC,OAAO,CAAC,IAAI,IAA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AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-images.d.ts","sourceRoot":"","sources":["../../src/commands/upload-images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8DpC,wBAAgB,yBAAyB,IAAI,OAAO,CAanD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
import { loadImageSource } from "../utils/load-image.js";
|
|
4
|
+
async function runUploadImages(options) {
|
|
5
|
+
if (options.manifest === undefined) {
|
|
6
|
+
printErrorAndExit(new Error('--manifest is required: a JSON array, e.g. \'[{"file":"/a.png","alt":"A"},{"url":"https://...","alt":"B"}]\''));
|
|
7
|
+
}
|
|
8
|
+
let manifest;
|
|
9
|
+
try {
|
|
10
|
+
manifest = JSON.parse(options.manifest);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
printErrorAndExit(new Error(`--manifest must be valid JSON. Received: ${options.manifest}`));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!Array.isArray(manifest) || manifest.length === 0) {
|
|
17
|
+
printErrorAndExit(new Error("--manifest must be a non-empty JSON array of { file|url, alt? } objects."));
|
|
18
|
+
}
|
|
19
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
20
|
+
try {
|
|
21
|
+
// Read/encode all sources in parallel, then send one batch editor-action.
|
|
22
|
+
const images = await Promise.all(manifest.map(async (entry) => {
|
|
23
|
+
const { base64, mimeType, fileName } = await loadImageSource({ file: entry.file, url: entry.url });
|
|
24
|
+
return {
|
|
25
|
+
base64,
|
|
26
|
+
mimeType,
|
|
27
|
+
fileName,
|
|
28
|
+
...(entry.alt ? { altText: entry.alt } : {}),
|
|
29
|
+
isVideo: false,
|
|
30
|
+
};
|
|
31
|
+
}));
|
|
32
|
+
const result = await runEditorAction("upload-images", { images }, { ...(port ? { port } : {}), timeoutMs: 60_000 });
|
|
33
|
+
printResultAndExit(result);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
printErrorAndExit(e);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function createUploadImagesCommand() {
|
|
40
|
+
const cmd = new Command("upload-images");
|
|
41
|
+
cmd
|
|
42
|
+
.description("Upload MANY images in one call (batch upload-image) and return their ids in order. --manifest is a JSON array of { file|url, alt? }. The host uploads them all in a single round-trip. Requires the editor embedded in the ikas admin panel.")
|
|
43
|
+
.requiredOption("--manifest <json>", 'JSON array, e.g. \'[{"file":"/a.png","alt":"A"},{"url":"https://x/b.jpg"}]\'')
|
|
44
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
45
|
+
.action(runUploadImages);
|
|
46
|
+
return cmd;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=upload-images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-images.js","sourceRoot":"","sources":["../../src/commands/upload-images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAazD,KAAK,UAAU,eAAe,CAAC,OAA4B;IACzD,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,iBAAiB,CACf,IAAI,KAAK,CAAC,8GAA8G,CAAC,CAC1H,CAAC;IACJ,CAAC;IACD,IAAI,QAAyB,CAAC;IAC9B,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB,CAAC,IAAI,KAAK,CAAC,4CAA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AC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACzC,GAAG;SACA,WAAW,CACV,8OAA8O,CAC/O;SACA,cAAc,CACb,mBAAmB,EACnB,8EAA8E,CAC/E;SACA,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyGpC,wBAAgB,GAAG,qBAElB;AAED,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import { createAddSectionsToPageCommand } from "./commands/add-sections-to-page.js";
|
|
3
|
+
import { createAddToPageCommand } from "./commands/add-to-page.js";
|
|
2
4
|
import { createAddCommand } from "./commands/add.js";
|
|
3
5
|
import { createBuildCommand } from "./commands/build.js";
|
|
4
6
|
import { createCheckCommand } from "./commands/check.js";
|
|
5
7
|
import { createConfigCommand } from "./commands/config.js";
|
|
8
|
+
import { createCreateBreakpointCommand, createCreateColorCommand, createCreateColorSchemeCommand, createCreateKeyframeCommand, createCreateTextStyleCommand, createRenameColorSchemeSlotCommand, createUpdateBreakpointCommand, createUpdateColorCommand, createUpdateColorSchemeCommand, createUpdateKeyframeCommand, createUpdateTextStyleCommand, } from "./commands/create-design-tokens.js";
|
|
9
|
+
import { createCreateGlobalVariableCommand } from "./commands/create-global-variable.js";
|
|
10
|
+
import { createCreatePageCommand } from "./commands/create-page.js";
|
|
11
|
+
import { createDeletePageCommand } from "./commands/delete-page.js";
|
|
12
|
+
import { createDeleteDesignTokenCommand, createDeleteGlobalVariableCommand, } from "./commands/delete-theme-globals.js";
|
|
6
13
|
import { createDevCommand } from "./commands/dev.js";
|
|
14
|
+
import { createGetComponentPropsCommand } from "./commands/get-component-props.js";
|
|
15
|
+
import { createEnableBuiltinPagesCommand } from "./commands/enable-builtin-pages.js";
|
|
16
|
+
import { createGetPageByTypeCommand } from "./commands/get-page-by-type.js";
|
|
17
|
+
import { createListBuiltinPagesCommand } from "./commands/list-builtin-pages.js";
|
|
18
|
+
import { createUpdateBuiltinPagePropCommand } from "./commands/update-builtin-page-prop.js";
|
|
19
|
+
import { createGetSectionValuesCommand } from "./commands/get-section-values.js";
|
|
20
|
+
import { createImportCommand } from "./commands/import.js";
|
|
21
|
+
import { createListEntitiesCommand } from "./commands/list-entities.js";
|
|
22
|
+
import { createListImportedCommand } from "./commands/list-imported.js";
|
|
23
|
+
import { createListPageSectionsCommand } from "./commands/list-page-sections.js";
|
|
24
|
+
import { createMovePageSectionCommand } from "./commands/move-page-section.js";
|
|
25
|
+
import { createRemovePageSectionCommand } from "./commands/remove-page-section.js";
|
|
26
|
+
import { createListPagesCommand } from "./commands/list-pages.js";
|
|
27
|
+
import { createListThemeGlobalsCommand } from "./commands/list-theme-globals.js";
|
|
28
|
+
import { createPublishThemeCommand } from "./commands/publish-theme.js";
|
|
7
29
|
import { createPublishCommand } from "./commands/publish.js";
|
|
30
|
+
import { createSearchProductsCommand } from "./commands/search-products.js";
|
|
31
|
+
import { createUpdateGlobalVariableCommand } from "./commands/update-global-variable.js";
|
|
32
|
+
import { createUpdatePageSectionsCommand } from "./commands/update-page-sections.js";
|
|
33
|
+
import { createUpdateSectionPropCommand } from "./commands/update-section-prop.js";
|
|
34
|
+
import { createUploadImageCommand } from "./commands/upload-image.js";
|
|
35
|
+
import { createUploadImagesCommand } from "./commands/upload-images.js";
|
|
8
36
|
const program = new Command();
|
|
9
37
|
program
|
|
10
38
|
.name("ikas-component")
|
|
@@ -17,6 +45,45 @@ program.addCommand(createBuildCommand());
|
|
|
17
45
|
program.addCommand(createPublishCommand());
|
|
18
46
|
program.addCommand(createCheckCommand());
|
|
19
47
|
program.addCommand(createConfigCommand());
|
|
48
|
+
program.addCommand(createListPagesCommand());
|
|
49
|
+
program.addCommand(createListImportedCommand());
|
|
50
|
+
program.addCommand(createImportCommand());
|
|
51
|
+
program.addCommand(createAddToPageCommand());
|
|
52
|
+
program.addCommand(createListThemeGlobalsCommand());
|
|
53
|
+
program.addCommand(createCreateGlobalVariableCommand());
|
|
54
|
+
program.addCommand(createCreateColorCommand());
|
|
55
|
+
program.addCommand(createUpdateColorCommand());
|
|
56
|
+
program.addCommand(createCreateTextStyleCommand());
|
|
57
|
+
program.addCommand(createUpdateTextStyleCommand());
|
|
58
|
+
program.addCommand(createCreateBreakpointCommand());
|
|
59
|
+
program.addCommand(createUpdateBreakpointCommand());
|
|
60
|
+
program.addCommand(createCreateKeyframeCommand());
|
|
61
|
+
program.addCommand(createUpdateKeyframeCommand());
|
|
62
|
+
program.addCommand(createCreateColorSchemeCommand());
|
|
63
|
+
program.addCommand(createUpdateColorSchemeCommand());
|
|
64
|
+
program.addCommand(createRenameColorSchemeSlotCommand());
|
|
65
|
+
program.addCommand(createUpdateGlobalVariableCommand());
|
|
66
|
+
program.addCommand(createDeleteGlobalVariableCommand());
|
|
67
|
+
program.addCommand(createDeleteDesignTokenCommand());
|
|
68
|
+
program.addCommand(createAddSectionsToPageCommand());
|
|
69
|
+
program.addCommand(createListPageSectionsCommand());
|
|
70
|
+
program.addCommand(createMovePageSectionCommand());
|
|
71
|
+
program.addCommand(createRemovePageSectionCommand());
|
|
72
|
+
program.addCommand(createGetSectionValuesCommand());
|
|
73
|
+
program.addCommand(createGetComponentPropsCommand());
|
|
74
|
+
program.addCommand(createGetPageByTypeCommand());
|
|
75
|
+
program.addCommand(createListBuiltinPagesCommand());
|
|
76
|
+
program.addCommand(createUpdateBuiltinPagePropCommand());
|
|
77
|
+
program.addCommand(createEnableBuiltinPagesCommand());
|
|
78
|
+
program.addCommand(createCreatePageCommand());
|
|
79
|
+
program.addCommand(createDeletePageCommand());
|
|
80
|
+
program.addCommand(createPublishThemeCommand());
|
|
81
|
+
program.addCommand(createUpdateSectionPropCommand());
|
|
82
|
+
program.addCommand(createUpdatePageSectionsCommand());
|
|
83
|
+
program.addCommand(createUploadImageCommand());
|
|
84
|
+
program.addCommand(createUploadImagesCommand());
|
|
85
|
+
program.addCommand(createSearchProductsCommand());
|
|
86
|
+
program.addCommand(createListEntitiesCommand());
|
|
20
87
|
export function run() {
|
|
21
88
|
return program.parseAsync(process.argv);
|
|
22
89
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE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AA4B,EAAE,CAAC,CAAC;AACnD,OAAO,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,CAAC;AACrD,OAAO,CAAC,UAAU,CAAC,6BAA6B,EAAE,CAAC,CAAC;AACpD,OAAO,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,CAAC;AACrD,OAAO,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,UAAU,CAAC,6BAA6B,EAAE,CAAC,CAAC;AACpD,OAAO,CAAC,UAAU,CAAC,kCAAkC,EAAE,CAAC,CAAC;AACzD,OAAO,CAAC,UAAU,CAAC,+BAA+B,EAAE,CAAC,CAAC;AACtD,OAAO,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;AAC9C,OAAO,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;AAC9C,OAAO,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAChD,OAAO,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,CAAC;AACrD,OAAO,CAAC,UAAU,CAAC,+BAA+B,EAAE,CAAC,CAAC;AACtD,OAAO,CAAC,UAAU,CAAC,wBAAwB,EAAE,CAAC,CAAC;AAC/C,OAAO,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAChD,OAAO,CAAC,UAAU,CAAC,2BAA2B,EAAE,CAAC,CAAC;AAClD,OAAO,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAEhD,MAAM,UAAU,GAAG;IACjB,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,cAAc,YAAY,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Prop types available for code components
|
|
3
3
|
* These map to the PropType enum in @ikas/editor-models
|
|
4
4
|
*/
|
|
5
|
-
export type PropType = "TEXT" | "RICH_TEXT" | "NUMBER" | "NUMBER_RANGE" | "BOOLEAN" | "IMAGE" | "IMAGE_LIST" | "VIDEO" | "DATE" | "LINK" | "LIST_OF_LINK" | "COLOR" | "ENUM" | "PRODUCT" | "PRODUCT_LIST" | "PRODUCT_ATTRIBUTE" | "PRODUCT_ATTRIBUTE_LIST" | "CATEGORY" | "CATEGORY_LIST" | "BRAND" | "BRAND_LIST" | "BLOG" | "BLOG_LIST" | "BLOG_CATEGORY" | "BLOG_CATEGORY_LIST" | "TYPE" | "COMPONENT" | "COMPONENT_LIST";
|
|
5
|
+
export type PropType = "TEXT" | "RICH_TEXT" | "NUMBER" | "NUMBER_RANGE" | "BOOLEAN" | "IMAGE" | "IMAGE_LIST" | "VIDEO" | "SVG" | "SVG_LIST" | "DATE" | "LINK" | "LIST_OF_LINK" | "COLOR" | "ENUM" | "PRODUCT" | "PRODUCT_LIST" | "PRODUCT_ATTRIBUTE" | "PRODUCT_ATTRIBUTE_LIST" | "CATEGORY" | "CATEGORY_LIST" | "BRAND" | "BRAND_LIST" | "BLOG" | "BLOG_LIST" | "BLOG_CATEGORY" | "BLOG_CATEGORY_LIST" | "TYPE" | "COMPONENT" | "COMPONENT_LIST";
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for a code component project (ikas.config.json)
|
|
8
8
|
*/
|
|
@@ -43,6 +43,24 @@ export interface ComponentPropGroup {
|
|
|
43
43
|
name: string;
|
|
44
44
|
description?: string;
|
|
45
45
|
children?: ComponentPropGroup[];
|
|
46
|
+
/**
|
|
47
|
+
* Conditional visibility ("Koşullu Prop"). Names a BOOLEAN or ENUM prop on this component; the
|
|
48
|
+
* group and everything under it are drawn in the editor's settings panel only while that prop
|
|
49
|
+
* satisfies the condition, and a required prop hidden this way stops blocking a publish.
|
|
50
|
+
*
|
|
51
|
+
* A NAME, not an id — config props carry no id, the CLI mints those from position, and a name
|
|
52
|
+
* survives a reorder where an index would not.
|
|
53
|
+
*
|
|
54
|
+
* Nothing under a hidden group is dropped from the theme or from what renders; the controls come
|
|
55
|
+
* back with what they held.
|
|
56
|
+
*/
|
|
57
|
+
requiredProp?: string;
|
|
58
|
+
/** For a BOOLEAN gate — which state of `requiredProp` shows this group. Defaults to `true`. */
|
|
59
|
+
requiredPropValue?: boolean;
|
|
60
|
+
/** For an ENUM gate — the option's id. */
|
|
61
|
+
requiredEnumOptionId?: string;
|
|
62
|
+
/** For an ENUM gate — the option value `requiredProp` must hold. */
|
|
63
|
+
requiredEnumOptionValue?: string;
|
|
46
64
|
}
|
|
47
65
|
/**
|
|
48
66
|
* Prop definition for a component
|
|
@@ -60,6 +78,13 @@ export interface ComponentProp {
|
|
|
60
78
|
typeId?: string;
|
|
61
79
|
/** For ENUM props — the enum type ID from TypeStore (e.g. "@ikas/bp-storefront-models-FlexDirectionStyleType") */
|
|
62
80
|
enumTypeId?: string;
|
|
81
|
+
/** For NUMBER_RANGE props — slider config (min/max/interval/unit) */
|
|
82
|
+
numberRangeData?: {
|
|
83
|
+
min?: number;
|
|
84
|
+
max?: number;
|
|
85
|
+
interval?: number;
|
|
86
|
+
unit?: string;
|
|
87
|
+
};
|
|
63
88
|
/** For COMPONENT/COMPONENT_LIST props — map of variable keys to { id, typeId } */
|
|
64
89
|
privateVarMap?: Record<string, {
|
|
65
90
|
id: string;
|
|
@@ -67,6 +92,16 @@ export interface ComponentProp {
|
|
|
67
92
|
}>;
|
|
68
93
|
/** For COMPONENT/COMPONENT_LIST props — restrict which components can be selected */
|
|
69
94
|
filteredComponentIds?: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Conditional visibility — see {@link ComponentPropGroup.requiredProp} for the full contract.
|
|
97
|
+
*/
|
|
98
|
+
requiredProp?: string;
|
|
99
|
+
/** For a BOOLEAN gate — which state of `requiredProp` shows this prop. Defaults to `true`. */
|
|
100
|
+
requiredPropValue?: boolean;
|
|
101
|
+
/** For an ENUM gate — the option's id. */
|
|
102
|
+
requiredEnumOptionId?: string;
|
|
103
|
+
/** For an ENUM gate — the option value `requiredProp` must hold. */
|
|
104
|
+
requiredEnumOptionValue?: string;
|
|
70
105
|
}
|
|
71
106
|
/**
|
|
72
107
|
* Result of component compilation
|
|
@@ -114,4 +149,20 @@ export interface SharedModuleData {
|
|
|
114
149
|
canvasClientJs: string;
|
|
115
150
|
compiledCss: string;
|
|
116
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Theme global-variable metadata carried over the dev-server `sync-types` protocol
|
|
154
|
+
* (name / displayName / type only — no value). Drives the generated `ThemeSettingName`
|
|
155
|
+
* union in the author's `src/global-types.ts`.
|
|
156
|
+
*/
|
|
157
|
+
export type ThemeSettingMeta = {
|
|
158
|
+
name: string;
|
|
159
|
+
displayName: string;
|
|
160
|
+
type: string;
|
|
161
|
+
/**
|
|
162
|
+
* ENUM only — id of the project enum the setting selects from. Types the setting's entry in
|
|
163
|
+
* the generated value map as that enum's union type, and forces the union to be emitted even
|
|
164
|
+
* when no component prop uses the enum.
|
|
165
|
+
*/
|
|
166
|
+
enumTypeId?: string;
|
|
167
|
+
};
|
|
117
168
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,cAAc,GACd,SAAS,GACT,OAAO,GACP,YAAY,GACZ,OAAO,GACP,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,GACP,MAAM,GACN,SAAS,GACT,cAAc,GACd,mBAAmB,GACnB,wBAAwB,GACxB,UAAU,GACV,eAAe,GACf,OAAO,GACP,YAAY,GACZ,MAAM,GACN,WAAW,GACX,eAAe,GACf,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,M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,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
package/dist/utils/compile.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type { CompilationResult, MultiCompilationResult } from "../types.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function compileComponent(entryPath: string, stylesPath: string, componentId: string): Promise<CompilationResult>;
|
|
6
6
|
/**
|
|
7
|
-
* Scope CSS selectors with a component-specific class prefix
|
|
7
|
+
* Scope CSS selectors with a component-specific class prefix, then namespace any
|
|
8
|
+
* document-global CSS identifiers (`@keyframes`, `@font-face` font-family,
|
|
9
|
+
* `@counter-style`) DEFINED in this component so two components — or the host theme —
|
|
10
|
+
* declaring the same name can't collide in the page's global namespace.
|
|
8
11
|
*/
|
|
9
12
|
export declare function scopeCSS(css: string, componentId: string): string;
|
|
10
13
|
/**
|
|
@@ -12,6 +15,18 @@ export declare function scopeCSS(css: string, componentId: string): string;
|
|
|
12
15
|
* Each selector becomes: .cc_id1 .sel, .cc_id2 .sel { ... }
|
|
13
16
|
*/
|
|
14
17
|
export declare function scopeCSSMulti(css: string, componentIds: string[]): string;
|
|
18
|
+
export interface CompileAllOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Bundle the `@ikas/bp-storefront*` packages into the artifact instead of leaving them for the
|
|
21
|
+
* host to resolve. See `vendorStorefrontPlugin` for why, and for what it costs.
|
|
22
|
+
*
|
|
23
|
+
* Off by default: a theme's own code components SHOULD bind to the storefront the theme ships,
|
|
24
|
+
* so a merchant gets one `customerStore` and one router. Turn it on only for artifacts that are
|
|
25
|
+
* published independently of any theme — today that means the built-in account pages, which are
|
|
26
|
+
* delivered from the CDN and cannot assume anything about the theme they land in.
|
|
27
|
+
*/
|
|
28
|
+
vendorStorefront?: boolean;
|
|
29
|
+
}
|
|
15
30
|
/**
|
|
16
31
|
* Compile all components together with esbuild code splitting.
|
|
17
32
|
* Shared code is automatically extracted into chunk files.
|
|
@@ -21,5 +36,5 @@ export declare function compileAllComponents(components: {
|
|
|
21
36
|
id: string;
|
|
22
37
|
entryPath: string;
|
|
23
38
|
stylesPath: string;
|
|
24
|
-
}[], globalStylesPath?: string): Promise<MultiCompilationResult>;
|
|
39
|
+
}[], globalStylesPath?: string, options?: CompileAllOptions): Promise<MultiCompilationResult>;
|
|
25
40
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/utils/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/utils/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAmElG;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CA8E5B;AAiBD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAGzE;AAkiBD,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAsCD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,EACnE,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAwXjC"}
|