@lattice-php/lattice 0.16.0 → 0.17.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.
Files changed (122) hide show
  1. package/dist/action/components/action-form.js +1 -1
  2. package/dist/action/use-action.js +1 -1
  3. package/dist/chat/types.d.ts +2 -10
  4. package/dist/core/components/button.js +34 -18
  5. package/dist/core/components/button.js.map +1 -1
  6. package/dist/core/components/control.d.ts +0 -2
  7. package/dist/core/components/control.js.map +1 -1
  8. package/dist/core/components/link.js +25 -29
  9. package/dist/core/components/link.js.map +1 -1
  10. package/dist/core/types.d.ts +22 -42
  11. package/dist/core/use-click-behavior.d.ts +42 -0
  12. package/dist/core/use-click-behavior.js +46 -0
  13. package/dist/core/use-click-behavior.js.map +1 -0
  14. package/dist/create-app.d.ts +8 -2
  15. package/dist/create-app.js +4 -2
  16. package/dist/create-app.js.map +1 -1
  17. package/dist/effects/registry.d.ts +9 -20
  18. package/dist/effects/registry.js +4 -6
  19. package/dist/effects/registry.js.map +1 -1
  20. package/dist/events/event-bridge.d.ts +1 -1
  21. package/dist/events/event-bridge.js +1 -1
  22. package/dist/events/event-bridge.js.map +1 -1
  23. package/dist/form/components/base/input-otp.d.ts +2 -1
  24. package/dist/form/components/base/input-otp.js.map +1 -1
  25. package/dist/form/components/conditions.d.ts +1 -1
  26. package/dist/form/components/conditions.js.map +1 -1
  27. package/dist/form/components/field-props.d.ts +2 -1
  28. package/dist/form/components/field-props.js.map +1 -1
  29. package/dist/form/components/field-scope.d.ts +2 -1
  30. package/dist/form/components/field-scope.js.map +1 -1
  31. package/dist/form/components/fields/row-action-menu.d.ts +2 -1
  32. package/dist/form/components/fields/row-action-menu.js.map +1 -1
  33. package/dist/form/components/fields/row-item.d.ts +2 -1
  34. package/dist/form/components/fields/row-item.js.map +1 -1
  35. package/dist/form/components/fields/table-rows.d.ts +2 -1
  36. package/dist/form/components/fields/table-rows.js.map +1 -1
  37. package/dist/form/components/fields/time-picker-columns.d.ts +2 -1
  38. package/dist/form/components/fields/time-picker-columns.js.map +1 -1
  39. package/dist/form/components/fields/time-picker.d.ts +2 -1
  40. package/dist/form/components/fields/time-picker.js.map +1 -1
  41. package/dist/form/components/fields/use-row-collection.d.ts +2 -1
  42. package/dist/form/components/fields/use-row-collection.js.map +1 -1
  43. package/dist/form/components/form-path.d.ts +0 -1
  44. package/dist/form/components/form-path.js +1 -1
  45. package/dist/form/components/form-path.js.map +1 -1
  46. package/dist/form/components/prefill-targets.d.ts +1 -1
  47. package/dist/form/components/prefill-targets.js.map +1 -1
  48. package/dist/form/components/types.d.ts +5 -1
  49. package/dist/form/components/use-field-commit.d.ts +2 -1
  50. package/dist/form/components/use-field-commit.js.map +1 -1
  51. package/dist/form/components/use-form-resolver.d.ts +2 -1
  52. package/dist/form/components/use-form-resolver.js.map +1 -1
  53. package/dist/format/date-time.d.ts +12 -0
  54. package/dist/format/date-time.js +30 -0
  55. package/dist/format/date-time.js.map +1 -0
  56. package/dist/format/value.js +1 -1
  57. package/dist/format/value.js.map +1 -1
  58. package/dist/i18n/config.d.ts +2 -1
  59. package/dist/i18n/config.js.map +1 -1
  60. package/dist/i18n/date-time.js +1 -1
  61. package/dist/i18n/date-time.js.map +1 -1
  62. package/dist/i18n/instance.d.ts +1 -1
  63. package/dist/i18n/instance.js.map +1 -1
  64. package/dist/i18n/locale-reload.d.ts +2 -1
  65. package/dist/i18n/locale-reload.js.map +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/layout/components.js +1 -1
  68. package/dist/layout/menu-item.js +43 -49
  69. package/dist/layout/menu-item.js.map +1 -1
  70. package/dist/notifications/api.d.ts +6 -0
  71. package/dist/notifications/api.js +21 -0
  72. package/dist/notifications/api.js.map +1 -0
  73. package/dist/notifications/components/empty-state.d.ts +1 -0
  74. package/dist/notifications/components/empty-state.js +21 -0
  75. package/dist/notifications/components/empty-state.js.map +1 -0
  76. package/dist/notifications/components/notification-item.d.ts +6 -0
  77. package/dist/notifications/components/notification-item.js +65 -0
  78. package/dist/notifications/components/notification-item.js.map +1 -0
  79. package/dist/notifications/components/notification-list.d.ts +10 -0
  80. package/dist/notifications/components/notification-list.js +38 -0
  81. package/dist/notifications/components/notification-list.js.map +1 -0
  82. package/dist/notifications/components/notifications-echo.d.ts +5 -0
  83. package/dist/notifications/components/notifications-echo.js +22 -0
  84. package/dist/notifications/components/notifications-echo.js.map +1 -0
  85. package/dist/notifications/components/notifications.d.ts +3 -0
  86. package/dist/notifications/components/notifications.js +109 -0
  87. package/dist/notifications/components/notifications.js.map +1 -0
  88. package/dist/notifications/index.d.ts +1 -0
  89. package/dist/notifications/index.js +11 -0
  90. package/dist/notifications/index.js.map +1 -0
  91. package/dist/notifications/store.d.ts +25 -0
  92. package/dist/notifications/store.js +100 -0
  93. package/dist/notifications/store.js.map +1 -0
  94. package/dist/notifications/types.d.ts +10 -0
  95. package/dist/notifications/types.js +0 -0
  96. package/dist/realtime/build-effects.d.ts +2 -1
  97. package/dist/realtime/build-effects.js.map +1 -1
  98. package/dist/realtime/subscriptions.js.map +1 -1
  99. package/dist/registry/eager.js +2 -1
  100. package/dist/registry/eager.js.map +1 -1
  101. package/dist/registry/lazy.js +2 -1
  102. package/dist/registry/lazy.js.map +1 -1
  103. package/dist/table/bulk.d.ts +2 -1
  104. package/dist/table/bulk.js.map +1 -1
  105. package/dist/table/components/bulk-bar.js +2 -2
  106. package/dist/table/components/cells/money-cell.js +1 -1
  107. package/dist/table/components/cells/number-cell.js +1 -1
  108. package/dist/table/components/cells/text-cell.js +1 -1
  109. package/dist/table/components/filter-controls.d.ts +0 -4
  110. package/dist/table/components/filter-controls.js.map +1 -1
  111. package/dist/table/components/table-cell.js.map +1 -1
  112. package/dist/table/format.d.ts +1 -12
  113. package/dist/table/format.js +2 -26
  114. package/dist/table/format.js.map +1 -1
  115. package/dist/table/types.d.ts +7 -17
  116. package/dist/types/generated.d.ts +119 -290
  117. package/dist/vite-client.d.ts +8 -0
  118. package/dist/vite.d.ts +35 -1
  119. package/dist/vite.js +60 -2
  120. package/dist/vite.js.map +1 -1
  121. package/package.json +13 -2
  122. package/resources/icons/bell.svg +16 -0
