@sudajs/theme-engine 0.0.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/dist/ai/slots.d.ts +33 -0
- package/dist/ai/slots.d.ts.map +1 -0
- package/dist/ai/slots.js +139 -0
- package/dist/ai/slots.js.map +1 -0
- package/dist/assets.d.ts +42 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +36 -0
- package/dist/assets.js.map +1 -0
- package/dist/cms/apply-bindings.d.ts +9 -0
- package/dist/cms/apply-bindings.d.ts.map +1 -0
- package/dist/cms/apply-bindings.js +128 -0
- package/dist/cms/apply-bindings.js.map +1 -0
- package/dist/cms/get-context.d.ts +9 -0
- package/dist/cms/get-context.d.ts.map +1 -0
- package/dist/cms/get-context.js +13 -0
- package/dist/cms/get-context.js.map +1 -0
- package/dist/cms/index.d.ts +4 -0
- package/dist/cms/index.d.ts.map +1 -0
- package/dist/cms/index.js +4 -0
- package/dist/cms/index.js.map +1 -0
- package/dist/cms/types.d.ts +116 -0
- package/dist/cms/types.d.ts.map +1 -0
- package/dist/cms/types.js +2 -0
- package/dist/cms/types.js.map +1 -0
- package/dist/components/base-blocks.d.ts +13 -0
- package/dist/components/base-blocks.d.ts.map +1 -0
- package/dist/components/base-blocks.js +157 -0
- package/dist/components/base-blocks.js.map +1 -0
- package/dist/components/containers.d.ts +8 -0
- package/dist/components/containers.d.ts.map +1 -0
- package/dist/components/containers.js +142 -0
- package/dist/components/containers.js.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +17 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/interactive.client.d.ts +12 -0
- package/dist/components/interactive.client.d.ts.map +1 -0
- package/dist/components/interactive.client.js +43 -0
- package/dist/components/interactive.client.js.map +1 -0
- package/dist/components/metadata.d.ts +20 -0
- package/dist/components/metadata.d.ts.map +1 -0
- package/dist/components/metadata.js +9 -0
- package/dist/components/metadata.js.map +1 -0
- package/dist/components/shared-fields.d.ts +11 -0
- package/dist/components/shared-fields.d.ts.map +1 -0
- package/dist/components/shared-fields.js +37 -0
- package/dist/components/shared-fields.js.map +1 -0
- package/dist/editor/context.d.ts +79 -0
- package/dist/editor/context.d.ts.map +1 -0
- package/dist/editor/context.js +12 -0
- package/dist/editor/context.js.map +1 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +5 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/overrides.d.ts +3 -0
- package/dist/editor/overrides.d.ts.map +1 -0
- package/dist/editor/overrides.js +379 -0
- package/dist/editor/overrides.js.map +1 -0
- package/dist/editor/theme-editor.d.ts +46 -0
- package/dist/editor/theme-editor.d.ts.map +1 -0
- package/dist/editor/theme-editor.js +169 -0
- package/dist/editor/theme-editor.js.map +1 -0
- package/dist/editor/unified-editor.d.ts +25 -0
- package/dist/editor/unified-editor.d.ts.map +1 -0
- package/dist/editor/unified-editor.js +229 -0
- package/dist/editor/unified-editor.js.map +1 -0
- package/dist/editor/use-theme-runtime.d.ts +8 -0
- package/dist/editor/use-theme-runtime.d.ts.map +1 -0
- package/dist/editor/use-theme-runtime.js +77 -0
- package/dist/editor/use-theme-runtime.js.map +1 -0
- package/dist/fields/basic-fields.d.ts +14 -0
- package/dist/fields/basic-fields.d.ts.map +1 -0
- package/dist/fields/basic-fields.js +46 -0
- package/dist/fields/basic-fields.js.map +1 -0
- package/dist/fields/color-field.d.ts +3 -0
- package/dist/fields/color-field.d.ts.map +1 -0
- package/dist/fields/color-field.js +97 -0
- package/dist/fields/color-field.js.map +1 -0
- package/dist/fields/color-scheme-field.d.ts +81 -0
- package/dist/fields/color-scheme-field.d.ts.map +1 -0
- package/dist/fields/color-scheme-field.js +234 -0
- package/dist/fields/color-scheme-field.js.map +1 -0
- package/dist/fields/index.d.ts +6 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.js +4 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/media-field.d.ts +10 -0
- package/dist/fields/media-field.d.ts.map +1 -0
- package/dist/fields/media-field.js +495 -0
- package/dist/fields/media-field.js.map +1 -0
- package/dist/fields/normalize-config.d.ts +3 -0
- package/dist/fields/normalize-config.d.ts.map +1 -0
- package/dist/fields/normalize-config.js +81 -0
- package/dist/fields/normalize-config.js.map +1 -0
- package/dist/fields/range-field.d.ts +9 -0
- package/dist/fields/range-field.d.ts.map +1 -0
- package/dist/fields/range-field.js +53 -0
- package/dist/fields/range-field.js.map +1 -0
- package/dist/fields/spacing-field.d.ts +7 -0
- package/dist/fields/spacing-field.d.ts.map +1 -0
- package/dist/fields/spacing-field.js +40 -0
- package/dist/fields/spacing-field.js.map +1 -0
- package/dist/fields/suda-fields.d.ts +45 -0
- package/dist/fields/suda-fields.d.ts.map +1 -0
- package/dist/fields/suda-fields.js +91 -0
- package/dist/fields/suda-fields.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +47 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +39 -0
- package/dist/manifest.js.map +1 -0
- package/dist/registry/filesystem.d.ts +27 -0
- package/dist/registry/filesystem.d.ts.map +1 -0
- package/dist/registry/filesystem.js +162 -0
- package/dist/registry/filesystem.js.map +1 -0
- package/dist/registry.d.ts +13 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -0
- package/dist/render/chrome.d.ts +18 -0
- package/dist/render/chrome.d.ts.map +1 -0
- package/dist/render/chrome.js +36 -0
- package/dist/render/chrome.js.map +1 -0
- package/dist/render/index.d.ts +4 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +4 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/render.d.ts +21 -0
- package/dist/render/render.d.ts.map +1 -0
- package/dist/render/render.js +50 -0
- package/dist/render/render.js.map +1 -0
- package/dist/render/slot.d.ts +14 -0
- package/dist/render/slot.d.ts.map +1 -0
- package/dist/render/slot.js +14 -0
- package/dist/render/slot.js.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +10 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +16 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +171 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LayoutData } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Theme-level chrome the host may need to apply outside the React tree (custom
|
|
4
|
+
* head code goes into the document `<head>`; CSS variables can be applied to a
|
|
5
|
+
* wrapper). Read from the layout document's root props by convention.
|
|
6
|
+
*/
|
|
7
|
+
export interface LayoutChrome {
|
|
8
|
+
customHeadCode?: string;
|
|
9
|
+
customBodyCode?: string;
|
|
10
|
+
cssVariables: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Extracts host-applied chrome from a layout document. Themes store these on the
|
|
14
|
+
* layout root props: `customHeadCode`, `customBodyCode`, and `cssVariables`
|
|
15
|
+
* (a flat map of CSS custom properties, e.g. `{ "--color-primary": "#1f6feb" }`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractLayoutChrome(layoutData: LayoutData | undefined): LayoutChrome;
|
|
18
|
+
//# sourceMappingURL=chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/render/chrome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAcD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,YAAY,CAsBpF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function readRootProps(layoutData) {
|
|
2
|
+
const root = layoutData?.root;
|
|
3
|
+
const props = root?.props;
|
|
4
|
+
return props && typeof props === "object" ? props : {};
|
|
5
|
+
}
|
|
6
|
+
function asString(value) {
|
|
7
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Extracts host-applied chrome from a layout document. Themes store these on the
|
|
11
|
+
* layout root props: `customHeadCode`, `customBodyCode`, and `cssVariables`
|
|
12
|
+
* (a flat map of CSS custom properties, e.g. `{ "--color-primary": "#1f6feb" }`).
|
|
13
|
+
*/
|
|
14
|
+
export function extractLayoutChrome(layoutData) {
|
|
15
|
+
const props = readRootProps(layoutData);
|
|
16
|
+
const rawVars = props["cssVariables"];
|
|
17
|
+
const cssVariables = {};
|
|
18
|
+
if (rawVars && typeof rawVars === "object") {
|
|
19
|
+
for (const [key, value] of Object.entries(rawVars)) {
|
|
20
|
+
if (typeof value === "string") {
|
|
21
|
+
cssVariables[key.startsWith("--") ? key : `--${key}`] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const chrome = { cssVariables };
|
|
26
|
+
const head = asString(props["customHeadCode"]);
|
|
27
|
+
const body = asString(props["customBodyCode"]);
|
|
28
|
+
if (head !== undefined) {
|
|
29
|
+
chrome.customHeadCode = head;
|
|
30
|
+
}
|
|
31
|
+
if (body !== undefined) {
|
|
32
|
+
chrome.customBodyCode = body;
|
|
33
|
+
}
|
|
34
|
+
return chrome;
|
|
35
|
+
}
|
|
36
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AAC,gBAAgB,CAAC,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAyB,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAqB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ThemeRenderMetadata } from "../components/metadata";
|
|
3
|
+
import type { LayoutData, PageData, ThemeModule } from "../types";
|
|
4
|
+
export interface ThemeRenderProps {
|
|
5
|
+
theme: Pick<ThemeModule, "pageConfig" | "layoutConfig" | "rendering">;
|
|
6
|
+
pageData: PageData;
|
|
7
|
+
layoutData: LayoutData;
|
|
8
|
+
/** Render-time helpers (asset resolution etc.). */
|
|
9
|
+
metadata?: ThemeRenderMetadata;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderThemePage(props: ThemeRenderProps): ReactElement;
|
|
12
|
+
/**
|
|
13
|
+
* Server component that renders a page within its theme layout. The page is
|
|
14
|
+
* rendered first, then injected into the layout via metadata so the theme's
|
|
15
|
+
* layout root can place it between header/footer chrome.
|
|
16
|
+
*
|
|
17
|
+
* Use from React Server Components (e.g. the public site). For the editor's live
|
|
18
|
+
* preview, Puck renders the same configs client-side.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ThemeRender({ theme, pageData, layoutData, metadata, }: ThemeRenderProps): ReactElement;
|
|
21
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render/render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIlE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC,CAAC;IACtE,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AA4BD,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAcrE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,EAAE,gBAAgB,GAAG,YAAY,CAMjC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Render } from "@puckeditor/core/rsc";
|
|
3
|
+
import { applyCmsBindings } from "../cms/apply-bindings";
|
|
4
|
+
import { getCmsContext } from "../cms/get-context";
|
|
5
|
+
import { normalizeSudaConfig } from "../fields/normalize-config";
|
|
6
|
+
import { THEME_PAGE_SLOT } from "./slot";
|
|
7
|
+
function renderPuckTheme({ theme, pageData, layoutData, metadata, }) {
|
|
8
|
+
const baseMeta = metadata ?? {};
|
|
9
|
+
// Project CMS data onto components that declared a `cmsBinding` before
|
|
10
|
+
// handing the data to Puck. Pure: when no binding/context matches the
|
|
11
|
+
// returned reference is identical to `pageData`.
|
|
12
|
+
const projectedPageData = applyCmsBindings(pageData, getCmsContext(baseMeta));
|
|
13
|
+
const pageConfig = normalizeSudaConfig(theme.pageConfig);
|
|
14
|
+
const layoutConfig = normalizeSudaConfig(theme.layoutConfig);
|
|
15
|
+
const page = (_jsx(Render, { config: pageConfig, data: projectedPageData, metadata: baseMeta }));
|
|
16
|
+
const layoutMeta = {
|
|
17
|
+
...baseMeta,
|
|
18
|
+
[THEME_PAGE_SLOT]: page,
|
|
19
|
+
};
|
|
20
|
+
return _jsx(Render, { config: layoutConfig, data: layoutData, metadata: layoutMeta });
|
|
21
|
+
}
|
|
22
|
+
export function renderThemePage(props) {
|
|
23
|
+
const renderPuck = () => renderPuckTheme(props);
|
|
24
|
+
if (props.theme.rendering?.mode === "custom" && props.theme.rendering.render) {
|
|
25
|
+
return props.theme.rendering.render({
|
|
26
|
+
theme: props.theme,
|
|
27
|
+
pageData: props.pageData,
|
|
28
|
+
layoutData: props.layoutData,
|
|
29
|
+
...(props.metadata !== undefined ? { metadata: props.metadata } : {}),
|
|
30
|
+
renderPuck,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return renderPuck();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Server component that renders a page within its theme layout. The page is
|
|
37
|
+
* rendered first, then injected into the layout via metadata so the theme's
|
|
38
|
+
* layout root can place it between header/footer chrome.
|
|
39
|
+
*
|
|
40
|
+
* Use from React Server Components (e.g. the public site). For the editor's live
|
|
41
|
+
* preview, Puck renders the same configs client-side.
|
|
42
|
+
*/
|
|
43
|
+
export function ThemeRender({ theme, pageData, layoutData, metadata, }) {
|
|
44
|
+
const props = { theme, pageData, layoutData };
|
|
45
|
+
if (metadata !== undefined) {
|
|
46
|
+
props.metadata = metadata;
|
|
47
|
+
}
|
|
48
|
+
return renderThemePage(props);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/render/render.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAUzC,SAAS,eAAe,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,GACS;IACjB,MAAM,QAAQ,GAAwB,QAAQ,IAAI,EAAE,CAAC;IACrD,uEAAuE;IACvE,sEAAsE;IACtE,iDAAiD;IACjD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7D,MAAM,IAAI,GAAc,CACtB,KAAC,MAAM,IAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAI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type { ReactNode } from "react";
|
|
2
|
+
import type { ThemeRenderMetadata } from "../components/metadata";
|
|
3
|
+
/**
|
|
4
|
+
* The metadata key under which the rendered page tree is exposed to the layout
|
|
5
|
+
* config's root render. Themes place page content via
|
|
6
|
+
* `puck.metadata[THEME_PAGE_SLOT]`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const THEME_PAGE_SLOT = "page";
|
|
9
|
+
/**
|
|
10
|
+
* Reads the injected page tree inside a theme's layout root render.
|
|
11
|
+
* Themes call this with their `puck.metadata` to place page content.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPageSlot(metadata: ThemeRenderMetadata | undefined): ReactNode;
|
|
14
|
+
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/render/slot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,SAAS,CAEhF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata key under which the rendered page tree is exposed to the layout
|
|
3
|
+
* config's root render. Themes place page content via
|
|
4
|
+
* `puck.metadata[THEME_PAGE_SLOT]`.
|
|
5
|
+
*/
|
|
6
|
+
export const THEME_PAGE_SLOT = "page";
|
|
7
|
+
/**
|
|
8
|
+
* Reads the injected page tree inside a theme's layout root render.
|
|
9
|
+
* Themes call this with their `puck.metadata` to place page content.
|
|
10
|
+
*/
|
|
11
|
+
export function getPageSlot(metadata) {
|
|
12
|
+
return metadata?.[THEME_PAGE_SLOT] ?? null;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/render/slot.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAyC;IACnE,OAAQ,QAAQ,EAAE,CAAC,eAAe,CAAe,IAAI,IAAI,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createEngineComponents } from "./components/index";
|
|
2
|
+
export { colorSchemeField, createColorSchemeDefault, createThemeCssVariables, resolveColorSchemeTokens, SUDA_COLOR_TOKEN_KEYS, type ColorSchemeFieldOptions, type CreateThemeCssVariablesOptions, type SudaColorSchemePreset, type SudaColorSchemeValue, type SudaThemeColorTokens, } from "./fields/index";
|
|
3
|
+
export { resolveAsset, type ThemeRenderMetadata } from "./components/metadata";
|
|
4
|
+
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot";
|
|
5
|
+
export { createThemeAssetPath, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets";
|
|
6
|
+
export type { LayoutData, PageData, SudaComponentConfig, SudaConfig, SudaField, SudaFields, SudaRootConfig, } from "./types";
|
|
7
|
+
export { applyCmsBindings, getCmsContext, type CmsBinding, type CmsContext, type CmsPagination, type CmsPostDetail, type CmsPostListPayload, type CmsPostSummary, type CmsTagDetail, type CmsTagSummary, type CmsViewBinding, type ThemeContentCapabilities, } from "./cms/index";
|
|
8
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Runtime-only helpers for theme packages. Keep this entry free of editor
|
|
2
|
+
// runtime exports to avoid pulling large client-only dependencies into theme
|
|
3
|
+
// runtime bundles.
|
|
4
|
+
export { createEngineComponents } from "./components/index";
|
|
5
|
+
export { colorSchemeField, createColorSchemeDefault, createThemeCssVariables, resolveColorSchemeTokens, SUDA_COLOR_TOKEN_KEYS, } from "./fields/index";
|
|
6
|
+
export { resolveAsset } from "./components/metadata";
|
|
7
|
+
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot";
|
|
8
|
+
export { createThemeAssetPath, resolveAssetPath, } from "./assets";
|
|
9
|
+
export { applyCmsBindings, getCmsContext, } from "./cms/index";
|
|
10
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,mBAAmB;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,GAMtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAIjB,MAAM,UAAU,CAAC;AAUlB,OAAO,EACL,gBAAgB,EAChB,aAAa,GAWd,MAAM,aAAa,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { renderThemePage, ThemeRender, type ThemeRenderProps } from "./render/render";
|
|
2
|
+
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot";
|
|
3
|
+
export { extractLayoutChrome, type LayoutChrome } from "./render/chrome";
|
|
4
|
+
export { resolveAsset, type ThemeRenderMetadata } from "./components/metadata";
|
|
5
|
+
export { createThemeAssetPath, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets";
|
|
6
|
+
export { composeUnifiedThemeEditorData, splitUnifiedThemeEditorData, } from "./editor/unified-editor";
|
|
7
|
+
export * from "./cms/index";
|
|
8
|
+
export * from "./types";
|
|
9
|
+
export { themeManifestSchema, parseThemeManifest, safeParseThemeManifest } from "./manifest";
|
|
10
|
+
export * from "./registry";
|
|
11
|
+
export * from "./registry/filesystem";
|
|
12
|
+
export * from "./ai/slots";
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC7F,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Server-only entry. Pulls `@puckeditor/core/rsc`; import from React Server
|
|
2
|
+
// Components only (e.g. the public site).
|
|
3
|
+
export { renderThemePage, ThemeRender } from "./render/render";
|
|
4
|
+
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot";
|
|
5
|
+
export { extractLayoutChrome } from "./render/chrome";
|
|
6
|
+
export { resolveAsset } from "./components/metadata";
|
|
7
|
+
export { createThemeAssetPath, resolveAssetPath, } from "./assets";
|
|
8
|
+
export { composeUnifiedThemeEditorData, splitUnifiedThemeEditorData, } from "./editor/unified-editor";
|
|
9
|
+
export * from "./cms/index";
|
|
10
|
+
// Re-export contracts for convenience in server code.
|
|
11
|
+
export * from "./types";
|
|
12
|
+
export { themeManifestSchema, parseThemeManifest, safeParseThemeManifest } from "./manifest";
|
|
13
|
+
export * from "./registry";
|
|
14
|
+
export * from "./registry/filesystem";
|
|
15
|
+
export * from "./ai/slots";
|
|
16
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0CAA0C;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAIjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,cAAc,aAAa,CAAC;AAE5B,sDAAsD;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC7F,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { ComponentConfig as PuckComponentConfig, Config, Data, DefaultComponentProps, DefaultComponents, Fields as PuckFields, RootConfig as PuckRootConfig } from "@puckeditor/core";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { ThemeContentCapabilities } from "./cms/types";
|
|
4
|
+
import type { ThemeRenderMetadata } from "./components/metadata";
|
|
5
|
+
import type { SudaField, SudaFieldExtension } from "./fields/suda-fields";
|
|
6
|
+
/**
|
|
7
|
+
* Theme-facing alias for Puck's component config. Generic on the component's
|
|
8
|
+
* prop shape so `fields` and `defaultProps` are strictly typed against the
|
|
9
|
+
* declared props, and themes never have to import from `@puckeditor/core`.
|
|
10
|
+
*
|
|
11
|
+
* We pass the props through Puck's `ComponentConfigParams` shape (`{ props }`)
|
|
12
|
+
* so generic forwarding satisfies its `LeftOrExactRight` constraint.
|
|
13
|
+
*/
|
|
14
|
+
export type SudaComponentConfig<Props extends DefaultComponentProps = DefaultComponentProps> = PuckComponentConfig<{
|
|
15
|
+
props: Props;
|
|
16
|
+
fields: Record<string, SudaFieldExtension>;
|
|
17
|
+
}>;
|
|
18
|
+
/** Theme-facing alias for Puck's root config. */
|
|
19
|
+
export type SudaRootConfig<Props extends DefaultComponentProps = DefaultComponentProps> = PuckRootConfig<{
|
|
20
|
+
props: Props;
|
|
21
|
+
fields: Record<string, SudaFieldExtension>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Theme-facing alias for the strict `Fields<Props>` map. Each field value can
|
|
25
|
+
* be one of Puck's built-in field shapes
|
|
26
|
+
* (`text | textarea | number | select | radio | richtext | array | object | external | custom | slot`)
|
|
27
|
+
* or one of the Suda-extended `{ type }` literals
|
|
28
|
+
* (`url | icon | font | menu | color | range | spacing | media | image | video`).
|
|
29
|
+
* Suda-extended fields are normalised to Puck's built-in shapes at render time
|
|
30
|
+
* by `normalizeSudaConfig`.
|
|
31
|
+
*/
|
|
32
|
+
export type SudaFields<Props extends DefaultComponentProps = DefaultComponentProps> = PuckFields<Props, SudaFieldExtension>;
|
|
33
|
+
/**
|
|
34
|
+
* Theme-facing alias for the union of all supported Puck field shapes.
|
|
35
|
+
* Useful when typing a single field declaration in isolation.
|
|
36
|
+
*/
|
|
37
|
+
export type { SudaField };
|
|
38
|
+
/**
|
|
39
|
+
* Theme-facing alias for a full Puck config (root + components + categories).
|
|
40
|
+
* Themes should use this for `pageConfig` / `layoutConfig` instead of importing
|
|
41
|
+
* `Config` from `@puckeditor/core`.
|
|
42
|
+
*/
|
|
43
|
+
export type SudaConfig<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[]> = Config<{
|
|
44
|
+
components: Components;
|
|
45
|
+
root: RootProps;
|
|
46
|
+
categories: CategoryNames;
|
|
47
|
+
fields: Record<string, SudaFieldExtension>;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Puck `Data` is the persisted source of truth for a single page. We keep it
|
|
51
|
+
* opaque here so the engine stays decoupled from any specific theme's prop
|
|
52
|
+
* shapes.
|
|
53
|
+
*/
|
|
54
|
+
export type PageData = Data;
|
|
55
|
+
/**
|
|
56
|
+
* Theme-level shared chrome (header/footer/announcement/custom code/color
|
|
57
|
+
* scheme/fonts). Rendered as a layout around every page via the theme's
|
|
58
|
+
* `layoutConfig`.
|
|
59
|
+
*/
|
|
60
|
+
export type LayoutData = Data;
|
|
61
|
+
export type ThemeCategory = "business" | "blog" | "portfolio" | "ecommerce" | "landing" | "other";
|
|
62
|
+
/**
|
|
63
|
+
* Static, serialisable description of a theme. Stored in the DB
|
|
64
|
+
* (`ThemePackage.manifest` / `ThemeVersion.manifest`) and shipped alongside the
|
|
65
|
+
* theme bundle so the marketplace/CLI can reason about it without executing
|
|
66
|
+
* code.
|
|
67
|
+
*/
|
|
68
|
+
export interface ThemeManifest {
|
|
69
|
+
/** Stable unique key, e.g. "immgway". */
|
|
70
|
+
key: string;
|
|
71
|
+
name: string;
|
|
72
|
+
version: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
/** Public URL or asset key of a preview image. */
|
|
75
|
+
preview?: string;
|
|
76
|
+
author?: string;
|
|
77
|
+
categories: ThemeCategory[];
|
|
78
|
+
/** Minimum `@sudajs/theme-engine` version this theme is built against. */
|
|
79
|
+
minEngineVersion: string;
|
|
80
|
+
/** Artifact-local server entry that exports a `ThemeModule`. */
|
|
81
|
+
entry: string;
|
|
82
|
+
/** Artifact-local browser runtime entry for editor/live client rendering. */
|
|
83
|
+
clientEntry?: string;
|
|
84
|
+
}
|
|
85
|
+
/** Runtime locations for a resolved theme artifact. */
|
|
86
|
+
export interface ThemeRuntime {
|
|
87
|
+
/** Absolute artifact root on the current server when the theme is file-backed. */
|
|
88
|
+
rootPath?: string;
|
|
89
|
+
/** Absolute server entry path loaded with dynamic `import(file://...)`. */
|
|
90
|
+
serverEntryPath?: string;
|
|
91
|
+
/** Browser-loadable bundled client runtime URL for the editor. */
|
|
92
|
+
clientEntryUrl?: string;
|
|
93
|
+
/** Browser-loadable stylesheet URL for this theme version. */
|
|
94
|
+
stylesheetUrl?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A named starter page a theme provides so a freshly installed project is not
|
|
98
|
+
* empty. `data` is a full Puck `Data` document.
|
|
99
|
+
*/
|
|
100
|
+
export interface ThemeStarterPage {
|
|
101
|
+
slug: string;
|
|
102
|
+
title: string;
|
|
103
|
+
isHome?: boolean;
|
|
104
|
+
data: PageData;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Declares a slot inside a theme's prop tree that the AI assistant is allowed
|
|
108
|
+
* to read/write. Used to scope AI edits to safe, content-only fields.
|
|
109
|
+
*/
|
|
110
|
+
export interface AiSlotDescriptor {
|
|
111
|
+
/** Dot/bracket path into a component's props, e.g. "blocks[0].heading". */
|
|
112
|
+
path: string;
|
|
113
|
+
/** Human label shown to the assistant. */
|
|
114
|
+
label: string;
|
|
115
|
+
kind: "text" | "richtext" | "image" | "url" | "list";
|
|
116
|
+
/** Optional guidance the assistant should respect. */
|
|
117
|
+
hint?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface ThemeRenderContext {
|
|
120
|
+
theme: Pick<ThemeModule, "pageConfig" | "layoutConfig">;
|
|
121
|
+
pageData: PageData;
|
|
122
|
+
layoutData: LayoutData;
|
|
123
|
+
metadata?: ThemeRenderMetadata;
|
|
124
|
+
renderPuck: () => ReactElement;
|
|
125
|
+
}
|
|
126
|
+
export type ThemeRenderer = (context: ThemeRenderContext) => ReactElement;
|
|
127
|
+
export interface ThemeRenderingOptions {
|
|
128
|
+
/**
|
|
129
|
+
* Defaults to Puck rendering. Custom renderers must consume the same
|
|
130
|
+
* `pageData` / `layoutData` contract so editor preview and site output stay
|
|
131
|
+
* aligned.
|
|
132
|
+
*/
|
|
133
|
+
mode?: "puck" | "custom";
|
|
134
|
+
render?: ThemeRenderer;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Runtime contract a theme package must export (default export of its `entry`).
|
|
138
|
+
* The two Puck `Config`s are the heart of the theme: one for page content, one
|
|
139
|
+
* for the shared layout chrome.
|
|
140
|
+
*/
|
|
141
|
+
export interface ThemeModule {
|
|
142
|
+
manifest: ThemeManifest;
|
|
143
|
+
/** Puck config for page-level sections/components. */
|
|
144
|
+
pageConfig: SudaConfig;
|
|
145
|
+
/** Puck config for the shared layout (header/footer/announcement/root). */
|
|
146
|
+
layoutConfig: SudaConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Default layout document used when a project has not customised its theme
|
|
149
|
+
* chrome yet.
|
|
150
|
+
*/
|
|
151
|
+
defaultLayout: LayoutData;
|
|
152
|
+
/** Starter pages seeded on install. */
|
|
153
|
+
starterPages: ThemeStarterPage[];
|
|
154
|
+
/** Optional advanced renderer. Defaults to Puck Render. */
|
|
155
|
+
rendering?: ThemeRenderingOptions;
|
|
156
|
+
/** AI-editable slots, by component type. Optional. */
|
|
157
|
+
aiSlots?: Record<string, AiSlotDescriptor[]>;
|
|
158
|
+
/**
|
|
159
|
+
* Optional declaration of structured CMS views the theme supports
|
|
160
|
+
* (post.index/post.detail/tag.index/tag.detail) and their default routes.
|
|
161
|
+
* Themes that omit this are treated as not supporting CMS views.
|
|
162
|
+
*/
|
|
163
|
+
content?: ThemeContentCapabilities;
|
|
164
|
+
}
|
|
165
|
+
/** A theme module paired with the version it was resolved at. */
|
|
166
|
+
export interface ResolvedTheme {
|
|
167
|
+
manifest: ThemeManifest;
|
|
168
|
+
module: ThemeModule;
|
|
169
|
+
runtime?: ThemeRuntime;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,MAAM,EACN,IAAI,EACJ,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,IAAI,UAAU,EACpB,UAAU,IAAI,cAAc,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,mBAAmB,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CAAE,CAAC,CAAC;AAEpF,iDAAiD;AACjD,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,IACpF,cAAc,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CAAE,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,IAChF,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC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E,CAAC;IACjC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sudajs/theme-engine",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"development": "./src/index.ts",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./runtime": {
|
|
15
|
+
"development": "./src/runtime.ts",
|
|
16
|
+
"types": "./dist/runtime.d.ts",
|
|
17
|
+
"import": "./dist/runtime.js",
|
|
18
|
+
"default": "./dist/runtime.js"
|
|
19
|
+
},
|
|
20
|
+
"./server": {
|
|
21
|
+
"development": "./src/server.ts",
|
|
22
|
+
"types": "./dist/server.d.ts",
|
|
23
|
+
"import": "./dist/server.js",
|
|
24
|
+
"default": "./dist/server.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"zod": "^3.24.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@puckeditor/core": "^0.21.2",
|
|
38
|
+
"@puckeditor/plugin-ai": "^0.7.0",
|
|
39
|
+
"react": "^19.0.0",
|
|
40
|
+
"react-dom": "^19.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@puckeditor/core": "^0.21.2",
|
|
44
|
+
"@puckeditor/plugin-ai": "^0.7.0",
|
|
45
|
+
"@testing-library/react": "^16.3.2",
|
|
46
|
+
"@testing-library/user-event": "^14.6.1",
|
|
47
|
+
"@types/node": "^22.10.2",
|
|
48
|
+
"@types/react": "^19.0.2",
|
|
49
|
+
"@types/react-dom": "^19.0.2",
|
|
50
|
+
"eslint": "^9.17.0",
|
|
51
|
+
"happy-dom": "^20.10.2",
|
|
52
|
+
"react": "^19.0.0",
|
|
53
|
+
"react-dom": "^19.0.0",
|
|
54
|
+
"typescript": "^5.7.2",
|
|
55
|
+
"vitest": "^3.2.4",
|
|
56
|
+
"@suda/build-config": "0.0.0",
|
|
57
|
+
"@suda/eslint-config": "0.0.0",
|
|
58
|
+
"@suda/tsconfig": "0.0.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc -p tsconfig.build.json",
|
|
62
|
+
"lint": "eslint .",
|
|
63
|
+
"lint:fix": "eslint . --fix",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:coverage": "vitest run --coverage",
|
|
66
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
67
|
+
}
|
|
68
|
+
}
|