@lattice-php/lattice 0.47.0 → 0.48.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/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export { withHeaders } from '@lattice-php/core/headers';
24
24
  export { LATTICE_EVENT } from '@lattice-php/core/event-names';
25
25
  export type { Emphasis } from '@lattice-php/ui/button';
26
26
  export type { ReloadComponentEvent } from '@lattice-php/core/event-names';
27
- export type { ComponentProps, KnownPageContainer, LayoutPayload, Node, NodeProps, NodeType, PageContainer, PageBreadcrumb, PagePayload, ComponentPropsOf, RendererComponent, RendererComponentModule, RendererComponentProps, Schema, UnknownComponent, } from './types/index.js';
27
+ export type { ComponentProps, KnownPageWidth, LayoutPayload, Node, NodeProps, NodeType, PageBreadcrumb, PagePayload, PageWidth, ComponentPropsOf, RendererComponent, RendererComponentModule, RendererComponentProps, Schema, UnknownComponent, } from './types/index.js';
28
28
  export { RealtimeListeners } from './realtime/listeners.js';
29
29
  export type { ChannelVisibility, Listen } from './types/generated.js';
30
30
  export type { DateFormat, NumberFormat } from '@lattice-php/ui';
package/dist/page.js CHANGED
@@ -4,22 +4,21 @@ import { Renderer } from "@lattice-php/core/renderer";
4
4
  import { cn } from "@lattice-php/ui/lib/utils";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region resources/js/page.tsx
7
+ var pageWidths = {
8
+ full: "max-w-none",
9
+ lg: "max-w-4xl",
10
+ md: "max-w-2xl",
11
+ sm: "max-w-md"
12
+ };
7
13
  function Page({ lattice }) {
8
- const content = /* @__PURE__ */ jsx(Renderer, { nodes: lattice.schema });
9
14
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10
15
  /* @__PURE__ */ jsx(Head, { title: lattice.title ?? void 0 }),
11
16
  /* @__PURE__ */ jsx(RealtimeListeners, { listeners: lattice.listeners }),
12
- lattice.container === "centered" ? /* @__PURE__ */ jsx("main", {
13
- className: "min-h-svh bg-lt-bg text-lt-fg",
14
- children: /* @__PURE__ */ jsx("div", {
15
- "data-test": "lattice-centered-container",
16
- className: "mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10",
17
- children: content
18
- })
19
- }) : /* @__PURE__ */ jsx("div", {
20
- "data-test": "lattice-default-container",
21
- className: cn("w-full", { "px-4 py-6": lattice.layout !== null }),
22
- children: content
17
+ /* @__PURE__ */ jsx("div", {
18
+ "data-test": "lattice-page-container",
19
+ "data-page-width": lattice.width,
20
+ className: cn("mx-auto w-full px-4 py-6 sm:px-6 lg:px-8", pageWidths[lattice.width] ?? pageWidths.full),
21
+ children: /* @__PURE__ */ jsx(Renderer, { nodes: lattice.schema })
23
22
  })
24
23
  ] });
25
24
  }