@@ -1,7 +1,7 @@
1
1
  export type Action = {
2
2
  confirmation: Confirmation | null;
3
3
  endpoint: string | null;
4
- form: Node | null;
4
+ form: WireNode | null;
5
5
  icon: string | null;
6
6
  label: string | null;
7
7
  lazyForm: boolean | null;
@@ -14,23 +14,7 @@ export type ActionGroup = {
14
14
  orientation: Orientation | null;
15
15
  ref: string | null;
16
16
  };
17
- export type ActionNode = {
18
- type: "action";
19
- key?: string;
20
- id?: string;
21
- props: Action;
22
- } | {
23
- type: "action.group";
24
- key?: string;
25
- id?: string;
26
- props: ActionGroup;
27
- schema?: Node[];
28
- } | {
29
- type: "bulkAction";
30
- key?: string;
31
- id?: string;
32
- props: BulkAction;
33
- };
17
+ export type ActionNodeType = "action" | "action.group" | "bulkAction";
34
18
  export type ActionResult = {
35
19
  readonly ok: boolean;
36
20
  readonly data: Record<string, unknown>;
@@ -91,7 +75,7 @@ export type Builder = {
91
75
  export type BulkAction = {
92
76
  confirmation: Confirmation | null;
93
77
  endpoint: string | null;
94
- form: Node | null;
78
+ form: WireNode | null;
95
79
  icon: string | null;
96
80
  label: string | null;
97
81
  lazyForm: boolean | null;
@@ -100,11 +84,13 @@ export type BulkAction = {
100
84
  variant: ButtonVariant | null;
101
85
  };
102
86
  export type Button = {
87
+ action: WireNode | null;
103
88
  buttonType: ButtonType;
104
89
  effects: Effect[];
105
90
  href: string | null;
106
91
  icon: string | null;
107
92
  label: string;
93
+ method: HttpMethod | null;
108
94
  variant: ButtonVariant | null;
109
95
  };
110
96
  export type ButtonType = "button" | "submit" | "reset";
@@ -112,7 +98,7 @@ export type ButtonVariant = "default" | "destructive" | "ghost" | "info" | "link
112
98
  export type Callout = {
113
99
  title: string | null;
114
100
  dismissible: boolean;
115
- action: Node | null;
101
+ action: WireNode | null;
116
102
  variant: Variant;
117
103
  message: string;
118
104
  };
@@ -161,20 +147,7 @@ export type ChatBox = {
161
147
  export type ChatMessage = {
162
148
  readonly id: string;
163
149
  readonly role: ChatRole;
164
- readonly parts: Node[];
165
- };
166
- export type ChatNode = {
167
- type: "chat.box";
168
- key?: string;
169
- props: ChatBox;
170
- } | {
171
- type: "chat.part.text";
172
- key?: string;
173
- props: TextPart;
174
- } | {
175
- type: "chat.part.tool-call";
176
- key?: string;
177
- props: ToolCallPart;
150
+ readonly parts: WireNode[];
178
151
  };
179
152
  export type ChatRole = "user" | "assistant" | "system";
180
153
  export type Checkbox = {
@@ -235,7 +208,7 @@ export type Collapsible = {
235
208
  collapsed: boolean;
236
209
  rememberState: boolean;
237
210
  tooltip: string | null;
238
- trigger: Node[];
211
+ trigger: WireNode[];
239
212
  };
240
213
  export type Color = "default" | "muted" | "primary" | "success" | "info" | "warning" | "danger";
241
214
  export type ColumnAlign = "start" | "center" | "end";
@@ -283,6 +256,63 @@ export type ColumnPropsMap = {
283
256
  };
284
257
  export type ColumnType = "column.text" | "column.boolean" | "column.number" | "column.money" | "column.stack" | "column.badge" | "column.icon" | "column.image";
285
258
  export type ColumnWidth = "xs" | "sm" | "md" | "lg" | "xl";
259
+ export type ComponentPropsMap = {
260
+ action: Action;
261
+ "action.group": ActionGroup;
262
+ badge: Badge;
263
+ breadcrumbs: Breadcrumbs;
264
+ bulkAction: BulkAction;
265
+ button: Button;
266
+ callouts: Callouts;
267
+ card: Card;
268
+ chart: Chart;
269
+ "chat.box": ChatBox;
270
+ "chat.part.text": TextPart;
271
+ "chat.part.tool-call": ToolCallPart;
272
+ collapsible: Collapsible;
273
+ dropdown: Dropdown;
274
+ "field.builder": Builder;
275
+ "field.checkbox": Checkbox;
276
+ "field.choice": Choice;
277
+ "field.date-input": DateInput;
278
+ "field.date-time-input": DateTimeInput;
279
+ "field.file-upload": FileUpload;
280
+ "field.hidden-input": HiddenInput;
281
+ "field.number-input": NumberInput;
282
+ "field.otp": OtpInput;
283
+ "field.password-input": PasswordInput;
284
+ "field.repeater": Repeater;
285
+ "field.rich-editor": RichEditor;
286
+ "field.select": Select;
287
+ "field.text-input": TextInput;
288
+ "field.textarea": Textarea;
289
+ "field.time-input": TimeInput;
290
+ "field.toggle": Toggle;
291
+ "floating-panel": FloatingPanel;
292
+ form: Form;
293
+ fragment: Fragment;
294
+ grid: Grid;
295
+ heading: Heading;
296
+ icon: Icon;
297
+ link: Link;
298
+ menu: Menu;
299
+ "menu-item": MenuItem;
300
+ modal: Modal;
301
+ notifications: Notifications;
302
+ outlet: Outlet;
303
+ "raw-block": RawBlock;
304
+ "remote.data-list": DataList;
305
+ section: Section;
306
+ "segmented-control": SegmentedControl;
307
+ sidebar: Sidebar;
308
+ stack: Stack;
309
+ tab: Tab;
310
+ table: Table;
311
+ tabs: Tabs;
312
+ text: Text;
313
+ tooltip: Tooltip;
314
+ topbar: Topbar;
315
+ };
286
316
  export type Condition = {
287
317
  readonly field: string;
288
318
  readonly operator: Op;
@@ -294,93 +324,6 @@ export type Confirmation = {
294
324
  readonly confirmLabel: string | null;
295
325
  readonly cancelLabel: string | null;
296
326
  };
297
- export type CoreNode = {
298
- type: "badge";
299
- key?: string;
300
- props: Badge;
301
- } | {
302
- type: "button";
303
- key?: string;
304
- props: Button;
305
- } | {
306
- type: "card";
307
- key?: string;
308
- props: Card;
309
- schema?: Node[];
310
- } | {
311
- type: "chart";
312
- key?: string;
313
- props: Chart;
314
- } | {
315
- type: "collapsible";
316
- key?: string;
317
- props: Collapsible;
318
- schema?: Node[];
319
- } | {
320
- type: "floating-panel";
321
- key?: string;
322
- props: FloatingPanel;
323
- schema?: Node[];
324
- } | {
325
- type: "grid";
326
- key?: string;
327
- props: Grid;
328
- schema?: Node[];
329
- } | {
330
- type: "heading";
331
- key?: string;
332
- props: Heading;
333
- } | {
334
- type: "icon";
335
- key?: string;
336
- props: Icon;
337
- } | {
338
- type: "link";
339
- key?: string;
340
- props: Link;
341
- } | {
342
- type: "modal";
343
- key?: string;
344
- id?: string;
345
- props: Modal;
346
- schema?: Node[];
347
- } | {
348
- type: "raw-block";
349
- key?: string;
350
- props: RawBlock;
351
- } | {
352
- type: "section";
353
- key?: string;
354
- props: Section;
355
- schema?: Node[];
356
- } | {
357
- type: "segmented-control";
358
- key?: string;
359
- props: SegmentedControl;
360
- } | {
361
- type: "stack";
362
- key?: string;
363
- props: Stack;
364
- schema?: Node[];
365
- } | {
366
- type: "tab";
367
- key?: string;
368
- props: Tab;
369
- schema?: Node[];
370
- } | {
371
- type: "tabs";
372
- key?: string;
373
- props: Tabs;
374
- schema?: Node[];
375
- } | {
376
- type: "text";
377
- key?: string;
378
- props: Text;
379
- } | {
380
- type: "tooltip";
381
- key?: string;
382
- props: Tooltip;
383
- };
384
327
  export type DataList = {
385
328
  dataEndpoint: string | null;
386
329
  emptyLabel: string | null;
@@ -456,31 +399,24 @@ export type DownloadEffect = {
456
399
  };
457
400
  export type Dropdown = {
458
401
  placement: Placement;
459
- trigger: Node[];
460
- };
461
- export type Effect = ({
462
- type: "callout";
463
- } & CalloutEffect) | ({
464
- type: "closeModal";
465
- } & CloseModalEffect) | ({
466
- type: "download";
467
- } & DownloadEffect) | ({
468
- type: "localeChange";
469
- } & LocaleChangeEffect) | ({
470
- type: "openModal";
471
- } & OpenModalEffect) | ({
472
- type: "redirect";
473
- } & RedirectEffect) | ({
474
- type: "reloadComponent";
475
- } & ReloadComponentEffect) | ({
476
- type: "reloadPage";
477
- } & ReloadPageEffect) | ({
478
- type: "resetForm";
479
- } & ResetFormEffect) | ({
480
- type: "toast";
481
- } & ToastEffect) | ({
482
- type: "toggleSidebar";
483
- } & ToggleSidebarEffect);
402
+ trigger: WireNode[];
403
+ };
404
+ export type Effect = {
405
+ type: string;
406
+ } & Record<string, unknown>;
407
+ export type EffectPropsMap = {
408
+ callout: CalloutEffect;
409
+ closeModal: CloseModalEffect;
410
+ download: DownloadEffect;
411
+ localeChange: LocaleChangeEffect;
412
+ openModal: OpenModalEffect;
413
+ redirect: RedirectEffect;
414
+ reloadComponent: ReloadComponentEffect;
415
+ reloadPage: ReloadPageEffect;
416
+ resetForm: ResetFormEffect;
417
+ toast: ToastEffect;
418
+ toggleSidebar: ToggleSidebarEffect;
419
+ };
484
420
  export type FieldType = "field.builder" | "field.checkbox" | "field.choice" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.number-input" | "field.otp" | "field.password-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.textarea" | "field.text-input" | "field.time-input" | "field.toggle";
485
421
  export type FileUpload = {
486
422
  accept: string | null;
@@ -535,7 +471,7 @@ export type FloatingPanel = {
535
471
  label: string | null;
536
472
  offset: number;
537
473
  placement: FloatingPlacement;
538
- trigger: Node[];
474
+ trigger: WireNode[];
539
475
  };
540
476
  export type FloatingPlacement = "bottom-end" | "bottom-start" | "top-end" | "top-start";
541
477
  export type Form = {
@@ -553,96 +489,14 @@ export type Form = {
553
489
  validationSummaryLabel: string;
554
490
  validationTimeout: number | null;
555
491
  };
556
- export type FormFieldNode = {
557
- type: "field.builder";
558
- key?: string;
559
- props: Builder;
560
- } | {
561
- type: "field.checkbox";
562
- key?: string;
563
- props: Checkbox;
564
- } | {
565
- type: "field.choice";
566
- key?: string;
567
- props: Choice;
568
- } | {
569
- type: "field.date-input";
570
- key?: string;
571
- props: DateInput;
572
- } | {
573
- type: "field.date-time-input";
574
- key?: string;
575
- props: DateTimeInput;
576
- } | {
577
- type: "field.file-upload";
578
- key?: string;
579
- props: FileUpload;
580
- } | {
581
- type: "field.hidden-input";
582
- key?: string;
583
- props: HiddenInput;
584
- } | {
585
- type: "field.number-input";
586
- key?: string;
587
- props: NumberInput;
588
- } | {
589
- type: "field.otp";
590
- key?: string;
591
- props: OtpInput;
592
- } | {
593
- type: "field.password-input";
594
- key?: string;
595
- props: PasswordInput;
596
- } | {
597
- type: "field.repeater";
598
- key?: string;
599
- props: Repeater;
600
- } | {
601
- type: "field.rich-editor";
602
- key?: string;
603
- props: RichEditor;
604
- } | {
605
- type: "field.select";
606
- key?: string;
607
- props: Select;
608
- } | {
609
- type: "field.text-input";
610
- key?: string;
611
- props: TextInput;
612
- } | {
613
- type: "field.textarea";
614
- key?: string;
615
- props: Textarea;
616
- } | {
617
- type: "field.time-input";
618
- key?: string;
619
- props: TimeInput;
620
- } | {
621
- type: "field.toggle";
622
- key?: string;
623
- props: Toggle;
624
- };
625
- export type FormNode = FormFieldNode | {
626
- type: "form";
627
- key?: string;
628
- id?: string;
629
- props: Form;
630
- schema?: Node[];
631
- };
632
- export type FormNodeType = FormNode["type"];
492
+ export type FormFieldNodeType = "field.builder" | "field.checkbox" | "field.choice" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.number-input" | "field.otp" | "field.password-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle";
493
+ export type FormNodeType = "field.builder" | "field.checkbox" | "field.choice" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.number-input" | "field.otp" | "field.password-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "form";
633
494
  export type Fragment = {
634
495
  endpoint: string | null;
635
496
  lazy: boolean | null;
636
497
  ref: string | null;
637
498
  size: Size;
638
499
  };
639
- export type FragmentNode = {
640
- type: "fragment";
641
- key?: string;
642
- id?: string;
643
- props: Fragment;
644
- schema?: Node[];
645
- };
646
500
  export type Gap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
647
501
  export type Grid = {
648
502
  columns: number | null;
@@ -700,46 +554,9 @@ export type ImageColumn = {
700
554
  size: number | null;
701
555
  };
702
556
  export type Justify = "start" | "center" | "end" | "between" | "around" | "evenly";
703
- export type LayoutNode = {
704
- type: "breadcrumbs";
705
- key?: string;
706
- props: Breadcrumbs;
707
- } | {
708
- type: "callouts";
709
- key?: string;
710
- props: Callouts;
711
- } | {
712
- type: "dropdown";
713
- key?: string;
714
- props: Dropdown;
715
- schema?: Node[];
716
- } | {
717
- type: "menu";
718
- key?: string;
719
- props: Menu;
720
- schema?: Node[];
721
- } | {
722
- type: "menu-item";
723
- key?: string;
724
- props: MenuItem;
725
- schema?: Node[];
726
- } | {
727
- type: "outlet";
728
- key?: string;
729
- props: Outlet;
730
- } | {
731
- type: "sidebar";
732
- key?: string;
733
- props: Sidebar;
734
- schema?: Node[];
735
- } | {
736
- type: "topbar";
737
- key?: string;
738
- props: Topbar;
739
- schema?: Node[];
740
- };
741
557
  export type Link = {
742
- action: Node | null;
558
+ action: WireNode | null;
559
+ effects: Effect[];
743
560
  href: string | null;
744
561
  icon: string | null;
745
562
  label: string;
@@ -759,7 +576,8 @@ export type LocaleChangeEffect = {
759
576
  };
760
577
  export type Menu = Record<string, never>;
761
578
  export type MenuItem = {
762
- action: Node | null;
579
+ action: WireNode | null;
580
+ effects: Effect[];
763
581
  href: string | null;
764
582
  icon: string | null;
765
583
  label: string;
@@ -780,8 +598,24 @@ export type MoneyColumn = {
780
598
  maximumFractionDigits: number | null;
781
599
  minimumFractionDigits: number | null;
782
600
  };
783
- export type Node = FormNode | CoreNode | ActionNode | FragmentNode | RemoteNode | TableNode | LayoutNode | ChatNode;
784
- export type NodeType = Node["type"];
601
+ export type NodeType = "action" | "action.group" | "badge" | "breadcrumbs" | "bulkAction" | "button" | "callouts" | "card" | "chart" | "chat.box" | "chat.part.text" | "chat.part.tool-call" | "collapsible" | "dropdown" | "field.builder" | "field.checkbox" | "field.choice" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.number-input" | "field.otp" | "field.password-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" | "link" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "raw-block" | "remote.data-list" | "section" | "segmented-control" | "sidebar" | "stack" | "tab" | "table" | "tabs" | "text" | "tooltip" | "topbar";
602
+ export type NotificationItem = {
603
+ readonly id: string;
604
+ readonly title: string | null;
605
+ readonly body: string | null;
606
+ readonly icon: string | null;
607
+ readonly variant: Variant | null;
608
+ readonly href: string | null;
609
+ readonly isRead: boolean;
610
+ readonly createdAt: string | null;
611
+ readonly actions: WireNode[];
612
+ };
613
+ export type Notifications = {
614
+ channel: string;
615
+ endpoint: string;
616
+ pollingInterval: number | null;
617
+ slideOut: boolean;
618
+ };
785
619
  export type NumberColumn = {
786
620
  compact: boolean;
787
621
  maximumFractionDigits: number | null;
@@ -927,12 +761,6 @@ export type RemoteAccess = {
927
761
  readonly tokenEndpoint: string;
928
762
  readonly ref: string;
929
763
  };
930
- export type RemoteNode = {
931
- type: "remote.data-list";
932
- key?: string;
933
- props: DataList;
934
- schema?: Node[];
935
- };
936
764
  export type Repeater = {
937
765
  addLabel: string | null;
938
766
  columnWidth: ColumnWidth;
@@ -1006,7 +834,7 @@ export type Section = {
1006
834
  collapsed: boolean;
1007
835
  collapsible: boolean;
1008
836
  description: string | null;
1009
- headerActions: Node[];
837
+ headerActions: WireNode[];
1010
838
  rememberState: boolean;
1011
839
  title: string | null;
1012
840
  tooltip: string | null;
@@ -1076,7 +904,7 @@ export type Tab = {
1076
904
  };
1077
905
  export type Table = {
1078
906
  actionsLabel: string;
1079
- bulkActions: Node[];
907
+ bulkActions: WireNode[];
1080
908
  columns: ColumnData[];
1081
909
  emptyLabel: string;
1082
910
  endpoint: string | null;
@@ -1088,12 +916,6 @@ export type Table = {
1088
916
  resizeIndicator: boolean;
1089
917
  striped: boolean | null;
1090
918
  };
1091
- export type TableNode = {
1092
- type: "table";
1093
- key?: string;
1094
- id?: string;
1095
- props: Table;
1096
- };
1097
919
  export type TablePagination = {
1098
920
  readonly mode: PaginationType;
1099
921
  readonly currentPage: number | null;
@@ -1241,7 +1063,7 @@ export type ToastMessage = {
1241
1063
  duration: number | null;
1242
1064
  persistent: boolean;
1243
1065
  dismissible: boolean;
1244
- action: Node | null;
1066
+ action: WireNode | null;
1245
1067
  variant: Variant;
1246
1068
  message: Translatable | string;
1247
1069
  };
@@ -1279,7 +1101,7 @@ export type ToolCallPart = {
1279
1101
  };
1280
1102
  export type Tooltip = {
1281
1103
  content: string | null;
1282
- trigger: Node[];
1104
+ trigger: WireNode[];
1283
1105
  };
1284
1106
  export type Topbar = {
1285
1107
  sticky: boolean;
@@ -1291,3 +1113,10 @@ export type Translatable = {
1291
1113
  };
1292
1114
  export type Variant = "success" | "info" | "warning" | "error";
1293
1115
  export type Width = "full" | "auto" | "sm" | "md" | "lg" | "fill";
1116
+ export type WireNode = {
1117
+ id?: string;
1118
+ key?: string;
1119
+ type: string;
1120
+ props?: Record<string, unknown>;
1121
+ schema?: WireNode[];
1122
+ };
@@ -0,0 +1,8 @@
1
+ declare module "virtual:lattice/plugins" {
2
+ import type { Plugin } from "@lattice-php/lattice";
3
+
4
+ /** Plugins for the Composer-installed Lattice component packages the `lattice()` Vite plugin discovered. */
5
+ const plugins: Plugin[];
6
+
7
+ export default plugins;
8
+ }
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SvgSpriteOptions } from '@lattice-php/vite-svg-sprite';
2
- import { PluginOption, UserConfig } from 'vite';
2
+ import { Plugin, PluginOption, UserConfig } from 'vite';
3
3
  type InlineDependency = string | RegExp;
4
4
  type ConfigWithTest = UserConfig & {
5
5
  test?: {
@@ -21,5 +21,39 @@ export type LatticeViteOptions = {
21
21
  source?: boolean;
22
22
  };
23
23
  export declare function lattice(options?: LatticeViteOptions): PluginOption[];
24
+ /** A Composer package that contributes a Lattice component plugin. */
25
+ export type LatticeComponentPackage = {
26
+ name: string;
27
+ /** Absolute path to the package's installed directory. */
28
+ dir: string;
29
+ /** Absolute path to the package's JS plugin entry (its `createPlugin(...)`). */
30
+ plugin: string;
31
+ };
32
+ type InstalledPackage = {
33
+ name: string;
34
+ "install-path"?: string;
35
+ extra?: {
36
+ lattice?: {
37
+ plugin?: string;
38
+ };
39
+ };
40
+ };
41
+ /**
42
+ * Resolve every Composer package that declares `extra.lattice.plugin` into an
43
+ * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the
44
+ * dir `installed.json` records its `install-path`s against).
45
+ */
46
+ export declare function collectComponentPackages(installed: {
47
+ packages?: InstalledPackage[];
48
+ } | InstalledPackage[], installPathsRelativeTo: string): LatticeComponentPackage[];
49
+ /** Read `<appRoot>/vendor/composer/installed.json` and collect component packages. */
50
+ export declare function discoverComponentPackages(appRoot: string): LatticeComponentPackage[];
51
+ /**
52
+ * Exposes the discovered component packages as `virtual:lattice/plugins` — a
53
+ * module whose default export is the array of their `createPlugin(...)` results,
54
+ * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem
55
+ * access to each package dir so its source compiles from `vendor/` (or a symlink).
56
+ */
57
+ export declare function componentPackagesPlugin(packages: LatticeComponentPackage[]): Plugin;
24
58
  export declare function latticeConfig(options?: LatticeViteOptions): ConfigWithTest;
25
59
  export {};
package/dist/vite.js CHANGED
@@ -1,13 +1,71 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import path from "node:path";
2
3
  import { svgSprite } from "@lattice-php/vite-svg-sprite";
3
4
  import { searchForWorkspaceRoot } from "vite";
4
5
  //#region resources/js/vite.ts
5
6
  function lattice(options = {}) {
6
- const plugins = [corePlugin(options), optionalPeersPlugin()];
7
+ const { appRoot } = resolveRoots(options);
8
+ const plugins = [
9
+ corePlugin(options),
10
+ optionalPeersPlugin(),
11
+ componentPackagesPlugin(discoverComponentPackages(appRoot))
12
+ ];
7
13
  const iconOptions = resolveIconOptions(options);
8
14
  if (iconOptions) plugins.push(svgSprite(iconOptions));
9
15
  return plugins;
10
16
  }
17
+ /**
18
+ * Resolve every Composer package that declares `extra.lattice.plugin` into an
19
+ * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the
20
+ * dir `installed.json` records its `install-path`s against).
21
+ */
22
+ function collectComponentPackages(installed, installPathsRelativeTo) {
23
+ return (Array.isArray(installed) ? installed : installed.packages ?? []).flatMap((pkg) => {
24
+ const entry = pkg.extra?.lattice?.plugin;
25
+ if (typeof entry !== "string") return [];
26
+ const dir = path.resolve(installPathsRelativeTo, pkg["install-path"] ?? `../${pkg.name}`);
27
+ return [{
28
+ name: pkg.name,
29
+ dir,
30
+ plugin: path.resolve(dir, entry)
31
+ }];
32
+ });
33
+ }
34
+ /** Read `<appRoot>/vendor/composer/installed.json` and collect component packages. */
35
+ function discoverComponentPackages(appRoot) {
36
+ const composerDir = path.resolve(appRoot, "vendor/composer");
37
+ let raw;
38
+ try {
39
+ raw = readFileSync(path.join(composerDir, "installed.json"), "utf8");
40
+ } catch {
41
+ return [];
42
+ }
43
+ return collectComponentPackages(JSON.parse(raw), composerDir);
44
+ }
45
+ var VIRTUAL_PLUGINS_ID = "virtual:lattice/plugins";
46
+ var RESOLVED_VIRTUAL_PLUGINS_ID = `\0${VIRTUAL_PLUGINS_ID}`;
47
+ /**
48
+ * Exposes the discovered component packages as `virtual:lattice/plugins` — a
49
+ * module whose default export is the array of their `createPlugin(...)` results,
50
+ * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem
51
+ * access to each package dir so its source compiles from `vendor/` (or a symlink).
52
+ */
53
+ function componentPackagesPlugin(packages) {
54
+ return {
55
+ name: "lattice:component-packages",
56
+ config() {
57
+ if (packages.length === 0) return {};
58
+ return { server: { fs: { allow: packages.map((pkg) => pkg.dir) } } };
59
+ },
60
+ resolveId(id) {
61
+ return id === VIRTUAL_PLUGINS_ID ? RESOLVED_VIRTUAL_PLUGINS_ID : null;
62
+ },
63
+ load(id) {
64
+ if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) return null;
65
+ return `${packages.map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`).join("\n")}\nexport default [${packages.map((_, index) => `p${index}`).join(", ")}];\n`;
66
+ }
67
+ };
68
+ }
11
69
  function latticeConfig(options = {}) {
12
70
  const { appRoot, root } = resolveRoots(options);
13
71
  return {
@@ -98,6 +156,6 @@ function resolveRoots(options) {
98
156
  };
99
157
  }
100
158
  //#endregion
101
- export { lattice, latticeConfig };
159
+ export { collectComponentPackages, componentPackagesPlugin, discoverComponentPackages, lattice, latticeConfig };
102
160
 
103
161
  //# sourceMappingURL=vite.js.map