smoodly 0.0.16 → 0.0.18

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.
Files changed (142) hide show
  1. package/README.md +176 -26
  2. package/dist/admin/client-ops.js +1 -1
  3. package/dist/admin/custom-section.d.ts +10 -0
  4. package/dist/admin/custom-section.js +10 -0
  5. package/dist/admin/editor/CanvasOverlay.d.ts +4 -4
  6. package/dist/admin/editor/CanvasOverlay.js +8 -6
  7. package/dist/admin/editor/EditorView.js +140 -108
  8. package/dist/admin/editor/GlobalInspector.d.ts +27 -0
  9. package/dist/admin/editor/GlobalInspector.js +13 -0
  10. package/dist/admin/editor/InsertPicker.d.ts +6 -5
  11. package/dist/admin/editor/InsertPicker.js +6 -4
  12. package/dist/admin/editor/InspectorFields.d.ts +21 -0
  13. package/dist/admin/editor/InspectorFields.js +22 -0
  14. package/dist/admin/editor/Outline.d.ts +0 -1
  15. package/dist/admin/editor/Outline.js +3 -3
  16. package/dist/admin/editor/{shared-edit.d.ts → global-edit.d.ts} +10 -10
  17. package/dist/admin/editor/{shared-edit.js → global-edit.js} +4 -4
  18. package/dist/admin/editor/useGlobalEdit.d.ts +6 -0
  19. package/dist/admin/editor/{useSharedEdit.js → useGlobalEdit.js} +4 -4
  20. package/dist/admin/forms/FieldWidget.d.ts +14 -1
  21. package/dist/admin/forms/FieldWidget.js +38 -11
  22. package/dist/admin/forms/ListField.d.ts +9 -1
  23. package/dist/admin/forms/ListField.js +16 -8
  24. package/dist/admin/forms/RichtextElementCard.js +11 -5
  25. package/dist/admin/forms/RowsWidget.d.ts +13 -0
  26. package/dist/admin/forms/RowsWidget.js +26 -0
  27. package/dist/admin/forms/SpanBar.d.ts +5 -0
  28. package/dist/admin/forms/SpanBar.js +37 -0
  29. package/dist/admin/forms/richtext-insert.d.ts +2 -2
  30. package/dist/admin/forms/richtext-insert.js +3 -3
  31. package/dist/admin/forms/richtext-nodes.js +1 -1
  32. package/dist/admin/forms/tabs.d.ts +15 -9
  33. package/dist/admin/forms/tabs.js +19 -23
  34. package/dist/admin/forms/useRichtextEditor.js +8 -1
  35. package/dist/admin/global-items.d.ts +9 -0
  36. package/dist/admin/{shared-items.js → global-items.js} +17 -16
  37. package/dist/admin/index.d.ts +3 -3
  38. package/dist/admin/index.js +1 -1
  39. package/dist/admin/ops-impl.js +65 -54
  40. package/dist/admin/ops.d.ts +6 -6
  41. package/dist/admin/serialize.d.ts +18 -6
  42. package/dist/admin/serialize.js +27 -4
  43. package/dist/admin/shell/AdminApp.js +6 -6
  44. package/dist/admin/shell/GlobalFields.d.ts +24 -0
  45. package/dist/admin/shell/GlobalFields.js +19 -0
  46. package/dist/admin/shell/{SharedForm.d.ts → GlobalForm.d.ts} +1 -1
  47. package/dist/admin/shell/{SharedForm.js → GlobalForm.js} +36 -26
  48. package/dist/admin/shell/{SharedList.d.ts → GlobalList.d.ts} +1 -1
  49. package/dist/admin/shell/{SharedList.js → GlobalList.js} +9 -9
  50. package/dist/admin/shell/IconRail.js +13 -6
  51. package/dist/admin/shell/PagesList.js +1 -6
  52. package/dist/admin/shell/{shared-list.d.ts → global-list.d.ts} +3 -3
  53. package/dist/admin/shell/{shared-list.js → global-list.js} +2 -2
  54. package/dist/admin/tree-ops.d.ts +10 -8
  55. package/dist/admin/tree-ops.js +28 -16
  56. package/dist/admin/ui/ActionMenu.d.ts +3 -1
  57. package/dist/admin/ui/ActionMenu.js +4 -3
  58. package/dist/admin/ui/HistoryModal.js +1 -1
  59. package/dist/admin/ui/PublishControl.d.ts +3 -1
  60. package/dist/admin/ui/PublishControl.js +2 -2
  61. package/dist/admin/ui/primitives.d.ts +4 -2
  62. package/dist/admin/ui/primitives.js +3 -3
  63. package/dist/admin/ui/theme.js +61 -18
  64. package/dist/admin/validate.d.ts +27 -2
  65. package/dist/admin/validate.js +47 -10
  66. package/dist/collections.d.ts +3 -3
  67. package/dist/collections.js +1 -1
  68. package/dist/conditions.d.ts +33 -0
  69. package/dist/conditions.js +79 -0
  70. package/dist/config.d.ts +26 -19
  71. package/dist/config.js +26 -25
  72. package/dist/css.d.ts +7 -0
  73. package/dist/css.js +57 -0
  74. package/dist/custom/CustomSection.d.ts +26 -0
  75. package/dist/custom/CustomSection.js +20 -0
  76. package/dist/custom/css.d.ts +3 -0
  77. package/dist/custom/css.js +28 -0
  78. package/dist/custom/index.d.ts +26 -0
  79. package/dist/custom/index.js +16 -0
  80. package/dist/custom/rows.d.ts +28 -0
  81. package/dist/custom/rows.js +129 -0
  82. package/dist/custom/schema.d.ts +32 -0
  83. package/dist/custom/schema.js +39 -0
  84. package/dist/entry-page.d.ts +5 -0
  85. package/dist/entry-page.js +1 -1
  86. package/dist/entry-store.d.ts +4 -4
  87. package/dist/entry-store.js +17 -17
  88. package/dist/fields.d.ts +5 -2
  89. package/dist/fields.js +4 -2
  90. package/dist/{shared-id.d.ts → global-id.d.ts} +1 -1
  91. package/dist/{shared-id.js → global-id.js} +4 -4
  92. package/dist/global.d.ts +57 -0
  93. package/dist/global.js +51 -0
  94. package/dist/index.d.ts +31 -21
  95. package/dist/index.js +11 -6
  96. package/dist/media.js +1 -1
  97. package/dist/next/index.d.ts +1 -1
  98. package/dist/next/page-renderer.d.ts +4 -2
  99. package/dist/next/page-renderer.js +16 -12
  100. package/dist/next/queries.d.ts +6 -6
  101. package/dist/next/queries.js +7 -7
  102. package/dist/page.js +2 -2
  103. package/dist/pairing.d.ts +13 -7
  104. package/dist/pairing.js +4 -4
  105. package/dist/paths.d.ts +21 -0
  106. package/dist/paths.js +25 -0
  107. package/dist/refs.d.ts +2 -2
  108. package/dist/refs.js +4 -4
  109. package/dist/render.d.ts +23 -1
  110. package/dist/render.js +12 -6
  111. package/dist/resolve.d.ts +11 -6
  112. package/dist/resolve.js +22 -12
  113. package/dist/revalidate.d.ts +4 -4
  114. package/dist/revalidate.js +4 -4
  115. package/dist/richtext-render.js +2 -2
  116. package/dist/richtext-walk.d.ts +5 -5
  117. package/dist/richtext-walk.js +4 -4
  118. package/dist/schema.d.ts +15 -10
  119. package/dist/schema.js +19 -7
  120. package/dist/section-wrapper.d.ts +18 -6
  121. package/dist/section-wrapper.js +24 -17
  122. package/dist/site.d.ts +29 -14
  123. package/dist/site.js +55 -28
  124. package/dist/sql-space.js +1 -1
  125. package/dist/sql.js +2 -2
  126. package/dist/store.d.ts +7 -0
  127. package/dist/store.js +6 -0
  128. package/dist/styles.d.ts +27 -0
  129. package/dist/styles.js +60 -0
  130. package/dist/supabase-entry-store.js +14 -14
  131. package/dist/supabase-store.js +2 -1
  132. package/dist/zones.d.ts +9 -7
  133. package/dist/zones.js +5 -5
  134. package/package.json +1 -1
  135. package/dist/admin/editor/SharedInspector.d.ts +0 -23
  136. package/dist/admin/editor/SharedInspector.js +0 -13
  137. package/dist/admin/editor/useSharedEdit.d.ts +0 -6
  138. package/dist/admin/shared-items.d.ts +0 -9
  139. package/dist/admin/shell/SharedFields.d.ts +0 -21
  140. package/dist/admin/shell/SharedFields.js +0 -15
  141. package/dist/shared.d.ts +0 -53
  142. package/dist/shared.js +0 -45