package/dist/page.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice-php/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport { RealtimeListeners } from \"@lattice-php/lattice/realtime/listeners\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nexport default function Page({ lattice }: Props) {\n const content = <Renderer nodes={lattice.schema} />;\n\n return (\n <>\n <Head title={lattice.title ?? undefined} />\n\n <RealtimeListeners listeners={lattice.listeners} />\n\n {lattice.container === \"centered\" ? (\n <main className=\"min-h-svh bg-lt-bg text-lt-fg\">\n <div\n data-test=\"lattice-centered-container\"\n className=\"mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10\"\n >\n {content}\n </div>\n </main>\n ) : (\n <div\n data-test=\"lattice-default-container\"\n className={cn(\"w-full\", {\n \"px-4 py-6\": lattice.layout !== null,\n })}\n >\n {content}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAwB,KAAK,EAAE,WAAkB;CAC/C,MAAM,UAAU,oBAAC,UAAD,EAAU,OAAO,QAAQ,OAAS,CAAA;CAElD,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD,EAAM,OAAO,QAAQ,SAAS,KAAA,EAAY,CAAA;EAE1C,oBAAC,mBAAD,EAAmB,WAAW,QAAQ,UAAY,CAAA;EAEjD,QAAQ,cAAc,aACrB,oBAAC,QAAD;GAAM,WAAU;GACd,UAAA,oBAAC,OAAD;IACE,aAAU;IACV,WAAU;IAET,UAAA;GACE,CAAA;EACD,CAAA,IAEN,oBAAC,OAAD;GACE,aAAU;GACV,WAAW,GAAG,UAAU,EACtB,aAAa,QAAQ,WAAW,KAClC,CAAC;GAEA,UAAA;EACE,CAAA;CAEP,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice-php/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport { RealtimeListeners } from \"@lattice-php/lattice/realtime/listeners\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nconst pageWidths: Record<string, string> = {\n full: \"max-w-none\",\n lg: \"max-w-4xl\",\n md: \"max-w-2xl\",\n sm: \"max-w-md\",\n};\n\nexport default function Page({ lattice }: Props) {\n return (\n <>\n <Head title={lattice.title ?? undefined} />\n\n <RealtimeListeners listeners={lattice.listeners} />\n\n <div\n data-test=\"lattice-page-container\"\n data-page-width={lattice.width}\n className={cn(\n \"mx-auto w-full px-4 py-6 sm:px-6 lg:px-8\",\n pageWidths[lattice.width] ?? pageWidths.full,\n )}\n >\n <Renderer nodes={lattice.schema} />\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;AAUA,IAAM,aAAqC;CACzC,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAwB,KAAK,EAAE,WAAkB;CAC/C,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD,EAAM,OAAO,QAAQ,SAAS,KAAA,EAAY,CAAA;EAE1C,oBAAC,mBAAD,EAAmB,WAAW,QAAQ,UAAY,CAAA;EAElD,oBAAC,OAAD;GACE,aAAU;GACV,mBAAiB,QAAQ;GACzB,WAAW,GACT,4CACA,WAAW,QAAQ,UAAU,WAAW,IAC1C;GAEA,UAAA,oBAAC,UAAD,EAAU,OAAO,QAAQ,OAAS,CAAA;EAC/B,CAAA;CACL,EAAA,CAAA;AAEN"}
@@ -1,5 +1,5 @@
1
1
  import { ActionNodeType, ChatNodeType, FormNodeType, FragmentNodeType, LayoutNodeType, NodeType, NotificationNodeType, RemoteNodeType, TableNodeType, UiNodeType } from './types/generated.js';
2
- type OptInNodeType = "api-reference" | "media.library" | "signature" | "tree";
2
+ type OptInNodeType = "api-reference" | "media.library" | "signature" | "timeline" | "tree";
3
3
  type RegisteredNodeType = ActionNodeType | ChatNodeType | FormNodeType | FragmentNodeType | LayoutNodeType | NotificationNodeType | OptInNodeType | RemoteNodeType | TableNodeType | UiNodeType;
4
4
  type Assert<T extends true> = T;
