@lattice-php/lattice 0.3.0 → 0.5.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 (195) hide show
  1. package/dist/action/components/action-form.js +3 -3
  2. package/dist/action/components/action-group.js +1 -1
  3. package/dist/action/components/action.js +10 -16
  4. package/dist/action/components/action.js.map +1 -1
  5. package/dist/action/run-action.d.ts +9 -0
  6. package/dist/action/run-action.js +22 -0
  7. package/dist/action/run-action.js.map +1 -0
  8. package/dist/chat/components/chat-box.js +31 -14
  9. package/dist/chat/components/chat-box.js.map +1 -1
  10. package/dist/chat/components/message.js +2 -2
  11. package/dist/chat/components/message.js.map +1 -1
  12. package/dist/chat/components/prompt-input.js +1 -1
  13. package/dist/chat/index.js +2 -0
  14. package/dist/chat/index.js.map +1 -1
  15. package/dist/chat/transport.d.ts +2 -0
  16. package/dist/chat/transport.js +23 -3
  17. package/dist/chat/transport.js.map +1 -1
  18. package/dist/core/api.d.ts +14 -7
  19. package/dist/core/api.js +77 -1
  20. package/dist/core/api.js.map +1 -1
  21. package/dist/core/components/badge.js +4 -4
  22. package/dist/core/components/badge.js.map +1 -1
  23. package/dist/core/components/button.js +31 -19
  24. package/dist/core/components/button.js.map +1 -1
  25. package/dist/core/components/card.js +3 -2
  26. package/dist/core/components/card.js.map +1 -1
  27. package/dist/core/components/chart.js +3 -2
  28. package/dist/core/components/chart.js.map +1 -1
  29. package/dist/core/components/checkbox.js +1 -1
  30. package/dist/core/components/checkbox.js.map +1 -1
  31. package/dist/core/components/control.js +4 -4
  32. package/dist/core/components/control.js.map +1 -1
  33. package/dist/core/components/dialog.d.ts +1 -1
  34. package/dist/core/components/dialog.js +3 -2
  35. package/dist/core/components/dialog.js.map +1 -1
  36. package/dist/core/components/floating-panel.js +5 -4
  37. package/dist/core/components/floating-panel.js.map +1 -1
  38. package/dist/core/components/fragment.js +3 -6
  39. package/dist/core/components/fragment.js.map +1 -1
  40. package/dist/core/components/grid.js +2 -1
  41. package/dist/core/components/grid.js.map +1 -1
  42. package/dist/core/components/heading.js +1 -1
  43. package/dist/core/components/heading.js.map +1 -1
  44. package/dist/core/components/index.js +0 -2
  45. package/dist/core/components/index.js.map +1 -1
  46. package/dist/core/components/popover.d.ts +1 -1
  47. package/dist/core/components/popover.js +1 -1
  48. package/dist/core/components/popover.js.map +1 -1
  49. package/dist/core/components/section.js +7 -11
  50. package/dist/core/components/section.js.map +1 -1
  51. package/dist/core/components/segmented-pills.js +1 -1
  52. package/dist/core/components/segmented-pills.js.map +1 -1
  53. package/dist/core/components/stack.js +9 -2
  54. package/dist/core/components/stack.js.map +1 -1
  55. package/dist/core/components/tabs.js +2 -2
  56. package/dist/core/components/tabs.js.map +1 -1
  57. package/dist/core/nodes.d.ts +6 -0
  58. package/dist/core/nodes.js +13 -0
  59. package/dist/core/nodes.js.map +1 -0
  60. package/dist/core/renderer.js +1 -1
  61. package/dist/core/types.d.ts +3 -1
  62. package/dist/create-app.d.ts +21 -0
  63. package/dist/create-app.js +31 -0
  64. package/dist/create-app.js.map +1 -0
  65. package/dist/effects/registry.js +2 -1
  66. package/dist/effects/registry.js.map +1 -1
  67. package/dist/effects/use-effect-dispatcher.js +1 -1
  68. package/dist/effects/use-flash-effects.js +1 -1
  69. package/dist/events/event-names.d.ts +3 -2
  70. package/dist/events/event-names.js +3 -2
  71. package/dist/events/event-names.js.map +1 -1
  72. package/dist/form/components/base/affix-group.d.ts +17 -0
  73. package/dist/form/components/base/affix-group.js +49 -0
  74. package/dist/form/components/base/affix-group.js.map +1 -0
  75. package/dist/form/components/base/input-otp.d.ts +7 -0
  76. package/dist/form/components/base/input-otp.js +30 -0
  77. package/dist/form/components/base/input-otp.js.map +1 -0
  78. package/dist/form/components/base/label.js +1 -1
  79. package/dist/form/components/base/label.js.map +1 -1
  80. package/dist/form/components/base/submit-button.js +1 -1
  81. package/dist/form/components/base/submit-button.js.map +1 -1
  82. package/dist/form/components/base/textarea.js +1 -1
  83. package/dist/form/components/base/textarea.js.map +1 -1
  84. package/dist/form/components/conditions.js +1 -1
  85. package/dist/form/components/conditions.js.map +1 -1
  86. package/dist/form/components/fields/file-upload.js +35 -3
  87. package/dist/form/components/fields/file-upload.js.map +1 -1
  88. package/dist/form/components/fields/number-input.js +21 -15
  89. package/dist/form/components/fields/number-input.js.map +1 -1
  90. package/dist/form/components/fields/otp-input.d.ts +2 -0
  91. package/dist/form/components/fields/otp-input.js +25 -0
  92. package/dist/form/components/fields/otp-input.js.map +1 -0
  93. package/dist/form/components/fields/password-input.js +21 -15
  94. package/dist/form/components/fields/password-input.js.map +1 -1
  95. package/dist/form/components/fields/rich-editor.js +2 -2
  96. package/dist/form/components/fields/rich-editor.js.map +1 -1
  97. package/dist/form/components/fields/row-item.js +1 -1
  98. package/dist/form/components/fields/table-rows.js +1 -1
  99. package/dist/form/components/fields/text-input.js +19 -13
  100. package/dist/form/components/fields/text-input.js.map +1 -1
  101. package/dist/form/components/form.js +2 -2
  102. package/dist/form/components/form.js.map +1 -1
  103. package/dist/form/components/index.d.ts +1 -0
  104. package/dist/form/components/index.js +2 -1
  105. package/dist/form/components/prefill-targets.d.ts +0 -1
  106. package/dist/form/components/prefill-targets.js +1 -4
  107. package/dist/form/components/prefill-targets.js.map +1 -1
  108. package/dist/form/components/use-form-resolver.js +2 -2
  109. package/dist/form/components/use-form-resolver.js.map +1 -1
  110. package/dist/form/index.js +1 -0
  111. package/dist/form/index.js.map +1 -1
  112. package/dist/form/skeleton.js +1 -1
  113. package/dist/form/skeleton.js.map +1 -1
  114. package/dist/i18n/locale-reload.js +1 -1
  115. package/dist/i18n/translatable.d.ts +4 -0
  116. package/dist/i18n/translatable.js +24 -0
  117. package/dist/i18n/translatable.js.map +1 -0
  118. package/dist/index.d.ts +3 -0
  119. package/dist/index.js +15 -13
  120. package/dist/lattice.css +99 -6
  121. package/dist/layout/breadcrumbs.js +3 -2
  122. package/dist/layout/breadcrumbs.js.map +1 -1
  123. package/dist/layout/callouts.js +2 -2
  124. package/dist/layout/callouts.js.map +1 -1
  125. package/dist/layout/components.js +4 -2
  126. package/dist/layout/components.js.map +1 -1
  127. package/dist/layout/dropdown.js +2 -1
  128. package/dist/layout/dropdown.js.map +1 -1
  129. package/dist/layout/menu-item.js +33 -12
  130. package/dist/layout/menu-item.js.map +1 -1
  131. package/dist/layout/menu.js +2 -1
  132. package/dist/layout/menu.js.map +1 -1
  133. package/dist/layout/popover.js +1 -1
  134. package/dist/layout/sidebar.js +69 -29
  135. package/dist/layout/sidebar.js.map +1 -1
  136. package/dist/layout/topbar.d.ts +3 -0
  137. package/dist/layout/topbar.js +16 -0
  138. package/dist/layout/topbar.js.map +1 -0
  139. package/dist/page.js +15 -10
  140. package/dist/page.js.map +1 -1
  141. package/dist/realtime/build-effects.d.ts +4 -0
  142. package/dist/realtime/build-effects.js +23 -0
  143. package/dist/realtime/build-effects.js.map +1 -0
  144. package/dist/realtime/listeners.d.ts +8 -0
  145. package/dist/realtime/listeners.js +31 -0
  146. package/dist/realtime/listeners.js.map +1 -0
  147. package/dist/realtime/subscriptions.d.ts +4 -0
  148. package/dist/realtime/subscriptions.js +45 -0
  149. package/dist/realtime/subscriptions.js.map +1 -0
  150. package/dist/registry.js +3 -2
  151. package/dist/registry.js.map +1 -1
  152. package/dist/remote/components/data-list.d.ts +10 -0
  153. package/dist/remote/components/data-list.js +106 -0
  154. package/dist/remote/components/data-list.js.map +1 -0
  155. package/dist/remote/index.d.ts +1 -0
  156. package/dist/remote/index.js +11 -0
  157. package/dist/remote/index.js.map +1 -0
  158. package/dist/table/components/bulk-bar.js +10 -15
  159. package/dist/table/components/bulk-bar.js.map +1 -1
  160. package/dist/table/components/cells/text-cell.js +38 -3
  161. package/dist/table/components/cells/text-cell.js.map +1 -1
  162. package/dist/table/components/column-filter-control.d.ts +2 -1
  163. package/dist/table/components/column-filter-control.js +28 -19
  164. package/dist/table/components/column-filter-control.js.map +1 -1
  165. package/dist/table/components/column-header.js +2 -2
  166. package/dist/table/components/column-header.js.map +1 -1
  167. package/dist/table/components/filter-bar.d.ts +7 -6
  168. package/dist/table/components/filter-bar.js +51 -28
  169. package/dist/table/components/filter-bar.js.map +1 -1
  170. package/dist/table/components/filter-controls.js +2 -2
  171. package/dist/table/components/filter-controls.js.map +1 -1
  172. package/dist/table/components/filter-stack-bar.js +4 -3
  173. package/dist/table/components/filter-stack-bar.js.map +1 -1
  174. package/dist/table/components/filter-value-input.js +1 -1
  175. package/dist/table/components/filter-value-input.js.map +1 -1
  176. package/dist/table/components/sort-bar.js +1 -1
  177. package/dist/table/components/sort-bar.js.map +1 -1
  178. package/dist/table/components/table.js +26 -17
  179. package/dist/table/components/table.js.map +1 -1
  180. package/dist/table/filter-values.d.ts +5 -0
  181. package/dist/table/filter-values.js +10 -3
  182. package/dist/table/filter-values.js.map +1 -1
  183. package/dist/table/query.js +5 -4
  184. package/dist/table/query.js.map +1 -1
  185. package/dist/table/use-table.d.ts +1 -0
  186. package/dist/table/use-table.js +4 -0
  187. package/dist/table/use-table.js.map +1 -1
  188. package/dist/toast/toast.js +5 -2
  189. package/dist/toast/toast.js.map +1 -1
  190. package/dist/toast/toaster.js +6 -5
  191. package/dist/toast/toaster.js.map +1 -1
  192. package/dist/types/generated.d.ts +122 -14
  193. package/dist/vite.js +32 -1
  194. package/dist/vite.js.map +1 -1
  195. package/package.json +33 -3
