soinproduction-gutenberg 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -2
- package/RELEASING.md +27 -0
- package/adapters/next/router.tsx +13 -0
- package/adapters/wordpress/README.md +40 -0
- package/adapters/wordpress/assets.htaccess +14 -0
- package/adapters/wordpress/assets.php +31 -0
- package/adapters/wordpress/blueprint.ts +32 -0
- package/adapters/wordpress/editor-router.tsx +26 -0
- package/adapters/wordpress/renderer.php +212 -0
- package/adapters/wordpress/router.tsx +4 -0
- package/adapters/wordpress/runtime.tsx +96 -0
- package/adapters/wordpress/static-media.ts +18 -0
- package/adapters/wordpress/styles.css +19 -0
- package/admin-ui/README.md +48 -0
- package/admin-ui/admin.css +466 -0
- package/admin-ui/bootstrap.php +18 -0
- package/admin-ui/controls.css +52 -0
- package/admin-ui/controls.js +195 -0
- package/admin-ui/editor.css +759 -0
- package/admin-ui/tokens.css +26 -0
- package/admin-ui/viewport.tsx +219 -0
- package/bootstrap.php +8 -0
- package/components/accordion/index.tsx +14 -0
- package/components/accordion/manifest.json +4 -0
- package/components/area/index.tsx +98 -0
- package/components/area/manifest.json +4 -0
- package/components/background/editor/canvas.tsx +138 -0
- package/components/background/editor/selection.ts +40 -0
- package/components/background/editor.tsx +4 -0
- package/components/background/implementation/component.tsx +27 -0
- package/components/background/implementation/schema.ts +10 -0
- package/components/background/implementation/video.tsx +122 -0
- package/components/background/index.tsx +23 -0
- package/components/background/manifest.json +11 -0
- package/components/button/index.tsx +27 -0
- package/components/button/manifest.json +6 -0
- package/components/buttons/implementation/actions.tsx +61 -0
- package/components/buttons/implementation/booking.tsx +34 -0
- package/components/buttons/implementation/content.tsx +89 -0
- package/components/buttons/implementation/data.ts +50 -0
- package/components/buttons/index.tsx +66 -0
- package/components/buttons/manifest.json +4 -0
- package/components/buttons/shared/index.tsx +63 -0
- package/components/choice/index.tsx +15 -0
- package/components/choice/manifest.json +4 -0
- package/components/cols/index.tsx +7 -0
- package/components/cols/manifest.json +4 -0
- package/components/drag/editor.tsx +239 -0
- package/components/drag/index.tsx +140 -0
- package/components/drag/layout.ts +86 -0
- package/components/drag/manifest.json +4 -0
- package/components/forms/editor.tsx +8 -0
- package/components/forms/implementation/component.tsx +46 -0
- package/components/forms/implementation/selected.tsx +21 -0
- package/components/forms/index.tsx +11 -0
- package/components/forms/manifest.json +17 -0
- package/components/forms/server.php +23 -0
- package/components/gallery/index.tsx +10 -0
- package/components/gallery/manifest.json +4 -0
- package/components/heading/index.tsx +10 -0
- package/components/heading/manifest.json +4 -0
- package/components/icon/index.tsx +11 -0
- package/components/icon/manifest.json +4 -0
- package/components/image/index.tsx +21 -0
- package/components/image/manifest.json +4 -0
- package/components/list/gallery.css +20 -0
- package/components/list/gallery.tsx +126 -0
- package/components/list/index.tsx +151 -0
- package/components/list/loading.tsx +23 -0
- package/components/list/manifest.json +7 -0
- package/components/media/index.tsx +10 -0
- package/components/media/manifest.json +4 -0
- package/components/paragraphs/index.tsx +18 -0
- package/components/paragraphs/manifest.json +4 -0
- package/components/pricing-plans/editor.tsx +2 -0
- package/components/pricing-plans/implementation/component.tsx +40 -0
- package/components/pricing-plans/implementation/editor.tsx +17 -0
- package/components/pricing-plans/implementation/selection.ts +10 -0
- package/components/pricing-plans/index.tsx +11 -0
- package/components/pricing-plans/manifest.json +17 -0
- package/components/pricing-plans/server.php +24 -0
- package/components/records/index.tsx +21 -0
- package/components/records/manifest.json +4 -0
- package/components/records/presentation.ts +13 -0
- package/components/reviews-carousel/card.tsx +63 -0
- package/components/reviews-carousel/editor.tsx +2 -0
- package/components/reviews-carousel/implementation/component.tsx +80 -0
- package/components/reviews-carousel/implementation/editor.tsx +17 -0
- package/components/reviews-carousel/implementation/selection.ts +10 -0
- package/components/reviews-carousel/index.tsx +12 -0
- package/components/reviews-carousel/manifest.json +14 -0
- package/components/reviews-carousel/server.php +18 -0
- package/components/section/index.tsx +21 -0
- package/components/section/manifest.json +4 -0
- package/components/show/index.tsx +16 -0
- package/components/show/manifest.json +4 -0
- package/components/slider/index.tsx +50 -0
- package/components/slider/manifest.json +4 -0
- package/components/text/index.tsx +11 -0
- package/components/text/manifest.json +4 -0
- package/components/toggle/index.tsx +14 -0
- package/components/toggle/manifest.json +4 -0
- package/core/README.md +83 -0
- package/core/content/areas/data.ts +33 -0
- package/core/content/areas/render.tsx +61 -0
- package/core/content/context.tsx +41 -0
- package/core/content/html-props.ts +80 -0
- package/core/content/html.tsx +32 -0
- package/core/content/layout-element.tsx +11 -0
- package/core/content/links.ts +11 -0
- package/core/content/paragraphs.tsx +42 -0
- package/core/content/rich-text.tsx +41 -0
- package/core/content/template.ts +15 -0
- package/core/editor/button-icon-settings.tsx +15 -0
- package/core/editor/collection-display.tsx +36 -0
- package/core/editor/content-area.tsx +59 -0
- package/core/editor/environment.ts +28 -0
- package/core/editor/icons.tsx +90 -0
- package/core/editor/list-actions.tsx +59 -0
- package/core/editor/manual-record.tsx +57 -0
- package/core/editor/media-select-action.tsx +28 -0
- package/core/editor/media.ts +49 -0
- package/core/editor/paragraphs.tsx +122 -0
- package/core/editor/relationship.tsx +196 -0
- package/core/editor/repeater.tsx +231 -0
- package/core/editor/source-relationship.tsx +35 -0
- package/core/editor/styles.css +1206 -0
- package/core/editor/video-inheritance.tsx +27 -0
- package/core/fields/README.md +138 -0
- package/core/fields/editor.tsx +758 -0
- package/core/fields/examples/README.md +123 -0
- package/core/fields/examples/buttons/example.md +68 -0
- package/core/fields/examples/color/example.md +55 -0
- package/core/fields/examples/content/example.md +86 -0
- package/core/fields/examples/gallery/example.md +53 -0
- package/core/fields/examples/group/example.md +55 -0
- package/core/fields/examples/icon/example.md +49 -0
- package/core/fields/examples/image/example.md +49 -0
- package/core/fields/examples/link/example.md +71 -0
- package/core/fields/examples/media/example.md +73 -0
- package/core/fields/examples/number/example.md +57 -0
- package/core/fields/examples/relationship/example.md +66 -0
- package/core/fields/examples/repeater/example.md +63 -0
- package/core/fields/examples/rich-text/example.md +53 -0
- package/core/fields/examples/select/example.md +56 -0
- package/core/fields/examples/text/example.md +53 -0
- package/core/fields/examples/textarea/example.md +51 -0
- package/core/fields/examples/toggle/example.md +51 -0
- package/core/fields/examples/wysiwyg/example.md +49 -0
- package/core/fields/item-focus.ts +12 -0
- package/core/fields/list-order.ts +10 -0
- package/core/fields/presets.ts +52 -0
- package/core/fields/records.ts +36 -0
- package/core/fields/render.tsx +583 -0
- package/core/fields/schema.ts +295 -0
- package/core/fields/values.ts +66 -0
- package/core/icons/button.tsx +31 -0
- package/core/icons/eyebrow.tsx +22 -0
- package/core/icons/icon.tsx +47 -0
- package/core/icons/library.ts +22 -0
- package/core/icons/list.tsx +46 -0
- package/core/media/image.tsx +10 -0
- package/core/media/universal/README.md +18 -0
- package/core/media/universal/bootstrap.php +32 -0
- package/core/media/universal/component.tsx +247 -0
- package/core/media/universal/editor.css +149 -0
- package/core/media/universal/editor.tsx +271 -0
- package/core/media/universal/model.ts +151 -0
- package/core/media/universal/styles.css +126 -0
- package/core/media/values.ts +11 -0
- package/core/modules/define-module.tsx +43 -0
- package/core/modules/section.ts +25 -0
- package/core/modules/types.ts +26 -0
- package/core/relationships/selection.ts +64 -0
- package/core/responsive/breakpoints.ts +19 -0
- package/core/ui/accordion.tsx +50 -0
- package/core/ui/button-appearance.ts +24 -0
- package/core/ui/button.tsx +49 -0
- package/core/ui/carousel.tsx +239 -0
- package/core/ui/dialog.tsx +102 -0
- package/core/ui/disclosure.tsx +80 -0
- package/core/ui/editor-action.tsx +18 -0
- package/core/ui/eyebrow.tsx +25 -0
- package/core/ui/loaded-collection.tsx +73 -0
- package/core/ui/pagination.tsx +16 -0
- package/core/ui/sheet.tsx +119 -0
- package/core/ui/slider.tsx +63 -0
- package/core/ui/switch.tsx +26 -0
- package/core/utils/classnames.ts +6 -0
- package/core/utils/color.ts +10 -0
- package/core/utils/path.ts +15 -0
- package/core/utils/url.ts +3 -0
- package/dist/adapters/next/router.d.ts +6 -0
- package/dist/adapters/next/router.js +42 -0
- package/dist/adapters/next/router.js.map +7 -0
- package/dist/adapters/wordpress/README.md +40 -0
- package/dist/adapters/wordpress/assets.htaccess +14 -0
- package/dist/adapters/wordpress/assets.php +31 -0
- package/dist/adapters/wordpress/blueprint.d.ts +84 -0
- package/dist/adapters/wordpress/blueprint.js +63 -0
- package/dist/adapters/wordpress/blueprint.js.map +7 -0
- package/dist/adapters/wordpress/editor-router.d.ts +10 -0
- package/dist/adapters/wordpress/editor-router.js +43 -0
- package/dist/adapters/wordpress/editor-router.js.map +7 -0
- package/dist/adapters/wordpress/renderer.php +212 -0
- package/dist/adapters/wordpress/router.d.ts +6 -0
- package/dist/adapters/wordpress/router.js +16 -0
- package/dist/adapters/wordpress/router.js.map +7 -0
- package/dist/adapters/wordpress/runtime.d.ts +7 -0
- package/dist/adapters/wordpress/runtime.js +109 -0
- package/dist/adapters/wordpress/runtime.js.map +7 -0
- package/dist/adapters/wordpress/static-media.d.ts +2 -0
- package/dist/adapters/wordpress/static-media.js +34 -0
- package/dist/adapters/wordpress/static-media.js.map +7 -0
- package/dist/adapters/wordpress/styles.css +19 -0
- package/dist/admin-ui/README.md +48 -0
- package/dist/admin-ui/admin.css +466 -0
- package/dist/admin-ui/bootstrap.php +18 -0
- package/dist/admin-ui/controls.css +52 -0
- package/dist/admin-ui/controls.js +195 -0
- package/dist/admin-ui/editor.css +759 -0
- package/dist/admin-ui/tokens.css +26 -0
- package/dist/admin-ui/viewport.d.ts +15 -0
- package/dist/admin-ui/viewport.js +226 -0
- package/dist/admin-ui/viewport.js.map +7 -0
- package/dist/bootstrap.php +8 -0
- package/dist/components/accordion/index.d.ts +7 -0
- package/dist/components/accordion/index.js +14 -0
- package/dist/components/accordion/index.js.map +7 -0
- package/dist/components/accordion/manifest.json +4 -0
- package/dist/components/area/index.d.ts +26 -0
- package/dist/components/area/index.js +85 -0
- package/dist/components/area/index.js.map +7 -0
- package/dist/components/area/manifest.json +4 -0
- package/dist/components/background/editor/canvas.d.ts +2 -0
- package/dist/components/background/editor/canvas.js +125 -0
- package/dist/components/background/editor/canvas.js.map +7 -0
- package/dist/components/background/editor/selection.d.ts +6 -0
- package/dist/components/background/editor/selection.js +57 -0
- package/dist/components/background/editor/selection.js.map +7 -0
- package/dist/components/background/editor.d.ts +1 -0
- package/dist/components/background/editor.js +9 -0
- package/dist/components/background/editor.js.map +7 -0
- package/dist/components/background/implementation/component.d.ts +6 -0
- package/dist/components/background/implementation/component.js +31 -0
- package/dist/components/background/implementation/component.js.map +7 -0
- package/dist/components/background/implementation/schema.d.ts +2 -0
- package/dist/components/background/implementation/schema.js +13 -0
- package/dist/components/background/implementation/schema.js.map +7 -0
- package/dist/components/background/implementation/video.d.ts +16 -0
- package/dist/components/background/implementation/video.js +108 -0
- package/dist/components/background/implementation/video.js.map +7 -0
- package/dist/components/background/index.d.ts +10 -0
- package/dist/components/background/index.js +25 -0
- package/dist/components/background/index.js.map +7 -0
- package/dist/components/background/manifest.json +11 -0
- package/dist/components/button/index.d.ts +19 -0
- package/dist/components/button/index.js +26 -0
- package/dist/components/button/index.js.map +7 -0
- package/dist/components/button/manifest.json +6 -0
- package/dist/components/buttons/implementation/actions.d.ts +6 -0
- package/dist/components/buttons/implementation/actions.js +47 -0
- package/dist/components/buttons/implementation/actions.js.map +7 -0
- package/dist/components/buttons/implementation/booking.d.ts +10 -0
- package/dist/components/buttons/implementation/booking.js +33 -0
- package/dist/components/buttons/implementation/booking.js.map +7 -0
- package/dist/components/buttons/implementation/content.d.ts +6 -0
- package/dist/components/buttons/implementation/content.js +60 -0
- package/dist/components/buttons/implementation/content.js.map +7 -0
- package/dist/components/buttons/implementation/data.d.ts +24 -0
- package/dist/components/buttons/implementation/data.js +31 -0
- package/dist/components/buttons/implementation/data.js.map +7 -0
- package/dist/components/buttons/index.d.ts +27 -0
- package/dist/components/buttons/index.js +62 -0
- package/dist/components/buttons/index.js.map +7 -0
- package/dist/components/buttons/manifest.json +4 -0
- package/dist/components/buttons/shared/index.d.ts +10 -0
- package/dist/components/buttons/shared/index.js +63 -0
- package/dist/components/buttons/shared/index.js.map +7 -0
- package/dist/components/choice/index.d.ts +14 -0
- package/dist/components/choice/index.js +18 -0
- package/dist/components/choice/index.js.map +7 -0
- package/dist/components/choice/manifest.json +4 -0
- package/dist/components/cols/index.d.ts +11 -0
- package/dist/components/cols/index.js +9 -0
- package/dist/components/cols/index.js.map +7 -0
- package/dist/components/cols/manifest.json +4 -0
- package/dist/components/drag/editor.d.ts +6 -0
- package/dist/components/drag/editor.js +359 -0
- package/dist/components/drag/editor.js.map +7 -0
- package/dist/components/drag/index.d.ts +54 -0
- package/dist/components/drag/index.js +136 -0
- package/dist/components/drag/index.js.map +7 -0
- package/dist/components/drag/layout.d.ts +45 -0
- package/dist/components/drag/layout.js +98 -0
- package/dist/components/drag/layout.js.map +7 -0
- package/dist/components/drag/manifest.json +4 -0
- package/dist/components/forms/editor.d.ts +1 -0
- package/dist/components/forms/editor.js +15 -0
- package/dist/components/forms/editor.js.map +7 -0
- package/dist/components/forms/implementation/component.d.ts +7 -0
- package/dist/components/forms/implementation/component.js +38 -0
- package/dist/components/forms/implementation/component.js.map +7 -0
- package/dist/components/forms/implementation/selected.d.ts +5 -0
- package/dist/components/forms/implementation/selected.js +18 -0
- package/dist/components/forms/implementation/selected.js.map +7 -0
- package/dist/components/forms/index.d.ts +6 -0
- package/dist/components/forms/index.js +13 -0
- package/dist/components/forms/index.js.map +7 -0
- package/dist/components/forms/manifest.json +17 -0
- package/dist/components/forms/server.php +23 -0
- package/dist/components/gallery/index.d.ts +14 -0
- package/dist/components/gallery/index.js +13 -0
- package/dist/components/gallery/index.js.map +7 -0
- package/dist/components/gallery/manifest.json +4 -0
- package/dist/components/heading/index.d.ts +14 -0
- package/dist/components/heading/index.js +13 -0
- package/dist/components/heading/index.js.map +7 -0
- package/dist/components/heading/manifest.json +4 -0
- package/dist/components/icon/index.d.ts +17 -0
- package/dist/components/icon/index.js +13 -0
- package/dist/components/icon/index.js.map +7 -0
- package/dist/components/icon/manifest.json +4 -0
- package/dist/components/image/index.d.ts +23 -0
- package/dist/components/image/index.js +19 -0
- package/dist/components/image/index.js.map +7 -0
- package/dist/components/image/manifest.json +4 -0
- package/dist/components/list/gallery.css +20 -0
- package/dist/components/list/gallery.d.ts +11 -0
- package/dist/components/list/gallery.js +180 -0
- package/dist/components/list/gallery.js.map +7 -0
- package/dist/components/list/index.d.ts +35 -0
- package/dist/components/list/index.js +133 -0
- package/dist/components/list/index.js.map +7 -0
- package/dist/components/list/loading.d.ts +13 -0
- package/dist/components/list/loading.js +25 -0
- package/dist/components/list/loading.js.map +7 -0
- package/dist/components/list/manifest.json +7 -0
- package/dist/components/media/index.d.ts +5 -0
- package/dist/components/media/index.js +13 -0
- package/dist/components/media/index.js.map +7 -0
- package/dist/components/media/manifest.json +4 -0
- package/dist/components/paragraphs/index.d.ts +15 -0
- package/dist/components/paragraphs/index.js +21 -0
- package/dist/components/paragraphs/index.js.map +7 -0
- package/dist/components/paragraphs/manifest.json +4 -0
- package/dist/components/pricing-plans/editor.d.ts +1 -0
- package/dist/components/pricing-plans/editor.js +9 -0
- package/dist/components/pricing-plans/editor.js.map +7 -0
- package/dist/components/pricing-plans/implementation/component.d.ts +4 -0
- package/dist/components/pricing-plans/implementation/component.js +45 -0
- package/dist/components/pricing-plans/implementation/component.js.map +7 -0
- package/dist/components/pricing-plans/implementation/editor.d.ts +6 -0
- package/dist/components/pricing-plans/implementation/editor.js +21 -0
- package/dist/components/pricing-plans/implementation/editor.js.map +7 -0
- package/dist/components/pricing-plans/implementation/selection.d.ts +3 -0
- package/dist/components/pricing-plans/implementation/selection.js +13 -0
- package/dist/components/pricing-plans/implementation/selection.js.map +7 -0
- package/dist/components/pricing-plans/index.d.ts +6 -0
- package/dist/components/pricing-plans/index.js +13 -0
- package/dist/components/pricing-plans/index.js.map +7 -0
- package/dist/components/pricing-plans/manifest.json +17 -0
- package/dist/components/pricing-plans/server.php +24 -0
- package/dist/components/records/index.d.ts +35 -0
- package/dist/components/records/index.js +19 -0
- package/dist/components/records/index.js.map +7 -0
- package/dist/components/records/manifest.json +4 -0
- package/dist/components/records/presentation.d.ts +1 -0
- package/dist/components/records/presentation.js +12 -0
- package/dist/components/records/presentation.js.map +7 -0
- package/dist/components/reviews-carousel/card.d.ts +1 -0
- package/dist/components/reviews-carousel/card.js +55 -0
- package/dist/components/reviews-carousel/card.js.map +7 -0
- package/dist/components/reviews-carousel/editor.d.ts +1 -0
- package/dist/components/reviews-carousel/editor.js +9 -0
- package/dist/components/reviews-carousel/editor.js.map +7 -0
- package/dist/components/reviews-carousel/implementation/component.d.ts +12 -0
- package/dist/components/reviews-carousel/implementation/component.js +63 -0
- package/dist/components/reviews-carousel/implementation/component.js.map +7 -0
- package/dist/components/reviews-carousel/implementation/editor.d.ts +6 -0
- package/dist/components/reviews-carousel/implementation/editor.js +21 -0
- package/dist/components/reviews-carousel/implementation/editor.js.map +7 -0
- package/dist/components/reviews-carousel/implementation/selection.d.ts +3 -0
- package/dist/components/reviews-carousel/implementation/selection.js +13 -0
- package/dist/components/reviews-carousel/implementation/selection.js.map +7 -0
- package/dist/components/reviews-carousel/index.d.ts +16 -0
- package/dist/components/reviews-carousel/index.js +13 -0
- package/dist/components/reviews-carousel/index.js.map +7 -0
- package/dist/components/reviews-carousel/manifest.json +14 -0
- package/dist/components/reviews-carousel/server.php +18 -0
- package/dist/components/section/index.d.ts +7 -0
- package/dist/components/section/index.js +18 -0
- package/dist/components/section/index.js.map +7 -0
- package/dist/components/section/manifest.json +4 -0
- package/dist/components/show/index.d.ts +6 -0
- package/dist/components/show/index.js +17 -0
- package/dist/components/show/index.js.map +7 -0
- package/dist/components/show/manifest.json +4 -0
- package/dist/components/slider/index.d.ts +41 -0
- package/dist/components/slider/index.js +39 -0
- package/dist/components/slider/index.js.map +7 -0
- package/dist/components/slider/manifest.json +4 -0
- package/dist/components/text/index.d.ts +17 -0
- package/dist/components/text/index.js +13 -0
- package/dist/components/text/index.js.map +7 -0
- package/dist/components/text/manifest.json +4 -0
- package/dist/components/toggle/index.d.ts +18 -0
- package/dist/components/toggle/index.js +16 -0
- package/dist/components/toggle/index.js.map +7 -0
- package/dist/components/toggle/manifest.json +4 -0
- package/dist/core/README.md +83 -0
- package/dist/core/content/areas/data.d.ts +13 -0
- package/dist/core/content/areas/data.js +17 -0
- package/dist/core/content/areas/data.js.map +7 -0
- package/dist/core/content/areas/render.d.ts +5 -0
- package/dist/core/content/areas/render.js +34 -0
- package/dist/core/content/areas/render.js.map +7 -0
- package/dist/core/content/context.d.ts +33 -0
- package/dist/core/content/context.js +25 -0
- package/dist/core/content/context.js.map +7 -0
- package/dist/core/content/html-props.d.ts +2 -0
- package/dist/core/content/html-props.js +57 -0
- package/dist/core/content/html-props.js.map +7 -0
- package/dist/core/content/html.d.ts +2 -0
- package/dist/core/content/html.js +27 -0
- package/dist/core/content/html.js.map +7 -0
- package/dist/core/content/layout-element.d.ts +4 -0
- package/dist/core/content/layout-element.js +9 -0
- package/dist/core/content/layout-element.js.map +7 -0
- package/dist/core/content/links.d.ts +2 -0
- package/dist/core/content/links.js +14 -0
- package/dist/core/content/links.js.map +7 -0
- package/dist/core/content/paragraphs.d.ts +17 -0
- package/dist/core/content/paragraphs.js +35 -0
- package/dist/core/content/paragraphs.js.map +7 -0
- package/dist/core/content/rich-text.d.ts +6 -0
- package/dist/core/content/rich-text.js +35 -0
- package/dist/core/content/rich-text.js.map +7 -0
- package/dist/core/content/template.d.ts +3 -0
- package/dist/core/content/template.js +12 -0
- package/dist/core/content/template.js.map +7 -0
- package/dist/core/editor/button-icon-settings.d.ts +5 -0
- package/dist/core/editor/button-icon-settings.js +19 -0
- package/dist/core/editor/button-icon-settings.js.map +7 -0
- package/dist/core/editor/collection-display.d.ts +6 -0
- package/dist/core/editor/collection-display.js +60 -0
- package/dist/core/editor/collection-display.js.map +7 -0
- package/dist/core/editor/content-area.d.ts +14 -0
- package/dist/core/editor/content-area.js +47 -0
- package/dist/core/editor/content-area.js.map +7 -0
- package/dist/core/editor/environment.d.ts +24 -0
- package/dist/core/editor/environment.js +17 -0
- package/dist/core/editor/environment.js.map +7 -0
- package/dist/core/editor/icons.d.ts +1 -0
- package/dist/core/editor/icons.js +80 -0
- package/dist/core/editor/icons.js.map +7 -0
- package/dist/core/editor/list-actions.d.ts +1 -0
- package/dist/core/editor/list-actions.js +60 -0
- package/dist/core/editor/list-actions.js.map +7 -0
- package/dist/core/editor/manual-record.d.ts +17 -0
- package/dist/core/editor/manual-record.js +57 -0
- package/dist/core/editor/manual-record.js.map +7 -0
- package/dist/core/editor/media-select-action.d.ts +7 -0
- package/dist/core/editor/media-select-action.js +27 -0
- package/dist/core/editor/media-select-action.js.map +7 -0
- package/dist/core/editor/media.d.ts +4 -0
- package/dist/core/editor/media.js +57 -0
- package/dist/core/editor/media.js.map +7 -0
- package/dist/core/editor/paragraphs.d.ts +10 -0
- package/dist/core/editor/paragraphs.js +103 -0
- package/dist/core/editor/paragraphs.js.map +7 -0
- package/dist/core/editor/relationship.d.ts +15 -0
- package/dist/core/editor/relationship.js +173 -0
- package/dist/core/editor/relationship.js.map +7 -0
- package/dist/core/editor/repeater.d.ts +1 -0
- package/dist/core/editor/repeater.js +230 -0
- package/dist/core/editor/repeater.js.map +7 -0
- package/dist/core/editor/source-relationship.d.ts +1 -0
- package/dist/core/editor/source-relationship.js +40 -0
- package/dist/core/editor/source-relationship.js.map +7 -0
- package/dist/core/editor/styles.css +1206 -0
- package/dist/core/editor/video-inheritance.d.ts +9 -0
- package/dist/core/editor/video-inheritance.js +47 -0
- package/dist/core/editor/video-inheritance.js.map +7 -0
- package/dist/core/fields/README.md +138 -0
- package/dist/core/fields/editor.d.ts +11 -0
- package/dist/core/fields/editor.js +692 -0
- package/dist/core/fields/editor.js.map +7 -0
- package/dist/core/fields/examples/README.md +123 -0
- package/dist/core/fields/examples/buttons/example.md +68 -0
- package/dist/core/fields/examples/color/example.md +55 -0
- package/dist/core/fields/examples/content/example.md +86 -0
- package/dist/core/fields/examples/gallery/example.md +53 -0
- package/dist/core/fields/examples/group/example.md +55 -0
- package/dist/core/fields/examples/icon/example.md +49 -0
- package/dist/core/fields/examples/image/example.md +49 -0
- package/dist/core/fields/examples/link/example.md +71 -0
- package/dist/core/fields/examples/media/example.md +73 -0
- package/dist/core/fields/examples/number/example.md +57 -0
- package/dist/core/fields/examples/relationship/example.md +66 -0
- package/dist/core/fields/examples/repeater/example.md +63 -0
- package/dist/core/fields/examples/rich-text/example.md +53 -0
- package/dist/core/fields/examples/select/example.md +56 -0
- package/dist/core/fields/examples/text/example.md +53 -0
- package/dist/core/fields/examples/textarea/example.md +51 -0
- package/dist/core/fields/examples/toggle/example.md +51 -0
- package/dist/core/fields/examples/wysiwyg/example.md +49 -0
- package/dist/core/fields/item-focus.d.ts +3 -0
- package/dist/core/fields/item-focus.js +21 -0
- package/dist/core/fields/item-focus.js.map +7 -0
- package/dist/core/fields/list-order.d.ts +2 -0
- package/dist/core/fields/list-order.js +13 -0
- package/dist/core/fields/list-order.js.map +7 -0
- package/dist/core/fields/presets.d.ts +8 -0
- package/dist/core/fields/presets.js +54 -0
- package/dist/core/fields/presets.js.map +7 -0
- package/dist/core/fields/records.d.ts +9 -0
- package/dist/core/fields/records.js +39 -0
- package/dist/core/fields/records.js.map +7 -0
- package/dist/core/fields/render.d.ts +144 -0
- package/dist/core/fields/render.js +458 -0
- package/dist/core/fields/render.js.map +7 -0
- package/dist/core/fields/schema.d.ts +81 -0
- package/dist/core/fields/schema.js +207 -0
- package/dist/core/fields/schema.js.map +7 -0
- package/dist/core/fields/values.d.ts +4 -0
- package/dist/core/fields/values.js +51 -0
- package/dist/core/fields/values.js.map +7 -0
- package/dist/core/icons/button.d.ts +6 -0
- package/dist/core/icons/button.js +28 -0
- package/dist/core/icons/button.js.map +7 -0
- package/dist/core/icons/eyebrow.d.ts +6 -0
- package/dist/core/icons/eyebrow.js +20 -0
- package/dist/core/icons/eyebrow.js.map +7 -0
- package/dist/core/icons/icon.d.ts +5 -0
- package/dist/core/icons/icon.js +46 -0
- package/dist/core/icons/icon.js.map +7 -0
- package/dist/core/icons/library.d.ts +10 -0
- package/dist/core/icons/library.js +20 -0
- package/dist/core/icons/library.js.map +7 -0
- package/dist/core/icons/list.d.ts +8 -0
- package/dist/core/icons/list.js +48 -0
- package/dist/core/icons/list.js.map +7 -0
- package/dist/core/media/image.d.ts +2 -0
- package/dist/core/media/image.js +14 -0
- package/dist/core/media/image.js.map +7 -0
- package/dist/core/media/universal/README.md +18 -0
- package/dist/core/media/universal/bootstrap.php +32 -0
- package/dist/core/media/universal/component.d.ts +8 -0
- package/dist/core/media/universal/component.js +209 -0
- package/dist/core/media/universal/component.js.map +7 -0
- package/dist/core/media/universal/editor.css +149 -0
- package/dist/core/media/universal/editor.d.ts +7 -0
- package/dist/core/media/universal/editor.js +236 -0
- package/dist/core/media/universal/editor.js.map +7 -0
- package/dist/core/media/universal/model.d.ts +61 -0
- package/dist/core/media/universal/model.js +114 -0
- package/dist/core/media/universal/model.js.map +7 -0
- package/dist/core/media/universal/styles.css +126 -0
- package/dist/core/media/values.d.ts +9 -0
- package/dist/core/media/values.js +13 -0
- package/dist/core/media/values.js.map +7 -0
- package/dist/core/modules/define-module.d.ts +15 -0
- package/dist/core/modules/define-module.js +33 -0
- package/dist/core/modules/define-module.js.map +7 -0
- package/dist/core/modules/section.d.ts +4 -0
- package/dist/core/modules/section.js +25 -0
- package/dist/core/modules/section.js.map +7 -0
- package/dist/core/modules/types.d.ts +25 -0
- package/dist/core/modules/types.js +1 -0
- package/dist/core/modules/types.js.map +7 -0
- package/dist/core/relationships/selection.d.ts +17 -0
- package/dist/core/relationships/selection.js +53 -0
- package/dist/core/relationships/selection.js.map +7 -0
- package/dist/core/responsive/breakpoints.d.ts +8 -0
- package/dist/core/responsive/breakpoints.js +22 -0
- package/dist/core/responsive/breakpoints.js.map +7 -0
- package/dist/core/ui/accordion.d.ts +7 -0
- package/dist/core/ui/accordion.js +41 -0
- package/dist/core/ui/accordion.js.map +7 -0
- package/dist/core/ui/button-appearance.d.ts +11 -0
- package/dist/core/ui/button-appearance.js +17 -0
- package/dist/core/ui/button-appearance.js.map +7 -0
- package/dist/core/ui/button.d.ts +11 -0
- package/dist/core/ui/button.js +42 -0
- package/dist/core/ui/button.js.map +7 -0
- package/dist/core/ui/carousel.d.ts +18 -0
- package/dist/core/ui/carousel.js +193 -0
- package/dist/core/ui/carousel.js.map +7 -0
- package/dist/core/ui/dialog.d.ts +19 -0
- package/dist/core/ui/dialog.js +85 -0
- package/dist/core/ui/dialog.js.map +7 -0
- package/dist/core/ui/disclosure.d.ts +30 -0
- package/dist/core/ui/disclosure.js +175 -0
- package/dist/core/ui/disclosure.js.map +7 -0
- package/dist/core/ui/editor-action.d.ts +1 -0
- package/dist/core/ui/editor-action.js +24 -0
- package/dist/core/ui/editor-action.js.map +7 -0
- package/dist/core/ui/eyebrow.d.ts +8 -0
- package/dist/core/ui/eyebrow.js +21 -0
- package/dist/core/ui/eyebrow.js.map +7 -0
- package/dist/core/ui/loaded-collection.d.ts +23 -0
- package/dist/core/ui/loaded-collection.js +77 -0
- package/dist/core/ui/loaded-collection.js.map +7 -0
- package/dist/core/ui/pagination.d.ts +10 -0
- package/dist/core/ui/pagination.js +26 -0
- package/dist/core/ui/pagination.js.map +7 -0
- package/dist/core/ui/sheet.d.ts +25 -0
- package/dist/core/ui/sheet.js +91 -0
- package/dist/core/ui/sheet.js.map +7 -0
- package/dist/core/ui/slider.d.ts +27 -0
- package/dist/core/ui/slider.js +92 -0
- package/dist/core/ui/slider.js.map +7 -0
- package/dist/core/ui/switch.d.ts +4 -0
- package/dist/core/ui/switch.js +28 -0
- package/dist/core/ui/switch.js.map +7 -0
- package/dist/core/utils/classnames.d.ts +2 -0
- package/dist/core/utils/classnames.js +9 -0
- package/dist/core/utils/classnames.js.map +7 -0
- package/dist/core/utils/color.d.ts +6 -0
- package/dist/core/utils/color.js +12 -0
- package/dist/core/utils/color.js.map +7 -0
- package/dist/core/utils/path.d.ts +3 -0
- package/dist/core/utils/path.js +15 -0
- package/dist/core/utils/path.js.map +7 -0
- package/dist/core/utils/url.d.ts +3 -0
- package/dist/core/utils/url.js +7 -0
- package/dist/core/utils/url.js.map +7 -0
- package/dist/generated/responsive.d.ts +11 -0
- package/dist/generated/responsive.js +9 -0
- package/dist/generated/responsive.js.map +7 -0
- package/dist/hooks/use-motion.d.ts +2 -0
- package/dist/hooks/use-motion.js +43 -0
- package/dist/hooks/use-motion.js.map +7 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/booking/README.md +197 -0
- package/dist/modules/booking/admin.css +183 -0
- package/dist/modules/booking/admin.js +351 -0
- package/dist/modules/booking/blocks/form/component.d.ts +5 -0
- package/dist/modules/booking/blocks/form/component.js +15 -0
- package/dist/modules/booking/blocks/form/component.js.map +7 -0
- package/dist/modules/booking/blocks/form/editor.d.ts +1 -0
- package/dist/modules/booking/blocks/form/editor.js +11 -0
- package/dist/modules/booking/blocks/form/editor.js.map +7 -0
- package/dist/modules/booking/blocks/form/register.php +2 -0
- package/dist/modules/booking/blocks/form/schema.d.ts +7 -0
- package/dist/modules/booking/blocks/form/schema.js +13 -0
- package/dist/modules/booking/blocks/form/schema.js.map +7 -0
- package/dist/modules/booking/blocks/section/component.d.ts +1 -0
- package/dist/modules/booking/blocks/section/component.js +12 -0
- package/dist/modules/booking/blocks/section/component.js.map +7 -0
- package/dist/modules/booking/blocks/section/editor.d.ts +1 -0
- package/dist/modules/booking/blocks/section/editor.js +11 -0
- package/dist/modules/booking/blocks/section/editor.js.map +7 -0
- package/dist/modules/booking/blocks/section/preview.svg +1 -0
- package/dist/modules/booking/blocks/section/register.php +2 -0
- package/dist/modules/booking/blocks/section/schema.d.ts +8 -0
- package/dist/modules/booking/blocks/section/schema.js +14 -0
- package/dist/modules/booking/blocks/section/schema.js.map +7 -0
- package/dist/modules/booking/bootstrap.php +39 -0
- package/dist/modules/booking/calendar-hours.js +14 -0
- package/dist/modules/booking/chat.js +94 -0
- package/dist/modules/booking/duration.js +48 -0
- package/dist/modules/booking/form.js +23 -0
- package/dist/modules/booking/frontend/route.d.ts +12 -0
- package/dist/modules/booking/frontend/route.js +53 -0
- package/dist/modules/booking/frontend/route.js.map +7 -0
- package/dist/modules/booking/frontend/skeleton.d.ts +3 -0
- package/dist/modules/booking/frontend/skeleton.js +40 -0
- package/dist/modules/booking/frontend/skeleton.js.map +7 -0
- package/dist/modules/booking/frontend/styles.css +27 -0
- package/dist/modules/booking/frontend/types.d.ts +55 -0
- package/dist/modules/booking/frontend/types.js +30 -0
- package/dist/modules/booking/frontend/types.js.map +7 -0
- package/dist/modules/booking/frontend/validation.d.ts +11 -0
- package/dist/modules/booking/frontend/validation.js +17 -0
- package/dist/modules/booking/frontend/validation.js.map +7 -0
- package/dist/modules/booking/frontend/widget.d.ts +7 -0
- package/dist/modules/booking/frontend/widget.js +631 -0
- package/dist/modules/booking/frontend/widget.js.map +7 -0
- package/dist/modules/booking/i18n.js +3 -0
- package/dist/modules/booking/languages/uk.json +74 -0
- package/dist/modules/booking/manifest.json +7 -0
- package/dist/modules/booking/php/admin.php +204 -0
- package/dist/modules/booking/php/api.php +88 -0
- package/dist/modules/booking/php/booking-chat.php +196 -0
- package/dist/modules/booking/php/client-context.php +63 -0
- package/dist/modules/booking/php/history.php +58 -0
- package/dist/modules/booking/php/i18n.php +27 -0
- package/dist/modules/booking/php/identity.php +23 -0
- package/dist/modules/booking/php/lifecycle.php +57 -0
- package/dist/modules/booking/php/limits.php +27 -0
- package/dist/modules/booking/php/notification-admin.php +61 -0
- package/dist/modules/booking/php/notifications.php +556 -0
- package/dist/modules/booking/php/service.php +256 -0
- package/dist/modules/booking/php/storage.php +163 -0
- package/dist/modules/booking/php/tariff-admin.php +93 -0
- package/dist/modules/booking/php/tariffs.php +29 -0
- package/dist/modules/booking/php/telegram-client.php +89 -0
- package/dist/modules/booking/php/telegram-moderation.php +141 -0
- package/dist/modules/booking/php/telegram-support.php +115 -0
- package/dist/modules/booking/php/telegram-topics.php +81 -0
- package/dist/modules/booking/php/widget.php +170 -0
- package/dist/modules/booking/widget-settings.js +13 -0
- package/dist/modules/forms/.env.example +5 -0
- package/dist/modules/forms/README.md +80 -0
- package/dist/modules/forms/admin.css +431 -0
- package/dist/modules/forms/admin.php +193 -0
- package/dist/modules/forms/bootstrap.php +80 -0
- package/dist/modules/forms/config.php +77 -0
- package/dist/modules/forms/delivery.php +103 -0
- package/dist/modules/forms/frontend/component.d.ts +11 -0
- package/dist/modules/forms/frontend/component.js +272 -0
- package/dist/modules/forms/frontend/component.js.map +7 -0
- package/dist/modules/forms/frontend/editor.css +580 -0
- package/dist/modules/forms/frontend/field-blocks.d.ts +13 -0
- package/dist/modules/forms/frontend/field-blocks.js +279 -0
- package/dist/modules/forms/frontend/field-blocks.js.map +7 -0
- package/dist/modules/forms/frontend/layout-controls.d.ts +14 -0
- package/dist/modules/forms/frontend/layout-controls.js +232 -0
- package/dist/modules/forms/frontend/layout-controls.js.map +7 -0
- package/dist/modules/forms/frontend/metrics.d.ts +14 -0
- package/dist/modules/forms/frontend/metrics.js +68 -0
- package/dist/modules/forms/frontend/metrics.js.map +7 -0
- package/dist/modules/forms/frontend/proxy.d.ts +7 -0
- package/dist/modules/forms/frontend/proxy.js +82 -0
- package/dist/modules/forms/frontend/proxy.js.map +7 -0
- package/dist/modules/forms/frontend/schema.d.ts +28 -0
- package/dist/modules/forms/frontend/schema.js +83 -0
- package/dist/modules/forms/frontend/schema.js.map +7 -0
- package/dist/modules/forms/frontend/settings-editor.d.ts +1 -0
- package/dist/modules/forms/frontend/settings-editor.js +301 -0
- package/dist/modules/forms/frontend/settings-editor.js.map +7 -0
- package/dist/modules/forms/frontend/styles.css +117 -0
- package/dist/modules/forms/manifest.json +7 -0
- package/dist/modules/forms/settings.php +75 -0
- package/dist/modules/forms/validation.php +79 -0
- package/dist/modules/icons/README.md +33 -0
- package/dist/modules/icons/admin.php +53 -0
- package/dist/modules/icons/assets/admin.css +699 -0
- package/dist/modules/icons/assets/admin.js +322 -0
- package/dist/modules/icons/bootstrap.php +10 -0
- package/dist/modules/icons/library.php +119 -0
- package/dist/modules/icons/manifest.json +12 -0
- package/dist/modules/modals/context.d.ts +1 -0
- package/dist/modules/modals/context.js +8 -0
- package/dist/modules/modals/context.js.map +7 -0
- package/dist/modules/modals/links.d.ts +5 -0
- package/dist/modules/modals/links.js +28 -0
- package/dist/modules/modals/links.js.map +7 -0
- package/dist/modules/video-posters/README.md +81 -0
- package/dist/modules/video-posters/README.ru.md +94 -0
- package/dist/modules/video-posters/assets/admin.css +88 -0
- package/dist/modules/video-posters/assets/admin.js +593 -0
- package/dist/modules/video-posters/bootstrap.php +512 -0
- package/dist/modules/video-posters/manifest.json +12 -0
- package/dist/modules/webp-uploads/README.md +34 -0
- package/dist/modules/webp-uploads/admin.php +118 -0
- package/dist/modules/webp-uploads/ajax.php +410 -0
- package/dist/modules/webp-uploads/assets/admin.css +584 -0
- package/dist/modules/webp-uploads/assets/admin.js +1198 -0
- package/dist/modules/webp-uploads/assets/replace.js +199 -0
- package/dist/modules/webp-uploads/attachments.php +443 -0
- package/dist/modules/webp-uploads/bootstrap.php +13 -0
- package/dist/modules/webp-uploads/class-module.php +19 -0
- package/dist/modules/webp-uploads/configuration.php +70 -0
- package/dist/modules/webp-uploads/conversion.php +541 -0
- package/dist/modules/webp-uploads/gutenberg.php +39 -0
- package/dist/modules/webp-uploads/manifest.json +12 -0
- package/dist/modules/webp-uploads/references.php +374 -0
- package/dist/modules/webp-uploads/unused.php +1530 -0
- package/dist/modules/webp-uploads/views/page.php +200 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.js +48 -0
- package/dist/schema/index.js.map +7 -0
- package/dist/shared/index.d.ts +32 -0
- package/dist/shared/index.js +19 -0
- package/dist/shared/index.js.map +7 -0
- package/dist/styles/rem-scale.css +76 -0
- package/dist/tooling/block-paths.mjs +32 -0
- package/dist/tooling/breakpoints.cjs +49 -0
- package/dist/tooling/build-booking.mjs +6 -0
- package/dist/tooling/build-editor.mjs +139 -0
- package/dist/tooling/build-package.mjs +19 -0
- package/dist/tooling/build-wordpress.mjs +58 -0
- package/dist/tooling/cli.mjs +29 -0
- package/dist/tooling/create-module.mjs +97 -0
- package/dist/tooling/create-section.mjs +25 -0
- package/dist/tooling/editor-css.mjs +6 -0
- package/dist/tooling/rem-css.cjs +14 -0
- package/dist/tooling/render-module.mjs +150 -0
- package/dist/tooling/sync-blocks.mjs +32 -0
- package/dist/tooling/sync-kit.mjs +92 -0
- package/dist/tooling/sync-sections.mjs +40 -0
- package/dist/tooling/verify-release.mjs +5 -0
- package/dist/ui/README.md +12 -0
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/checkbox.js +12 -0
- package/dist/ui/checkbox.js.map +7 -0
- package/dist/ui/forms-admin.css +10 -0
- package/dist/ui/forms.css +23 -0
- package/dist/ui/input.d.ts +2 -0
- package/dist/ui/input.js +12 -0
- package/dist/ui/input.js.map +7 -0
- package/dist/ui/radio-group.d.ts +4 -0
- package/dist/ui/radio-group.js +15 -0
- package/dist/ui/radio-group.js.map +7 -0
- package/dist/ui/select.d.ts +29 -0
- package/dist/ui/select.js +61 -0
- package/dist/ui/select.js.map +7 -0
- package/dist/ui/turnstile.d.ts +12 -0
- package/dist/ui/turnstile.js +55 -0
- package/dist/ui/turnstile.js.map +7 -0
- package/generated/responsive.ts +3 -0
- package/hooks/use-motion.ts +47 -0
- package/index.tsx +31 -0
- package/modules/booking/README.md +197 -0
- package/modules/booking/admin.css +183 -0
- package/modules/booking/admin.js +351 -0
- package/modules/booking/blocks/form/component.tsx +17 -0
- package/modules/booking/blocks/form/editor.tsx +8 -0
- package/modules/booking/blocks/form/register.php +2 -0
- package/modules/booking/blocks/form/schema.ts +8 -0
- package/modules/booking/blocks/section/component.tsx +12 -0
- package/modules/booking/blocks/section/editor.tsx +8 -0
- package/modules/booking/blocks/section/preview.svg +1 -0
- package/modules/booking/blocks/section/register.php +2 -0
- package/modules/booking/blocks/section/schema.ts +9 -0
- package/modules/booking/bootstrap.php +39 -0
- package/modules/booking/calendar-hours.js +14 -0
- package/modules/booking/chat.js +94 -0
- package/modules/booking/duration.js +48 -0
- package/modules/booking/form.js +23 -0
- package/modules/booking/frontend/route.ts +46 -0
- package/modules/booking/frontend/skeleton.tsx +25 -0
- package/modules/booking/frontend/styles.css +27 -0
- package/modules/booking/frontend/types.ts +63 -0
- package/modules/booking/frontend/validation.ts +21 -0
- package/modules/booking/frontend/widget.tsx +665 -0
- package/modules/booking/i18n.js +3 -0
- package/modules/booking/languages/uk.json +74 -0
- package/modules/booking/manifest.json +7 -0
- package/modules/booking/php/admin.php +204 -0
- package/modules/booking/php/api.php +88 -0
- package/modules/booking/php/booking-chat.php +196 -0
- package/modules/booking/php/client-context.php +63 -0
- package/modules/booking/php/history.php +58 -0
- package/modules/booking/php/i18n.php +27 -0
- package/modules/booking/php/identity.php +23 -0
- package/modules/booking/php/lifecycle.php +57 -0
- package/modules/booking/php/limits.php +27 -0
- package/modules/booking/php/notification-admin.php +61 -0
- package/modules/booking/php/notifications.php +556 -0
- package/modules/booking/php/service.php +256 -0
- package/modules/booking/php/storage.php +163 -0
- package/modules/booking/php/tariff-admin.php +93 -0
- package/modules/booking/php/tariffs.php +29 -0
- package/modules/booking/php/telegram-client.php +89 -0
- package/modules/booking/php/telegram-moderation.php +141 -0
- package/modules/booking/php/telegram-support.php +115 -0
- package/modules/booking/php/telegram-topics.php +81 -0
- package/modules/booking/php/widget.php +170 -0
- package/modules/booking/widget-settings.js +13 -0
- package/modules/forms/.env.example +5 -0
- package/modules/forms/README.md +80 -0
- package/modules/forms/admin.css +431 -0
- package/modules/forms/admin.php +193 -0
- package/modules/forms/bootstrap.php +80 -0
- package/modules/forms/config.php +77 -0
- package/modules/forms/delivery.php +103 -0
- package/modules/forms/frontend/component.tsx +306 -0
- package/modules/forms/frontend/editor.css +580 -0
- package/modules/forms/frontend/field-blocks.tsx +282 -0
- package/modules/forms/frontend/layout-controls.tsx +260 -0
- package/modules/forms/frontend/metrics.ts +75 -0
- package/modules/forms/frontend/proxy.ts +120 -0
- package/modules/forms/frontend/schema.ts +89 -0
- package/modules/forms/frontend/settings-editor.tsx +368 -0
- package/modules/forms/frontend/styles.css +117 -0
- package/modules/forms/manifest.json +7 -0
- package/modules/forms/settings.php +75 -0
- package/modules/forms/validation.php +79 -0
- package/modules/icons/README.md +33 -0
- package/modules/icons/admin.php +53 -0
- package/modules/icons/assets/admin.css +699 -0
- package/modules/icons/assets/admin.js +322 -0
- package/modules/icons/bootstrap.php +10 -0
- package/modules/icons/library.php +119 -0
- package/modules/icons/manifest.json +12 -0
- package/modules/modals/context.ts +3 -0
- package/modules/modals/links.ts +23 -0
- package/modules/video-posters/README.md +81 -0
- package/modules/video-posters/README.ru.md +94 -0
- package/modules/video-posters/assets/admin.css +88 -0
- package/modules/video-posters/assets/admin.js +593 -0
- package/modules/video-posters/bootstrap.php +512 -0
- package/modules/video-posters/manifest.json +12 -0
- package/modules/webp-uploads/README.md +34 -0
- package/modules/webp-uploads/admin.php +118 -0
- package/modules/webp-uploads/ajax.php +410 -0
- package/modules/webp-uploads/assets/admin.css +584 -0
- package/modules/webp-uploads/assets/admin.js +1198 -0
- package/modules/webp-uploads/assets/replace.js +199 -0
- package/modules/webp-uploads/attachments.php +443 -0
- package/modules/webp-uploads/bootstrap.php +13 -0
- package/modules/webp-uploads/class-module.php +19 -0
- package/modules/webp-uploads/configuration.php +70 -0
- package/modules/webp-uploads/conversion.php +541 -0
- package/modules/webp-uploads/gutenberg.php +39 -0
- package/modules/webp-uploads/manifest.json +12 -0
- package/modules/webp-uploads/references.php +374 -0
- package/modules/webp-uploads/unused.php +1530 -0
- package/modules/webp-uploads/views/page.php +200 -0
- package/package.json +119 -4
- package/schema/index.tsx +45 -0
- package/shared/index.tsx +45 -0
- package/styles/rem-scale.css +76 -0
- package/tooling/block-paths.mjs +32 -0
- package/tooling/breakpoints.cjs +49 -0
- package/tooling/build-booking.mjs +6 -0
- package/tooling/build-editor.mjs +139 -0
- package/tooling/build-package.mjs +19 -0
- package/tooling/build-wordpress.mjs +58 -0
- package/tooling/cli.mjs +29 -0
- package/tooling/create-module.mjs +97 -0
- package/tooling/create-section.mjs +25 -0
- package/tooling/editor-css.mjs +6 -0
- package/tooling/rem-css.cjs +14 -0
- package/tooling/render-module.mjs +150 -0
- package/tooling/smoke-package.mjs +25 -0
- package/tooling/sync-blocks.mjs +32 -0
- package/tooling/sync-kit.mjs +92 -0
- package/tooling/sync-sections.mjs +40 -0
- package/tooling/verify-release.mjs +5 -0
- package/tsconfig.json +43 -0
- package/ui/README.md +12 -0
- package/ui/checkbox.tsx +8 -0
- package/ui/forms-admin.css +10 -0
- package/ui/forms.css +23 -0
- package/ui/input.tsx +7 -0
- package/ui/radio-group.tsx +6 -0
- package/ui/select.tsx +56 -0
- package/ui/turnstile.tsx +66 -0
package/README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# soinproduction-gutenberg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Portable React / WordPress components with their field engine, editors, PHP rendering, administration UI and module assets.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install soinproduction-gutenberg react react-dom
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import {Background, Heading, Section} from 'soinproduction-gutenberg';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The npm package includes compiled ESM, TypeScript declarations, source templates, PHP, CSS and browser/admin assets. React and React DOM are peers. Next is an optional peer used only by the Next adapter.
|
|
14
|
+
|
|
15
|
+
## WordPress project preparation
|
|
16
|
+
|
|
17
|
+
The host owns its theme tokens, authored sections/layouts, CMS data, endpoint configuration and secrets. Kit owns reusable component functionality.
|
|
18
|
+
|
|
19
|
+
For the existing declarative theme architecture, add this to the frontend's `package.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{"scripts":{"kit:prepare":"soinproduction-kit prepare"}}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run preparation before the editor/site builds. This materializes an npm-managed `kit/` source tree from the installed version and generates the project's connections there. It does not modify `node_modules`. Subsequent preparations refresh the managed source from the installed package, so change reusable code in this repository rather than in the generated copy.
|
|
26
|
+
|
|
27
|
+
An existing hand-maintained `kit/` is never overwritten. Move it aside when migrating to the npm dependency.
|
|
28
|
+
|
|
29
|
+
The host supplies:
|
|
30
|
+
|
|
31
|
+
- `config/breakpoints.json`: `breakpoints`, `media.columns` and `layoutIgnore`.
|
|
32
|
+
- `kit.config.json`: enabled global modules and editor settings.
|
|
33
|
+
- `src/sections/section-*/section.tsx` and `section.json`: authored sections.
|
|
34
|
+
- Existing project content renderer and editor integration points when using legacy blocks.
|
|
35
|
+
|
|
36
|
+
Example `kit.config.json`:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"modules": ["forms", "icons", "video-posters"],
|
|
41
|
+
"editor": {"entry":"src/site/editor/index.tsx","stylesheet":"app/globals.css"},
|
|
42
|
+
"wordpress": {"entry":"src/wordpress.tsx"}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Point the host TypeScript aliases `@kit` and `@kit/*` to `kit/index.tsx` and `kit/*`; `@ui/*` to `kit/ui/*`; and `@forms/*` to `kit/modules/forms/frontend/*` where existing host code uses them. The generated source itself uses relative imports. Compile authored portable sections through the root `@kit` import so the WordPress compiler can substitute its markers.
|
|
47
|
+
|
|
48
|
+
Load `kit/bootstrap.php` once from the WordPress theme and supply module settings through host integration files. Deploy the managed kit's PHP and published assets along with the theme. Node is needed for preparation/building, not PHP request rendering.
|
|
49
|
+
|
|
50
|
+
## Automatic connections
|
|
51
|
+
|
|
52
|
+
Static imports/re-exports identify components. Each component's `manifest.json` describes transitive component dependencies, editor controls, PHP, styles, modules and assets. Preparation regenerates frontend/editor/PHP block registries and component connection files. Removing usage removes stale generated connections. No per-component project registry edits are needed.
|
|
53
|
+
|
|
54
|
+
New primitive kinds still need matching WordPress compiler/interpreter support; automatic discovery does not invent server rendering behavior.
|
|
55
|
+
|
|
56
|
+
## Structure
|
|
57
|
+
|
|
58
|
+
- `components/`: component-specific rendering, editing, metadata and server code.
|
|
59
|
+
- `core/`: fields, content, media, shared controls and utilities.
|
|
60
|
+
- `ui/`, `admin-ui/`: shared controls and administration design system.
|
|
61
|
+
- `modules/`: Forms, Booking, Icons, WebP Uploads, Video Posters and modal contexts.
|
|
62
|
+
- `adapters/`: WordPress and Next integration.
|
|
63
|
+
- `tooling/`: discovery, preparation, builds and generators.
|
|
64
|
+
- `generated/responsive.ts`: default responsive values for direct ESM use; host preparation replaces these with host values in the managed copy.
|
|
65
|
+
|
|
66
|
+
## Development and releases
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm ci
|
|
70
|
+
npm run check
|
|
71
|
+
npm pack --dry-run
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
CI checks types, isolated component-connection tests, package exports, PHP syntax and packaging. Push a matching `vX.Y.Z` tag to publish version `X.Y.Z` automatically. See [RELEASING.md](RELEASING.md) for one-time npm trusted-publisher setup.
|
|
75
|
+
|
|
76
|
+
Source is published without an open-source license grant (`UNLICENSED`).
|
package/RELEASING.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Publishing
|
|
2
|
+
|
|
3
|
+
Package: `soinproduction-gutenberg`.
|
|
4
|
+
Repository: `soinproduction/soinproduction-gutenberg`.
|
|
5
|
+
Workflow: `.github/workflows/publish.yml`.
|
|
6
|
+
|
|
7
|
+
## One-time npm account setup
|
|
8
|
+
|
|
9
|
+
1. Sign in with the owning npm account and publish the initial checked version with `npm publish --access public` (npm may request account verification/2FA).
|
|
10
|
+
2. Open the package's Settings → Trusted publishing → GitHub Actions.
|
|
11
|
+
3. Set organization/user `soinproduction`, repository `soinproduction-gutenberg`, workflow filename `publish.yml`; leave environment blank. Allow `npm publish`.
|
|
12
|
+
4. Run the **Publish npm package** workflow for the next version or push its matching version tag.
|
|
13
|
+
|
|
14
|
+
The workflow uses GitHub OIDC with `id-token: write`. No persistent `NPM_TOKEN` secret is required. npm requires a recent npm CLI and Node; the workflow uses Node 24. Public GitHub builds receive npm provenance automatically.
|
|
15
|
+
|
|
16
|
+
The first successful trusted-publisher publish must occur within npm's activation window after the connection is created. Do not create the connection long before a release is ready.
|
|
17
|
+
|
|
18
|
+
## Subsequent releases
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm version patch
|
|
22
|
+
git push origin main --follow-tags
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`npm version minor` and `npm version major` are available for larger changes. The tag must match the package version exactly. CI publishes only after checks and a build succeed. A manual workflow dispatch is also available on `main`, for the checked-in version. Publishing an already-published version fails; bump the version first.
|
|
26
|
+
|
|
27
|
+
Do not commit `.npmrc`, environment credentials or consumer-generated connection files.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {useSite,useIsEditor} from '../../core/content/context.js';
|
|
3
|
+
import {usePathname} from 'next/navigation';
|
|
4
|
+
export function Link({to,params={},search,hash,activeProps,children,...props}:any){
|
|
5
|
+
const editor=useIsEditor();
|
|
6
|
+
let href=String(to??'/').replace(/\$([\w]+)/g,(_,key)=>encodeURIComponent(params[key]??''));
|
|
7
|
+
if(search) href+='?'+new URLSearchParams(search).toString(); if(hash) href+='#'+hash;
|
|
8
|
+
return <a href={href} {...props} onClick={(event)=>{if(editor){event.preventDefault();return;}props.onClick?.(event);}} onAuxClick={(event)=>{if(editor)event.preventDefault();else props.onAuxClick?.(event);}}>{children}</a>;
|
|
9
|
+
}
|
|
10
|
+
export function useLocation({select}:any){return select({pathname:usePathname()});}
|
|
11
|
+
export function useBookingSearch():{plan?:string} { const site=useSite();const value=site.query?.plan;return site.settings?.plans?.some((p:any)=>p.id===value)?{plan:value}:{}; }
|
|
12
|
+
|
|
13
|
+
export function useNavigate(_options?:any){const editor=useIsEditor();return ({search}:any)=>{if(editor)return;window.location.assign(window.location.pathname+'?'+new URLSearchParams(search).toString());};}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# WordPress / PHP adapter
|
|
2
|
+
|
|
3
|
+
The approved declarative sections in `src/sections/index.generated.ts` are the source for both renderers. `npm run build:wordpress` compiles their JSX to `build/wordpress/sections.json`, builds browser React into `runtime.js`, and compiles shared site CSS. PHP interprets the blueprint with current CMS values on each request. Content changes do not require a rebuild; changes to components/styles do.
|
|
4
|
+
|
|
5
|
+
Node is required locally for building only. Deploy the theme PHP, its existing editor/module builds, and `build/wordpress/` (including `images/`). Keep the required WordPress plugins, uploads and database on the server. Never upload `.env*`, `node_modules`, or development credentials.
|
|
6
|
+
|
|
7
|
+
## Migration
|
|
8
|
+
|
|
9
|
+
Set `mode` to `next` or `wordpress` in the theme-root `render.config.json`. This is the sole renderer setting shared by PHP and the build scripts; there is no admin control or database option. `npm run dev` watches editor sources and starts Next in next mode, or rebuilds browser/PHP assets in wordpress mode. `npm run build` produces the selected target plus the editor. Restart dev after changing mode. In WordPress mode open the WordPress URL, not the Next port.
|
|
10
|
+
|
|
11
|
+
Legacy sections and the project header/footer still need migration: the PHP shell renders saved header/footer data through the legacy layout bridge, while new sections use the generated blueprint. Other legacy sections still require migration.
|
|
12
|
+
|
|
13
|
+
Supported sections: hero, marquee, studio introduction, services, gallery, and flexible content. Native WordPress SEO hooks (`wp_head`, `wp_footer`, language and body attributes) remain available. PHP supplies text, media and links before JavaScript. Browser React enhances interactive containers after a successful commit, using the same section components and shared interactions. Static declarative sections retain their server HTML; background video uses a small native enhancement. Header enhancement starts on navigation interaction and preserves the server logo node. If initial enhancement fails, the PHP fallback remains visible. This is progressive replacement, not React hydration.
|
|
14
|
+
|
|
15
|
+
PHP List applies saved item counts, loading mode and URL page state. Page links provide navigation without JavaScript; browser React enhances them with pagination/show-more/infinite scrolling. Gallery viewers, modal dialogs and dynamic filters require JavaScript.
|
|
16
|
+
|
|
17
|
+
## Extending the boilerplate
|
|
18
|
+
|
|
19
|
+
Use the declarative kit for new portable sections. Built-in HTML and the kit markers are serialized by `blueprint.ts`; callback props and unknown React components fail the build. Add a matching PHP primitive in `inc/rendering/renderer.php` when introducing a new kit node. Do not add a separate PHP template for each section.
|
|
20
|
+
|
|
21
|
+
`runtime.tsx` is the browser host adapter; `router.tsx` supplies browser navigation without a Next server. Modal and booking requests use WordPress REST directly. The forms adapter signs internal FormEngine requests server-side, retaining challenges and validation; signing secrets never enter the browser bundle.
|
|
22
|
+
|
|
23
|
+
Before rollout verify content parity, archives, SEO output, modal opening, booking availability, form submission and cache behavior on the target host. The current implementation is a migration foundation, not an automatic converter for arbitrary legacy React components.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Automatic section discovery
|
|
27
|
+
|
|
28
|
+
Create a `src/sections/section-*` folder with `section.json` and `section.tsx`, exporting `section(meta, () => (...))` from `@kit`. `syncSections()` discovers it for both builds; PHP registration discovers the same metadata. WordPress dev watches these folders and regenerates the blueprint and browser bundle on edits. No PHP registry entry or second section template is required. Keep data-driven rendering inside kit primitives (List/Records/Drag/Show etc.); arbitrary callbacks or custom React-only components cannot execute on a PHP host and intentionally fail compilation.
|
|
29
|
+
|
|
30
|
+
The legacy header/footer bridge is in `inc/rendering/layouts.php`. It reads current CMS data on every request, including resolved menu references and modal buttons. Browser enhancement replaces the fallback after commit. The bridge exists for these old layout components only; new declarative sections never use this path.
|
|
31
|
+
|
|
32
|
+
## Loading and asset delivery
|
|
33
|
+
|
|
34
|
+
Deploy the entire generated `build/wordpress/` directory, including `chunks/`, `critical.css`, `runtime-manifest.json`, `assets.php`, images and precompressed `.gz` files. The runtime is an ES module with split chunks; booking/modal code loads on demand. Critical styles are generated from the shared stylesheet and blueprint classes and inlined; the full stylesheet loads asynchronously with a noscript fallback. Browser payloads include only referenced icons.
|
|
35
|
+
|
|
36
|
+
`assets.php/PATH` serves allowlisted generated assets with gzip negotiation and cache validators without bootstrapping WordPress. This requires PHP PATH_INFO support (verified locally on Apache); verify routing on the deployment host. The included `.htaccess` also supplies optional Apache compression/cache rules. Host/CDN configuration must be checked separately on Nginx-based managed hosting.
|
|
37
|
+
|
|
38
|
+
Background videos initially show an optimized WordPress poster. Automatic playback is suppressed on mobile, reduced-motion and data-saving connections; a play control remains available. Desktop playback follows the saved autoplay setting. Static-section classification is generated from supported primitives rather than section names.
|
|
39
|
+
|
|
40
|
+
Performance checks should use a production build, a logged-out browser and separate desktop/mobile profiles. Local HTTP affects Lighthouse Best Practices; deploy with HTTPS. Lighthouse scores are measurements of a particular run, not a guarantee for every device or host.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Optional Apache transport optimizations. Other servers may ignore this file.
|
|
2
|
+
<IfModule mod_deflate.c>
|
|
3
|
+
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/json image/svg+xml
|
|
4
|
+
</IfModule>
|
|
5
|
+
<IfModule mod_expires.c>
|
|
6
|
+
ExpiresActive On
|
|
7
|
+
ExpiresByType text/css "access plus 1 month"
|
|
8
|
+
ExpiresByType application/javascript "access plus 1 month"
|
|
9
|
+
</IfModule>
|
|
10
|
+
<IfModule mod_headers.c>
|
|
11
|
+
<FilesMatch "-[A-Z0-9]{8}\.js$">
|
|
12
|
+
Header set Cache-Control "public, max-age=31536000, immutable"
|
|
13
|
+
</FilesMatch>
|
|
14
|
+
</IfModule>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/** Public compiled assets only; no WordPress bootstrap or source-file access. */
|
|
3
|
+
$asset = ltrim( $_SERVER['PATH_INFO'] ?? '', '/' );
|
|
4
|
+
if ( ! preg_match( '~^(?:runtime\.js|site\.css|chunks/[A-Za-z0-9_-]+\.js|images/[A-Za-z0-9_-]+\.png)$~D', $asset ) ) {
|
|
5
|
+
http_response_code( 404 );
|
|
6
|
+
exit;
|
|
7
|
+
}
|
|
8
|
+
$file = __DIR__ . '/' . $asset;
|
|
9
|
+
if ( ! is_file( $file ) ) {
|
|
10
|
+
http_response_code( 404 );
|
|
11
|
+
exit;
|
|
12
|
+
}
|
|
13
|
+
$gzip = is_file( $file . '.gz' ) && preg_match( '/(?:^|,)\s*gzip\s*(?:;\s*q=(?!0(?:\.0*)?(?:\s*,|$))[^,]+)?(?:,|$)/i', $_SERVER['HTTP_ACCEPT_ENCODING'] ?? '' );
|
|
14
|
+
$etag = '"' . filemtime( $file ) . '-' . filesize( $file ) . ( $gzip ? '-gzip' : '' ) . '"';
|
|
15
|
+
header( 'ETag: ' . $etag );
|
|
16
|
+
header( 'Vary: Accept-Encoding' );
|
|
17
|
+
header( 'Cache-Control: public, max-age=' . ( str_starts_with( $asset, 'chunks/' ) ? '31536000, immutable' : '3600' ) );
|
|
18
|
+
header( 'X-Content-Type-Options: nosniff' );
|
|
19
|
+
if ( ( $_SERVER['HTTP_IF_NONE_MATCH'] ?? '' ) === $etag ) {
|
|
20
|
+
http_response_code( 304 );
|
|
21
|
+
exit;
|
|
22
|
+
}
|
|
23
|
+
header( 'Content-Type: ' . ( str_ends_with( $asset, '.js' ) ? 'application/javascript; charset=UTF-8' : ( str_ends_with( $asset, '.css' ) ? 'text/css; charset=UTF-8' : 'image/png' ) ) );
|
|
24
|
+
if ( $gzip ) {
|
|
25
|
+
header( 'Content-Encoding: gzip' );
|
|
26
|
+
$file .= '.gz';
|
|
27
|
+
}
|
|
28
|
+
header( 'Content-Length: ' . filesize( $file ) );
|
|
29
|
+
if ( ( $_SERVER['REQUEST_METHOD'] ?? 'GET' ) !== 'HEAD' ) {
|
|
30
|
+
readfile( $file );
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {Children, Fragment, isValidElement, type ReactNode} from 'react';
|
|
2
|
+
|
|
3
|
+
const marker = (name: string) => Object.assign((_props: any) => null, {kitName: name});
|
|
4
|
+
export const Section = marker('Section'), Text = marker('Text'), Heading = marker('Heading'),
|
|
5
|
+
Paragraphs = marker('Paragraphs'), Image = marker('Image'), Icon = marker('Icon'),
|
|
6
|
+
Background = marker('Background'), Buttons = marker('Buttons'), Button = marker('Button'), List = marker('List'),
|
|
7
|
+
PricingPlans = marker('PricingPlans'), ReviewsCarousel = marker('ReviewsCarousel'), Form = marker('Form'), Records = marker('Records'), RecordEdit = marker('RecordEdit'), RecordImage = marker('RecordImage'),
|
|
8
|
+
RecordDate = marker('RecordDate'), RecordTitle = marker('RecordTitle'), RecordExcerpt = marker('RecordExcerpt'), RecordLink = marker('RecordLink'),
|
|
9
|
+
RecordIndex = marker('RecordIndex'), Drag = marker('Drag'), Cols = marker('Cols'), Toggle = marker('Toggle'),
|
|
10
|
+
Choice = marker('Choice'), Show = marker('Show'), Area = marker('Area'), Gallery = marker('Gallery'),
|
|
11
|
+
Accordion = marker('Accordion'), AccordionItem = marker('AccordionItem'), AccordionTrigger = marker('AccordionTrigger'), AccordionContent = marker('AccordionContent'),
|
|
12
|
+
Slider = marker('Slider'), SliderButton = marker('SliderButton'), SliderPagination = marker('SliderPagination'), RecordText = marker('RecordText'), RecordContent = marker('RecordContent'), Media = marker('Media');
|
|
13
|
+
|
|
14
|
+
function describe(node: ReactNode): any[] {
|
|
15
|
+
return Children.toArray(node).flatMap(child => {
|
|
16
|
+
if (!isValidElement(child)) return [{type: '#text', value: String(child)}];
|
|
17
|
+
if (child.type === Fragment) return describe((child.props as any).children);
|
|
18
|
+
const props = {...child.props as any};
|
|
19
|
+
delete props.children;
|
|
20
|
+
const type = typeof child.type === 'string' ? child.type : (child.type as any).kitName;
|
|
21
|
+
if (!type) throw new Error('WordPress compiler: unsupported React component. Supply an adapter before using it in a portable section.');
|
|
22
|
+
for (const [key, value] of Object.entries(props)) if (typeof value === 'function') throw new Error(`WordPress compiler: callback ${key} cannot be serialized`);
|
|
23
|
+
return [{type, props, children: describe((child.props as any).children)}];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function section(meta: any, View: () => ReactNode) {
|
|
28
|
+
const template = describe(View());
|
|
29
|
+
const staticTypes = new Set(['#text','Section','Text','Heading','Paragraphs','Image','Icon','Background','Buttons','Button','Show','Toggle','Choice']);
|
|
30
|
+
const isStatic = (nodes:any[]):boolean => nodes.every(node => (staticTypes.has(node.type) || /^[a-z]/.test(node.type)) && isStatic(node.children ?? []));
|
|
31
|
+
return {name: 'site/' + meta.slug, title: meta.title, template, static: isStatic(template)};
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function Link({ to, params, search, hash, activeProps, children, ...props }: any) {
|
|
2
|
+
return (
|
|
3
|
+
<a
|
|
4
|
+
{...props}
|
|
5
|
+
href="#"
|
|
6
|
+
onClick={(event) => event.preventDefault()}
|
|
7
|
+
onAuxClick={(event) => event.preventDefault()}
|
|
8
|
+
>
|
|
9
|
+
{children}
|
|
10
|
+
</a>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export function useLocation({ select }: any) {
|
|
14
|
+
return select({
|
|
15
|
+
pathname: '/',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export function useBookingSearch() {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
export function useNavigate(_options?: any) {
|
|
22
|
+
return () => {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function usePathname(){return '/';}
|
|
26
|
+
export function useRouter(){return {push:()=>{},replace:()=>{},refresh:()=>{}};}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
namespace SiteTheme\Rendering;
|
|
3
|
+
defined('ABSPATH') || exit;
|
|
4
|
+
foreach (require dirname(__DIR__, 2).'/generated/connections.php' as $entry) require_once dirname(__DIR__, 2).'/'.$entry;
|
|
5
|
+
|
|
6
|
+
/** Interpreter for the build-time JSX blueprint. No JS execution or Node on the host. */
|
|
7
|
+
function manifest(): array {
|
|
8
|
+
static $manifest;
|
|
9
|
+
if($manifest===null){$file=get_theme_file_path('build/wordpress/sections.json');$manifest=is_readable($file)?json_decode(file_get_contents($file),true,512,JSON_THROW_ON_ERROR):['sections'=>[]];}
|
|
10
|
+
return $manifest;
|
|
11
|
+
}
|
|
12
|
+
function definition(string $name): ?array {foreach(manifest()['sections'] as $section)if($section['name']===$name)return $section;return null;}
|
|
13
|
+
function classes(array $props): string {return trim(($props['className']??'').' '.($props['frontClassName']??''));}
|
|
14
|
+
function attrs(array $attributes): string {
|
|
15
|
+
$out='';foreach($attributes as $key=>$value){if($value===null||$value===false||str_starts_with($key,'on'))continue;$out.=' '.esc_attr($key).'="'.esc_attr($value===true?'':(string)$value).'"';}return $out;
|
|
16
|
+
}
|
|
17
|
+
function tag(string $name,array $attributes,string $content=''): string {
|
|
18
|
+
if(!preg_match('/^[a-z][a-z0-9-]*$/',$name)||in_array($name,['script','iframe','style'],true))return '';
|
|
19
|
+
return '<'.$name.attrs($attributes).'>'.(in_array($name,['img','source','br','hr','input'],true)?'':$content.'</'.$name.'>');
|
|
20
|
+
}
|
|
21
|
+
function nodes(array $nodes,array $context): string {return implode('',array_map(fn($node)=>node($node,$context),$nodes));}
|
|
22
|
+
function image($value,string $class=''): string {
|
|
23
|
+
if(is_string($value))$value=['url'=>$value];$url=$value['url']??'';
|
|
24
|
+
return $url?tag('img',['src'=>esc_url($url),'alt'=>$value['alt']??'','class'=>$class,'loading'=>'lazy']):'';
|
|
25
|
+
}
|
|
26
|
+
/** Use a generated, bounded poster rather than the original background image. */
|
|
27
|
+
function background_poster(string $url): string {
|
|
28
|
+
if(!$url||!function_exists('attachment_url_to_postid'))return $url;
|
|
29
|
+
$id=attachment_url_to_postid($url);
|
|
30
|
+
return $id?(wp_get_attachment_image_url($id,'large')?:$url):$url;
|
|
31
|
+
}
|
|
32
|
+
function button(array $value,?string $fallback=null,array $site=[]): string {
|
|
33
|
+
if(empty($value['text']))return '';
|
|
34
|
+
$url=$value['url']??'#';$id=(int)($value['modalId']??0);
|
|
35
|
+
if($id)foreach($site['modals']??[] as $modal)if($modal['id']===$id)$url='#modal-'.($modal['slug']??$id);
|
|
36
|
+
if(!empty($value['linkId']))$url=get_permalink((int)$value['linkId'])?:$url;
|
|
37
|
+
$style=$value['style']??$fallback;
|
|
38
|
+
$class=match($style){'text'=>'site-text-link eyebrow !text-foreground transition-colors hover:!text-flame','accent'=>'btn-primary !bg-flame !text-flame-foreground hover:!opacity-90','outline'=>'btn-ghost','light-outline'=>'btn-ghost !border-background/40 hover:!bg-background hover:!text-foreground',default=>'btn-primary'};
|
|
39
|
+
$label=wp_kses_post($value['text']);$metadata=$value['metadata']??[];
|
|
40
|
+
foreach($site['icons']??[] as $icon)if(($icon['value']??'')===($metadata['siteButtonIcon']??null)){
|
|
41
|
+
$mask='url("data:image/svg+xml,'.rawurlencode($icon['svg']).'")';
|
|
42
|
+
$label=tag('span',['class'=>'site-button-label site-button-icon-'.(($metadata['siteButtonIconPosition']??'')==='before'?'before':'after'),'style'=>'--site-button-icon:'.$mask],$label);break;
|
|
43
|
+
}
|
|
44
|
+
return tag('a',['href'=>esc_url($url),'class'=>$class,'data-modal-plan'=>$value['plan']??null],$label);
|
|
45
|
+
}
|
|
46
|
+
/** Mirrors `flowPlacement` in frontend/kit/flow-layout.ts. */
|
|
47
|
+
function flow_placement(int $grid,array $column,array $palette,int $max_col): array {
|
|
48
|
+
$span=min($grid,max(1,(int)($column['span']??0)?:(int)($palette['span']??0)?:(int)round($grid/max(1,$max_col))));
|
|
49
|
+
$start=(int)($column['start']??0)?:(int)($palette['start']??0);
|
|
50
|
+
return ['start'=>$start?min($grid-$span+1,max(1,$start)):0,'span'=>$span];
|
|
51
|
+
}
|
|
52
|
+
/** Mirrors `flowColumnLayout`: the default placement and per-range placements read by the generated grid rules. */
|
|
53
|
+
function flow_column_layout(int $grid,array $column,array $palette,int $max_col,int $mobile_grid=0): array {
|
|
54
|
+
|
|
55
|
+
$base=\SiteTheme\breakpoint_media('columns');$names=\SiteTheme\layout_breakpoints();
|
|
56
|
+
$below=array_slice($names,0,max(0,(int)array_search($base,$names,true)));
|
|
57
|
+
$own=$grid?flow_placement($grid,$column,$palette,$max_col):['start'=>0,'span'=>1];$layers=$grid&&empty($column['fullRow'])?['default'=>$own]:[];
|
|
58
|
+
foreach($names as $name){
|
|
59
|
+
$value=$column['responsive'][$name]??null;
|
|
60
|
+
if($grid&&empty($column['fullRow'])&&is_array($value)&&(!empty($value['span'])||!empty($value['start'])))$layers[$name]=flow_placement(in_array($name,$below,true)?($mobile_grid?:$grid):$grid,$value,['span'=>$own['span']],$max_col);
|
|
61
|
+
}
|
|
62
|
+
$style='';foreach($layers as $name=>$place)$style.='--site-col-'.$name.'-start:'.($place['start']?:'auto').';--site-col-'.$name.'-span:'.$place['span'].';';
|
|
63
|
+
$classes=array_map(fn($name)=>'site-col-at-'.$name,array_keys($layers));
|
|
64
|
+
foreach($column['responsive']??[] as $name=>$value){if(!in_array($name,$names,true))continue;
|
|
65
|
+
$v=['top'=>'flex-start','center'=>'center','bottom'=>'flex-end'][$value['verticalAlign']??'']??null;
|
|
66
|
+
$h=['left'=>'flex-start','center'=>'center','right'=>'flex-end','stretch'=>'stretch'][$value['horizontalAlign']??'']??null;
|
|
67
|
+
if($v){$classes[]='site-align-v-'.$name;$style.='--site-align-'.$name.'-vertical:'.$v.';';}
|
|
68
|
+
if($h){$classes[]='site-align-h-'.$name;$style.='--site-align-'.$name.'-horizontal:'.$h.';--site-align-'.$name.'-text:'.(($value['horizontalAlign']??'')==='stretch'?'inherit':$value['horizontalAlign']).';';}}
|
|
69
|
+
return ['class'=>implode(' ',$classes),'style'=>$style];
|
|
70
|
+
}
|
|
71
|
+
function drag_elements(array $children,string $palette=''): array {
|
|
72
|
+
$result=[];foreach($children as $child){
|
|
73
|
+
if($child['type']==='Cols'){$result+=drag_elements($child['children'],$child['props']['name']);continue;}
|
|
74
|
+
$find=function($node)use(&$find){if(!empty($node['props']['name']))return $node['props']['name'];foreach($node['children']??[] as $c){$key=$find($c);if($key)return $key;}return null;};
|
|
75
|
+
$key=$find($child);if($key)$result[($palette?$palette.':':'').$key]=$child;
|
|
76
|
+
}return $result;
|
|
77
|
+
}
|
|
78
|
+
function icon_mask(?string $name,array $site): string {
|
|
79
|
+
foreach($site['icons']??[] as $icon)if($name&&($icon['value']??'')===$name)return 'url("data:image/svg+xml,'.rawurlencode($icon['svg']).'")';
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
/** Core blocks keep their own markup; only a layout holding kit elements is rebuilt around them. */
|
|
83
|
+
function holds_elements(array $block): bool {
|
|
84
|
+
foreach($block['innerBlocks']??[] as $child)if(!str_starts_with($child['name']??'','core/')||holds_elements($child))return true;
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
/** Library icons as list markers: one for the list, one per top-level item over it. */
|
|
88
|
+
function list_icons(string $html,array $block,array $site): string {
|
|
89
|
+
$processor=new \WP_HTML_Tag_Processor($html);$depth=0;$index=0;
|
|
90
|
+
$items=array_values(array_filter($block['innerBlocks']??[],fn($child)=>($child['name']??'')==='core/list-item'));
|
|
91
|
+
while($processor->next_tag(['tag_closers'=>'visit'])){
|
|
92
|
+
$tag=$processor->get_tag();
|
|
93
|
+
if(in_array($tag,['UL','OL'],true)){
|
|
94
|
+
if($processor->is_tag_closer()){$depth--;continue;}
|
|
95
|
+
$depth++;
|
|
96
|
+
if($depth===1&&($mask=icon_mask($block['attrs']['metadata']['siteListIcon']??null,$site))){$processor->add_class('site-icon-list');$processor->set_attribute('style','--site-list-icon:'.$mask);}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if($tag!=='LI'||$processor->is_tag_closer()||$depth!==1)continue;
|
|
100
|
+
$mask=icon_mask($items[$index++]['attrs']['metadata']['siteListIcon']??null,$site);
|
|
101
|
+
if($mask){$processor->add_class('site-icon-item');$processor->set_attribute('style','--site-list-icon:'.$mask);}
|
|
102
|
+
}
|
|
103
|
+
return $processor->get_updated_html();
|
|
104
|
+
}
|
|
105
|
+
function native_blocks(array $blocks,array $context,array $elements=[]): string {
|
|
106
|
+
$html='';foreach($blocks as $block){
|
|
107
|
+
$name=$block['name']??'';
|
|
108
|
+
if(str_starts_with($name,'core/')){
|
|
109
|
+
if(holds_elements($block)){$html.=tag('div',['class'=>$block['attrs']['className']??null],native_blocks($block['innerBlocks'],$context,$elements));continue;}
|
|
110
|
+
$markup=wp_kses_post($block['html']??'');
|
|
111
|
+
$html.=$name==='core/list'?list_icons($markup,$block,$context['site']??[]):$markup;continue;
|
|
112
|
+
}
|
|
113
|
+
$key=$block['attrs']['element']??'';if(isset($elements[$key]))$html.=node($elements[$key],array_replace($context,['data'=>$block['attrs']['data']??[]]));
|
|
114
|
+
}return $html;
|
|
115
|
+
}
|
|
116
|
+
/** One paging window for repeaters and relationships, after filtering/resolving rows. */
|
|
117
|
+
function collection(array $rows,array $props,array $context,callable $render): string {
|
|
118
|
+
$data=$context['data']??[];
|
|
119
|
+
$display=!empty($props['displaySettings'])?($data[($props['name']??'').'Display']??[]):[];
|
|
120
|
+
$loading=$display['loading']??$props['loading']??'all';
|
|
121
|
+
if(!in_array($loading,['pagination','lazyload','show-more'],true))$loading='all';
|
|
122
|
+
$size=max(1,(int)($display['perPage']??$props['perPage']??count($rows)));
|
|
123
|
+
$pages=max(1,(int)ceil(count($rows)/$size));
|
|
124
|
+
$key='list-'.($data['sectionId']??'').'-'.($props['name']??'');
|
|
125
|
+
$raw=(string)($_GET[$key]??'1');$page=max(1,min($pages,ctype_digit($raw)?(int)$raw:1));
|
|
126
|
+
$offset=$loading==='pagination'?($page-1)*$size:0;
|
|
127
|
+
$visible=$loading==='all'?$rows:array_slice($rows,$offset,$loading==='pagination'?$size:$page*$size);
|
|
128
|
+
$html='';foreach($visible as $i=>$row)$html.=$render($row,$offset+$i);
|
|
129
|
+
$content=tag('div',['class'=>classes($props)],$html);
|
|
130
|
+
if($loading==='all')return $content;
|
|
131
|
+
$navigation='';
|
|
132
|
+
if($pages>1){
|
|
133
|
+
if($loading==='pagination'){for($i=1;$i<=$pages;$i++)$navigation.=tag('a',['href'=>esc_url(add_query_arg($key,$i)),'class'=>'btn-ghost','aria-current'=>$i===$page?'page':null],(string)$i);}
|
|
134
|
+
elseif($page<$pages){$appearance=$display['button']??$props['loadMoreButton']??[];$navigation=button(['url'=>add_query_arg($key,$page+1),'text'=>trim($appearance['text']??'')?:'LoadMore','style'=>($appearance['style']??'')?:'outline','metadata'=>['siteButtonIcon'=>$appearance['icon']??'','siteButtonIconPosition'=>$appearance['iconPosition']??'after']],null,$context['site']??[]);}
|
|
135
|
+
}
|
|
136
|
+
return tag('div',['class'=>'site-loaded-list'],$content.($navigation?tag('nav',['class'=>'mt-10 flex justify-center gap-2','aria-label'=>'List pages'],$navigation):''));
|
|
137
|
+
}
|
|
138
|
+
function node(array $node,array $context): string {
|
|
139
|
+
$type=$node['type'];$p=$node['props']??[];$children=$node['children']??[];$data=$context['data']??[];$site=$context['site']??[];$record=$context['record']??[];
|
|
140
|
+
$value=$data[$p['name']??'']??null;$class=classes($p);
|
|
141
|
+
if($type==='#text')return esc_html($node['value']);
|
|
142
|
+
if(ctype_lower(substr($type,0,1))){$attributes=$p;unset($attributes['children'],$attributes['className'],$attributes['initial']);if($class)$attributes['class']=$class;return tag($type,$attributes,nodes($children,$context));}
|
|
143
|
+
switch($type){
|
|
144
|
+
case 'Accordion':return tag('div',['class'=>$class,'data-disclosure-mode'=>'accordion','data-icon-position'=>$p['iconPosition']??'after'],tag('div',['data-disclosure-items'=>true],nodes($children,array_replace($context,['disclosure'=>$p]))));
|
|
145
|
+
case 'AccordionItem':return tag('details',['class'=>$class,'data-disclosure-item'=>true],nodes($children,$context));
|
|
146
|
+
case 'AccordionContent':return tag('div',['class'=>$class,'data-disclosure-content'=>true],nodes($children,$context));
|
|
147
|
+
case 'AccordionTrigger':
|
|
148
|
+
$settings=$context['disclosure']??[];$icon='';
|
|
149
|
+
if(!array_key_exists('icon',$settings))$icon='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg>';
|
|
150
|
+
elseif($settings['icon'])$icon=node(['type'=>'Icon','props'=>['name'=>'indicator']],array_replace($context,['data'=>['indicator'=>$settings['icon']]]));
|
|
151
|
+
return tag('summary',['class'=>$class],nodes($children,$context).($icon?tag('span',['data-disclosure-icon'=>true],$icon):''));
|
|
152
|
+
case 'Section':if(!empty($p['when'])&&empty($data[$p['when']]))return '';return tag('section',['id'=>$data['sectionId']??null,'class'=>$class],nodes($children,$context));
|
|
153
|
+
case 'Text':case 'Heading':return tag($type==='Heading'?'h'.($p['level']??2):'p',['class'=>$class],wp_kses_post((string)($value??'')));
|
|
154
|
+
case 'Paragraphs':return tag('div',['class'=>'site-paragraph-flow '.$class],implode('',array_map(fn($v,$i)=>tag('div',['class'=>trim('site-description-row '.(is_array($v)&&($v['style']??'')==='accent-line'?'is-style-studio-accent-line ':'').($i?($p['paragraphClassName']??''):''))],tag('p',[],wp_kses_post(is_array($v)?($v['text']??''):$v))),is_array($value)?$value:[],array_keys(is_array($value)?$value:[]))));
|
|
155
|
+
case 'Image':return image($value,$class);
|
|
156
|
+
case 'Icon':
|
|
157
|
+
if(!$value)return '';$name=is_string($value)?$value:($value['type']??'');
|
|
158
|
+
foreach($site['icons']??[] as $icon){if(($icon['value']??'')===$name){$mask='url("data:image/svg+xml,'.rawurlencode($icon['svg']).'")';return tag('span',['class'=>trim('inline-flex shrink-0 leading-none text-flame '.$class),'aria-hidden'=>'true'],tag('span',['style'=>'display:inline-block;width:.9em;height:.9em;background-color:currentColor;mask:'.$mask.' center/contain no-repeat;-webkit-mask:'.$mask.' center/contain no-repeat']));}}return '';
|
|
159
|
+
case 'Choice':case 'RecordEdit':return '';
|
|
160
|
+
case 'Toggle':return ($value??($p['default']??false))?nodes($children,$context):'';
|
|
161
|
+
case 'Show':
|
|
162
|
+
$visible=is_array($p['when'])?(bool)array_filter($p['when'],fn($key)=>trim(wp_strip_all_tags((string)($data[$key]??'')))!==''):(isset($p['is'])?($data[$p['when']]??null)===$p['is']:!empty($data[$p['when']]));return $visible?nodes($children,$context):'';
|
|
163
|
+
case 'Button':return button(is_array($value)?$value:[],$p['style']??null,$site);
|
|
164
|
+
case 'Buttons':$html='';foreach(is_array($value)?$value:[] as $i=>$button)$html.=button($button,$p['styles'][$i]??null,$site);return tag('div',['class'=>$class],$html);
|
|
165
|
+
case 'Background':case 'Media':
|
|
166
|
+
if(!$value)return '';if(is_string($value)||($value['type']??'image')==='image')return image(is_string($value)?$value:['url'=>$value['image']??$value['url']??'','alt'=>$value['alt']??''],$class?:'absolute inset-0 h-full w-full object-cover');
|
|
167
|
+
return tag('video',['class'=>$class?:'absolute inset-0 h-full w-full object-cover','poster'=>esc_url(background_poster($value['poster']??'')),'src'=>esc_url($value['video']??$value['mp4']??''),'muted'=>$value['muted']??true,'preload'=>'none','data-site-background'=>'true','data-autoplay'=>($value['autoplay']??true)?'true':'false','autoplay'=>false,'loop'=>$value['loop']??true,'playsinline'=>true,'controls'=>$value['controls']??false]);
|
|
168
|
+
case 'List':
|
|
169
|
+
$rows=is_array($value)?$value:[];
|
|
170
|
+
if(!empty($p['gallery']))$rows=array_values(array_filter($rows,fn($row)=>!empty($row['image']['url'])));
|
|
171
|
+
|
|
172
|
+
return collection($rows,$p,$context,fn($row,$i)=>nodes($children,array_replace($context,['data'=>$row])));
|
|
173
|
+
|
|
174
|
+
case 'Slider':
|
|
175
|
+
if(!$children){$html='';foreach(is_array($value)?$value:[] as $row)$html.=image($row,'w-full h-full object-cover');return tag('div',['class'=>$class],$html);}
|
|
176
|
+
foreach($children as &$child)if(in_array($child['type'],['Records','List'],true))$child['props']['className']=trim(($child['props']['className']??'').' site-slider-items '.($p['trackClassName']??''));unset($child);
|
|
177
|
+
return tag('div',['class'=>$class,'data-slider'=>$p['name']??'slider','data-slider-below'=>$p['activeBelow']??null,'data-slider-loop'=>!empty($p['loop'])?'true':'false','role'=>'region','aria-roledescription'=>'carousel','aria-label'=>$p['label']??'Slider'],tag('div',['data-slider-viewport'=>'','tabindex'=>'0'],tag('div',['data-slider-track'=>'','class'=>$p['trackClassName']??null],nodes($children,$context))));
|
|
178
|
+
case 'SliderButton':
|
|
179
|
+
$direction=($p['direction']??'next')==='previous'?'previous':'next';
|
|
180
|
+
return tag('button',['type'=>'button','class'=>$class,'data-slider-for'=>$p['slider']??'','data-slider-button'=>$direction,'aria-label'=>$p['label']??($direction==='previous'?'Previous slide':'Next slide'),'disabled'=>true],$children?nodes($children,$context):($direction==='previous'?'←':'→'));
|
|
181
|
+
case 'SliderPagination':return tag('div',['class'=>$class,'data-slider-for'=>$p['slider']??'','data-slider-pagination'=>'','data-slider-page-class'=>$p['buttonClassName']??'','data-slider-page-label'=>$p['pageLabel']??'Slide','role'=>'group','aria-label'=>$p['label']??'Slider pages'],'');
|
|
182
|
+
case 'RecordContent':return native_blocks(is_array($record[$p['field']??'']??null)?$record[$p['field']]:[],$context);
|
|
183
|
+
case 'RecordText':$text=$record[$p['field']??'']??'';return $text?tag(in_array($p['as']??'p',['p','span','div','blockquote'],true)?($p['as']??'p'):'p',['class'=>$class],wp_kses_post((string)$text)):'';
|
|
184
|
+
case 'Gallery':$html='';foreach(is_array($value)?$value:[] as $row)$html.=image($row,'w-full h-full object-cover');return tag('div',['class'=>$class],$html);
|
|
185
|
+
case 'PricingPlans':return pricing_plans(is_array($value)?$value:null,$site,$class);
|
|
186
|
+
// The form is interactive and mounts in the browser.
|
|
187
|
+
case 'Form':return tag('div',['class'=>$class],'');
|
|
188
|
+
case 'ReviewsCarousel':return reviews_carousel(is_array($value)?$value:null,$site,$class);
|
|
189
|
+
case 'Records':
|
|
190
|
+
$library=$site[($p['type']??'post').'s']??[];$rows=[];
|
|
191
|
+
foreach(is_array($value)?$value:[] as $item){if(is_array($item)&&!empty($item['manual'])){$rows[]=$item;continue;}$id=is_array($item)?($item['id']??0):$item;foreach($library as $r)if((string)$r['id']===(string)$id)$rows[]=$r;}
|
|
192
|
+
if(!empty($p['latest'])&&($data[$p['modeField']??'']??'latest')!=='manual'){$rows=$library;usort($rows,fn($a,$b)=>(strtotime($b['publishedAt']??$b['date']??'')<=>strtotime($a['publishedAt']??$a['date']??''))?:((int)($b['id']??0)<=>(int)($a['id']??0)));$rows=array_slice($rows,0,max(0,(int)$p['latest']));}
|
|
193
|
+
return collection($rows,$p,$context,fn($row,$i)=>nodes($children,array_replace($context,['record'=>$row,'index'=>$i])));
|
|
194
|
+
case 'RecordDate':$timestamp=strtotime($record['publishedAt']??$record['date']??'');return $timestamp===false?'':tag('time',['class'=>$class,'datetime'=>gmdate('c',$timestamp)],gmdate('d.m.Y',$timestamp));
|
|
195
|
+
case 'RecordTitle':return tag('h3',['class'=>$class],wp_kses_post($record['title']??''));
|
|
196
|
+
case 'RecordExcerpt':return tag('p',['class'=>$class],wp_kses_post($record['excerpt']??''));
|
|
197
|
+
case 'RecordIndex':return tag('span',['class'=>$class],sprintf('%02d',($context['index']??0)+1));
|
|
198
|
+
case 'RecordImage':return image(['url'=>$record['image']??'','alt'=>$record['alt']??''],$class);
|
|
199
|
+
case 'RecordLink':$url=$record['url']??$record['to']??'';return $url?tag('a',['href'=>esc_url($url),'class'=>$class],nodes($children,$context)):tag('div',['class'=>$class],nodes($children,$context));
|
|
200
|
+
case 'Area':
|
|
201
|
+
$html='';foreach(is_array($value)?$value:[] as $item)foreach($children as $child)if(strtolower($child['props']['type']??$child['type'])===($item['type']??'')){$child['props']['name']='value';$html.=node($child,array_replace($context,['data'=>['value'=>$item['value']??null]]));break;}return tag('div',['class'=>$class],$html);
|
|
202
|
+
case 'Drag':
|
|
203
|
+
$elements=drag_elements($children);$blocks=$context['blocks']??[];$palettes=array_values(array_filter($children,fn($c)=>$c['type']==='Cols'));
|
|
204
|
+
if(!$palettes)return $class?tag('div',['class'=>$class],native_blocks($blocks,$context,$elements)):native_blocks($blocks,$context,$elements);
|
|
205
|
+
$grid=min(24,max(0,(int)($p['grid']??0)));$mobile_grid=$grid?min($grid,max(1,(int)($p['mobileGrid']??6)?:6)):0;$gap=$p['gap']??null;$gap=is_int($gap)||is_float($gap)?($gap>=0?$gap.'rem':''):(is_string($gap)&&preg_match('/^[\d.]+(rem|em|%)$/',trim($gap))?trim($gap):'');$max_col=max(1,(int)($p['maxCol']??2));
|
|
206
|
+
$html='';foreach($blocks as $block){if(!str_ends_with($block['name']??'','-column'))continue;$a=$block['attrs'];$palette=$a['palette']??$palettes[0]['props']['name'];$definition=null;foreach($palettes as $c)if($c['props']['name']===$palette)$definition=$c;
|
|
207
|
+
$layout=flow_column_layout($grid,$a,$definition['props']??[],$max_col,$mobile_grid);
|
|
208
|
+
$html.=tag('div',['class'=>trim('site-flow-column '.(!empty($a['fullRow'])?'is-full-row ':'').$layout['class'].' '.classes($definition['props']??[])),'style'=>$layout['style']?:null,'data-vertical-align'=>$a['verticalAlign']??'top','data-horizontal-align'=>$a['horizontalAlign']??'stretch'],native_blocks($block['innerBlocks']??[],$context,$elements));
|
|
209
|
+
}return tag('div',['class'=>trim('site-flow-drag '.($grid?'has-grid ':'').$class),'style'=>'--site-flow-columns:'.($grid?:$max_col).($mobile_grid?';--site-flow-mobile-columns:'.$mobile_grid:'').($gap?';--site-flow-gap:'.$gap:'')],$html);
|
|
210
|
+
default:throw new \RuntimeException('Unsupported kit node: '.$type);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {useSyncExternalStore} from 'react';
|
|
2
|
+
const subscribe=(notify:()=>void)=>{window.addEventListener('popstate',notify);return()=>window.removeEventListener('popstate',notify);};
|
|
3
|
+
export function usePathname(){return useSyncExternalStore(subscribe,()=>window.location.pathname,()=>'/');}
|
|
4
|
+
export function useRouter(){return {push:(url:string)=>window.location.assign(url),replace:(url:string)=>window.location.replace(url),refresh:()=>window.location.reload()};}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {enhanceStaticMedia} from './static-media.js';
|
|
2
|
+
import {Component, useEffect, useLayoutEffect, useState, type ReactNode} from 'react';
|
|
3
|
+
import {createRoot} from 'react-dom/client';
|
|
4
|
+
import {createPortal} from 'react-dom';
|
|
5
|
+
import {ContentProvider} from '../../core/content/context.js';
|
|
6
|
+
import type {ModuleDefinition} from '../../core/modules/types.js';
|
|
7
|
+
import type {ComponentType} from 'react';
|
|
8
|
+
import {resolveMedia as mediaValues} from '../../core/media/values.js';
|
|
9
|
+
|
|
10
|
+
export function mountWordPress({getModules,BlockList,SiteShell}: {
|
|
11
|
+
getModules:()=>ModuleDefinition[];
|
|
12
|
+
BlockList:ComponentType<any>;
|
|
13
|
+
SiteShell:ComponentType<any>;
|
|
14
|
+
}) {
|
|
15
|
+
/** Keep PHP visible until an island has committed successfully. */
|
|
16
|
+
function Island({target, children}: { target: HTMLElement; children: ReactNode }) {
|
|
17
|
+
const [mount] = useState(() => {
|
|
18
|
+
const element = document.createElement('div');
|
|
19
|
+
element.style.display = 'contents';
|
|
20
|
+
return element;
|
|
21
|
+
});
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const fallback = Array.from(target.childNodes);
|
|
24
|
+
target.replaceChildren(mount);
|
|
25
|
+
return () => {
|
|
26
|
+
target.replaceChildren(...fallback);
|
|
27
|
+
};
|
|
28
|
+
}, [target, mount]);
|
|
29
|
+
return createPortal(children, mount);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class FallbackBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
|
|
33
|
+
state = {failed: false};
|
|
34
|
+
|
|
35
|
+
static getDerivedStateFromError() {
|
|
36
|
+
return {failed: true};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
return this.state.failed ? null : this.props.children;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Keep the already functional PHP header until a visitor interacts with navigation. */
|
|
45
|
+
function InteractiveHeader({target,site}:{target:HTMLElement;site:any}) {
|
|
46
|
+
const [active,setActive]=useState(false);
|
|
47
|
+
useEffect(()=>{
|
|
48
|
+
const enable=()=>{
|
|
49
|
+
site.runtime.initialMobileMenu=!!target.querySelector('details[data-mobile-menu][open]');
|
|
50
|
+
const menu=target.querySelector<HTMLElement>('details[data-menu-index][open]');
|
|
51
|
+
site.runtime.initialDesktopMenu=menu?'services-'+menu.dataset.menuIndex:'';
|
|
52
|
+
setActive(true);
|
|
53
|
+
};
|
|
54
|
+
const click=()=>requestAnimationFrame(enable);
|
|
55
|
+
const hover=(event:PointerEvent)=>{if(event.pointerType==='mouse')enable();};
|
|
56
|
+
target.addEventListener('click',click,{once:true});
|
|
57
|
+
target.addEventListener('pointerover',hover);
|
|
58
|
+
target.addEventListener('keyup',click,{once:true});
|
|
59
|
+
return ()=>{target.removeEventListener('click',click);target.removeEventListener('pointerover',hover);target.removeEventListener('keyup',click);};
|
|
60
|
+
},[target,site]);
|
|
61
|
+
return active?<Island target={target}><BlockList blocks={site.header} site={site}/></Island>:null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** PHP owns crawlable HTML; browser React provides shared interactions. */
|
|
65
|
+
const payload = document.getElementById('site-wordpress-data');
|
|
66
|
+
if (payload) {
|
|
67
|
+
const {site, instances} = JSON.parse(payload.textContent ?? '{}');
|
|
68
|
+
site.runtime.retainedHeaderLogo = document.querySelector('#site-header-root header img');
|
|
69
|
+
const root = document.createElement('div');
|
|
70
|
+
root.id = 'site-wordpress-runtime';
|
|
71
|
+
document.body.append(root);
|
|
72
|
+
enhanceStaticMedia();
|
|
73
|
+
const islands = instances.flatMap((instance: any) => {
|
|
74
|
+
if (instance.static) return [];
|
|
75
|
+
const target = document.getElementById(instance.id);
|
|
76
|
+
const definition = getModules().find(section => section.name === instance.block.name);
|
|
77
|
+
if (!target || !definition) return [];
|
|
78
|
+
const View = definition.View;
|
|
79
|
+
return [<FallbackBoundary key={instance.id}><Island target={target}>
|
|
80
|
+
<ContentProvider data={mediaValues(instance.block.attrs.data ?? {}, site.media)}
|
|
81
|
+
innerBlocks={instance.block.innerBlocks ?? []} site={site}><View
|
|
82
|
+
data={mediaValues(instance.block.attrs.data ?? {}, site.media)}
|
|
83
|
+
blocks={instance.block.innerBlocks ?? []} site={site}/></ContentProvider>
|
|
84
|
+
</Island></FallbackBoundary>];
|
|
85
|
+
});
|
|
86
|
+
for (const part of ['header', 'footer'] as const) {
|
|
87
|
+
const target = document.getElementById(`site-${part}-root`);
|
|
88
|
+
if (target && site[part]?.length) islands.push(
|
|
89
|
+
<FallbackBoundary key={part}>{part==='header'?<InteractiveHeader target={target} site={site}/>:<Island target={target}><BlockList blocks={site[part]}
|
|
90
|
+
site={site}/></Island>}</FallbackBoundary>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
createRoot(root).render(<SiteShell site={site} chrome={false}>{islands}</SiteShell>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|