@asheeui/puck 0.0.0-stage → 2.3.1
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/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +126 -3
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +22 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +22 -0
- package/dist/index.native.js.map +1 -0
- package/dist/native/blocks/content.d.ts +19 -0
- package/dist/native/blocks/content.d.ts.map +1 -0
- package/dist/native/blocks/content.js +28 -0
- package/dist/native/blocks/content.js.map +1 -0
- package/dist/native/blocks/layout.d.ts +42 -0
- package/dist/native/blocks/layout.d.ts.map +1 -0
- package/dist/native/blocks/layout.js +33 -0
- package/dist/native/blocks/layout.js.map +1 -0
- package/dist/native/blocks/navigation.d.ts +19 -0
- package/dist/native/blocks/navigation.d.ts.map +1 -0
- package/dist/native/blocks/navigation.js +38 -0
- package/dist/native/blocks/navigation.js.map +1 -0
- package/dist/native/blocks/sections.d.ts +30 -0
- package/dist/native/blocks/sections.d.ts.map +1 -0
- package/dist/native/blocks/sections.js +60 -0
- package/dist/native/blocks/sections.js.map +1 -0
- package/dist/native/blocks/utility.d.ts +13 -0
- package/dist/native/blocks/utility.d.ts.map +1 -0
- package/dist/native/blocks/utility.js +18 -0
- package/dist/native/blocks/utility.js.map +1 -0
- package/dist/native/config.d.ts +19 -0
- package/dist/native/config.d.ts.map +1 -0
- package/dist/native/config.js +45 -0
- package/dist/native/config.js.map +1 -0
- package/dist/native/index.d.ts +18 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +18 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/render.d.ts +39 -0
- package/dist/native/render.d.ts.map +1 -0
- package/dist/native/render.js +71 -0
- package/dist/native/render.js.map +1 -0
- package/dist/native/root.d.ts +21 -0
- package/dist/native/root.d.ts.map +1 -0
- package/dist/native/root.js +28 -0
- package/dist/native/root.js.map +1 -0
- package/dist/shared/adapters.d.ts +52 -0
- package/dist/shared/adapters.d.ts.map +1 -0
- package/dist/shared/adapters.js +57 -0
- package/dist/shared/adapters.js.map +1 -0
- package/dist/shared/blocks/content.d.ts +42 -0
- package/dist/shared/blocks/content.d.ts.map +1 -0
- package/dist/shared/blocks/content.js +44 -0
- package/dist/shared/blocks/content.js.map +1 -0
- package/dist/shared/blocks/index.d.ts +42 -0
- package/dist/shared/blocks/index.d.ts.map +1 -0
- package/dist/shared/blocks/index.js +81 -0
- package/dist/shared/blocks/index.js.map +1 -0
- package/dist/shared/blocks/layout.d.ts +52 -0
- package/dist/shared/blocks/layout.d.ts.map +1 -0
- package/dist/shared/blocks/layout.js +51 -0
- package/dist/shared/blocks/layout.js.map +1 -0
- package/dist/shared/blocks/navigation.d.ts +74 -0
- package/dist/shared/blocks/navigation.d.ts.map +1 -0
- package/dist/shared/blocks/navigation.js +86 -0
- package/dist/shared/blocks/navigation.js.map +1 -0
- package/dist/shared/blocks/sections.d.ts +142 -0
- package/dist/shared/blocks/sections.d.ts.map +1 -0
- package/dist/shared/blocks/sections.js +166 -0
- package/dist/shared/blocks/sections.js.map +1 -0
- package/dist/shared/blocks/utility.d.ts +31 -0
- package/dist/shared/blocks/utility.d.ts.map +1 -0
- package/dist/shared/blocks/utility.js +36 -0
- package/dist/shared/blocks/utility.js.map +1 -0
- package/dist/shared/fields.d.ts +103 -0
- package/dist/shared/fields.d.ts.map +1 -0
- package/dist/shared/fields.js +162 -0
- package/dist/shared/fields.js.map +1 -0
- package/dist/shared/index.d.ts +14 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +14 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/types.d.ts +235 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +20 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/web/blocks/content.d.ts +10 -0
- package/dist/web/blocks/content.d.ts.map +1 -0
- package/dist/web/blocks/content.js +28 -0
- package/dist/web/blocks/content.js.map +1 -0
- package/dist/web/blocks/layout.d.ts +27 -0
- package/dist/web/blocks/layout.d.ts.map +1 -0
- package/dist/web/blocks/layout.js +28 -0
- package/dist/web/blocks/layout.js.map +1 -0
- package/dist/web/blocks/navigation.d.ts +10 -0
- package/dist/web/blocks/navigation.d.ts.map +1 -0
- package/dist/web/blocks/navigation.js +38 -0
- package/dist/web/blocks/navigation.js.map +1 -0
- package/dist/web/blocks/sections.d.ts +22 -0
- package/dist/web/blocks/sections.d.ts.map +1 -0
- package/dist/web/blocks/sections.js +60 -0
- package/dist/web/blocks/sections.js.map +1 -0
- package/dist/web/blocks/utility.d.ts +6 -0
- package/dist/web/blocks/utility.d.ts.map +1 -0
- package/dist/web/blocks/utility.js +19 -0
- package/dist/web/blocks/utility.js.map +1 -0
- package/dist/web/config.d.ts +65 -0
- package/dist/web/config.d.ts.map +1 -0
- package/dist/web/config.js +35 -0
- package/dist/web/config.js.map +1 -0
- package/dist/web/index.d.ts +19 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +20 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/page.d.ts +24 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +27 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/root.d.ts +9 -0
- package/dist/web/root.d.ts.map +1 -0
- package/dist/web/root.js +26 -0
- package/dist/web/root.js.map +1 -0
- package/package.json +120 -3
- package/src/index.native.ts +22 -0
- package/src/index.ts +24 -0
- package/src/native/blocks/content.tsx +61 -0
- package/src/native/blocks/layout.tsx +72 -0
- package/src/native/blocks/navigation.tsx +71 -0
- package/src/native/blocks/sections.tsx +174 -0
- package/src/native/blocks/utility.tsx +27 -0
- package/src/native/config.tsx +66 -0
- package/src/native/index.ts +18 -0
- package/src/native/render.tsx +113 -0
- package/src/native/root.tsx +31 -0
- package/src/shared/adapters.ts +82 -0
- package/src/shared/blocks/content.ts +80 -0
- package/src/shared/blocks/index.ts +100 -0
- package/src/shared/blocks/layout.ts +82 -0
- package/src/shared/blocks/navigation.ts +168 -0
- package/src/shared/blocks/sections.ts +322 -0
- package/src/shared/blocks/utility.ts +65 -0
- package/src/shared/fields.ts +199 -0
- package/src/shared/index.ts +14 -0
- package/src/shared/types.ts +278 -0
- package/src/web/blocks/content.tsx +55 -0
- package/src/web/blocks/layout.tsx +73 -0
- package/src/web/blocks/navigation.tsx +72 -0
- package/src/web/blocks/sections.tsx +177 -0
- package/src/web/blocks/utility.tsx +31 -0
- package/src/web/config.tsx +141 -0
- package/src/web/index.ts +21 -0
- package/src/web/page.tsx +40 -0
- package/src/web/root.tsx +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/web/config.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACf,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAYzB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,oDAAoD;IACpD,OAAO,EAAE,iBAAiB,CAAC;IAE3B,+DAA+D;IAC/D,OAAO,EAAE,iBAAiB,CAAC;IAE3B,yBAAyB;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAE3B,gCAAgC;IAChC,IAAI,EAAE,cAAc,CAAC;IAErB,oCAAoC;IACpC,MAAM,EAAE,gBAAgB,CAAC;IAEzB,4BAA4B;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,uCAAuC;IACvC,IAAI,EAAE,cAAc,CAAC;IAErB,4CAA4C;IAC5C,GAAG,EAAE,aAAa,CAAC;IAEnB,+CAA+C;IAC/C,WAAW,EAAE,qBAAqB,CAAC;IAEnC,4CAA4C;IAC5C,YAAY,EAAE,sBAAsB,CAAC;IAErC,mCAAmC;IACnC,WAAW,EAAE,qBAAqB,CAAC;IAEnC,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,YAAY,GACZ,MAAM,GACN,SAAS,GACT,UAAU,GACV,KAAK,GACL,SAAS,GACT,cAAc,GACd,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,eAqB7B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { PUCK_CATEGORIES } from "../shared";
|
|
4
|
+
import { headingBlock, textBlock } from "./blocks/content";
|
|
5
|
+
import { columnsBlock, sectionBlock, } from "./blocks/layout";
|
|
6
|
+
import { footerBlock, navbarBlock } from "./blocks/navigation";
|
|
7
|
+
import { ctaBlock, featureGridBlock, heroBlock, pricingCardBlock, testimonialsBlock, } from "./blocks/sections";
|
|
8
|
+
import { emptyStateBlock } from "./blocks/utility";
|
|
9
|
+
import { PuckRoot } from "./root";
|
|
10
|
+
/**
|
|
11
|
+
* The AsheeUI blocks, filed under the categories the builder shows.
|
|
12
|
+
*/
|
|
13
|
+
export const asheePuckConfig = {
|
|
14
|
+
components: {
|
|
15
|
+
Section: sectionBlock,
|
|
16
|
+
Columns: columnsBlock,
|
|
17
|
+
Heading: headingBlock,
|
|
18
|
+
Text: textBlock,
|
|
19
|
+
Navbar: navbarBlock,
|
|
20
|
+
Footer: footerBlock,
|
|
21
|
+
Hero: heroBlock,
|
|
22
|
+
CTA: ctaBlock,
|
|
23
|
+
FeatureGrid: featureGridBlock,
|
|
24
|
+
Testimonials: testimonialsBlock,
|
|
25
|
+
PricingCard: pricingCardBlock,
|
|
26
|
+
EmptyState: emptyStateBlock,
|
|
27
|
+
},
|
|
28
|
+
categories: PUCK_CATEGORIES,
|
|
29
|
+
root: {
|
|
30
|
+
fields: {},
|
|
31
|
+
defaultProps: {},
|
|
32
|
+
render: ({ children }) => _jsx(PuckRoot, { children: children }),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/web/config.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAiCb,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEL,YAAY,EAEZ,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAkElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,UAAU,EAAE;QACV,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,QAAQ;QACb,WAAW,EAAE,gBAAgB;QAC7B,YAAY,EAAE,iBAAiB;QAC/B,WAAW,EAAE,gBAAgB;QAC7B,UAAU,EAAE,eAAe;KACgB;IAC7C,UAAU,EAAE,eAA2D;IACvE,IAAI,EAAE;QACJ,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAE,QAAQ,GAAY;KAC1D;CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web half of the Puck integration.
|
|
3
|
+
*
|
|
4
|
+
* It is the shared layer plus this platform's drawings: the block specs, the field
|
|
5
|
+
* builders and the adapters are re-exported unchanged, and the block registrations and
|
|
6
|
+
* the page renderer are the web's own. Nothing here imports React Native, and nothing
|
|
7
|
+
* here imports the native half of the package, so a browser bundle reaches only the DOM
|
|
8
|
+
* renderer.
|
|
9
|
+
*/
|
|
10
|
+
export * from "../shared";
|
|
11
|
+
export * from "./blocks/content";
|
|
12
|
+
export * from "./blocks/layout";
|
|
13
|
+
export * from "./blocks/navigation";
|
|
14
|
+
export * from "./blocks/sections";
|
|
15
|
+
export * from "./blocks/utility";
|
|
16
|
+
export * from "./config";
|
|
17
|
+
export * from "./page";
|
|
18
|
+
export * from "./root";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* The web half of the Puck integration.
|
|
4
|
+
*
|
|
5
|
+
* It is the shared layer plus this platform's drawings: the block specs, the field
|
|
6
|
+
* builders and the adapters are re-exported unchanged, and the block registrations and
|
|
7
|
+
* the page renderer are the web's own. Nothing here imports React Native, and nothing
|
|
8
|
+
* here imports the native half of the package, so a browser bundle reaches only the DOM
|
|
9
|
+
* renderer.
|
|
10
|
+
*/
|
|
11
|
+
export * from "../shared";
|
|
12
|
+
export * from "./blocks/content";
|
|
13
|
+
export * from "./blocks/layout";
|
|
14
|
+
export * from "./blocks/navigation";
|
|
15
|
+
export * from "./blocks/sections";
|
|
16
|
+
export * from "./blocks/utility";
|
|
17
|
+
export * from "./config";
|
|
18
|
+
export * from "./page";
|
|
19
|
+
export * from "./root";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;GAQG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AsheePuckData } from "../shared";
|
|
2
|
+
import { type AsheePuckConfig } from "./config";
|
|
3
|
+
/**
|
|
4
|
+
* Props of {@link PuckPage}.
|
|
5
|
+
*/
|
|
6
|
+
export interface PuckPageProps {
|
|
7
|
+
/** The page the builder published. */
|
|
8
|
+
data: AsheePuckData;
|
|
9
|
+
/** The block registry to render with. Defaults to the AsheeUI configuration. */
|
|
10
|
+
config?: AsheePuckConfig;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a stored page.
|
|
14
|
+
*
|
|
15
|
+
* @param props - The stored page, and optionally the registry to render it with.
|
|
16
|
+
* @returns The rendered page.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <PuckPage data={page} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function PuckPage({ data, config }: PuckPageProps): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/web/page.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,UAAU,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,sCAAsC;IACtC,IAAI,EAAE,aAAa,CAAC;IAEpB,gFAAgF;IAChF,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAwB,EAAE,EAAE,aAAa,+BAEzE"}
|
package/dist/web/page.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Rendering a stored page, on the web.
|
|
5
|
+
*
|
|
6
|
+
* A published page renders through the editor's own renderer, which needs no editor:
|
|
7
|
+
* the same block registry the builder reads is what a live site renders, so the two
|
|
8
|
+
* cannot drift. The native entry offers a component of the same name, so an application
|
|
9
|
+
* writes one import and one call and gets each platform's own renderer.
|
|
10
|
+
*/
|
|
11
|
+
import { Render } from "@puckeditor/core";
|
|
12
|
+
import { asheePuckConfig } from "./config";
|
|
13
|
+
/**
|
|
14
|
+
* Render a stored page.
|
|
15
|
+
*
|
|
16
|
+
* @param props - The stored page, and optionally the registry to render it with.
|
|
17
|
+
* @returns The rendered page.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <PuckPage data={page} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function PuckPage({ data, config = asheePuckConfig }) {
|
|
25
|
+
return _jsx(Render, { config: config, data: data });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/web/page.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;GAOG;AAEH,OAAO,EAAa,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAwB,eAAe,EAAE,MAAM,UAAU,CAAC;AAajE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,EAAiB;IACxE,OAAO,KAAC,MAAM,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAuB,GAAI,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AsheePuckRootProps } from "../shared";
|
|
2
|
+
/**
|
|
3
|
+
* The published page's root.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The page the builder composed.
|
|
6
|
+
* @returns The page, inside the framework's provider when the application has none.
|
|
7
|
+
*/
|
|
8
|
+
export declare function PuckRoot({ children }: AsheePuckRootProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/web/root.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAUxD"}
|
package/dist/web/root.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The page shell a published page renders into, on the web.
|
|
5
|
+
*
|
|
6
|
+
* A block resolves its theme through the framework provider, so the shell supplies one
|
|
7
|
+
* when the consumer has not. An existing provider is respected rather than nested, so a
|
|
8
|
+
* consumer's own configuration — a default theme, a component override — keeps applying
|
|
9
|
+
* to a built page. That is the whole reason this reads the context instead of always
|
|
10
|
+
* rendering a provider: a second provider would replace the resolved configuration with
|
|
11
|
+
* the framework's own defaults.
|
|
12
|
+
*/
|
|
13
|
+
import { AsheeConfigContext, AsheeUIProvider } from "@asheeui/web";
|
|
14
|
+
import { useContext } from "react";
|
|
15
|
+
/**
|
|
16
|
+
* The published page's root.
|
|
17
|
+
*
|
|
18
|
+
* @param props - The page the builder composed.
|
|
19
|
+
* @returns The page, inside the framework's provider when the application has none.
|
|
20
|
+
*/
|
|
21
|
+
export function PuckRoot({ children }) {
|
|
22
|
+
const existingConfig = useContext(AsheeConfigContext);
|
|
23
|
+
const page = (_jsx("div", { className: "flex min-h-dvh w-full flex-col bg-background text-foreground", children: children }));
|
|
24
|
+
return existingConfig ? page : _jsx(AsheeUIProvider, { children: page });
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/web/root.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;GASG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAsB;IACvD,MAAM,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEtD,MAAM,IAAI,GAAG,CACX,cAAK,SAAS,EAAC,8DAA8D,YAC1E,QAAQ,GACL,CACP,CAAC;IAEF,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,eAAe,cAAE,IAAI,GAAmB,CAAC;AAC3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,123 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asheeui/puck",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"description": "The AsheeUI Puck integration: one block registry behind one import, routed by the bundler so an editor composes a page on the web and a device renders the stored page with the native components.",
|
|
5
|
+
"author": "Ashee Softworks <asheesoftworks@gmail.com>",
|
|
6
|
+
"homepage": "https://asheeui.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AsheeSoftworks/AsheeUI.git",
|
|
10
|
+
"directory": "packages/puck"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/AsheeSoftworks/AsheeUI/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"react-native",
|
|
18
|
+
"expo",
|
|
19
|
+
"puck",
|
|
20
|
+
"page-builder",
|
|
21
|
+
"visual-editor",
|
|
22
|
+
"component-library",
|
|
23
|
+
"design-system",
|
|
24
|
+
"tailwindcss",
|
|
25
|
+
"nativewind",
|
|
26
|
+
"typescript"
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"react-native": "./src/index.native.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"react-native": {
|
|
37
|
+
"types": "./dist/index.native.d.ts",
|
|
38
|
+
"default": "./dist/index.native.js"
|
|
39
|
+
},
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"import": "./dist/index.js",
|
|
42
|
+
"default": "./dist/index.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"provenance": true
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"src/index.ts",
|
|
51
|
+
"src/index.native.ts",
|
|
52
|
+
"src/shared",
|
|
53
|
+
"src/web",
|
|
54
|
+
"src/native",
|
|
55
|
+
"!src/**/*.test.ts",
|
|
56
|
+
"!src/**/*.test.tsx",
|
|
57
|
+
"LICENSE",
|
|
58
|
+
"NOTICE"
|
|
59
|
+
],
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@asheeui/core": "^3.0.0",
|
|
62
|
+
"@asheeui/web": "^2.8.0",
|
|
63
|
+
"@asheeui/native": "^2.8.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@puckeditor/core": "^0.23.0",
|
|
67
|
+
"nativewind": ">=4.2.0",
|
|
68
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
69
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
70
|
+
"react-native": ">=0.78.0",
|
|
71
|
+
"tailwindcss": ">=4.0.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"@puckeditor/core": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"nativewind": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"react-dom": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"react-native": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"tailwindcss": {
|
|
87
|
+
"optional": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@babel/core": "^8.0.7",
|
|
92
|
+
"@babel/runtime": "^8.0.7",
|
|
93
|
+
"@puckeditor/core": "^0.23.0",
|
|
94
|
+
"@react-native/babel-preset": "^0.88.0",
|
|
95
|
+
"@react-native/jest-preset": "^0.88.0",
|
|
96
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
97
|
+
"@testing-library/react": "^16.3.3",
|
|
98
|
+
"@testing-library/react-native": "^14.1.0",
|
|
99
|
+
"@types/jest": "^30.0.0",
|
|
100
|
+
"@types/node": "^26.6.5",
|
|
101
|
+
"@types/react": "^19.3.0",
|
|
102
|
+
"@types/react-dom": "^19.3.0",
|
|
103
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
104
|
+
"babel-jest": "^30.5.2",
|
|
105
|
+
"jest": "^30.5.2",
|
|
106
|
+
"jsdom": "^30.1.3",
|
|
107
|
+
"nativewind": "^4.2.7",
|
|
108
|
+
"react": "^19.3.1",
|
|
109
|
+
"react-dom": "^19.3.1",
|
|
110
|
+
"react-native": "0.88.0",
|
|
111
|
+
"tailwindcss": "^4.3.3",
|
|
112
|
+
"typescript": "^7.0.2",
|
|
113
|
+
"vitest": "^5.0.5"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"build": "tsc -p tsconfig.build.json",
|
|
117
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
118
|
+
"test": "vitest run && jest",
|
|
119
|
+
"test:web": "vitest run",
|
|
120
|
+
"test:native": "jest",
|
|
121
|
+
"test:watch": "vitest"
|
|
122
|
+
}
|
|
6
123
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AsheeUI Puck integration, native branch.
|
|
3
|
+
*
|
|
4
|
+
* Metro reaches this file for a React Native platform — through the manifest's
|
|
5
|
+
* `react-native` field, through the `react-native` condition of the exports map, or by
|
|
6
|
+
* resolving the platform extension (`.native`) beside `index.ts` — so an application's
|
|
7
|
+
* import specifiers do not change between the web and a device.
|
|
8
|
+
*
|
|
9
|
+
* It exports the native registry and the native page renderer alongside the same shared
|
|
10
|
+
* specs the web branch exports, because the point of the package is that the import a
|
|
11
|
+
* developer writes is the same one on both platforms. It imports no DOM renderer and
|
|
12
|
+
* nothing from the editor: resolving this file must not pull Tailwind, React DOM or
|
|
13
|
+
* `@puckeditor/core` into a native bundle.
|
|
14
|
+
*
|
|
15
|
+
* The file is published as source rather than only as a build, and so are the modules it
|
|
16
|
+
* imports, because the manifest's `react-native` field cannot be redirected at publish
|
|
17
|
+
* time the way `main` and `types` are: whatever that field names has to exist in the
|
|
18
|
+
* tarball, and a resolver that reads the field instead of the exports map has to be able
|
|
19
|
+
* to compile it and everything it reaches.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export * from "./native";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The AsheeUI Puck integration.
|
|
5
|
+
*
|
|
6
|
+
* One import, two renderers. An application installs `@asheeui/puck` and writes the same
|
|
7
|
+
* specifiers whether it runs in a browser or on a device; the resolver decides which half
|
|
8
|
+
* answers:
|
|
9
|
+
*
|
|
10
|
+
* - On the web, it reads `main` (and the `import` condition) and reaches this file,
|
|
11
|
+
* which is the editor's block registry, the editor's page renderer and the shared
|
|
12
|
+
* specs behind them.
|
|
13
|
+
* - Under Expo and Metro, it reads the manifest's `react-native` field, then the
|
|
14
|
+
* `react-native` condition of the exports map, and finally Metro's platform extension
|
|
15
|
+
* (`.native.ts` beside `.ts`), and reaches `./index.native`, which renders a stored
|
|
16
|
+
* page with the native components.
|
|
17
|
+
*
|
|
18
|
+
* The routing is a property of the file name and the manifest rather than of a runtime
|
|
19
|
+
* check, which is what keeps a browser bundle free of React Native and a device bundle
|
|
20
|
+
* free of the DOM edition of the framework. This module is the web branch, and it
|
|
21
|
+
* imports no native renderer.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export * from "./web";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform content blocks.
|
|
3
|
+
*
|
|
4
|
+
* Each block is the framework component plus the shared spec: the label, the fields and
|
|
5
|
+
* the defaults come from `src/shared`, and only the drawing is written here. What the
|
|
6
|
+
* platform draws differently is stated in the block: a paragraph's alignment is a
|
|
7
|
+
* property of its `Typography` rather than a class on a paragraph element, so the shared
|
|
8
|
+
* alignment vocabulary is what reaches the component.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
Container,
|
|
13
|
+
SECTION_BLOCK_TEXT_ALIGN,
|
|
14
|
+
Section,
|
|
15
|
+
Typography,
|
|
16
|
+
} from "@asheeui/native";
|
|
17
|
+
import { SectionHeading } from "@asheeui/native/section-kit";
|
|
18
|
+
import type {
|
|
19
|
+
AsheeBlock,
|
|
20
|
+
HeadingBlockProps,
|
|
21
|
+
TextBlockProps,
|
|
22
|
+
} from "../../shared";
|
|
23
|
+
import { HEADING_SPEC, TEXT_SPEC } from "../../shared";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A section heading with an optional eyebrow and description.
|
|
27
|
+
*/
|
|
28
|
+
export const headingBlock: AsheeBlock<HeadingBlockProps> = {
|
|
29
|
+
...HEADING_SPEC,
|
|
30
|
+
render: ({ eyebrow, title, description, align }) => (
|
|
31
|
+
<Section spacing="md">
|
|
32
|
+
<Container>
|
|
33
|
+
<SectionHeading
|
|
34
|
+
eyebrow={eyebrow || undefined}
|
|
35
|
+
title={title || undefined}
|
|
36
|
+
description={description || undefined}
|
|
37
|
+
align={align ?? "start"}
|
|
38
|
+
size="lg"
|
|
39
|
+
/>
|
|
40
|
+
</Container>
|
|
41
|
+
</Section>
|
|
42
|
+
),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A paragraph of body text.
|
|
47
|
+
*/
|
|
48
|
+
export const textBlock: AsheeBlock<TextBlockProps> = {
|
|
49
|
+
...TEXT_SPEC,
|
|
50
|
+
render: ({ text, align }) => (
|
|
51
|
+
<Section spacing="sm">
|
|
52
|
+
<Container>
|
|
53
|
+
<Typography
|
|
54
|
+
role="body-lg"
|
|
55
|
+
align={SECTION_BLOCK_TEXT_ALIGN[align ?? "start"]}>
|
|
56
|
+
{text}
|
|
57
|
+
</Typography>
|
|
58
|
+
</Container>
|
|
59
|
+
</Section>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform layout blocks.
|
|
3
|
+
*
|
|
4
|
+
* A band and a two-column arrangement. Both are the only blocks whose props hold a drop
|
|
5
|
+
* zone, and on the platform a drop zone is a rendered node rather than a component to
|
|
6
|
+
* place: the page renderer resolves a stored page's children before it calls a block, so
|
|
7
|
+
* the block receives what to draw. That is why these two props are declared here while
|
|
8
|
+
* every other block's come from the shared spec.
|
|
9
|
+
*
|
|
10
|
+
* One difference between the platforms is deliberate and stated rather than hidden. A
|
|
11
|
+
* two-column block offers a ratio on the web, where a stylesheet expresses one; the
|
|
12
|
+
* platform's grid resolves its own window and offers whole column counts, so the ratio
|
|
13
|
+
* resolves to the framework's two columns once there is room for them and the block
|
|
14
|
+
* draws the same arrangement at every width below that.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Container, Grid, Section } from "@asheeui/native";
|
|
18
|
+
import type { ReactNode } from "react";
|
|
19
|
+
import type {
|
|
20
|
+
AsheeBlock,
|
|
21
|
+
ColumnsBandProps,
|
|
22
|
+
SectionBandProps,
|
|
23
|
+
} from "../../shared";
|
|
24
|
+
import { COLUMNS_SPEC, SECTION_SPEC } from "../../shared";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The props of the band block.
|
|
28
|
+
*/
|
|
29
|
+
export type SectionBlockProps = SectionBandProps & {
|
|
30
|
+
/** Content dropped into the band, already rendered. */
|
|
31
|
+
content?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A band with its own vertical rhythm and background.
|
|
36
|
+
*/
|
|
37
|
+
export const sectionBlock: AsheeBlock<SectionBlockProps> = {
|
|
38
|
+
...SECTION_SPEC,
|
|
39
|
+
render: ({ spacing, background, content }) => (
|
|
40
|
+
<Section spacing={spacing ?? "lg"} background={background ?? "none"}>
|
|
41
|
+
<Container>{content}</Container>
|
|
42
|
+
</Section>
|
|
43
|
+
),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The props of the two-column block.
|
|
48
|
+
*/
|
|
49
|
+
export type ColumnsBlockProps = ColumnsBandProps & {
|
|
50
|
+
/** Content of the first column, already rendered. */
|
|
51
|
+
start?: ReactNode;
|
|
52
|
+
|
|
53
|
+
/** Content of the second column, already rendered. */
|
|
54
|
+
end?: ReactNode;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Two columns that stack on a narrow screen.
|
|
59
|
+
*/
|
|
60
|
+
export const columnsBlock: AsheeBlock<ColumnsBlockProps> = {
|
|
61
|
+
...COLUMNS_SPEC,
|
|
62
|
+
render: ({ spacing, start, end }) => (
|
|
63
|
+
<Section spacing={spacing ?? "lg"}>
|
|
64
|
+
<Container>
|
|
65
|
+
<Grid columns={1} columnsLg={2} gap="lg">
|
|
66
|
+
{start}
|
|
67
|
+
{end}
|
|
68
|
+
</Grid>
|
|
69
|
+
</Container>
|
|
70
|
+
</Section>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform navigation blocks.
|
|
3
|
+
*
|
|
4
|
+
* A bar and a footer, with the navigation as data: link lists a non-developer can edit
|
|
5
|
+
* and no application state. The bar's action region is the framework's own action group,
|
|
6
|
+
* so a configured action renders exactly as a hand-written button does and follows the
|
|
7
|
+
* destination through the platform's own URL handler. The fields and the defaults come
|
|
8
|
+
* from `src/shared`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Footer, Navbar } from "@asheeui/native";
|
|
12
|
+
import { ActionGroup } from "@asheeui/native/section-kit";
|
|
13
|
+
import type {
|
|
14
|
+
AsheeBlock,
|
|
15
|
+
FooterBlockProps,
|
|
16
|
+
NavbarBlockProps,
|
|
17
|
+
} from "../../shared";
|
|
18
|
+
import { FOOTER_SPEC, NAVBAR_SPEC, toAction } from "../../shared";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The navigation bar of a page.
|
|
22
|
+
*/
|
|
23
|
+
export const navbarBlock: AsheeBlock<NavbarBlockProps> = {
|
|
24
|
+
...NAVBAR_SPEC,
|
|
25
|
+
render: ({
|
|
26
|
+
brand,
|
|
27
|
+
brandHref,
|
|
28
|
+
align,
|
|
29
|
+
links,
|
|
30
|
+
primaryAction,
|
|
31
|
+
secondaryAction,
|
|
32
|
+
}) => (
|
|
33
|
+
<Navbar
|
|
34
|
+
brand={brand || undefined}
|
|
35
|
+
brandHref={brandHref || undefined}
|
|
36
|
+
align={align ?? "center"}
|
|
37
|
+
links={(links ?? []).map((link) => ({
|
|
38
|
+
label: link.label ?? "",
|
|
39
|
+
href: link.href,
|
|
40
|
+
}))}
|
|
41
|
+
actions={
|
|
42
|
+
<ActionGroup
|
|
43
|
+
primaryAction={toAction(primaryAction)}
|
|
44
|
+
secondaryAction={toAction(secondaryAction)}
|
|
45
|
+
/>
|
|
46
|
+
}
|
|
47
|
+
/>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The footer of a page.
|
|
53
|
+
*/
|
|
54
|
+
export const footerBlock: AsheeBlock<FooterBlockProps> = {
|
|
55
|
+
...FOOTER_SPEC,
|
|
56
|
+
render: ({ brand, description, groups, copyright }) => (
|
|
57
|
+
<Footer
|
|
58
|
+
brand={brand || undefined}
|
|
59
|
+
description={description || undefined}
|
|
60
|
+
copyright={copyright || undefined}
|
|
61
|
+
groups={(groups ?? []).map((group, index) => ({
|
|
62
|
+
id: index,
|
|
63
|
+
title: group.title ?? "Links",
|
|
64
|
+
links: (group.links ?? []).map((item) => ({
|
|
65
|
+
label: item.label ?? "",
|
|
66
|
+
href: item.href,
|
|
67
|
+
})),
|
|
68
|
+
}))}
|
|
69
|
+
/>
|
|
70
|
+
),
|
|
71
|
+
};
|