@@ -1,15 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { STYLES_KEY } from "../../shared.js";
4
- import { FieldWidget } from "../forms/FieldWidget.js";
5
- import { UnlocalizedMark } from "../ui/primitives.js";
6
- export function SharedFields({ item, entries, fields, errors, refOptions, multilingual, inlinePath, onEditHere, onChange }) {
7
- const styles = (fields[STYLES_KEY] ?? {});
8
- return (_jsx(_Fragment, { children: entries.map(({ key, ns, descriptor }) => {
9
- if (ns === "meta")
10
- return null; // a shared item has no meta namespace
11
- const target = (descriptor.type === "ref" || descriptor.type === "refList") && typeof descriptor.target === "string" ? descriptor.target : null;
12
- const localized = ns === "fields" && item.fields[key]?.localized === true;
13
- return (_jsx(FieldWidget, { fieldKey: key, descriptor: descriptor, value: ns === "fields" ? fields[key] : styles[key], errors: errors, refOptions: target ? refOptions[target] ?? [] : undefined, mark: ns === "fields" && multilingual && !localized ? _jsx(UnlocalizedMark, {}) : undefined, inlinePath: ns === "fields" ? inlinePath : undefined, onEditHere: onEditHere, onChange: (value) => onChange(ns, key, value) }, `${ns}.${key}`));
14
- }) }));
15
- }
package/dist/shared.d.ts DELETED
@@ -1,53 +0,0 @@
1
- import type { CollectionSchema } from "./collections.ts";
2
- import type { Descriptor } from "./fields.ts";
3
- import type { PairedComponent } from "./pairing.tsx";
4
- import type { BuilderMap, NamespaceValues, SectionSchema } from "./schema.ts";
5
- /** The reserved tree node type of a placement. */
6
- export declare const SHARED_NODE_TYPE = "shared";
7
- /** The reserved key a visual item's styles live under in the node's shared JSONB. */
8
- export declare const STYLES_KEY = "$styles";
9
- /** The node id a layout-rendered visual item carries (spec 2026-09-13 §1):
10
- * `getShared` stamps it into the styles, the section wrapper emits it,
11
- * the canvas selects by it. A placement keeps its own tree node id
12
- * (`shared-xxxxxxxx`, no colon). */
13
- export declare const SHARED_NODE_PREFIX = "shared:";
14
- export declare const sharedNodeId: (name: string) => string;
15
- /** The item a layout node id names, or null for any other id. */
16
- export declare function sharedNameOf(id: string): string | null;
17
- export type SharedSchema<V = Record<string, unknown>, N extends string = string> = CollectionSchema<any, N> & {
18
- kind: "shared";
19
- /** The registered section a visual item renders through; absent = an object item. */
20
- section?: string;
21
- /** The section's style descriptors (empty for an object item). */
22
- styles: Record<string, Descriptor>;
23
- sample?: Record<string, unknown>;
24
- /** phantom: what getShared returns */
25
- readonly __value?: V;
26
- };
27
- export type SharedLink = {
28
- item: string;
29
- ref: string;
30
- };
31
- /** The placement a tree node is, or null for any other node. Accepts a
32
- * bare `{ type, fields }` shape or a full tree node — `id` (and any
33
- * other tree-node property) is ignored. */
34
- export declare function sharedLink(node: {
35
- id?: string;
36
- type: string;
37
- fields?: Record<string, unknown>;
38
- }): SharedLink | null;
39
- type SharedInput<N extends string = string> = {
40
- name: N;
41
- title: string;
42
- };
43
- export declare function shared<F extends BuilderMap, const N extends string = string>(input: SharedInput<N> & {
44
- fields: F;
45
- section?: undefined;
46
- }): SharedSchema<NamespaceValues<F>, N>;
47
- export declare function shared<F extends BuilderMap, St extends BuilderMap, const N extends string = string>(input: SharedInput<N> & {
48
- section: PairedComponent<SectionSchema<F, St>, F, St>;
49
- fields?: undefined;
50
- }): SharedSchema<NamespaceValues<F> & {
51
- styles: NamespaceValues<St>;
52
- }, N>;
53
- export {};
package/dist/shared.js DELETED
@@ -1,45 +0,0 @@
1
- /** The reserved tree node type of a placement. */
2
- export const SHARED_NODE_TYPE = "shared";
3
- /** The reserved key a visual item's styles live under in the node's shared JSONB. */
4
- export const STYLES_KEY = "$styles";
5
- /** The node id a layout-rendered visual item carries (spec 2026-09-13 §1):
6
- * `getShared` stamps it into the styles, the section wrapper emits it,
7
- * the canvas selects by it. A placement keeps its own tree node id
8
- * (`shared-xxxxxxxx`, no colon). */
9
- export const SHARED_NODE_PREFIX = "shared:";
10
- export const sharedNodeId = (name) => `${SHARED_NODE_PREFIX}${name}`;
11
- /** The item a layout node id names, or null for any other id. */
12
- export function sharedNameOf(id) {
13
- return id.startsWith(SHARED_NODE_PREFIX) && id.length > SHARED_NODE_PREFIX.length ? id.slice(SHARED_NODE_PREFIX.length) : null;
14
- }
15
- /** The placement a tree node is, or null for any other node. Accepts a
16
- * bare `{ type, fields }` shape or a full tree node — `id` (and any
17
- * other tree-node property) is ignored. */
18
- export function sharedLink(node) {
19
- if (node.type !== SHARED_NODE_TYPE)
20
- return null;
21
- const { item, ref } = node.fields ?? {};
22
- return typeof item === "string" && typeof ref === "string" ? { item, ref } : null;
23
- }
24
- export function shared(input) {
25
- if (!input?.name)
26
- throw new Error("smoodly: a shared item requires a name.");
27
- if ((input.fields === undefined) === (input.section === undefined)) {
28
- throw new Error(`smoodly: shared item "${input.name}" must declare exactly one of \`section\` or \`fields\`.`);
29
- }
30
- const fields = input.section
31
- ? input.section.schema.fields
32
- : Object.fromEntries(Object.entries(input.fields).map(([k, b]) => [k, b.descriptor]));
33
- if (Object.prototype.hasOwnProperty.call(fields, STYLES_KEY)) {
34
- throw new Error(`smoodly: shared item "${input.name}" has a field named "${STYLES_KEY}" — that key is reserved for a visual item's styles.`);
35
- }
36
- return {
37
- kind: "shared",
38
- name: input.name,
39
- title: input.title,
40
- fields,
41
- styles: input.section ? input.section.schema.styles : {},
42
- ...(input.section ? { section: input.section.schema.name } : {}),
43
- ...(input.section?.schema.sample ? { sample: input.section.schema.sample } : {}),
44
- };
45
- }