5
5
  export type AllNodeTypesRegistered = Assert<Exclude<NodeType, RegisteredNodeType> extends never ? true : false>;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/core/registry\";\nimport type {\n ActionNodeType,\n ChatNodeType,\n FormNodeType,\n FragmentNodeType,\n LayoutNodeType,\n NodeType,\n NotificationNodeType,\n RemoteNodeType,\n TableNodeType,\n UiNodeType,\n} from \"@lattice-php/lattice/types/generated\";\nimport { actionComponents } from \"@lattice-php/action/plugin\";\nimport { chatComponents } from \"./chat/plugin\";\nimport { formComponents } from \"@lattice-php/form\";\nimport { fragmentComponents } from \"./fragments/plugin\";\nimport { layoutComponents } from \"./layout/plugin\";\nimport { notificationsComponents } from \"./notifications/plugin\";\nimport { remoteComponents } from \"./remote/plugin\";\nimport { tableComponents } from \"@lattice-php/table\";\nimport { uiComponents } from \"@lattice-php/ui\";\n\n// Opt-in packages whose plugins are not bundled in the framework registry —\n// a consuming app registers them itself when it opts into the package.\n// WireModelBuilder::buildAll() still discovers them for the framework\n// document's system-wide NodeType (every composer package that declares\n// extra.lattice.discover, not just the ones this workbench emits a module\n// for), so their node types are legitimately part of it and are acknowledged\n// here rather than belonging to a registered plugin's union.\ntype OptInNodeType = \"api-reference\" | \"media.library\" | \"signature\" | \"tree\";\n\n// Compile-time totality: every generated NodeType must belong to a registered\n// plugin's union, or be an acknowledged opt-in package above. A new PHP\n// domain fails here until its plugin exists (or it's added to the opt-in list).\ntype RegisteredNodeType =\n | ActionNodeType\n | ChatNodeType\n | FormNodeType\n | FragmentNodeType\n | LayoutNodeType\n | NotificationNodeType\n | OptInNodeType\n | RemoteNodeType\n | TableNodeType\n | UiNodeType;\ntype Assert<T extends true> = T;\nexport type AllNodeTypesRegistered = Assert<\n Exclude<NodeType, RegisteredNodeType> extends never ? true : false\n>;\n\nexport const registry = createRegistry(\n uiComponents,\n fragmentComponents,\n actionComponents,\n formComponents,\n layoutComponents,\n tableComponents,\n chatComponents,\n notificationsComponents,\n remoteComponents,\n);\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,WAAW,eACtB,cACA,oBACA,kBACA,gBACA,kBACA,iBACA,gBACA,yBACA,gBACF"}
1
+ {"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/core/registry\";\nimport type {\n ActionNodeType,\n ChatNodeType,\n FormNodeType,\n FragmentNodeType,\n LayoutNodeType,\n NodeType,\n NotificationNodeType,\n RemoteNodeType,\n TableNodeType,\n UiNodeType,\n} from \"@lattice-php/lattice/types/generated\";\nimport { actionComponents } from \"@lattice-php/action/plugin\";\nimport { chatComponents } from \"./chat/plugin\";\nimport { formComponents } from \"@lattice-php/form\";\nimport { fragmentComponents } from \"./fragments/plugin\";\nimport { layoutComponents } from \"./layout/plugin\";\nimport { notificationsComponents } from \"./notifications/plugin\";\nimport { remoteComponents } from \"./remote/plugin\";\nimport { tableComponents } from \"@lattice-php/table\";\nimport { uiComponents } from \"@lattice-php/ui\";\n\n// Opt-in packages whose plugins are not bundled in the framework registry —\n// a consuming app registers them itself when it opts into the package.\n// WireModelBuilder::buildAll() still discovers them for the framework\n// document's system-wide NodeType (every composer package that declares\n// extra.lattice.discover, not just the ones this workbench emits a module\n// for), so their node types are legitimately part of it and are acknowledged\n// here rather than belonging to a registered plugin's union.\ntype OptInNodeType = \"api-reference\" | \"media.library\" | \"signature\" | \"timeline\" | \"tree\";\n\n// Compile-time totality: every generated NodeType must belong to a registered\n// plugin's union, or be an acknowledged opt-in package above. A new PHP\n// domain fails here until its plugin exists (or it's added to the opt-in list).\ntype RegisteredNodeType =\n | ActionNodeType\n | ChatNodeType\n | FormNodeType\n | FragmentNodeType\n | LayoutNodeType\n | NotificationNodeType\n | OptInNodeType\n | RemoteNodeType\n | TableNodeType\n | UiNodeType;\ntype Assert<T extends true> = T;\nexport type AllNodeTypesRegistered = Assert<\n Exclude<NodeType, RegisteredNodeType> extends never ? true : false\n>;\n\nexport const registry = createRegistry(\n uiComponents,\n fragmentComponents,\n actionComponents,\n formComponents,\n layoutComponents,\n tableComponents,\n chatComponents,\n notificationsComponents,\n remoteComponents,\n);\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,WAAW,eACtB,cACA,oBACA,kBACA,gBACA,kBACA,iBACA,gBACA,yBACA,gBACF"}
@@ -10,6 +10,7 @@ export type BrowserToken = {
10
10
  readonly scopes: string[];
11
11
  readonly tokenType: string;
12
12
  };
13
+ export type CalendarNodeType = "timeline";
13
14
  export type Callouts = Record<string, never>;
