@lattice-php/lattice 0.70.2 → 0.72.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/lattice.css +9 -0
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js.map +1 -1
- package/dist/runtime.d.ts +13 -3
- package/dist/runtime.js +14 -4
- package/dist/types/generated.d.ts +3 -2
- package/dist/vite.d.ts +20 -1
- package/dist/vite.js +123 -10
- package/dist/vite.js.map +1 -1
- package/dist-standalone/chunks/{chart-view-DHIU7BgJ.js → chart-view-BRyqFBsK.js} +6 -6
- package/dist-standalone/chunks/{date-picker-view-BvP8AU0b.js → date-picker-view-BtiQA-d7.js} +1 -1
- package/dist-standalone/chunks/dist-BTYZr5rg.js +3 -0
- package/dist-standalone/chunks/dist-CDI2N5YZ.js +144 -0
- package/dist-standalone/chunks/input-B7b-fHQh.js +1 -0
- package/dist-standalone/chunks/{instance-D6cXaqIT.js → instance-CloWXP86.js} +1 -1
- package/dist-standalone/chunks/locale-D9oL6nV7.js +1 -0
- package/dist-standalone/chunks/pattern-input-view-3kNVTqfw.js +4 -0
- package/dist-standalone/chunks/rich-editor-view-DOQgR_B4.js +39 -0
- package/dist-standalone/chunks/runtime-zUPRVTKq.js +138 -0
- package/dist-standalone/chunks/subscriptions-CJyO9Lc-.js +1 -0
- package/dist-standalone/chunks/{timezone-Ckl1gbqB.js → timezone-gE1nfovq.js} +1 -1
- package/dist-standalone/lattice.css +1 -1
- package/dist-standalone/lattice.js +1 -1
- package/dist-standalone/manifest.json +1 -1
- package/dist-standalone/runtime.js +1 -1
- package/dist-standalone/sprite.svg +1 -1
- package/package.json +6 -6
- package/dist-standalone/chunks/dist-CBO25w6A.js +0 -106
- package/dist-standalone/chunks/input-BIm8kbcS.js +0 -1
- package/dist-standalone/chunks/locale-BZOrJtMq.js +0 -1
- package/dist-standalone/chunks/pattern-input-view-Bsxej1-J.js +0 -4
- package/dist-standalone/chunks/rich-editor-view-ZEUTk2co.js +0 -54
- package/dist-standalone/chunks/runtime-CtQSqkek.js +0 -162
- package/dist-standalone/chunks/subscriptions-DoBY68cJ.js +0 -1
package/dist/lattice.css
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
@source "./**/*.js";
|
|
2
2
|
|
|
3
|
+
/*
|
|
4
|
+
* Unlayered so it beats Tailwind's utilities layer regardless of cascade
|
|
5
|
+
* order — a `hidden` node whose className still carries `flex`/`grid` (e.g.
|
|
6
|
+
* a collapsed Section keeping its content mounted) must stay hidden.
|
|
7
|
+
*/
|
|
8
|
+
[hidden] {
|
|
9
|
+
display: none !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
/*
|
|
4
13
|
* Token defaults live in a cascade layer so any unlayered override wins
|
|
5
14
|
* regardless of stylesheet order — the @latticeTheme style tag and plain
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionNodeType, ApiReferenceNodeType, BoardNodeType, CalendarNodeType, ChatNodeType, FormNodeType, FragmentNodeType, LayoutNodeType, MapNodeType, MediumNodeType, NodeType, NotificationNodeType, PdfNodeType, RemoteNodeType, SearchNodeType, SignatureExampleNodeType, TableNodeType, TreeNodeType, UiNodeType } from './types/generated.js';
|
|
2
|
-
type OptInNodeType = ApiReferenceNodeType | BoardNodeType | CalendarNodeType | ChatNodeType | MapNodeType | MediumNodeType | PdfNodeType | SearchNodeType | SignatureExampleNodeType | TreeNodeType;
|
|
1
|
+
import { ActionNodeType, ApiReferenceNodeType, BlockNodeType, BoardNodeType, CalendarNodeType, ChatNodeType, FormNodeType, FragmentNodeType, LayoutNodeType, MapNodeType, MediumNodeType, NodeType, NotificationNodeType, PdfNodeType, RemoteNodeType, SearchNodeType, SignatureExampleNodeType, TableNodeType, TreeNodeType, UiNodeType } from './types/generated.js';
|
|
2
|
+
type OptInNodeType = ApiReferenceNodeType | BlockNodeType | BoardNodeType | CalendarNodeType | ChatNodeType | MapNodeType | MediumNodeType | PdfNodeType | SearchNodeType | SignatureExampleNodeType | TreeNodeType;
|
|
3
3
|
type RegisteredNodeType = ActionNodeType | 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>;
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/core/registry\";\nimport { navigationPlugin } from \"./inertia-navigation\";\nimport type {\n ActionNodeType,\n ApiReferenceNodeType,\n BoardNodeType,\n CalendarNodeType,\n ChatNodeType,\n FormNodeType,\n FragmentNodeType,\n LayoutNodeType,\n MapNodeType,\n MediumNodeType,\n NodeType,\n NotificationNodeType,\n PdfNodeType,\n RemoteNodeType,\n SearchNodeType,\n SignatureExampleNodeType,\n TableNodeType,\n TreeNodeType,\n UiNodeType,\n} from \"@lattice-php/lattice/types/generated\";\nimport { actionComponents } from \"@lattice-php/action/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 =\n | ApiReferenceNodeType\n | BoardNodeType\n | CalendarNodeType\n | ChatNodeType\n | MapNodeType\n | MediumNodeType\n | PdfNodeType\n | SearchNodeType\n | SignatureExampleNodeType\n | TreeNodeType;\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 | 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 notificationsComponents,\n remoteComponents,\n navigationPlugin,\n);\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/core/registry\";\nimport { navigationPlugin } from \"./inertia-navigation\";\nimport type {\n ActionNodeType,\n ApiReferenceNodeType,\n BlockNodeType,\n BoardNodeType,\n CalendarNodeType,\n ChatNodeType,\n FormNodeType,\n FragmentNodeType,\n LayoutNodeType,\n MapNodeType,\n MediumNodeType,\n NodeType,\n NotificationNodeType,\n PdfNodeType,\n RemoteNodeType,\n SearchNodeType,\n SignatureExampleNodeType,\n TableNodeType,\n TreeNodeType,\n UiNodeType,\n} from \"@lattice-php/lattice/types/generated\";\nimport { actionComponents } from \"@lattice-php/action/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 =\n | ApiReferenceNodeType\n | BlockNodeType\n | BoardNodeType\n | CalendarNodeType\n | ChatNodeType\n | MapNodeType\n | MediumNodeType\n | PdfNodeType\n | SearchNodeType\n | SignatureExampleNodeType\n | TreeNodeType;\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 | 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 notificationsComponents,\n remoteComponents,\n navigationPlugin,\n);\n"],"mappings":";;;;;;;;;;;AAuEA,IAAa,WAAW,eACtB,cACA,oBACA,kBACA,gBACA,kBACA,iBACA,yBACA,kBACA,gBACF"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -7,14 +7,24 @@ export type { CallActionResult } from '@lattice-php/action';
|
|
|
7
7
|
export { ActionConfirmOverlay } from '@lattice-php/action/components/action-confirm-overlay';
|
|
8
8
|
export { ActionsDropdown } from '@lattice-php/action/components/actions-dropdown';
|
|
9
9
|
export { apiFetch, apiJson, setRefRefreshEndpoint, xsrfToken } from '@lattice-php/core/api';
|
|
10
|
-
export { useExtensionRegistry } from '@lattice-php/core/registry-context';
|
|
10
|
+
export { RegistryProvider, useExtensionRegistry } from '@lattice-php/core/registry-context';
|
|
11
11
|
export { RenderNode } from '@lattice-php/core/renderer';
|
|
12
12
|
export { coerceColor, colorValue, toneProps } from '@lattice-php/ui/lib/color';
|
|
13
13
|
export { nodeIdentity } from '@lattice-php/core/test-id';
|
|
14
14
|
export { requestSignedUpload, xhrTransfer } from '@lattice-php/core/upload';
|
|
15
15
|
export { SimpleField } from '@lattice-php/form/components/base/simple-field';
|
|
16
16
|
export { RICH_EDITOR_EXTENSION, ToolbarIconButton } from '@lattice-php/form/rich-editor';
|
|
17
|
+
export { assembleBlockCommands, assembleStarterKitOptions, assembleTiptapExtensions, assembleToolbar, resolveRichEditorExtensions, } from '@lattice-php/form/rich-editor/registry';
|
|
18
|
+
export { builtinRichEditorExtensions } from '@lattice-php/form/rich-editor/builtins';
|
|
19
|
+
export { BlockMenuController } from '@lattice-php/form/rich-editor/block-menu/block-menu-controller';
|
|
20
|
+
export { createSlashMenuExtension, SLASH_MENU_PLUGIN_KEY, } from '@lattice-php/form/rich-editor/block-menu/slash-extension';
|
|
21
|
+
export { filterBlockCommands } from '@lattice-php/form/rich-editor/block-menu/filter';
|
|
22
|
+
export { Heading } from '@lattice-php/ui/components/heading/heading';
|
|
23
|
+
export { Text } from '@lattice-php/ui/components/text/text';
|
|
24
|
+
export { Image } from '@lattice-php/ui/components/image/image';
|
|
25
|
+
export { Popover, PopoverClose, PopoverContent, PopoverTrigger, } from '@lattice-php/ui/components/popover/popover';
|
|
17
26
|
export * from '@lattice-php/form/toolkit';
|
|
27
|
+
export { collectFields, FieldCommitOverrideProvider, FormProvider, FormValuesProvider, PrefillProvider, ResolvedNodesProvider, } from '@lattice-php/form/embed';
|
|
18
28
|
export { useTable } from '@lattice-php/table/hooks/use-table';
|
|
19
29
|
export { useTableSelection } from '@lattice-php/table/hooks/use-table-selection';
|
|
20
30
|
export { getBulkActionNodes } from '@lattice-php/table/lib/bulk';
|
|
@@ -25,7 +35,7 @@ export { isActiveFilterValue } from '@lattice-php/table/lib/filter-values';
|
|
|
25
35
|
export { BOARD_OWNED_QUERY_KEYS, claimUrlSyncScope, writeQueryToUrl, } from '@lattice-php/table/lib/url-sync';
|
|
26
36
|
export { useAction } from '@lattice-php/action/hooks/use-action';
|
|
27
37
|
export { MODAL_MISSING_ERROR, useEmbeddedModal, useModal, } from '@lattice-php/ui/components/modal/modal-host';
|
|
28
|
-
export { Badge, Button, cn, CodeBlock, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogHeader, DialogTitle, formatDateValue, IconButton, InfoTooltip, NativeSelect, PreviewableImage, SegmentedControl, Spinner, useDebouncedCallback, useFormatContext, usePersistentState, } from '@lattice-php/ui';
|
|
38
|
+
export { Badge, Button, cn, CodeBlock, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, formatDateValue, IconButton, InfoTooltip, NativeSelect, PreviewableImage, SegmentedControl, Spinner, useDebouncedCallback, useFormatContext, usePersistentState, } from '@lattice-php/ui';
|
|
29
39
|
export { Checkbox, Combobox, Input, Label, Textarea } from '@lattice-php/form';
|
|
30
40
|
export * from '@lattice-php/ui/i18n';
|
|
31
|
-
export { announce, attachTreeItemInstruction, cancelDragStartFromInteractive, combine, draggable, dropTargetForElements, extractTreeItemInstruction, } from './dnd/index.js';
|
|
41
|
+
export { announce, attachClosestEdge, attachTreeItemInstruction, autoScrollForElements, cancelDragStartFromInteractive, combine, draggable, dropTargetForElements, extractClosestEdge, extractTreeItemInstruction, getReorderDestinationIndex, monitorForElements, preserveOffsetOnSource, setCustomNativeDragPreview, } from './dnd/index.js';
|
package/dist/runtime.js
CHANGED
|
@@ -11,15 +11,16 @@ import { createLatticeApp } from "./create-app.js";
|
|
|
11
11
|
import { Provider, useColumnRegistry, useComponentRegistry } from "./provider.js";
|
|
12
12
|
import { Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, Renderer, SpriteProvider, builtinEffectHandlers, columnCell, copyToClipboard, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, isActionEffect, lazyComponent, loadPluginModules, mergeEffectHandlers, useEffectDispatcher, withHeaders, withRefHeader } from "./index.js";
|
|
13
13
|
import { cancelDragStartFromInteractive } from "./dnd/cancel-drag-start.js";
|
|
14
|
-
import { announce, attachTreeItemInstruction, combine, draggable, dropTargetForElements, extractTreeItemInstruction } from "./dnd/index.js";
|
|
14
|
+
import { announce, attachClosestEdge, attachTreeItemInstruction, autoScrollForElements, combine, draggable, dropTargetForElements, extractClosestEdge, extractTreeItemInstruction, getReorderDestinationIndex, monitorForElements, preserveOffsetOnSource, setCustomNativeDragPreview } from "./dnd/index.js";
|
|
15
15
|
import { Checkbox, Combobox, Input, Label, Textarea } from "@lattice-php/form";
|
|
16
|
-
import { Badge, Button, CodeBlock, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogHeader, DialogTitle, IconButton, InfoTooltip, NativeSelect, PreviewableImage, SegmentedControl, Spinner, cn, formatDateValue, useDebouncedCallback, useFormatContext, usePersistentState } from "@lattice-php/ui";
|
|
16
|
+
import { Badge, Button, CodeBlock, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, IconButton, InfoTooltip, NativeSelect, PreviewableImage, SegmentedControl, Spinner, cn, formatDateValue, useDebouncedCallback, useFormatContext, usePersistentState } from "@lattice-php/ui";
|
|
17
17
|
import { router } from "@inertiajs/react";
|
|
18
18
|
import { apiFetch, apiJson, setRefRefreshEndpoint, xsrfToken } from "@lattice-php/core/api";
|
|
19
|
-
import { useExtensionRegistry } from "@lattice-php/core/registry-context";
|
|
19
|
+
import { RegistryProvider, useExtensionRegistry } from "@lattice-php/core/registry-context";
|
|
20
20
|
import { RenderNode } from "@lattice-php/core/renderer";
|
|
21
21
|
import { NavigationProvider, defaultNavigation, useNavigation } from "@lattice-php/ui/navigation";
|
|
22
22
|
import { MODAL_MISSING_ERROR, useEmbeddedModal, useModal } from "@lattice-php/ui/components/modal/modal-host";
|
|
23
|
+
import { Popover, PopoverClose, PopoverContent, PopoverTrigger } from "@lattice-php/ui/components/popover/popover";
|
|
23
24
|
import { callAction, runAction, useCallAction } from "@lattice-php/action";
|
|
24
25
|
import { ActionConfirmOverlay } from "@lattice-php/action/components/action-confirm-overlay";
|
|
25
26
|
import { ActionsDropdown } from "@lattice-php/action/components/actions-dropdown";
|
|
@@ -28,6 +29,15 @@ import { nodeIdentity } from "@lattice-php/core/test-id";
|
|
|
28
29
|
import { requestSignedUpload, xhrTransfer } from "@lattice-php/core/upload";
|
|
29
30
|
import { SimpleField } from "@lattice-php/form/components/base/simple-field";
|
|
30
31
|
import { RICH_EDITOR_EXTENSION, ToolbarIconButton } from "@lattice-php/form/rich-editor";
|
|
32
|
+
import { assembleBlockCommands, assembleStarterKitOptions, assembleTiptapExtensions, assembleToolbar, resolveRichEditorExtensions } from "@lattice-php/form/rich-editor/registry";
|
|
33
|
+
import { builtinRichEditorExtensions } from "@lattice-php/form/rich-editor/builtins";
|
|
34
|
+
import { BlockMenuController } from "@lattice-php/form/rich-editor/block-menu/block-menu-controller";
|
|
35
|
+
import { SLASH_MENU_PLUGIN_KEY, createSlashMenuExtension } from "@lattice-php/form/rich-editor/block-menu/slash-extension";
|
|
36
|
+
import { filterBlockCommands } from "@lattice-php/form/rich-editor/block-menu/filter";
|
|
37
|
+
import { Heading } from "@lattice-php/ui/components/heading/heading";
|
|
38
|
+
import { Text } from "@lattice-php/ui/components/text/text";
|
|
39
|
+
import { Image } from "@lattice-php/ui/components/image/image";
|
|
40
|
+
import { FieldCommitOverrideProvider, FormProvider, FormValuesProvider, PrefillProvider, ResolvedNodesProvider, collectFields } from "@lattice-php/form/embed";
|
|
31
41
|
import { useTable } from "@lattice-php/table/hooks/use-table";
|
|
32
42
|
import { useTableSelection } from "@lattice-php/table/hooks/use-table-selection";
|
|
33
43
|
import { getBulkActionNodes } from "@lattice-php/table/lib/bulk";
|
|
@@ -39,4 +49,4 @@ import { BOARD_OWNED_QUERY_KEYS, claimUrlSyncScope, writeQueryToUrl } from "@lat
|
|
|
39
49
|
import { useAction } from "@lattice-php/action/hooks/use-action";
|
|
40
50
|
export * from "@lattice-php/ui/i18n";
|
|
41
51
|
export * from "@lattice-php/form/toolkit";
|
|
42
|
-
export { ActionConfirmOverlay, ActionsDropdown, BOARD_OWNED_QUERY_KEYS, Badge, Button, Checkbox, CodeBlock, Combobox, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogHeader, DialogTitle, EventBridge, FilterBar, FilterMenu, Icon, IconButton, IconRenderer, IconRendererProvider, InfoTooltip, Input, LATTICE_EVENT, LATTICE_REF_HEADER, Label, MODAL_MISSING_ERROR, NativeSelect, NavigationProvider, OutletProvider, PreviewableImage, Provider, RICH_EDITOR_EXTENSION, RealtimeListeners, RenderNode, Renderer, SchemaLayout, SegmentedControl, SimpleField, Spinner, SpriteProvider, TableSearch, Textarea, ToolbarIconButton, announce, apiFetch, apiJson, appendTableFilters, attachTreeItemInstruction, builtinEffectHandlers, callAction, cancelDragStartFromInteractive, claimUrlSyncScope, cn, coerceColor, colorValue, columnCell, combine, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createRegistry, defaultNavigation, dispatchActionError, dispatchEffects, draggable, dropTargetForElements, eagerComponent, effectHandler, extendRegistry, extractTreeItemInstruction, fetchFilterOptions, formatDateValue, getActionEffects, getBulkActionNodes, getUrlQueryParams, inertiaNavigation, initializeAppearance, isActionEffect, isActiveFilterValue, layoutComponents, lazyComponent, loadPluginModules, mergeEffectHandlers, navigationPlugin, nodeIdentity, pageComponentName, registry, requestSignedUpload, router, runAction, setRefRefreshEndpoint, toneProps, updateAppearance, useAction, useAppearance, useCallAction, useColumnRegistry, useComponentRegistry, useDebouncedCallback, useEffectDispatcher, useEmbeddedModal, useExtensionRegistry, useFormatContext, useModal, useNavigation, useOutlet, usePersistentState, useTable, useTableSelection, withHeaders, withRefHeader, withVisitHeaders, writeQueryToUrl, xhrTransfer, xsrfToken };
|
|
52
|
+
export { ActionConfirmOverlay, ActionsDropdown, BOARD_OWNED_QUERY_KEYS, Badge, BlockMenuController, Button, Checkbox, CodeBlock, Combobox, ConfirmDialog, CopyButton, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, EventBridge, FieldCommitOverrideProvider, FilterBar, FilterMenu, FormProvider, FormValuesProvider, Heading, Icon, IconButton, IconRenderer, IconRendererProvider, Image, InfoTooltip, Input, LATTICE_EVENT, LATTICE_REF_HEADER, Label, MODAL_MISSING_ERROR, NativeSelect, NavigationProvider, OutletProvider, Popover, PopoverClose, PopoverContent, PopoverTrigger, PrefillProvider, PreviewableImage, Provider, RICH_EDITOR_EXTENSION, RealtimeListeners, RegistryProvider, RenderNode, Renderer, ResolvedNodesProvider, SLASH_MENU_PLUGIN_KEY, SchemaLayout, SegmentedControl, SimpleField, Spinner, SpriteProvider, TableSearch, Text, Textarea, ToolbarIconButton, announce, apiFetch, apiJson, appendTableFilters, assembleBlockCommands, assembleStarterKitOptions, assembleTiptapExtensions, assembleToolbar, attachClosestEdge, attachTreeItemInstruction, autoScrollForElements, builtinEffectHandlers, builtinRichEditorExtensions, callAction, cancelDragStartFromInteractive, claimUrlSyncScope, cn, coerceColor, collectFields, colorValue, columnCell, combine, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createRegistry, createSlashMenuExtension, defaultNavigation, dispatchActionError, dispatchEffects, draggable, dropTargetForElements, eagerComponent, effectHandler, extendRegistry, extractClosestEdge, extractTreeItemInstruction, fetchFilterOptions, filterBlockCommands, formatDateValue, getActionEffects, getBulkActionNodes, getReorderDestinationIndex, getUrlQueryParams, inertiaNavigation, initializeAppearance, isActionEffect, isActiveFilterValue, layoutComponents, lazyComponent, loadPluginModules, mergeEffectHandlers, monitorForElements, navigationPlugin, nodeIdentity, pageComponentName, preserveOffsetOnSource, registry, requestSignedUpload, resolveRichEditorExtensions, router, runAction, setCustomNativeDragPreview, setRefRefreshEndpoint, toneProps, updateAppearance, useAction, useAppearance, useCallAction, useColumnRegistry, useComponentRegistry, useDebouncedCallback, useEffectDispatcher, useEmbeddedModal, useExtensionRegistry, useFormatContext, useModal, useNavigation, useOutlet, usePersistentState, useTable, useTableSelection, withHeaders, withRefHeader, withVisitHeaders, writeQueryToUrl, xhrTransfer, xsrfToken };
|
|
@@ -3,6 +3,7 @@ import { Size, Translatable, Variant } from '@lattice-php/ui';
|
|
|
3
3
|
import { Effect } from '@lattice-php/ui/effects/types';
|
|
4
4
|
export type ActionNodeType = "action" | "action.bulk" | "action.group";
|
|
5
5
|
export type ApiReferenceNodeType = "api-reference";
|
|
6
|
+
export type BlockNodeType = "blocks.editor" | "blocks.frame" | "blocks.rich-text" | "blocks.slot" | "blocks.unknown" | "blocks.view";
|
|
6
7
|
export type BoardNodeType = "board";
|
|
7
8
|
export type CalendarNodeType = "calendar";
|
|
8
9
|
export type ChannelVisibility = "public" | "private" | "presence";
|
|
@@ -19,7 +20,7 @@ export type DataList = {
|
|
|
19
20
|
emptyLabel: string | null;
|
|
20
21
|
remote: RemoteAccess | null;
|
|
21
22
|
};
|
|
22
|
-
export type FilterNodeType = "filter.date-range" | "filter.media-type" | "filter.select" | "filter.ternary" | "filter.toggle";
|
|
23
|
+
export type FilterNodeType = "filter.date-range" | "filter.media-folder" | "filter.media-type" | "filter.select" | "filter.ternary" | "filter.toggle";
|
|
23
24
|
export type FormFieldNodeType = "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" | "field.tree" | "wizard" | "wizard-step";
|
|
24
25
|
export type FormNodeType = "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" | "field.tree" | "form" | "wizard" | "wizard-step";
|
|
25
26
|
export type Fragment = {
|
|
@@ -41,7 +42,7 @@ export type Listen = {
|
|
|
41
42
|
};
|
|
42
43
|
export type MapNodeType = "map";
|
|
43
44
|
export type MediumNodeType = "media.library";
|
|
44
|
-
export type NodeType = "accordion" | "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "board" | "breadcrumbs" | "button" | "calendar" | "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" | "field.tree" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "map" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "pdf" | "popover" | "progress" | "raw-block" | "remote.data-list" | "search.box" | "search.categories" | "search.input" | "search.preview" | "search.recent" | "search.results" | "section" | "segmented-control" | "separator" | "sidebar" | "sidebar.footer" | "signature" | "stack" | "tab" | "table" | "tabs" | "text" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
|
|
45
|
+
export type NodeType = "accordion" | "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "blocks.editor" | "blocks.frame" | "blocks.rich-text" | "blocks.slot" | "blocks.unknown" | "blocks.view" | "board" | "breadcrumbs" | "button" | "calendar" | "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" | "field.tree" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "map" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "pdf" | "popover" | "progress" | "raw-block" | "remote.data-list" | "search.box" | "search.categories" | "search.input" | "search.preview" | "search.recent" | "search.results" | "section" | "segmented-control" | "separator" | "sidebar" | "sidebar.footer" | "signature" | "stack" | "tab" | "table" | "tabs" | "text" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
|
|
45
46
|
export type NotificationItem = {
|
|
46
47
|
readonly actions: Node[];
|
|
47
48
|
readonly body: Translatable | string | null;
|
package/dist/vite.d.ts
CHANGED
|
@@ -79,8 +79,27 @@ export declare function discoverComponentPackages(appRoot: string): LatticeCompo
|
|
|
79
79
|
* module whose default export is the array of their plugin objects,
|
|
80
80
|
* ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem
|
|
81
81
|
* access to each package dir so its source compiles from `vendor/` (or a symlink).
|
|
82
|
+
*
|
|
83
|
+
* Also wires the stylesheet counterpart: `@lattice-php/lattice/css` and
|
|
84
|
+
* `@lattice-php/ui/css` normally resolve straight to the published, static
|
|
85
|
+
* `lattice.css` — which must stay self-contained, since plenty of consumers
|
|
86
|
+
* (the docs site, the standalone bundle, a package building itself) import it
|
|
87
|
+
* without this plugin at all. When `uiCssPath` is given (the app actually
|
|
88
|
+
* uses this plugin), both specifiers are instead aliased to a generated
|
|
89
|
+
* wrapper — `@import` of the real stylesheet plus every discovered package's
|
|
90
|
+
* `@source`/`@import` — so a consumer's existing single import picks up every
|
|
91
|
+
* package with no per-package import of their own. `virtual:lattice/css`
|
|
92
|
+
* exposes just the package-only half the same way, for anyone composing their
|
|
93
|
+
* own wrapper. Tailwind's `@import` resolver reads the resolved file straight
|
|
94
|
+
* off disk — it never calls back into a Vite plugin's `load` — so neither can
|
|
95
|
+
* serve generated content directly; both are aliased to real files instead,
|
|
96
|
+
* generated into `node_modules/.lattice/` in `buildStart`, and Vite's own
|
|
97
|
+
* resolver (which Tailwind delegates to for `@import`) follows the alias to
|
|
98
|
+
* them like any other file.
|
|
82
99
|
*/
|
|
83
|
-
export declare function componentPackagesPlugin(packages: LatticeComponentPackage[]
|
|
100
|
+
export declare function componentPackagesPlugin(packages: LatticeComponentPackage[], appRoot?: string, uiCssPath?: string, options?: {
|
|
101
|
+
requireComposer?: boolean;
|
|
102
|
+
}): Plugin;
|
|
84
103
|
export declare function latticeConfig(options?: LatticeViteOptions): ConfigWithTest;
|
|
85
104
|
export declare function resolveIconOptions(options: LatticeViteOptions, packages?: LatticeComponentPackage[]): SvgSpriteOptions | null;
|
|
86
105
|
/**
|
package/dist/vite.js
CHANGED
|
@@ -1,22 +1,66 @@
|
|
|
1
1
|
import { refreshTypeScriptTypes } from "./vite-typescript-refresh.js";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { buildSprite, svgSprite } from "@lattice-php/vite-svg-sprite";
|
|
5
5
|
import { searchForWorkspaceRoot } from "vite";
|
|
6
6
|
//#region resources/js/vite.ts
|
|
7
7
|
function lattice(options = {}) {
|
|
8
|
-
const { appRoot } = resolveRoots(options);
|
|
8
|
+
const { appRoot, root } = resolveRoots(options);
|
|
9
9
|
const packages = discoverComponentPackages(appRoot);
|
|
10
10
|
const plugins = [
|
|
11
11
|
corePlugin(options),
|
|
12
12
|
optionalPeersPlugin(),
|
|
13
|
-
componentPackagesPlugin(packages),
|
|
13
|
+
componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), { requireComposer: true }),
|
|
14
14
|
typescriptPlugin(options)
|
|
15
15
|
];
|
|
16
16
|
const iconOptions = resolveIconOptions(options, packages);
|
|
17
17
|
if (iconOptions) plugins.push(svgSprite(iconOptions));
|
|
18
18
|
return plugins;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the real, on-disk `@lattice-php/ui/css` file that
|
|
22
|
+
* `componentPackagesPlugin` should wrap — source-link mode reads straight
|
|
23
|
+
* from the sibling `ui` package the same way `latticeConfig`'s own alias
|
|
24
|
+
* does; package-link mode reads the installed `@lattice-php/ui` package's
|
|
25
|
+
* own `exports["./css"]` and joins it against that package's directory,
|
|
26
|
+
* exactly what a plain `import "@lattice-php/ui/css"` would resolve to.
|
|
27
|
+
* This is computed, not resolved through Node's module resolution: the
|
|
28
|
+
* wrapper `@import`s this path but isn't read until Tailwind processes the
|
|
29
|
+
* build, so the target only has to be correct here, not already built —
|
|
30
|
+
* `require.resolve` would demand the (often not-yet-built) dist file exist
|
|
31
|
+
* at config time and throw otherwise. Returns `undefined` (skipping the
|
|
32
|
+
* wrapper) only when `@lattice-php/ui` itself isn't installed — an app that
|
|
33
|
+
* hasn't run `npm install` yet degrades the same way `discoverComponentPackages`
|
|
34
|
+
* used to for a missing `vendor/`.
|
|
35
|
+
*/
|
|
36
|
+
function resolveUiCssPath(options, appRoot, root) {
|
|
37
|
+
if (options.source) return path.resolve(root, "../ui/resources/css/lattice.css");
|
|
38
|
+
const packageDir = resolveInstalledPackageDir(appRoot, "@lattice-php/ui");
|
|
39
|
+
if (!packageDir) return;
|
|
40
|
+
try {
|
|
41
|
+
const cssExport = JSON.parse(readFileSync(path.join(packageDir, "package.json"), "utf8")).exports?.["./css"];
|
|
42
|
+
const cssRelative = typeof cssExport === "string" ? cssExport : cssExport?.default;
|
|
43
|
+
return typeof cssRelative === "string" ? path.resolve(packageDir, cssRelative) : void 0;
|
|
44
|
+
} catch {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Locate an installed npm package's directory by walking up from `startDir`
|
|
50
|
+
* through each ancestor's `node_modules/<name>`, the same walk Node's own
|
|
51
|
+
* module resolution does — stopping at the first one whose `package.json`
|
|
52
|
+
* actually exists, without requiring anything the package exports to exist.
|
|
53
|
+
*/
|
|
54
|
+
function resolveInstalledPackageDir(startDir, name) {
|
|
55
|
+
let dir = startDir;
|
|
56
|
+
for (;;) {
|
|
57
|
+
const candidate = path.join(dir, "node_modules", name);
|
|
58
|
+
if (existsSync(path.join(candidate, "package.json"))) return candidate;
|
|
59
|
+
const parent = path.dirname(dir);
|
|
60
|
+
if (parent === dir) return;
|
|
61
|
+
dir = parent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
20
64
|
function resolveManifestPaths(manifest, dir) {
|
|
21
65
|
return {
|
|
22
66
|
...typeof manifest.css === "string" ? { css: path.resolve(dir, manifest.css) } : {},
|
|
@@ -65,9 +109,10 @@ function collectRootComponentPackage(composerJson, appRoot) {
|
|
|
65
109
|
*/
|
|
66
110
|
function discoverComponentPackages(appRoot) {
|
|
67
111
|
const composerDir = path.resolve(appRoot, "vendor/composer");
|
|
112
|
+
const installedJsonPath = path.join(composerDir, "installed.json");
|
|
68
113
|
let installed = [];
|
|
69
114
|
try {
|
|
70
|
-
const raw = readFileSync(
|
|
115
|
+
const raw = readFileSync(installedJsonPath, "utf8");
|
|
71
116
|
installed = collectComponentPackages(JSON.parse(raw), composerDir);
|
|
72
117
|
} catch {
|
|
73
118
|
installed = [];
|
|
@@ -83,28 +128,96 @@ function discoverComponentPackages(appRoot) {
|
|
|
83
128
|
}
|
|
84
129
|
var VIRTUAL_PLUGINS_ID = "virtual:lattice/plugins";
|
|
85
130
|
var RESOLVED_VIRTUAL_PLUGINS_ID = `\0${VIRTUAL_PLUGINS_ID}`;
|
|
131
|
+
var VIRTUAL_CSS_ID = "virtual:lattice/css";
|
|
132
|
+
var RESOLVED_VIRTUAL_CSS_ID = `\0${VIRTUAL_CSS_ID}`;
|
|
133
|
+
var GENERATED_CSS_RELATIVE_PATH = "node_modules/.lattice/component-packages.css";
|
|
134
|
+
var GENERATED_WRAPPER_CSS_RELATIVE_PATH = "node_modules/.lattice/lattice.css";
|
|
135
|
+
/**
|
|
136
|
+
* An `@import` of every discovered package's own stylesheet, followed by a
|
|
137
|
+
* Tailwind `@source` per package so its component TSX is scanned for
|
|
138
|
+
* utility classes. `@import` must precede every other rule in a stylesheet —
|
|
139
|
+
* interleaving `@source`/`@import` per package instead silently drops every
|
|
140
|
+
* import that comes after the first `@source`.
|
|
141
|
+
*/
|
|
142
|
+
function componentPackagesCss(packages) {
|
|
143
|
+
const imports = packages.flatMap((pkg) => pkg.css ? [`@import ${JSON.stringify(pkg.css)};`] : []);
|
|
144
|
+
const sources = packages.map((pkg) => `@source ${JSON.stringify(path.dirname(pkg.plugin))};`);
|
|
145
|
+
return [...imports, ...sources].join("\n");
|
|
146
|
+
}
|
|
86
147
|
/**
|
|
87
148
|
* Exposes the discovered component packages as `virtual:lattice/plugins` — a
|
|
88
149
|
* module whose default export is the array of their plugin objects,
|
|
89
150
|
* ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem
|
|
90
151
|
* access to each package dir so its source compiles from `vendor/` (or a symlink).
|
|
152
|
+
*
|
|
153
|
+
* Also wires the stylesheet counterpart: `@lattice-php/lattice/css` and
|
|
154
|
+
* `@lattice-php/ui/css` normally resolve straight to the published, static
|
|
155
|
+
* `lattice.css` — which must stay self-contained, since plenty of consumers
|
|
156
|
+
* (the docs site, the standalone bundle, a package building itself) import it
|
|
157
|
+
* without this plugin at all. When `uiCssPath` is given (the app actually
|
|
158
|
+
* uses this plugin), both specifiers are instead aliased to a generated
|
|
159
|
+
* wrapper — `@import` of the real stylesheet plus every discovered package's
|
|
160
|
+
* `@source`/`@import` — so a consumer's existing single import picks up every
|
|
161
|
+
* package with no per-package import of their own. `virtual:lattice/css`
|
|
162
|
+
* exposes just the package-only half the same way, for anyone composing their
|
|
163
|
+
* own wrapper. Tailwind's `@import` resolver reads the resolved file straight
|
|
164
|
+
* off disk — it never calls back into a Vite plugin's `load` — so neither can
|
|
165
|
+
* serve generated content directly; both are aliased to real files instead,
|
|
166
|
+
* generated into `node_modules/.lattice/` in `buildStart`, and Vite's own
|
|
167
|
+
* resolver (which Tailwind delegates to for `@import`) follows the alias to
|
|
168
|
+
* them like any other file.
|
|
91
169
|
*/
|
|
92
|
-
function componentPackagesPlugin(packages) {
|
|
170
|
+
function componentPackagesPlugin(packages, appRoot, uiCssPath, options = {}) {
|
|
171
|
+
const installedJsonPath = appRoot ? path.resolve(appRoot, "vendor/composer/installed.json") : void 0;
|
|
172
|
+
let generatedCssPath = "";
|
|
173
|
+
let generatedWrapperCssPath = "";
|
|
93
174
|
return {
|
|
94
175
|
name: "lattice:component-packages",
|
|
95
176
|
config(config) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const alias = Object.fromEntries(packages.flatMap((pkg) => pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : []));
|
|
177
|
+
const workspaceRoot = searchForWorkspaceRoot(config?.root ?? process.cwd());
|
|
178
|
+
generatedCssPath = path.resolve(workspaceRoot, GENERATED_CSS_RELATIVE_PATH);
|
|
99
179
|
return {
|
|
100
|
-
|
|
180
|
+
resolve: { alias: {
|
|
181
|
+
[VIRTUAL_CSS_ID]: generatedCssPath,
|
|
182
|
+
...uiCssPath ? (() => {
|
|
183
|
+
generatedWrapperCssPath = path.resolve(workspaceRoot, GENERATED_WRAPPER_CSS_RELATIVE_PATH);
|
|
184
|
+
return {
|
|
185
|
+
"@lattice-php/lattice/css": generatedWrapperCssPath,
|
|
186
|
+
"@lattice-php/ui/css": generatedWrapperCssPath
|
|
187
|
+
};
|
|
188
|
+
})() : {},
|
|
189
|
+
...Object.fromEntries(packages.flatMap((pkg) => pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : []))
|
|
190
|
+
} },
|
|
101
191
|
server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } }
|
|
102
192
|
};
|
|
103
193
|
},
|
|
194
|
+
buildStart() {
|
|
195
|
+
if (generatedCssPath) {
|
|
196
|
+
mkdirSync(path.dirname(generatedCssPath), { recursive: true });
|
|
197
|
+
writeFileSync(generatedCssPath, componentPackagesCss(packages));
|
|
198
|
+
}
|
|
199
|
+
if (generatedWrapperCssPath && uiCssPath) {
|
|
200
|
+
mkdirSync(path.dirname(generatedWrapperCssPath), { recursive: true });
|
|
201
|
+
writeFileSync(generatedWrapperCssPath, [`@import ${JSON.stringify(uiCssPath)};`, componentPackagesCss(packages)].join("\n"));
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
configResolved(config) {
|
|
205
|
+
if (options.requireComposer && installedJsonPath && config.command === "build" && !existsSync(installedJsonPath)) throw new Error(`Lattice couldn't find ${installedJsonPath}. Run \`composer install\` before building.`);
|
|
206
|
+
},
|
|
207
|
+
configureServer(server) {
|
|
208
|
+
if (!installedJsonPath) return;
|
|
209
|
+
server.watcher.add(installedJsonPath);
|
|
210
|
+
server.watcher.on("change", (file) => {
|
|
211
|
+
if (file === installedJsonPath) server.restart();
|
|
212
|
+
});
|
|
213
|
+
},
|
|
104
214
|
resolveId(id) {
|
|
105
|
-
|
|
215
|
+
if (id === VIRTUAL_PLUGINS_ID) return RESOLVED_VIRTUAL_PLUGINS_ID;
|
|
216
|
+
if (id === VIRTUAL_CSS_ID) return RESOLVED_VIRTUAL_CSS_ID;
|
|
217
|
+
return null;
|
|
106
218
|
},
|
|
107
219
|
load(id) {
|
|
220
|
+
if (id === RESOLVED_VIRTUAL_CSS_ID) return componentPackagesCss(packages);
|
|
108
221
|
if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) return null;
|
|
109
222
|
return `${packages.map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`).join("\n")}\nexport default [${packages.map((_, index) => `p${index}`).join(", ")}];\n`;
|
|
110
223
|
}
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { buildSprite, svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, Sprite, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh.ts\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot } = resolveRoots(options);\n const packages = discoverComponentPackages(appRoot);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(packages),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options, packages);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry. */\n plugin: string;\n /** Absolute path to the package's stylesheet, when it declares one. */\n css?: string;\n /** Absolute path to the package's icon directory, when it declares one. */\n icons?: string;\n};\n\ntype LatticeManifest = { plugin?: string; css?: string; icons?: string };\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\nfunction resolveManifestPaths(\n manifest: LatticeManifest,\n dir: string,\n): Pick<LatticeComponentPackage, \"css\" | \"icons\"> {\n return {\n ...(typeof manifest.css === \"string\" ? { css: path.resolve(dir, manifest.css) } : {}),\n ...(typeof manifest.icons === \"string\" ? { icons: path.resolve(dir, manifest.icons) } : {}),\n };\n}\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const manifest = pkg.extra?.lattice ?? {};\n const entry = manifest.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [\n {\n name: pkg.name,\n dir,\n plugin: path.resolve(dir, entry),\n ...resolveManifestPaths(manifest, dir),\n },\n ];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const manifest = composerJson.extra?.lattice ?? {};\n\n if (typeof manifest.plugin !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [\n {\n name: composerJson.name,\n dir: appRoot,\n plugin: path.resolve(appRoot, manifest.plugin),\n ...resolveManifestPaths(manifest, appRoot),\n },\n ];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(composerDir, \"installed.json\"), \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their plugin objects,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n */\nexport function componentPackagesPlugin(packages: LatticeComponentPackage[]): Plugin {\n return {\n name: \"lattice:component-packages\",\n config(config) {\n if (packages.length === 0) {\n return {};\n }\n\n const workspaceRoot = searchForWorkspaceRoot(config.root ?? process.cwd());\n // Vite's mergeAlias puts plugin-config aliases in front of the user config's,\n // so this specific `/css` alias wins over a user's broader package-dir alias.\n const alias = Object.fromEntries(\n packages.flatMap((pkg) => (pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : [])),\n );\n\n return {\n ...(Object.keys(alias).length > 0 ? { resolve: { alias } } : {}),\n server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } },\n };\n },\n resolveId(id) {\n return id === VIRTUAL_PLUGINS_ID ? RESOLVED_VIRTUAL_PLUGINS_ID : null;\n },\n load(id) {\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n // A react alias would break SSR: Vite only externalizes bare specifiers,\n // so an absolute path inlines react's CJS into the SSR module runner.\n // `dedupe` alone keeps the app on a single React copy, symlinks included.\n ...(options.source\n ? {\n alias: {\n \"@lattice-php/lattice/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n \"@lattice-php/action\": path.resolve(root, \"../action/resources/js\"),\n \"@lattice-php/core\": path.resolve(root, \"../core/resources/js\"),\n \"@lattice-php/form\": path.resolve(root, \"../form/resources/js\"),\n \"@lattice-php/table\": path.resolve(root, \"../table/resources/js\"),\n \"@lattice-php/ui/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/ui\": path.resolve(root, \"../ui/resources/js\"),\n },\n }\n : {}),\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n \"@lattice-php/action\",\n \"@lattice-php/core\",\n \"@lattice-php/form\",\n \"@lattice-php/table\",\n \"@lattice-php/ui\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(\n options: LatticeViteOptions,\n packages: LatticeComponentPackage[] = [],\n): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/ui\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [\n path.resolve(root, \"../ui/resources/icons\"),\n ...packages.flatMap((pkg) => (pkg.icons ? [pkg.icons] : [])),\n ...dirs,\n ],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\n/**\n * Builds the same icon sprite the `lattice()` Vite plugin serves, outside of\n * Vite: ui's icon set, every discovered component package's icons, and the\n * app's own `icons.dirs`. The result is a `SpriteValue` for `SpriteProvider`\n * (`href: \"\"` inlines the markup), which is what a Storybook, a design-system\n * export, a prerender script, or a test needs to render `Icon` without a\n * dev server or an emitted asset.\n */\nexport function buildLatticeSprite(options: LatticeViteOptions = {}): Sprite & { href: \"\" } {\n const { appRoot } = resolveRoots(options);\n const iconOptions = resolveIconOptions(options, discoverComponentPackages(appRoot));\n\n if (!iconOptions) {\n return { href: \"\", ids: [], source: \"\" };\n }\n\n const { iconDirs = [], symbolId, svgoConfig } = iconOptions;\n\n return { href: \"\", ...buildSprite(iconDirs, { symbolId, svgoConfig }) };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.root ?? path.resolve(appRoot, \"vendor/lattice-php/lattice\");\n\n return { appRoot, root };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,QAAQ,UAA8B,C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F,MAAM,EAAE,YAAY,aAAa,OAAO;CACxC,MAAM,cAAc,mBAAmB,SAAS,0BAA0B,OAAO,CAAC;CAElF,IAAI,CAAC,aACH,OAAO;EAAE,MAAM;EAAI,KAAK,CAAC;EAAG,QAAQ;CAAG;CAGzC,MAAM,EAAE,WAAW,CAAC,GAAG,UAAU,eAAe;CAEhD,OAAO;EAAE,MAAM;EAAI,GAAG,YAAY,UAAU;GAAE;GAAU;EAAW,CAAC;CAAE;AACxE;AAEA,SAAS,aAAa,SAAoC;CACxD,MAAM,UAAU,QAAQ,WAAW,QAAQ,IAAI;CAG/C,OAAO;EAAE;EAAS,MAFL,QAAQ,QAAQ,KAAK,QAAQ,SAAS,4BAA4B;CAExD;AACzB"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { buildSprite, svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, Sprite, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh.ts\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot, root } = resolveRoots(options);\n const packages = discoverComponentPackages(appRoot);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), {\n requireComposer: true,\n }),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options, packages);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/**\n * Resolve the real, on-disk `@lattice-php/ui/css` file that\n * `componentPackagesPlugin` should wrap — source-link mode reads straight\n * from the sibling `ui` package the same way `latticeConfig`'s own alias\n * does; package-link mode reads the installed `@lattice-php/ui` package's\n * own `exports[\"./css\"]` and joins it against that package's directory,\n * exactly what a plain `import \"@lattice-php/ui/css\"` would resolve to.\n * This is computed, not resolved through Node's module resolution: the\n * wrapper `@import`s this path but isn't read until Tailwind processes the\n * build, so the target only has to be correct here, not already built —\n * `require.resolve` would demand the (often not-yet-built) dist file exist\n * at config time and throw otherwise. Returns `undefined` (skipping the\n * wrapper) only when `@lattice-php/ui` itself isn't installed — an app that\n * hasn't run `npm install` yet degrades the same way `discoverComponentPackages`\n * used to for a missing `vendor/`.\n */\nfunction resolveUiCssPath(\n options: LatticeViteOptions,\n appRoot: string,\n root: string,\n): string | undefined {\n if (options.source) {\n return path.resolve(root, \"../ui/resources/css/lattice.css\");\n }\n\n const packageDir = resolveInstalledPackageDir(appRoot, \"@lattice-php/ui\");\n\n if (!packageDir) {\n return undefined;\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(path.join(packageDir, \"package.json\"), \"utf8\"));\n const cssExport = packageJson.exports?.[\"./css\"];\n const cssRelative = typeof cssExport === \"string\" ? cssExport : cssExport?.default;\n\n return typeof cssRelative === \"string\" ? path.resolve(packageDir, cssRelative) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Locate an installed npm package's directory by walking up from `startDir`\n * through each ancestor's `node_modules/<name>`, the same walk Node's own\n * module resolution does — stopping at the first one whose `package.json`\n * actually exists, without requiring anything the package exports to exist.\n */\nfunction resolveInstalledPackageDir(startDir: string, name: string): string | undefined {\n let dir = startDir;\n\n for (;;) {\n const candidate = path.join(dir, \"node_modules\", name);\n\n if (existsSync(path.join(candidate, \"package.json\"))) {\n return candidate;\n }\n\n const parent = path.dirname(dir);\n\n if (parent === dir) {\n return undefined;\n }\n\n dir = parent;\n }\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry. */\n plugin: string;\n /** Absolute path to the package's stylesheet, when it declares one. */\n css?: string;\n /** Absolute path to the package's icon directory, when it declares one. */\n icons?: string;\n};\n\ntype LatticeManifest = { plugin?: string; css?: string; icons?: string };\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\nfunction resolveManifestPaths(\n manifest: LatticeManifest,\n dir: string,\n): Pick<LatticeComponentPackage, \"css\" | \"icons\"> {\n return {\n ...(typeof manifest.css === \"string\" ? { css: path.resolve(dir, manifest.css) } : {}),\n ...(typeof manifest.icons === \"string\" ? { icons: path.resolve(dir, manifest.icons) } : {}),\n };\n}\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const manifest = pkg.extra?.lattice ?? {};\n const entry = manifest.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [\n {\n name: pkg.name,\n dir,\n plugin: path.resolve(dir, entry),\n ...resolveManifestPaths(manifest, dir),\n },\n ];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const manifest = composerJson.extra?.lattice ?? {};\n\n if (typeof manifest.plugin !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [\n {\n name: composerJson.name,\n dir: appRoot,\n plugin: path.resolve(appRoot, manifest.plugin),\n ...resolveManifestPaths(manifest, appRoot),\n },\n ];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n const installedJsonPath = path.join(composerDir, \"installed.json\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(installedJsonPath, \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\nconst VIRTUAL_CSS_ID = \"virtual:lattice/css\";\nconst RESOLVED_VIRTUAL_CSS_ID = `\\0${VIRTUAL_CSS_ID}`;\nconst GENERATED_CSS_RELATIVE_PATH = \"node_modules/.lattice/component-packages.css\";\nconst GENERATED_WRAPPER_CSS_RELATIVE_PATH = \"node_modules/.lattice/lattice.css\";\n\n/**\n * An `@import` of every discovered package's own stylesheet, followed by a\n * Tailwind `@source` per package so its component TSX is scanned for\n * utility classes. `@import` must precede every other rule in a stylesheet —\n * interleaving `@source`/`@import` per package instead silently drops every\n * import that comes after the first `@source`.\n */\nfunction componentPackagesCss(packages: LatticeComponentPackage[]): string {\n const imports = packages.flatMap((pkg) =>\n pkg.css ? [`@import ${JSON.stringify(pkg.css)};`] : [],\n );\n const sources = packages.map((pkg) => `@source ${JSON.stringify(path.dirname(pkg.plugin))};`);\n\n return [...imports, ...sources].join(\"\\n\");\n}\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their plugin objects,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n *\n * Also wires the stylesheet counterpart: `@lattice-php/lattice/css` and\n * `@lattice-php/ui/css` normally resolve straight to the published, static\n * `lattice.css` — which must stay self-contained, since plenty of consumers\n * (the docs site, the standalone bundle, a package building itself) import it\n * without this plugin at all. When `uiCssPath` is given (the app actually\n * uses this plugin), both specifiers are instead aliased to a generated\n * wrapper — `@import` of the real stylesheet plus every discovered package's\n * `@source`/`@import` — so a consumer's existing single import picks up every\n * package with no per-package import of their own. `virtual:lattice/css`\n * exposes just the package-only half the same way, for anyone composing their\n * own wrapper. Tailwind's `@import` resolver reads the resolved file straight\n * off disk — it never calls back into a Vite plugin's `load` — so neither can\n * serve generated content directly; both are aliased to real files instead,\n * generated into `node_modules/.lattice/` in `buildStart`, and Vite's own\n * resolver (which Tailwind delegates to for `@import`) follows the alias to\n * them like any other file.\n */\nexport function componentPackagesPlugin(\n packages: LatticeComponentPackage[],\n appRoot?: string,\n uiCssPath?: string,\n options: { requireComposer?: boolean } = {},\n): Plugin {\n const installedJsonPath = appRoot\n ? path.resolve(appRoot, \"vendor/composer/installed.json\")\n : undefined;\n let generatedCssPath = \"\";\n let generatedWrapperCssPath = \"\";\n\n return {\n name: \"lattice:component-packages\",\n config(config) {\n const workspaceRoot = searchForWorkspaceRoot(config?.root ?? process.cwd());\n\n generatedCssPath = path.resolve(workspaceRoot, GENERATED_CSS_RELATIVE_PATH);\n\n // Vite's mergeAlias puts plugin-config aliases in front of the user config's,\n // so this specific `/css` alias wins over a user's broader package-dir alias.\n // Among plugins, a later plugin's alias wins on a key collision — this\n // plugin runs after `corePlugin` in `lattice()`, so it wins over\n // `latticeConfig`'s source-mode `@lattice-php/*/css` aliases too.\n const alias: Record<string, string> = {\n [VIRTUAL_CSS_ID]: generatedCssPath,\n ...(uiCssPath\n ? (() => {\n generatedWrapperCssPath = path.resolve(\n workspaceRoot,\n GENERATED_WRAPPER_CSS_RELATIVE_PATH,\n );\n\n return {\n \"@lattice-php/lattice/css\": generatedWrapperCssPath,\n \"@lattice-php/ui/css\": generatedWrapperCssPath,\n };\n })()\n : {}),\n ...Object.fromEntries(\n packages.flatMap((pkg) => (pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : [])),\n ),\n };\n\n return {\n resolve: { alias },\n server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } },\n };\n },\n buildStart() {\n if (generatedCssPath) {\n mkdirSync(path.dirname(generatedCssPath), { recursive: true });\n writeFileSync(generatedCssPath, componentPackagesCss(packages));\n }\n\n if (generatedWrapperCssPath && uiCssPath) {\n mkdirSync(path.dirname(generatedWrapperCssPath), { recursive: true });\n writeFileSync(\n generatedWrapperCssPath,\n [`@import ${JSON.stringify(uiCssPath)};`, componentPackagesCss(packages)].join(\"\\n\"),\n );\n }\n },\n configResolved(config) {\n // A consumer building for production without its Composer dependencies\n // would otherwise silently ship no component package at all. Only the\n // build command is gated: this package's own tests spin up dev/SSR\n // servers through `lattice()` with no vendor/ on purpose.\n if (\n options.requireComposer &&\n installedJsonPath &&\n config.command === \"build\" &&\n !existsSync(installedJsonPath)\n ) {\n throw new Error(\n `Lattice couldn't find ${installedJsonPath}. Run \\`composer install\\` before building.`,\n );\n }\n },\n configureServer(server) {\n if (!installedJsonPath) {\n return;\n }\n\n // A composer change can add or remove a component package, which this\n // plugin only discovers at startup — restart so it re-runs discovery\n // instead of silently continuing to serve the stale set.\n server.watcher.add(installedJsonPath);\n server.watcher.on(\"change\", (file) => {\n if (file === installedJsonPath) {\n server.restart();\n }\n });\n },\n resolveId(id) {\n if (id === VIRTUAL_PLUGINS_ID) {\n return RESOLVED_VIRTUAL_PLUGINS_ID;\n }\n\n if (id === VIRTUAL_CSS_ID) {\n return RESOLVED_VIRTUAL_CSS_ID;\n }\n\n return null;\n },\n load(id) {\n if (id === RESOLVED_VIRTUAL_CSS_ID) {\n return componentPackagesCss(packages);\n }\n\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n // A react alias would break SSR: Vite only externalizes bare specifiers,\n // so an absolute path inlines react's CJS into the SSR module runner.\n // `dedupe` alone keeps the app on a single React copy, symlinks included.\n ...(options.source\n ? {\n alias: {\n \"@lattice-php/lattice/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n \"@lattice-php/action\": path.resolve(root, \"../action/resources/js\"),\n \"@lattice-php/core\": path.resolve(root, \"../core/resources/js\"),\n \"@lattice-php/form\": path.resolve(root, \"../form/resources/js\"),\n \"@lattice-php/table\": path.resolve(root, \"../table/resources/js\"),\n \"@lattice-php/ui/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/ui\": path.resolve(root, \"../ui/resources/js\"),\n },\n }\n : {}),\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n \"@lattice-php/action\",\n \"@lattice-php/core\",\n \"@lattice-php/form\",\n \"@lattice-php/table\",\n \"@lattice-php/ui\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(\n options: LatticeViteOptions,\n packages: LatticeComponentPackage[] = [],\n): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/ui\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [\n path.resolve(root, \"../ui/resources/icons\"),\n ...packages.flatMap((pkg) => (pkg.icons ? [pkg.icons] : [])),\n ...dirs,\n ],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\n/**\n * Builds the same icon sprite the `lattice()` Vite plugin serves, outside of\n * Vite: ui's icon set, every discovered component package's icons, and the\n * app's own `icons.dirs`. The result is a `SpriteValue` for `SpriteProvider`\n * (`href: \"\"` inlines the markup), which is what a Storybook, a design-system\n * export, a prerender script, or a test needs to render `Icon` without a\n * dev server or an emitted asset.\n */\nexport function buildLatticeSprite(options: LatticeViteOptions = {}): Sprite & { href: \"\" } {\n const { appRoot } = resolveRoots(options);\n const iconOptions = resolveIconOptions(options, discoverComponentPackages(appRoot));\n\n if (!iconOptions) {\n return { href: \"\", ids: [], source: \"\" };\n }\n\n const { iconDirs = [], symbolId, svgoConfig } = iconOptions;\n\n return { href: \"\", ...buildSprite(iconDirs, { symbolId, svgoConfig }) };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.root ?? path.resolve(appRoot, \"vendor/lattice-php/lattice\");\n\n return { appRoot, root };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,QAAQ,UAA8B,CAAC,GAAmB;CACxE,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;CAC9C,MAAM,WAAW,0BAA0B,OAAO;CAClD,MAAM,UAA0B;EAC9B,WAAW,OAAO;EAClB,oBAAoB;EACpB,wBAAwB,UAAU,SAAS,iBAAiB,SAAS,SAAS,IAAI,GAAG,EACnF,iBAAiB,KACnB,CAAC;EACD,iBAAiB,OAAO;CAC1B;CACA,MAAM,cAAc,mBAAmB,SAAS,QAAQ;CAExD,IAAI,aACF,QAAQ,KAAK,UAAU,WAAW,CAAC;CAGrC,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBACP,SACA,SACA,MACoB;CACpB,IAAI,QAAQ,QACV,OAAO,KAAK,QAAQ,MAAM,iCAAiC;CAG7D,MAAM,aAAa,2BAA2B,SAAS,iBAAiB;CAExE,IAAI,CAAC,YACH;CAGF,IAAI;EAEF,MAAM,YADc,KAAK,MAAM,aAAa,KAAK,KAAK,YAAY,cAAc,GAAG,MAAM,CACvE,CAAA,CAAY,UAAU;EACxC,MAAM,cAAc,OAAO,cAAc,WAAW,YAAY,WAAW;EA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