create-kywi-app 0.7.1 → 0.8.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.
@@ -443,7 +443,15 @@ interchangeable.
443
443
  pin) and A/B experiments. Since 0.6.3 it also renders in the layout editor as
444
444
  a badged block with an **arm switcher**, each arm editable with the ordinary
445
445
  section/column/module tools, so server-resolution no longer costs the owner
446
- their editing surface.
446
+ their editing surface. Since kywi-cms#119, the owner doesn't need an agent to
447
+ hand-author this shape at all: the section chrome — in the admin layout
448
+ editor and in the in-place front-of-site overlay alike — offers
449
+ **Personalize this section** / **A/B test** actions that wrap an ordinary
450
+ section into a section-level variant container on the spot, seeding the
451
+ default arm from the section's current content and opening straight into its
452
+ config (audience/experiment picker included). An agent only needs to reach
453
+ for `update_layout` when scripting bulk changes or building a container the
454
+ UI can't reach.
447
455
  - **Module-level** — the `variantContainer` *module*, placed in a column; its
448
456
  arms are HTML strings (`defaultContent`, `variants: [{audienceId, label,
449
457
  content}]`). Every arm ships in the HTML (default visible, the rest
package/lib/templates.mjs CHANGED
@@ -1559,6 +1559,7 @@ export default async function PublicPage({ params, searchParams }: Params & Sear
1559
1559
  initialLayout={layout ?? { regions: { main: [] } }}
1560
1560
  adminHref={\`/admin/content/\${contentType}/\${contentId}\`}
1561
1561
  moduleComponents={moduleComponents}
1562
+ hostModules={config.modules ?? []}
1562
1563
  >
1563
1564
  {content}
1564
1565
  </KywiFrontEdit>
@@ -1607,6 +1608,7 @@ import {
1607
1608
  BUILT_IN_MODULE_COMPONENTS,
1608
1609
  type LayoutDocument,
1609
1610
  type ModuleComponentMap,
1611
+ type ModuleConfig,
1610
1612
  } from '@kywi-software/core/layout'
1611
1613
  import type { SaveAction } from '@kywi-software/core/admin'
1612
1614
 
@@ -1638,6 +1640,10 @@ export interface KywiFrontEditProps {
1638
1640
  adminHref: string
1639
1641
  /** Custom (defineModule) renderers, shared with the public layout + admin (#48). */
1640
1642
  moduleComponents?: ModuleComponentMap
1643
+ /** Custom (defineModule) module CONFIGS from kywi.config.ts — gives the overlay
1644
+ * editor each custom module's prop definitions, so the props rail and inline
1645
+ * text editing work for them exactly as in the admin editor (kywi-cms#118). */
1646
+ hostModules?: ModuleConfig[]
1641
1647
  children: React.ReactNode
1642
1648
  }
1643
1649
 
@@ -1662,6 +1668,7 @@ export function KywiFrontEdit({
1662
1668
  initialLayout,
1663
1669
  adminHref,
1664
1670
  moduleComponents = {},
1671
+ hostModules = [],
1665
1672
  children,
1666
1673
  }: KywiFrontEditProps) {
1667
1674
  const edit = useKywiEditMode({ canEdit, canPublish })
@@ -1675,10 +1682,14 @@ export function KywiFrontEdit({
1675
1682
  if (editRequested) startEdit()
1676
1683
  }, [editRequested, startEdit])
1677
1684
 
1678
- // Registries + renderers for the editor: built from core (no module list is
1679
- // re-declared here) and merged with this app's custom module renderers from
1680
- // lib/modules the SAME source the admin app and public renderer use (#48).
1681
- const moduleRegistry = React.useMemo(() => createModuleRegistry([]), [])
1685
+ // Registries + renderers for the editor: the module registry carries each
1686
+ // module's prop definitions (built-ins + this app's kywi.config.ts modules
1687
+ // without the host list, custom modules render but are uneditable, kywi-cms#118),
1688
+ // merged with the custom renderers from lib/modules (#48).
1689
+ const moduleRegistry = React.useMemo(
1690
+ () => createModuleRegistry(hostModules ?? []),
1691
+ [hostModules],
1692
+ )
1682
1693
  const themeRegistry = React.useMemo(() => createThemeRegistry(), [])
1683
1694
  const editorComponents = React.useMemo(
1684
1695
  () => ({ ...BUILT_IN_MODULE_COMPONENTS, ...moduleComponents }),
@@ -2215,10 +2226,10 @@ leaving the editor keeps \`?kywi-edit=1\` in the URL in sync, so reloading (or
2215
2226
  sharing the link) lands back in the same mode. It all lives in
2216
2227
  \`app/(site)/kywi-front-edit.tsx\`; the editor bundle (and the admin stylesheet) is
2217
2228
  lazy-loaded, so pages your visitors see never carry its weight — an anonymous
2218
- or read-only visitor gets no toolbar and no extra client JS. Note: custom
2219
- \`defineModule\` types still RENDER on the canvas, but they don't appear in the
2220
- front-of-site editor's insert palette (it uses the built-in module set) add
2221
- them from the admin's Layout tab instead.
2229
+ or read-only visitor gets no toolbar and no extra client JS. Custom
2230
+ \`defineModule\` types from \`kywi.config.ts\` also appear in the front-of-site
2231
+ editor's insert palette and are fully editable in placethe props rail and
2232
+ inline text editing work exactly as they do in the admin's Layout tab.
2222
2233
 
2223
2234
  ## Personalization, A/B testing & self-ID
2224
2235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kywi-app",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Scaffold a new Kywi CMS project — npx create-kywi-app my-site",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Kywi-Software/kywi-cms#readme",