@@ -1,6 +1,5 @@
1
1
  export type Action = {
2
2
  confirmation: Confirmation | null;
3
- effects: Effect[];
4
3
  endpoint: string | null;
5
4
  form: Node | null;
6
5
  icon: string | null;
@@ -37,6 +36,10 @@ export type ActionResult = {
37
36
  readonly data: Record<string, unknown>;
38
37
  readonly effects: Effect[];
39
38
  };
39
+ export type Affix = {
40
+ readonly icon: string | null;
41
+ readonly text: string | null;
42
+ };
40
43
  export type Align = "center" | "left" | "start" | "stretch";
41
44
  export type Badge = {
42
45
  label: string;
@@ -46,6 +49,13 @@ export type BadgeColumn = {
46
49
  };
47
50
  export type BooleanColumn = Record<string, never>;
48
51
  export type Breadcrumbs = Record<string, never>;
52
+ export type BrowserToken = {
53
+ readonly accessToken: string;
54
+ readonly tokenType: string;
55
+ readonly expiresIn: number;
56
+ readonly audience: string;
57
+ readonly scopes: string[];
58
+ };
49
59
  export type Builder = {
50
60
  addLabel: string | null;
51
61
  columnWidth: ColumnWidth;
@@ -80,7 +90,6 @@ export type Builder = {
80
90
  };
81
91
  export type BulkAction = {
82
92
  confirmation: Confirmation | null;
83
- effects: Effect[];
84
93
  endpoint: string | null;
85
94
  form: Node | null;
86
95
  icon: string | null;
@@ -92,7 +101,9 @@ export type BulkAction = {
92
101
  };
93
102
  export type Button = {
94
103
  buttonType: ButtonType;
104
+ effects: Effect[];
95
105
  href: string | null;
106
+ icon: string | null;
96
107
  label: string;
97
108
  variant: ButtonVariant | null;
98
109
  };
@@ -113,6 +124,7 @@ export type Card = {
113
124
  description: string | null;
114
125
  title: string | null;
115
126
  };
127
+ export type ChannelVisibility = "public" | "private" | "presence";
116
128
  export type Chart = {
117
129
  categoryKey: string | null;
118
130
  data: Record<string, unknown>[];
@@ -136,19 +148,23 @@ export type ChartSeries = {
136
148
  };
137
149
  export type ChartSeriesType = "area" | "bar" | "line" | "pie";
138
150
  export type ChatBox = {
139
- conversationId: string | null;
140
151
  fill: boolean;
141
152
  historyEndpoint: string | null;
142
153
  placeholder: string | null;
154
+ remote: RemoteAccess | null;
143
155
  streamEndpoint: string | null;
144
156
  title: string | null;
145
157
  };
146
158
  export type ChatMessage = {
147
159
  readonly id: string;
148
160
  readonly role: ChatRole;
149
- readonly parts: ChatNode[];
161
+ readonly parts: Node[];
150
162
  };
151
163
  export type ChatNode = {
164
+ type: "chat.box";
165
+ key?: string;
166
+ props: ChatBox;
167
+ } | {
152
168
  type: "chat.part.text";
153
169
  key?: string;
154
170
  props: TextPart;
@@ -234,6 +250,16 @@ export type ColumnFilter = {
234
250
  readonly options: Option[];
235
251
  readonly multiple: boolean;
236
252
  readonly searchable: boolean;
253
+ readonly clauseOptions?: ColumnFilterOption[];
254
+ };
255
+ export type ColumnFilterOption = {
256
+ readonly label: string;
257
+ readonly value: string;
258
+ readonly clauses: ColumnFilterOptionClause[];
259
+ };
260
+ export type ColumnFilterOptionClause = {
261
+ readonly operator: Op;
262
+ readonly value: string;
237
263
  };
238
264
  export type ColumnPropsMap = {
239
265
  "column.badge": BadgeColumn;
@@ -274,10 +300,6 @@ export type CoreNode = {
274
300
  type: "chart";
275
301
  key?: string;
276
302
  props: Chart;
277
- } | {
278
- type: "chat.box";
279
- key?: string;
280
- props: ChatBox;
281
303
  } | {
282
304
  type: "floating-panel";
283
305
  key?: string;
@@ -339,6 +361,11 @@ export type CoreNode = {
339
361
  key?: string;
340
362
  props: Text;
341
363
  };
364
+ export type DataList = {
365
+ dataEndpoint: string | null;
366
+ emptyLabel: string | null;
367
+ remote: RemoteAccess | null;
368
+ };
342
369
  export type DateInput = {
343
370
  autoFocus: boolean;
344
371
  columnWidth: ColumnWidth;
@@ -393,9 +420,10 @@ export type Effect = ({
393
420
  type: "resetForm";
394
421
  } & ResetFormEffect) | ({
395
422
  type: "toast";
396
- } & ToastEffect);
397
- export type EffectType = "toast" | "callout" | "reloadComponent" | "reloadPage" | "redirect" | "download" | "openModal" | "closeModal" | "resetForm" | "localeChange";
398
- export type FieldType = "field.builder" | "field.checkbox" | "field.choice" | "field.date-input" | "field.file-upload" | "field.hidden-input" | "field.number-input" | "field.password-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.textarea" | "field.text-input";
423
+ } & ToastEffect) | ({
424
+ type: "toggleSidebar";
425
+ } & ToggleSidebarEffect);
426
+ export type FieldType = "field.builder" | "field.checkbox" | "field.choice" | "field.date-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";
399
427
  export type FileUpload = {
400
428
  accept: string | null;
401
429
  columnWidth: ColumnWidth;
@@ -495,6 +523,10 @@ export type FormFieldNode = {
495
523
  type: "field.number-input";
496
524
  key?: string;
497
525
  props: NumberInput;
526
+ } | {
527
+ type: "field.otp";
528
+ key?: string;
529
+ props: OtpInput;
498
530
  } | {
499
531
  type: "field.password-input";
500
532
  key?: string;
@@ -628,6 +660,11 @@ export type LayoutNode = {
628
660
  key?: string;
629
661
  props: Sidebar;
630
662
  schema?: Node[];
663
+ } | {
664
+ type: "topbar";
665
+ key?: string;
666
+ props: Topbar;
667
+ schema?: Node[];
631
668
  };
632
669
  export type Link = {
633
670
  href: string | null;
@@ -635,6 +672,12 @@ export type Link = {
635
672
  method: HttpMethod | null;
636
673
  tabIndex: number | null;
637
674
  };
675
+ export type ListenerPayload = {
676
+ readonly channel: string;
677
+ readonly visibility: ChannelVisibility;
678
+ readonly events: string[];
679
+ readonly effects: Effect[];
680
+ };
638
681
  export type LocaleChangeEffect = {
639
682
  readonly locale: string;
640
683
  };
@@ -644,6 +687,8 @@ export type MenuItem = {
644
687
  icon: string | null;
645
688
  label: string;
646
689
  method: HttpMethod | null;
690
+ prefix: Affix | null;
691
+ suffix: Affix | null;
647
692
  };
648
693
  export type Modal = {
649
694
  closeLabel: string;
@@ -658,7 +703,7 @@ export type MoneyColumn = {
658
703
  maximumFractionDigits: number | null;
659
704
  minimumFractionDigits: number | null;
660
705
  };
661
- export type Node = FormNode | CoreNode | ActionNode | FragmentNode | TableNode | LayoutNode | ChatNode;
706
+ export type Node = FormNode | CoreNode | ActionNode | FragmentNode | RemoteNode | TableNode | LayoutNode | ChatNode;
662
707
  export type NodeType = Node["type"];
663
708
  export type NumberColumn = {
664
709
  maximumFractionDigits: number | null;
@@ -688,10 +733,12 @@ export type NumberInput = {
688
733
  placeholder: string | null;
689
734
  prefillRefreshOn: string[] | null;
690
735
  prefillResetOn: string[] | null;
736
+ prefix: Affix | null;
691
737
  readOnly: boolean;
692
738
  required: boolean;
693
739
  slider: boolean;
694
740
  step: number | null;
741
+ suffix: Affix | null;
695
742
  tabIndex: number | null;
696
743
  tooltip: string | null;
697
744
  value: unknown;
@@ -705,6 +752,31 @@ export type Option = {
705
752
  readonly value: string;
706
753
  };
707
754
  export type Orientation = "horizontal" | "vertical";
755
+ export type OtpInput = {
756
+ autoFocus: boolean;
757
+ columnWidth: ColumnWidth;
758
+ conditions: {
759
+ visible?: Condition[];
760
+ required?: Condition[];
761
+ readOnly?: Condition[];
762
+ disabled?: Condition[];
763
+ } | null;
764
+ dependsOnAny: boolean;
765
+ dependsOnKeys: string[] | null;
766
+ disabled: boolean;
767
+ editablePrefill: boolean;
768
+ helperText: string | null;
769
+ hidden: boolean;
770
+ label: string | null;
771
+ length: number;
772
+ name: string;
773
+ prefillRefreshOn: string[] | null;
774
+ prefillResetOn: string[] | null;
775
+ readOnly: boolean;
776
+ required: boolean;
777
+ tooltip: string | null;
778
+ value: unknown;
779
+ };
708
780
  export type Outlet = Record<string, never>;
709
781
  export type PageContainer = "centered" | "default";
710
782
  export type PageLayout = "app" | "auth" | "none";
@@ -741,8 +813,10 @@ export type PasswordInput = {
741
813
  placeholder: string | null;
742
814
  prefillRefreshOn: string[] | null;
743
815
  prefillResetOn: string[] | null;
816
+ prefix: Affix | null;
744
817
  readOnly: boolean;
745
818
  required: boolean;
819
+ suffix: Affix | null;
746
820
  tabIndex: number | null;
747
821
  tooltip: string | null;
748
822
  value: unknown;
@@ -758,6 +832,21 @@ export type ReloadComponentEffect = {
758
832
  readonly component: string;
759
833
  };
760
834
  export type ReloadPageEffect = object;
835
+ export type RemoteAccess = {
836
+ readonly source: string;
837
+ readonly audience: string;
838
+ readonly scopes: string[];
839
+ readonly nodeId: string;
840
+ readonly nodeType: string;
841
+ readonly tokenEndpoint: string;
842
+ readonly ref: string;
843
+ };
844
+ export type RemoteNode = {
845
+ type: "remote.data-list";
846
+ key?: string;
847
+ props: DataList;
848
+ schema?: Node[];
849
+ };
761
850
  export type Repeater = {
762
851
  addLabel: string | null;
763
852
  columnWidth: ColumnWidth;
@@ -873,6 +962,7 @@ export type Select = {
873
962
  tooltip: string | null;
874
963
  value: unknown;
875
964
  };
965
+ export type Side = "start" | "end";
876
966
  export type Sidebar = {
877
967
  collapsible: boolean;
878
968
  rememberState: boolean;
@@ -882,6 +972,7 @@ export type SortDirection = "asc" | "desc";
882
972
  export type Stack = {
883
973
  align: Align | null;
884
974
  direction: string | null;
975
+ float: Side | null;
885
976
  gap: Gap | null;
886
977
  height: Height | null;
887
978
  justify: Justify | null;
@@ -951,6 +1042,9 @@ export type Text = {
951
1042
  text: string;
952
1043
  };
953
1044
  export type TextColumn = {
1045
+ badge: {
1046
+ colorKey: string;
1047
+ } | null;
954
1048
  copyable: boolean;
955
1049
  date: {
956
1050
  format: string | null;
@@ -959,6 +1053,7 @@ export type TextColumn = {
959
1053
  href: string | null;
960
1054
  external: boolean;
961
1055
  } | null;
1056
+ multiple: string | null;
962
1057
  };
963
1058
  export type TextInput = {
964
1059
  autoComplete: string | null;
@@ -981,8 +1076,10 @@ export type TextInput = {
981
1076
  placeholder: string | null;
982
1077
  prefillRefreshOn: string[] | null;
983
1078
  prefillResetOn: string[] | null;
1079
+ prefix: Affix | null;
984
1080
  readOnly: boolean;
985
1081
  required: boolean;
1082
+ suffix: Affix | null;
986
1083
  tabIndex: number | null;
987
1084
  tooltip: string | null;
988
1085
  type: string | null;
@@ -1027,11 +1124,22 @@ export type ToastMessage = {
1027
1124
  dismissible: boolean;
1028
1125
  action: Node | null;
1029
1126
  variant: Variant;
1030
- message: string;
1127
+ message: Translatable | string;
1128
+ };
1129
+ export type ToggleSidebarEffect = {
1130
+ readonly target: string | null;
1031
1131
  };
1032
1132
  export type ToolCallPart = {
1033
1133
  args: Record<string, unknown>;
1034
1134
  name: string;
1035
1135
  };
1136
+ export type Topbar = {
1137
+ sticky: boolean;
1138
+ };
1139
+ export type Translatable = {
1140
+ payload: Record<string, string>;
1141
+ replacements: Record<string, string | number | boolean>;
1142
+ key: string;
1143
+ };
1036
1144
  export type Variant = "success" | "info" | "warning" | "error";
1037
- export type Width = "full" | "sm" | "md" | "lg" | "fill";
1145
+ export type Width = "full" | "auto" | "sm" | "md" | "lg" | "fill";
package/dist/vite.js CHANGED
@@ -3,7 +3,7 @@ import { svgSprite } from "@lattice-php/vite-svg-sprite";
3
3
  import { searchForWorkspaceRoot } from "vite";
4
4
  //#region resources/js/vite.ts
5
5
  function lattice(options = {}) {
6
- const plugins = [corePlugin(options)];
6
+ const plugins = [corePlugin(options), optionalPeersPlugin()];
7
7
  const iconOptions = resolveIconOptions(options);
8
8
  if (iconOptions) plugins.push(svgSprite(iconOptions));
9
9
  return plugins;
@@ -43,6 +43,37 @@ function corePlugin(options) {
43
43
  }
44
44
  };
45
45
  }
46
+ var OPTIONAL_PEER_STUB_PREFIX = "\0lattice-optional-peer/";
47
+ /**
48
+ * Real-time listeners statically import their optional Echo peers. A consumer
49
+ * that never uses real-time should still build, so stub a missing peer with
50
+ * hooks that throw — the `RealtimeListeners` error boundary then degrades
51
+ * gracefully and warns to install the peer, exactly as when it is absent.
52
+ */
53
+ var OPTIONAL_PEER_STUBS = { "@laravel/echo-react": [
54
+ "const missing = () => {",
55
+ " throw new Error(",
56
+ " \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",",
57
+ " );",
58
+ "};",
59
+ "export const useEcho = missing;",
60
+ "export const useEchoPublic = missing;",
61
+ "export const useEchoPresence = missing;"
62
+ ].join("\n") };
63
+ function optionalPeersPlugin() {
64
+ return {
65
+ name: "lattice:optional-peers",
66
+ enforce: "pre",
67
+ async resolveId(id) {
68
+ if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) return null;
69
+ return await this.resolve(id, void 0, { skipSelf: true }) ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;
70
+ },
71
+ load(id) {
72
+ if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) return null;
73
+ return OPTIONAL_PEER_STUBS[id.slice(23)] ?? null;
74
+ }
75
+ };
76
+ }
46
77
  function resolveIconOptions(options) {
47
78
  const icons = options.icons ?? true;
48
79
  if (icons === false) return null;
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import path from \"node:path\";\nimport { svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\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?: SvgSpriteOptions[\"dts\"] | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const plugins: PluginOption[] = [corePlugin(options)];\n const iconOptions = resolveIconOptions(options);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n alias: options.source\n ? {\n \"@lattice-php/lattice/css\": path.resolve(root, \"resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n }\n : {\n react: path.resolve(appRoot, \"node_modules/react\"),\n \"react-dom\": path.resolve(appRoot, \"node_modules/react-dom\"),\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[/\\\\]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\nfunction resolveIconOptions(options: LatticeViteOptions): 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/lattice\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [path.resolve(root, \"resources/icons\"), ...dirs],\n ...(dts === false ? {} : { dts: dts ?? defaultTypes }),\n };\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":";;;;AAmCA,SAAgB,QAAQ,UAA8B,CAAC,GAAmB;CACxE,MAAM,UAA0B,CAAC,WAAW,OAAO,CAAC;CACpD,MAAM,cAAc,mBAAmB,OAAO;CAE9C,IAAI,aACF,QAAQ,KAAK,UAAU,WAAW,CAAC;CAGrC,OAAO;AACT;AAEA,SAAgB,cAAc,UAA8B,CAAC,GAAmB;CAC9E,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;CAE9C,OAAO;EACL,SAAS;GACP,OAAO,QAAQ,SACX;IACE,4BAA4B,KAAK,QAAQ,MAAM,2BAA2B;IAC1E,wBAAwB,KAAK,QAAQ,MAAM,cAAc;GAC3D,IACA;IACE,OAAO,KAAK,QAAQ,SAAS,oBAAoB;IACjD,aAAa,KAAK,QAAQ,SAAS,wBAAwB;GAC7D;GACJ,QAAQ;IAAC;IAAoB;IAAS;GAAW;EACnD;EACA,QAAQ,QAAQ,SACZ,EACE,IAAI,EACF,OAAO,CAAC,uBAAuB,OAAO,GAAG,IAAI,EAC/C,EACF,IACA,KAAA;EACJ,MAAM,EACJ,QAAQ,EACN,MAAM,EACJ,QAAQ;GACN;GACA;GACA;GACA;GACA;EACF,EACF,EACF,EACF;CACF;AACF;AAEA,SAAS,WAAW,SAAqC;CACvD,OAAO;EACL,MAAM;EACN,SAAS;GACP,OAAO,cAAc,OAAO;EAC9B;CACF;AACF;AAEA,SAAS,mBAAmB,SAAsD;CAChF,MAAM,QAAQ,QAAQ,SAAS;CAE/B,IAAI,UAAU,OACZ,OAAO;CAGT,MAAM,EAAE,SAAS,aAAa,OAAO;CAErC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,GAAG,kBADP,UAAU,OAAO,CAAC,IAAI;CAE1C,MAAM,eAAe;EACnB,MAAM;EACN,eAAe;EACf,kBAAkB;CACpB;CAEA,OAAO;EACL,GAAG;EACH,UAAU,CAAC,KAAK,QAAQ,MAAM,iBAAiB,GAAG,GAAG,IAAI;EACzD,GAAI,QAAQ,QAAQ,CAAC,IAAI,EAAE,KAAK,OAAO,aAAa;CACtD;AACF;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 path from \"node:path\";\nimport { svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\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?: SvgSpriteOptions[\"dts\"] | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const plugins: PluginOption[] = [corePlugin(options), optionalPeersPlugin()];\n const iconOptions = resolveIconOptions(options);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n alias: options.source\n ? {\n \"@lattice-php/lattice/css\": path.resolve(root, \"resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n }\n : {\n react: path.resolve(appRoot, \"node_modules/react\"),\n \"react-dom\": path.resolve(appRoot, \"node_modules/react-dom\"),\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[/\\\\]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 ].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\nfunction resolveIconOptions(options: LatticeViteOptions): 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/lattice\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [path.resolve(root, \"resources/icons\"), ...dirs],\n ...(dts === false ? {} : { dts: dts ?? defaultTypes }),\n };\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":";;;;AAmCA,SAAgB,QAAQ,UAA8B,CAAC,GAAmB;CACxE,MAAM,UAA0B,CAAC,WAAW,OAAO,GAAG,oBAAoB,CAAC;CAC3E,MAAM,cAAc,mBAAmB,OAAO;CAE9C,IAAI,aACF,QAAQ,KAAK,UAAU,WAAW,CAAC;CAGrC,OAAO;AACT;AAEA,SAAgB,cAAc,UAA8B,CAAC,GAAmB;CAC9E,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;CAE9C,OAAO;EACL,SAAS;GACP,OAAO,QAAQ,SACX;IACE,4BAA4B,KAAK,QAAQ,MAAM,2BAA2B;IAC1E,wBAAwB,KAAK,QAAQ,MAAM,cAAc;GAC3D,IACA;IACE,OAAO,KAAK,QAAQ,SAAS,oBAAoB;IACjD,aAAa,KAAK,QAAQ,SAAS,wBAAwB;GAC7D;GACJ,QAAQ;IAAC;IAAoB;IAAS;GAAW;EACnD;EACA,QAAQ,QAAQ,SACZ,EACE,IAAI,EACF,OAAO,CAAC,uBAAuB,OAAO,GAAG,IAAI,EAC/C,EACF,IACA,KAAA;EACJ,MAAM,EACJ,QAAQ,EACN,MAAM,EACJ,QAAQ;GACN;GACA;GACA;GACA;GACA;EACF,EACF,EACF,EACF;CACF;AACF;AAEA,SAAS,WAAW,SAAqC;CACvD,OAAO;EACL,MAAM;EACN,SAAS;GACP,OAAO,cAAc,OAAO;EAC9B;CACF;AACF;AAEA,IAAM,4BAA4B;;;;;;;AAQlC,IAAM,sBAA8C,EAClD,uBAAuB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EAAE,KAAK,IAAI,EACb;AAEA,SAAS,sBAA8B;CACrC,OAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,IAAI;GAClB,IAAI,CAAC,OAAO,UAAU,eAAe,KAAK,qBAAqB,EAAE,GAC/D,OAAO;GAKT,OAAO,MAFiB,KAAK,QAAQ,IAAI,KAAA,GAAW,EAAE,UAAU,KAAK,CAAC,IAEnD,OAAO,GAAG,4BAA4B;EAC3D;EACA,KAAK,IAAI;GACP,IAAI,CAAC,GAAG,WAAW,yBAAyB,GAC1C,OAAO;GAGT,OAAO,oBAAoB,GAAG,MAAM,EAAgC,MAAM;EAC5E;CACF;AACF;AAEA,SAAS,mBAAmB,SAAsD;CAChF,MAAM,QAAQ,QAAQ,SAAS;CAE/B,IAAI,UAAU,OACZ,OAAO;CAGT,MAAM,EAAE,SAAS,aAAa,OAAO;CAErC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,GAAG,kBADP,UAAU,OAAO,CAAC,IAAI;CAE1C,MAAM,eAAe;EACnB,MAAM;EACN,eAAe;EACf,kBAAkB;CACpB;CAEA,OAAO;EACL,GAAG;EACH,UAAU,CAAC,KAAK,QAAQ,MAAM,iBAAiB,GAAG,GAAG,IAAI;EACzD,GAAI,QAAQ,QAAQ,CAAC,IAAI,EAAE,KAAK,OAAO,aAAa;CACtD;AACF;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lattice-php/lattice",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Server-driven React components for Laravel and Inertia.",
5
5
  "license": "MIT",
6
6
  "author": "Manuel Christlieb <manuel@christlieb.eu>",
@@ -127,10 +127,22 @@
127
127
  "types": "./dist/provider.d.ts",
128
128
  "import": "./dist/provider.js"
129
129
  },
130
+ "./realtime/*": {
131
+ "types": "./dist/realtime/*.d.ts",
132
+ "import": "./dist/realtime/*.js"
133
+ },
130
134
  "./registry": {
131
135
  "types": "./dist/registry.d.ts",
132
136
  "import": "./dist/registry.js"
133
137
  },
138
+ "./remote": {
139
+ "types": "./dist/remote/index.d.ts",
140
+ "import": "./dist/remote/index.js"
141
+ },
142
+ "./remote/*": {
143
+ "types": "./dist/remote/*.d.ts",
144
+ "import": "./dist/remote/*.js"
145
+ },
134
146
  "./table": {
135
147
  "types": "./dist/table/index.d.ts",
136
148
  "import": "./dist/table/index.js"
@@ -191,8 +203,8 @@
191
203
  "lint": "oxlint resources/js workbench/resources/js",
192
204
  "lint:fix": "oxlint resources/js workbench/resources/js --fix",
193
205
  "lint:github": "oxlint resources/js workbench/resources/js --format=github",
194
- "format": "oxfmt --write \"resources/js/**/*.{ts,tsx}\" \"workbench/resources/js/**/*.{ts,tsx}\"",
195
- "format:check": "oxfmt --check \"resources/js/**/*.{ts,tsx}\" \"workbench/resources/js/**/*.{ts,tsx}\"",
206
+ "format": "oxfmt --write \"resources/js/**/*.{ts,tsx}\" \"workbench/resources/js/**/*.{ts,tsx}\" \"docs/**/*.{ts,tsx,md,mdx}\"",
207
+ "format:check": "oxfmt --check \"resources/js/**/*.{ts,tsx}\" \"workbench/resources/js/**/*.{ts,tsx}\" \"docs/**/*.{ts,tsx,md,mdx}\"",
196
208
  "analyze": "SONDA=1 vite build && mkdir -p docs/public && cp docs/generated/bundle-report.html docs/public/bundle-report.html",
197
209
  "docs:dev": "npm run analyze && astro dev",
198
210
  "docs:build": "npm run analyze && astro build",
@@ -218,14 +230,26 @@
218
230
  "clsx": "^2.1.1",
219
231
  "i18next": "^26.3.1",
220
232
  "i18next-http-backend": "^4.0.0",
233
+ "input-otp": "^1.4.2",
221
234
  "recharts": "^3.8.1",
235
+ "starlight-llms-txt": "^0.10.0",
222
236
  "tailwind-merge": "^3.0.1"
223
237
  },
224
238
  "peerDependencies": {
225
239
  "@inertiajs/react": "^3.0.0",
240
+ "@laravel/echo-react": "^2.0.0",
241
+ "pusher-js": "^8.0.0",
226
242
  "react": "^19.0.0",
227
243
  "react-dom": "^19.0.0"
228
244
  },
245
+ "peerDependenciesMeta": {
246
+ "@laravel/echo-react": {
247
+ "optional": true
248
+ },
249
+ "pusher-js": {
250
+ "optional": true
251
+ }
252
+ },
229
253
  "devDependencies": {
230
254
  "@astrojs/react": "^5.0.7",
231
255
  "@astrojs/starlight": "^0.40.0",
@@ -233,6 +257,7 @@
233
257
  "@codecov/vite-plugin": "^2.0.1",
234
258
  "@inertiajs/react": "^3.0.0",
235
259
  "@inertiajs/vite": "^3.0.0",
260
+ "@laravel/echo-react": "^2.3.7",
236
261
  "@tailwindcss/vite": "^4.1.11",
237
262
  "@testing-library/dom": "^10.4.1",
238
263
  "@testing-library/jest-dom": "^6.9.1",
@@ -243,12 +268,17 @@
243
268
  "@vitejs/plugin-react": "^6.0.2",
244
269
  "@vitest/coverage-v8": "^4.1.8",
245
270
  "astro": "7.0.0-beta.3",
271
+ "astro-og-canvas": "^0.11.1",
272
+ "canvaskit-wasm": "^0.41.1",
246
273
  "jsdom": "^29.1.1",
274
+ "laravel-echo": "^2.3.7",
247
275
  "laravel-vite-plugin": "^3.0.0",
248
276
  "lucide-static": "^1.18.0",
277
+ "mermaid": "^11.15.0",
249
278
  "oxfmt": "^0.54.0",
250
279
  "oxlint": "^1.68.0",
251
280
  "playwright": "^1.60.0",
281
+ "pusher-js": "^8.5.0",
252
282
  "react": "^19.2.0",
253
283
  "react-dom": "^19.2.0",
254
284
  "react-scan": "^0.5.7",