14
15
  export type ChannelVisibility = "public" | "private" | "presence";
15
16
  export type ChatBox = {
@@ -92,7 +93,7 @@ export type MenuItem = {
92
93
  prefix: Affix | null;
93
94
  suffix: Affix | null;
94
95
  };
95
- export type NodeType = "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "breadcrumbs" | "button" | "callouts" | "card" | "chart" | "chat.box" | "chat.part.text" | "chat.part.tool-call" | "code-block" | "collapsible" | "dropdown" | "field.builder" | "field.checkbox" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "progress" | "raw-block" | "remote.data-list" | "section" | "segmented-control" | "separator" | "sidebar" | "signature" | "stack" | "tab" | "table" | "tabs" | "text" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
96
+ export type NodeType = "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "breadcrumbs" | "button" | "callouts" | "card" | "chart" | "chat.box" | "chat.part.text" | "chat.part.tool-call" | "code-block" | "collapsible" | "description-list" | "dropdown" | "entry.badge" | "entry.boolean" | "entry.component" | "entry.date" | "entry.text" | "field.builder" | "field.checkbox" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "progress" | "raw-block" | "remote.data-list" | "section" | "segmented-control" | "separator" | "sidebar" | "signature" | "stack" | "tab" | "table" | "tabs" | "text" | "timeline" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
96
97
  export type NotificationItem = {
97
98
  readonly actions: Node[];
98
99
  readonly body: Translatable | string | null;
@@ -123,11 +124,11 @@ export type PageLayoutPayload = {
123
124
  };
124
125
  export type PagePayload = {
125
126
  readonly breadcrumbs: Breadcrumb[];
126
- readonly container: string;
127
127
  readonly layout: PageLayoutPayload | null;
128
128
  readonly listeners: Listen[];
129
129
  readonly schema: Node[];
130
130
  readonly title: string | null;
131
+ readonly width: string;
131
132
  };
132
133
  export type RemoteAccess = {
133
134
  readonly audience: string;
@@ -155,7 +156,7 @@ export type ToolCallPart = {
155
156
  export type Topbar = {
156
157
  sticky: boolean;
157
158
  };
158
- export type UiNodeType = "avatar" | "badge" | "button" | "card" | "chart" | "code-block" | "collapsible" | "floating-panel" | "grid" | "heading" | "icon" | "image" | "link" | "modal" | "progress" | "raw-block" | "section" | "segmented-control" | "separator" | "stack" | "tab" | "tabs" | "text" | "tooltip";
159
+ export type UiNodeType = "avatar" | "badge" | "button" | "card" | "chart" | "code-block" | "collapsible" | "description-list" | "entry.badge" | "entry.boolean" | "entry.component" | "entry.date" | "entry.text" | "floating-panel" | "grid" | "heading" | "icon" | "image" | "link" | "modal" | "progress" | "raw-block" | "section" | "segmented-control" | "separator" | "stack" | "tab" | "tabs" | "text" | "tooltip";
159
160
  export type UnreadCount = {
160
161
  readonly unreadCount: number;
161
162
  };
@@ -1,11 +1,11 @@
1
- import { Breadcrumb, PageContainer as GeneratedPageContainer } from '@lattice-php/core';
1
+ import { Breadcrumb, PageWidth as GeneratedPageWidth } from '@lattice-php/core';
2
2
  import { NodeType, PageLayoutPayload, PagePayload as GeneratedPagePayload } from './generated.js';
3
3
  export type * from '@lattice-php/core';
4
4
  export type LayoutPayload = PageLayoutPayload;
5
5
  export type PageBreadcrumb = Breadcrumb;
6
- export type PagePayload = Omit<GeneratedPagePayload, "container"> & {
7
- container: PageContainer;
6
+ export type PagePayload = Omit<GeneratedPagePayload, "width"> & {
7
+ width: PageWidth;
8
8
  };
9
- export type PageContainer = GeneratedPageContainer | (string & {});
9
+ export type PageWidth = GeneratedPageWidth | (string & {});
10
10
  export type { NodeType };
11
- export type KnownPageContainer = GeneratedPageContainer;
11
+ export type KnownPageWidth = GeneratedPageWidth;