@lattice-php/lattice 0.2.0 → 0.4.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/README.md +3 -1
- package/dist/action/components/action-form.d.ts +2 -2
- package/dist/action/components/action-form.js +35 -67
- package/dist/action/components/action-form.js.map +1 -1
- package/dist/action/components/action-group.js +18 -6
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action-menu-context.d.ts +6 -0
- package/dist/action/components/action-menu-context.js +18 -0
- package/dist/action/components/action-menu-context.js.map +1 -0
- package/dist/action/components/action.js +20 -13
- package/dist/action/components/action.js.map +1 -1
- package/dist/action/index.js.map +1 -1
- package/dist/appearance/index.js +7 -2
- package/dist/appearance/index.js.map +1 -1
- package/dist/chat/components/chat-box.d.ts +3 -0
- package/dist/chat/components/chat-box.js +53 -0
- package/dist/chat/components/chat-box.js.map +1 -0
- package/dist/chat/components/message-list.d.ts +5 -0
- package/dist/chat/components/message-list.js +22 -0
- package/dist/chat/components/message-list.js.map +1 -0
- package/dist/chat/components/message.d.ts +5 -0
- package/dist/chat/components/message.js +20 -0
- package/dist/chat/components/message.js.map +1 -0
- package/dist/chat/components/prompt-input.d.ts +8 -0
- package/dist/chat/components/prompt-input.js +49 -0
- package/dist/chat/components/prompt-input.js.map +1 -0
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +15 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/parts/text.d.ts +3 -0
- package/dist/chat/parts/text.js +12 -0
- package/dist/chat/parts/text.js.map +1 -0
- package/dist/chat/parts/tool-call.d.ts +3 -0
- package/dist/chat/parts/tool-call.js +20 -0
- package/dist/chat/parts/tool-call.js.map +1 -0
- package/dist/chat/transport.d.ts +4 -0
- package/dist/chat/transport.js +67 -0
- package/dist/chat/transport.js.map +1 -0
- package/dist/chat/types.d.ts +39 -0
- package/dist/chat/use-chat.d.ts +15 -0
- package/dist/chat/use-chat.js +161 -0
- package/dist/chat/use-chat.js.map +1 -0
- package/dist/core/api.d.ts +25 -0
- package/dist/core/api.js +127 -0
- package/dist/core/api.js.map +1 -0
- package/dist/core/collapsed-context.d.ts +2 -0
- package/dist/core/collapsed-context.js +10 -0
- package/dist/core/collapsed-context.js.map +1 -0
- package/dist/core/column-sizing.d.ts +17 -0
- package/dist/core/column-sizing.js +61 -0
- package/dist/core/column-sizing.js.map +1 -0
- package/dist/core/components/badge.js +3 -3
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/button.d.ts +1 -1
- package/dist/core/components/button.js +19 -15
- package/dist/core/components/button.js.map +1 -1
- package/dist/core/components/card.js +1 -1
- package/dist/core/components/card.js.map +1 -1
- package/dist/core/components/chart.d.ts +3 -0
- package/dist/core/components/chart.js +175 -0
- package/dist/core/components/chart.js.map +1 -0
- package/dist/{form/components/base → core/components}/checkbox.js +4 -4
- package/dist/core/components/checkbox.js.map +1 -0
- package/dist/core/components/combobox.d.ts +33 -0
- package/dist/core/components/combobox.js +99 -0
- package/dist/core/components/combobox.js.map +1 -0
- package/dist/core/components/confirm-dialog.js +6 -12
- package/dist/core/components/confirm-dialog.js.map +1 -1
- package/dist/core/components/control.d.ts +13 -0
- package/dist/core/components/control.js +27 -0
- package/dist/core/components/control.js.map +1 -0
- package/dist/core/components/dialog.d.ts +19 -0
- package/dist/core/components/dialog.js +76 -0
- package/dist/core/components/dialog.js.map +1 -0
- package/dist/core/components/dropdown-menu.d.ts +14 -0
- package/dist/core/components/dropdown-menu.js +42 -0
- package/dist/core/components/dropdown-menu.js.map +1 -0
- package/dist/core/components/floating-panel.d.ts +3 -0
- package/dist/core/components/floating-panel.js +65 -0
- package/dist/core/components/floating-panel.js.map +1 -0
- package/dist/core/components/fragment.js +25 -13
- package/dist/core/components/fragment.js.map +1 -1
- package/dist/core/components/grid.js.map +1 -1
- package/dist/core/components/heading.js +1 -1
- package/dist/core/components/heading.js.map +1 -1
- package/dist/core/components/icon.js +1 -0
- package/dist/core/components/icon.js.map +1 -1
- package/dist/core/components/index.js +8 -1
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/info-tooltip.d.ts +3 -0
- package/dist/core/components/info-tooltip.js +26 -0
- package/dist/core/components/info-tooltip.js.map +1 -0
- package/dist/core/components/link.js +12 -6
- package/dist/core/components/link.js.map +1 -1
- package/dist/core/components/modal.js +9 -31
- package/dist/core/components/modal.js.map +1 -1
- package/dist/core/components/popover.d.ts +8 -0
- package/dist/core/components/popover.js +37 -0
- package/dist/core/components/popover.js.map +1 -0
- package/dist/core/components/raw-block.d.ts +3 -0
- package/dist/core/components/raw-block.js +10 -0
- package/dist/core/components/raw-block.js.map +1 -0
- package/dist/core/components/section.js +8 -12
- package/dist/core/components/section.js.map +1 -1
- package/dist/core/components/segmented-control.js.map +1 -1
- package/dist/core/components/segmented-pills.js +1 -1
- package/dist/core/components/segmented-pills.js.map +1 -1
- package/dist/core/components/skeleton.d.ts +3 -0
- package/dist/core/components/skeleton.js +16 -0
- package/dist/core/components/skeleton.js.map +1 -0
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/stack.js +25 -8
- package/dist/core/components/stack.js.map +1 -1
- package/dist/core/components/tabs.js +1 -1
- package/dist/core/components/tabs.js.map +1 -1
- package/dist/core/components/text.js +17 -1
- package/dist/core/components/text.js.map +1 -1
- package/dist/core/headers.d.ts +1 -0
- package/dist/core/headers.js +14 -0
- package/dist/core/headers.js.map +1 -0
- package/dist/core/registry-context.d.ts +21 -0
- package/dist/core/registry-context.js +40 -0
- package/dist/core/registry-context.js.map +1 -0
- package/dist/core/registry.d.ts +4 -1
- package/dist/core/registry.js +10 -1
- package/dist/core/registry.js.map +1 -1
- package/dist/core/renderer.d.ts +8 -14
- package/dist/core/renderer.js +17 -27
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/test-id.d.ts +8 -0
- package/dist/core/test-id.js +21 -0
- package/dist/core/test-id.js.map +1 -0
- package/dist/core/types.d.ts +25 -9
- package/dist/core/use-column-resizing.d.ts +27 -0
- package/dist/core/use-column-resizing.js +228 -0
- package/dist/core/use-column-resizing.js.map +1 -0
- package/dist/effects/dispatch.d.ts +20 -0
- package/dist/effects/dispatch.js +39 -0
- package/dist/effects/dispatch.js.map +1 -0
- package/dist/effects/registry.d.ts +38 -0
- package/dist/effects/registry.js +51 -0
- package/dist/effects/registry.js.map +1 -0
- package/dist/effects/use-effect-dispatcher.d.ts +8 -0
- package/dist/effects/use-effect-dispatcher.js +20 -0
- package/dist/effects/use-effect-dispatcher.js.map +1 -0
- package/dist/effects/use-flash-effects.d.ts +5 -0
- package/dist/effects/use-flash-effects.js +22 -0
- package/dist/effects/use-flash-effects.js.map +1 -0
- package/dist/events/event-bridge.d.ts +3 -7
- package/dist/events/event-bridge.js +17 -47
- package/dist/events/event-bridge.js.map +1 -1
- package/dist/events/event-names.d.ts +3 -1
- package/dist/events/event-names.js +3 -1
- package/dist/events/event-names.js.map +1 -1
- package/dist/form/components/base/affix-group.d.ts +17 -0
- package/dist/form/components/base/affix-group.js +49 -0
- package/dist/form/components/base/affix-group.js.map +1 -0
- package/dist/form/components/base/field.d.ts +2 -1
- package/dist/form/components/base/field.js +17 -2
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/base/input-error.js +1 -1
- package/dist/form/components/base/input-error.js.map +1 -1
- package/dist/form/components/base/input.js +2 -1
- package/dist/form/components/base/input.js.map +1 -1
- package/dist/form/components/base/label.js +1 -1
- package/dist/form/components/base/label.js.map +1 -1
- package/dist/form/components/base/password-input.js.map +1 -1
- package/dist/form/components/base/submit-button.js +4 -2
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/base/textarea.js +2 -1
- package/dist/form/components/base/textarea.js.map +1 -1
- package/dist/form/components/conditions.js.map +1 -1
- package/dist/form/components/context.d.ts +1 -0
- package/dist/form/components/context.js +1 -0
- package/dist/form/components/context.js.map +1 -1
- package/dist/form/components/field-props.d.ts +4 -0
- package/dist/form/components/field-props.js.map +1 -1
- package/dist/form/components/field-scope.d.ts +21 -0
- package/dist/form/components/field-scope.js +54 -0
- package/dist/form/components/field-scope.js.map +1 -0
- package/dist/form/components/fields/block-add-menu.d.ts +9 -0
- package/dist/form/components/fields/block-add-menu.js +27 -0
- package/dist/form/components/fields/block-add-menu.js.map +1 -0
- package/dist/form/components/fields/builder.d.ts +2 -0
- package/dist/form/components/fields/builder.js +124 -0
- package/dist/form/components/fields/builder.js.map +1 -0
- package/dist/form/components/fields/checkbox.d.ts +1 -1
- package/dist/form/components/fields/checkbox.js +14 -11
- package/dist/form/components/fields/checkbox.js.map +1 -1
- package/dist/form/components/fields/choice.d.ts +1 -1
- package/dist/form/components/fields/choice.js +5 -4
- package/dist/form/components/fields/choice.js.map +1 -1
- package/dist/form/components/fields/date-input.d.ts +1 -1
- package/dist/form/components/fields/date-input.js +2 -1
- package/dist/form/components/fields/date-input.js.map +1 -1
- package/dist/form/components/fields/file-upload.d.ts +2 -0
- package/dist/form/components/fields/file-upload.js +282 -0
- package/dist/form/components/fields/file-upload.js.map +1 -0
- package/dist/form/components/fields/hidden-input.d.ts +1 -1
- package/dist/form/components/fields/hidden-input.js +11 -5
- package/dist/form/components/fields/hidden-input.js.map +1 -1
- package/dist/form/components/fields/number-input.d.ts +1 -1
- package/dist/form/components/fields/number-input.js +23 -15
- package/dist/form/components/fields/number-input.js.map +1 -1
- package/dist/form/components/fields/password-input.d.ts +1 -1
- package/dist/form/components/fields/password-input.js +42 -27
- package/dist/form/components/fields/password-input.js.map +1 -1
- package/dist/form/components/fields/repeater-rows.d.ts +12 -0
- package/dist/form/components/fields/repeater-rows.js +46 -0
- package/dist/form/components/fields/repeater-rows.js.map +1 -0
- package/dist/form/components/fields/repeater.d.ts +2 -0
- package/dist/form/components/fields/repeater.js +97 -0
- package/dist/form/components/fields/repeater.js.map +1 -0
- package/dist/form/components/fields/rich-editor.d.ts +1 -1
- package/dist/form/components/fields/rich-editor.js +39 -11
- package/dist/form/components/fields/rich-editor.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.d.ts +17 -0
- package/dist/form/components/fields/row-action-menu.js +61 -0
- package/dist/form/components/fields/row-action-menu.js.map +1 -0
- package/dist/form/components/fields/row-actions.d.ts +10 -0
- package/dist/form/components/fields/row-actions.js +45 -0
- package/dist/form/components/fields/row-actions.js.map +1 -0
- package/dist/form/components/fields/row-item.d.ts +27 -0
- package/dist/form/components/fields/row-item.js +69 -0
- package/dist/form/components/fields/row-item.js.map +1 -0
- package/dist/form/components/fields/select.d.ts +1 -1
- package/dist/form/components/fields/select.js +69 -104
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/simple-field.js +1 -0
- package/dist/form/components/fields/simple-field.js.map +1 -1
- package/dist/form/components/fields/table-rows.d.ts +32 -0
- package/dist/form/components/fields/table-rows.js +188 -0
- package/dist/form/components/fields/table-rows.js.map +1 -0
- package/dist/form/components/fields/text-input.d.ts +1 -1
- package/dist/form/components/fields/text-input.js +19 -12
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/textarea.d.ts +1 -1
- package/dist/form/components/fields/textarea.js +2 -1
- package/dist/form/components/fields/textarea.js.map +1 -1
- package/dist/form/components/fields/use-flip-reorder.d.ts +6 -0
- package/dist/form/components/fields/use-flip-reorder.js +51 -0
- package/dist/form/components/fields/use-flip-reorder.js.map +1 -0
- package/dist/form/components/fields/use-row-collection.d.ts +11 -0
- package/dist/form/components/fields/use-row-collection.js +44 -0
- package/dist/form/components/fields/use-row-collection.js.map +1 -0
- package/dist/form/components/form-path.d.ts +5 -0
- package/dist/form/components/form-path.js +40 -0
- package/dist/form/components/form-path.js.map +1 -0
- package/dist/form/components/form-transport.d.ts +3 -4
- package/dist/form/components/form-transport.js +17 -18
- package/dist/form/components/form-transport.js.map +1 -1
- package/dist/form/components/form.js +24 -18
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/index.d.ts +3 -0
- package/dist/form/components/index.js +4 -1
- package/dist/form/components/override-keys.d.ts +2 -0
- package/dist/form/components/override-keys.js +12 -0
- package/dist/form/components/override-keys.js.map +1 -0
- package/dist/form/components/prefill-context.d.ts +5 -0
- package/dist/form/components/prefill-context.js +11 -0
- package/dist/form/components/prefill-context.js.map +1 -0
- package/dist/form/components/prefill-targets.d.ts +17 -0
- package/dist/form/components/prefill-targets.js +73 -0
- package/dist/form/components/prefill-targets.js.map +1 -0
- package/dist/form/components/resolved-nodes.js +4 -1
- package/dist/form/components/resolved-nodes.js.map +1 -1
- package/dist/form/components/row-layout-context.d.ts +5 -0
- package/dist/form/components/row-layout-context.js +18 -0
- package/dist/form/components/row-layout-context.js.map +1 -0
- package/dist/form/components/use-controlled-field.d.ts +2 -0
- package/dist/form/components/use-controlled-field.js +13 -5
- package/dist/form/components/use-controlled-field.js.map +1 -1
- package/dist/form/components/use-dependent-field.js +7 -1
- package/dist/form/components/use-dependent-field.js.map +1 -1
- package/dist/form/components/use-field-commit.d.ts +4 -0
- package/dist/form/components/use-field-commit.js +21 -7
- package/dist/form/components/use-field-commit.js.map +1 -1
- package/dist/form/components/use-form-resolver.d.ts +6 -1
- package/dist/form/components/use-form-resolver.js +50 -5
- package/dist/form/components/use-form-resolver.js.map +1 -1
- package/dist/form/components/use-seed-default.js +8 -3
- package/dist/form/components/use-seed-default.js.map +1 -1
- package/dist/form/components/values.js +20 -5
- package/dist/form/components/values.js.map +1 -1
- package/dist/form/index.js +13 -10
- package/dist/form/index.js.map +1 -1
- package/dist/form/skeleton.js +5 -4
- package/dist/form/skeleton.js.map +1 -1
- package/dist/i18n/backend.d.ts +7 -5
- package/dist/i18n/backend.js +23 -8
- package/dist/i18n/backend.js.map +1 -1
- package/dist/i18n/config.d.ts +6 -0
- package/dist/i18n/config.js +36 -0
- package/dist/i18n/config.js.map +1 -0
- package/dist/i18n/index.d.ts +7 -1
- package/dist/i18n/index.js +5 -1
- package/dist/i18n/instance.d.ts +27 -0
- package/dist/i18n/instance.js +63 -16
- package/dist/i18n/instance.js.map +1 -1
- package/dist/i18n/locale-reload.d.ts +3 -0
- package/dist/i18n/locale-reload.js +17 -0
- package/dist/i18n/locale-reload.js.map +1 -0
- package/dist/i18n/locale-switcher.d.ts +21 -0
- package/dist/i18n/locale-switcher.js +25 -0
- package/dist/i18n/locale-switcher.js.map +1 -0
- package/dist/i18n/locale.d.ts +9 -0
- package/dist/i18n/locale.js +93 -0
- package/dist/i18n/locale.js.map +1 -0
- package/dist/i18n/page-props.d.ts +3 -0
- package/dist/i18n/page-props.js +24 -0
- package/dist/i18n/page-props.js.map +1 -0
- package/dist/i18n/translatable.d.ts +4 -0
- package/dist/i18n/translatable.js +24 -0
- package/dist/i18n/translatable.js.map +1 -0
- package/dist/index.d.ts +20 -8
- package/dist/index.js +19 -7
- package/dist/inertia.d.ts +2 -1
- package/dist/inertia.js +9 -2
- package/dist/inertia.js.map +1 -1
- package/dist/lattice.css +148 -22
- package/dist/layout/breadcrumbs.d.ts +3 -0
- package/dist/layout/breadcrumbs.js +34 -0
- package/dist/layout/breadcrumbs.js.map +1 -0
- package/dist/layout/callouts.d.ts +3 -0
- package/dist/layout/callouts.js +67 -0
- package/dist/layout/callouts.js.map +1 -0
- package/dist/layout/components.js +9 -1
- package/dist/layout/components.js.map +1 -1
- package/dist/layout/context.d.ts +2 -10
- package/dist/layout/context.js +3 -14
- package/dist/layout/context.js.map +1 -1
- package/dist/layout/dropdown.d.ts +3 -0
- package/dist/layout/dropdown.js +24 -0
- package/dist/layout/dropdown.js.map +1 -0
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.js +3 -1
- package/dist/layout/menu-item.js +54 -62
- package/dist/layout/menu-item.js.map +1 -1
- package/dist/layout/menu.js.map +1 -1
- package/dist/layout/outlet.js +2 -2
- package/dist/layout/outlet.js.map +1 -1
- package/dist/layout/popover.d.ts +17 -0
- package/dist/layout/popover.js +46 -0
- package/dist/layout/popover.js.map +1 -0
- package/dist/layout/schema-layout.js +2 -9
- package/dist/layout/schema-layout.js.map +1 -1
- package/dist/layout/sidebar.js +4 -4
- package/dist/layout/sidebar.js.map +1 -1
- package/dist/layout/topbar.d.ts +3 -0
- package/dist/layout/topbar.js +15 -0
- package/dist/layout/topbar.js.map +1 -0
- package/dist/page.js +16 -17
- package/dist/page.js.map +1 -1
- package/dist/provider.d.ts +2 -4
- package/dist/provider.js +5 -9
- package/dist/provider.js.map +1 -1
- package/dist/realtime/build-effects.d.ts +4 -0
- package/dist/realtime/build-effects.js +23 -0
- package/dist/realtime/build-effects.js.map +1 -0
- package/dist/realtime/listeners.d.ts +8 -0
- package/dist/realtime/listeners.js +31 -0
- package/dist/realtime/listeners.js.map +1 -0
- package/dist/realtime/subscriptions.d.ts +4 -0
- package/dist/realtime/subscriptions.js +45 -0
- package/dist/realtime/subscriptions.js.map +1 -0
- package/dist/registry.js +3 -1
- package/dist/registry.js.map +1 -1
- package/dist/remote/components/chat-box.d.ts +3 -0
- package/dist/remote/components/chat-box.js +65 -0
- package/dist/remote/components/chat-box.js.map +1 -0
- package/dist/remote/components/data-list.d.ts +10 -0
- package/dist/remote/components/data-list.js +106 -0
- package/dist/remote/components/data-list.js.map +1 -0
- package/dist/remote/index.d.ts +1 -0
- package/dist/remote/index.js +15 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/svg-sprite-client/index.d.ts +1 -0
- package/dist/svg-sprite-client/index.js +0 -0
- package/dist/svg-sprite-client.d.ts +1 -0
- package/dist/table/align.d.ts +4 -0
- package/dist/table/align.js +23 -0
- package/dist/table/align.js.map +1 -0
- package/dist/table/bulk.js +1 -1
- package/dist/table/bulk.js.map +1 -1
- package/dist/table/components/bulk-bar.js +8 -5
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.d.ts +2 -5
- package/dist/table/components/cells/badge-cell.js +3 -3
- package/dist/table/components/cells/badge-cell.js.map +1 -1
- package/dist/table/components/cells/boolean-cell.d.ts +3 -0
- package/dist/table/components/cells/boolean-cell.js +23 -0
- package/dist/table/components/cells/boolean-cell.js.map +1 -0
- package/dist/table/components/cells/icon-cell.d.ts +2 -5
- package/dist/table/components/cells/icon-cell.js +4 -5
- package/dist/table/components/cells/icon-cell.js.map +1 -1
- package/dist/table/components/cells/image-cell.d.ts +2 -5
- package/dist/table/components/cells/image-cell.js +4 -5
- package/dist/table/components/cells/image-cell.js.map +1 -1
- package/dist/table/components/cells/money-cell.d.ts +2 -0
- package/dist/table/components/cells/money-cell.js +28 -0
- package/dist/table/components/cells/money-cell.js.map +1 -0
- package/dist/table/components/cells/number-cell.d.ts +2 -0
- package/dist/table/components/cells/number-cell.js +25 -0
- package/dist/table/components/cells/number-cell.js.map +1 -0
- package/dist/table/components/cells/numeric.d.ts +2 -0
- package/dist/table/components/cells/numeric.js +10 -0
- package/dist/table/components/cells/numeric.js.map +1 -0
- package/dist/table/components/cells/stack-cell.d.ts +3 -0
- package/dist/table/components/cells/stack-cell.js +17 -0
- package/dist/table/components/cells/stack-cell.js.map +1 -0
- package/dist/table/components/cells/text-cell.d.ts +2 -6
- package/dist/table/components/cells/text-cell.js +6 -7
- package/dist/table/components/cells/text-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.d.ts +4 -1
- package/dist/table/components/column-filter-control.js +82 -11
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.d.ts +3 -1
- package/dist/table/components/column-header.js +11 -8
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/filter-bar.d.ts +16 -0
- package/dist/table/components/filter-bar.js +104 -0
- package/dist/table/components/filter-bar.js.map +1 -0
- package/dist/table/components/filter-controls.d.ts +18 -0
- package/dist/table/components/filter-controls.js +256 -0
- package/dist/table/components/filter-controls.js.map +1 -0
- package/dist/table/components/filter-stack-bar.js +4 -3
- package/dist/table/components/filter-stack-bar.js.map +1 -1
- package/dist/table/components/filter-value-input.d.ts +1 -0
- package/dist/table/components/filter-value-input.js +7 -6
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.js +1 -1
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.js +1 -1
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-action-node.js.map +1 -1
- package/dist/table/components/table-cell.d.ts +1 -1
- package/dist/table/components/table-cell.js +18 -28
- package/dist/table/components/table-cell.js.map +1 -1
- package/dist/table/components/table.js +200 -152
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/filter-values.d.ts +13 -0
- package/dist/table/filter-values.js +30 -0
- package/dist/table/filter-values.js.map +1 -0
- package/dist/table/format.js.map +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/table/payload.js +24 -3
- package/dist/table/payload.js.map +1 -1
- package/dist/table/query.d.ts +10 -1
- package/dist/table/query.js +60 -6
- package/dist/table/query.js.map +1 -1
- package/dist/table/registry.d.ts +19 -0
- package/dist/table/registry.js +14 -0
- package/dist/table/registry.js.map +1 -0
- package/dist/table/types.d.ts +9 -19
- package/dist/table/use-table.d.ts +8 -2
- package/dist/table/use-table.js +61 -7
- package/dist/table/use-table.js.map +1 -1
- package/dist/toast/callout.d.ts +6 -0
- package/dist/toast/callout.js +31 -0
- package/dist/toast/callout.js.map +1 -0
- package/dist/toast/index.d.ts +4 -0
- package/dist/toast/index.js +3 -1
- package/dist/toast/toast.d.ts +14 -0
- package/dist/toast/toast.js +54 -0
- package/dist/toast/toast.js.map +1 -0
- package/dist/toast/toaster.js +14 -77
- package/dist/toast/toaster.js.map +1 -1
- package/dist/toast/variant-styles.d.ts +6 -0
- package/dist/toast/variant-styles.js +37 -0
- package/dist/toast/variant-styles.js.map +1 -0
- package/dist/types/generated.d.ts +547 -103
- package/dist/types/vite-env.d.ts +1 -0
- package/dist/vite.d.ts +25 -0
- package/dist/vite.js +72 -0
- package/dist/vite.js.map +1 -0
- package/package.json +130 -13
- package/resources/icons/rotate-ccw.svg +16 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/action/effects.d.ts +0 -11
- package/dist/action/effects.js +0 -44
- package/dist/action/effects.js.map +0 -1
- package/dist/form/components/base/checkbox.js.map +0 -1
- package/dist/node_modules/i18next/dist/esm/i18next.js +0 -1982
- package/dist/node_modules/i18next/dist/esm/i18next.js.map +0 -1
- package/dist/node_modules/i18next-http-backend/esm/index.js +0 -352
- package/dist/node_modules/i18next-http-backend/esm/index.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/context.js +0 -23
- package/dist/node_modules/react-i18next/dist/es/context.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -29
- package/dist/node_modules/react-i18next/dist/es/defaults.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -10
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -14
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -30
- package/dist/node_modules/react-i18next/dist/es/unescape.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -157
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js.map +0 -1
- package/dist/node_modules/react-i18next/dist/es/utils.js +0 -58
- package/dist/node_modules/react-i18next/dist/es/utils.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -70
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -61
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
- package/dist/table/column-registry.d.ts +0 -9
- package/dist/test-support.d.ts +0 -14
- package/dist/test-support.js +0 -14
- package/dist/test-support.js.map +0 -1
- /package/dist/{table/column-registry.js → chat/types.js} +0 -0
- /package/dist/{form/components/base → core/components}/checkbox.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","names":[],"sources":["../../../resources/js/core/components/stack.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice/lattice/core/types\";\nimport { cn } from \"@lattice/lattice/lib/utils\";\n\nconst gridAlignments: Record<string, string> = {\n center: \"justify-items-center text-center\",\n start: \"justify-items-start text-left\",\n stretch: \"justify-items-stretch\",\n};\n\nconst flexAlignments: Record<string, string> = {\n center: \"items-center
|
|
1
|
+
{"version":3,"file":"stack.js","names":[],"sources":["../../../resources/js/core/components/stack.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nconst gridAlignments: Record<string, string> = {\n center: \"justify-items-center text-center\",\n start: \"justify-items-start text-left\",\n stretch: \"justify-items-stretch\",\n};\n\nconst flexAlignments: Record<string, string> = {\n center: \"items-center text-center\",\n start: \"items-center text-left\",\n stretch: \"items-stretch justify-stretch\",\n};\n\nconst stackGaps: Record<string, string> = {\n none: \"gap-0\",\n xs: \"gap-1\",\n lg: \"gap-6\",\n md: \"gap-4\",\n sm: \"gap-2\",\n xl: \"gap-8\",\n};\n\nconst stackWidths: Record<string, string> = {\n auto: \"w-auto\",\n fill: \"min-w-0 flex-1\",\n full: \"w-full\",\n lg: \"mx-auto w-full max-w-4xl\",\n md: \"mx-auto w-full max-w-2xl\",\n sm: \"mx-auto w-full max-w-md\",\n};\n\nconst justifyClasses: Record<string, string> = {\n around: \"justify-around\",\n between: \"justify-between\",\n center: \"justify-center\",\n end: \"justify-end\",\n evenly: \"justify-evenly\",\n start: \"justify-start\",\n};\n\nconst stackHeights: Record<string, string> = {\n full: \"h-full\",\n screen: \"min-h-screen\",\n};\n\nconst floatClasses: Record<string, string> = {\n end: \"ml-auto\",\n start: \"mr-auto\",\n};\n\nconst StackComponent: RendererComponent<\"stack\"> = ({ children, node }) => {\n const align = node.props.align ?? \"stretch\";\n const direction = node.props.direction ?? \"column\";\n const gap = node.props.gap ?? \"md\";\n const width = node.props.width ?? \"full\";\n const justify = node.props.justify;\n const height = node.props.height;\n const float = node.props.float;\n const isFlex = direction === \"row\" || justify != null;\n\n return (\n <div\n data-lattice-component={node.id}\n className={cn(\n isFlex ? cn(\"flex\", direction === \"row\" ? \"flex-wrap\" : \"flex-col\") : \"grid content-start\",\n isFlex\n ? (flexAlignments[align] ?? flexAlignments.stretch)\n : (gridAlignments[align] ?? gridAlignments.stretch),\n stackGaps[gap] ?? stackGaps.md,\n stackWidths[width] ?? stackWidths.full,\n justify ? justifyClasses[justify] : null,\n height ? stackHeights[height] : null,\n float ? floatClasses[float] : null,\n )}\n >\n {children}\n </div>\n );\n};\n\nexport default StackComponent;\n"],"mappings":";;;AAGA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,OAAO;CACP,SAAS;AACX;AAEA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,OAAO;CACP,SAAS;AACX;AAEA,IAAM,YAAoC;CACxC,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,cAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,OAAO;AACT;AAEA,IAAM,eAAuC;CAC3C,MAAM;CACN,QAAQ;AACV;AAEA,IAAM,eAAuC;CAC3C,KAAK;CACL,OAAO;AACT;AAEA,IAAM,kBAA8C,EAAE,UAAU,WAAW;CACzE,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,YAAY,KAAK,MAAM,aAAa;CAC1C,MAAM,MAAM,KAAK,MAAM,OAAO;CAC9B,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,UAAU,KAAK,MAAM;CAC3B,MAAM,SAAS,KAAK,MAAM;CAC1B,MAAM,QAAQ,KAAK,MAAM;CACzB,MAAM,SAAS,cAAc,SAAS,WAAW;CAEjD,OACE,oBAAC,OAAD;EACE,0BAAwB,KAAK;EAC7B,WAAW,GACT,SAAS,GAAG,QAAQ,cAAc,QAAQ,cAAc,UAAU,IAAI,sBACtE,SACK,eAAe,UAAU,eAAe,UACxC,eAAe,UAAU,eAAe,SAC7C,UAAU,QAAQ,UAAU,IAC5B,YAAY,UAAU,YAAY,MAClC,UAAU,eAAe,WAAW,MACpC,SAAS,aAAa,UAAU,MAChC,QAAQ,aAAa,SAAS,IAChC;EAEC;CACE,CAAA;AAET"}
|
|
@@ -101,7 +101,7 @@ var TabsComponent = ({ children, node }) => {
|
|
|
101
101
|
"aria-controls": `${tab.value}-panel`,
|
|
102
102
|
"aria-selected": isActive,
|
|
103
103
|
"data-test": `tab-${tab.value}`,
|
|
104
|
-
className: cn("whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors", isActive ? "bg-lt-bg text-lt-fg shadow-xs" : "text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg", isVertical && "text-left"),
|
|
104
|
+
className: cn("whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors", isActive ? "bg-lt-bg text-lt-fg shadow-lt-xs" : "text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg", isVertical && "text-left"),
|
|
105
105
|
id: `${tab.value}-tab`,
|
|
106
106
|
onClick: () => selectTab(tab),
|
|
107
107
|
onKeyDown: onTablistKeyDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":[],"sources":["../../../resources/js/core/components/tabs.tsx"],"sourcesContent":["import { router } from \"@inertiajs/react\";\nimport { createContext, useContext, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport type { Node, RendererComponent } from \"@lattice/lattice/core/types\";\nimport type { Tab } from \"@lattice/lattice/types/generated\";\nimport { cn } from \"@lattice/lattice/lib/utils\";\nimport { useT } from \"@lattice/lattice/i18n\";\n\ntype TabsContextValue = {\n activeValue: string;\n setActiveValue: (value: string) => void;\n};\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext);\n\n if (!context) {\n return {\n activeValue: \"\",\n setActiveValue: () => {},\n };\n }\n\n return context;\n}\n\ntype TabItem = {\n confirm?: {\n required?: boolean;\n };\n label: string;\n value: string;\n};\n\nfunction getTabs(node: Node): TabItem[] {\n return (node.schema ?? [])\n .filter((child) => child.type === \"tab\")\n .map((child) => {\n const props = child.props as unknown as Tab;\n\n return {\n confirm: props.confirm ? { required: props.confirm.required } : undefined,\n label: props.label,\n value: props.value,\n };\n })\n .filter((tab) => tab.value !== \"\");\n}\n\nfunction queryValue(queryKey: string, tabs: Array<{ value: string }>): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const value = new URLSearchParams(window.location.search).get(queryKey);\n\n if (!value || !tabs.some((tab) => tab.value === value)) {\n return null;\n }\n\n return value;\n}\n\nfunction replaceQueryValue(queryKey: string, value: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n window.history.replaceState(window.history.state, \"\", `${url.pathname}${url.search}${url.hash}`);\n}\n\nfunction queryUrl(queryKey: string, value: string): string {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n\n return `${url.pathname}${url.search}${url.hash}`;\n}\n\nexport const TabsComponent: RendererComponent<\"tabs\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const tabs = useMemo(() => getTabs(node), [node]);\n const firstValue = tabs[0]?.value ?? \"\";\n const queryKey = node.props.queryKey;\n const orientation = node.props.orientation;\n const isVertical = orientation === \"vertical\";\n const serverActiveValue = node.props.activeValue;\n const defaultValue = node.props.defaultValue ?? firstValue;\n const tablistRef = useRef<HTMLDivElement>(null);\n const [activeValue, setActiveTabValue] = useState(\n () => serverActiveValue || (queryValue(queryKey, tabs) ?? defaultValue) || firstValue,\n );\n\n function selectTab(tab: TabItem): void {\n if (tab.confirm?.required) {\n router.visit(queryUrl(queryKey, tab.value), {\n preserveScroll: true,\n });\n\n return;\n }\n\n setActiveTabValue(tab.value);\n replaceQueryValue(queryKey, tab.value);\n }\n\n function selectTabValue(value: string): void {\n const tab = tabs.find((item) => item.value === value);\n\n if (tab) {\n selectTab(tab);\n }\n }\n\n function onTablistKeyDown(event: KeyboardEvent<HTMLButtonElement>): void {\n const nextKey = isVertical ? \"ArrowDown\" : \"ArrowRight\";\n const prevKey = isVertical ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (\n event.key !== nextKey &&\n event.key !== prevKey &&\n event.key !== \"Home\" &&\n event.key !== \"End\"\n ) {\n return;\n }\n\n const buttons = Array.from(\n tablistRef.current?.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]') ?? [],\n );\n\n if (buttons.length === 0) {\n return;\n }\n\n event.preventDefault();\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n\n let index: number;\n if (event.key === \"Home\") {\n index = 0;\n } else if (event.key === \"End\") {\n index = buttons.length - 1;\n } else {\n const delta = event.key === nextKey ? 1 : -1;\n const base = current < 0 ? 0 : current;\n index = (base + delta + buttons.length) % buttons.length;\n }\n\n buttons[index]?.focus();\n }\n\n return (\n <TabsContext.Provider value={{ activeValue, setActiveValue: selectTabValue }}>\n <div\n className={cn(\"gap-6\", isVertical ? \"flex\" : \"grid\")}\n data-lattice-tabs={node.key ?? node.id}\n >\n <div\n aria-label={t(\"a11y.tabs\", \"Tabs\")}\n aria-orientation={orientation}\n className={cn(\n \"gap-1 rounded-lt bg-lt-muted p-1\",\n isVertical ? \"flex flex-col\" : \"inline-flex w-fit max-w-full overflow-x-auto\",\n )}\n ref={tablistRef}\n role=\"tablist\"\n >\n {tabs.map((tab) => {\n const isActive = activeValue === tab.value;\n\n return (\n <button\n aria-controls={`${tab.value}-panel`}\n aria-selected={isActive}\n data-test={`tab-${tab.value}`}\n className={cn(\n \"whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors\",\n isActive\n ? \"bg-lt-bg text-lt-fg shadow-xs\"\n : \"text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg\",\n isVertical && \"text-left\",\n )}\n id={`${tab.value}-tab`}\n key={tab.value}\n onClick={() => selectTab(tab)}\n onKeyDown={onTablistKeyDown}\n role=\"tab\"\n tabIndex={isActive ? 0 : -1}\n type=\"button\"\n >\n {tab.label}\n </button>\n );\n })}\n </div>\n\n <div className={cn(\"min-w-0\", isVertical && \"flex-1\")}>{children}</div>\n </div>\n </TabsContext.Provider>\n );\n};\n\nconst TabComponent: RendererComponent<\"tab\"> = ({ children, node }) => {\n const { activeValue } = useTabsContext();\n const value = node.props.value;\n const isActive = activeValue === value;\n const [hasOpened, setHasOpened] = useState(isActive);\n\n useEffect(() => {\n if (isActive) {\n setHasOpened(true);\n }\n }, [isActive]);\n\n return (\n <section\n aria-labelledby={`${value}-tab`}\n className={cn(\"space-y-8\", !isActive && \"hidden\")}\n hidden={!isActive}\n id={`${value}-panel`}\n role=\"tabpanel\"\n tabIndex={0}\n >\n {hasOpened ? (children as ReactNode) : null}\n </section>\n );\n};\n\nexport default TabComponent;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../../resources/js/core/components/tabs.tsx"],"sourcesContent":["import { router } from \"@inertiajs/react\";\nimport { createContext, useContext, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport type { Tab } from \"@lattice-php/lattice/types/generated\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype TabsContextValue = {\n activeValue: string;\n setActiveValue: (value: string) => void;\n};\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext);\n\n if (!context) {\n return {\n activeValue: \"\",\n setActiveValue: () => {},\n };\n }\n\n return context;\n}\n\ntype TabItem = {\n confirm?: {\n required?: boolean;\n };\n label: string;\n value: string;\n};\n\nfunction getTabs(node: Node): TabItem[] {\n return (node.schema ?? [])\n .filter((child) => child.type === \"tab\")\n .map((child) => {\n const props = child.props as unknown as Tab;\n\n return {\n confirm: props.confirm ? { required: props.confirm.required } : undefined,\n label: props.label,\n value: props.value,\n };\n })\n .filter((tab) => tab.value !== \"\");\n}\n\nfunction queryValue(queryKey: string, tabs: Array<{ value: string }>): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const value = new URLSearchParams(window.location.search).get(queryKey);\n\n if (!value || !tabs.some((tab) => tab.value === value)) {\n return null;\n }\n\n return value;\n}\n\nfunction replaceQueryValue(queryKey: string, value: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n window.history.replaceState(window.history.state, \"\", `${url.pathname}${url.search}${url.hash}`);\n}\n\nfunction queryUrl(queryKey: string, value: string): string {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n\n return `${url.pathname}${url.search}${url.hash}`;\n}\n\nexport const TabsComponent: RendererComponent<\"tabs\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const tabs = useMemo(() => getTabs(node), [node]);\n const firstValue = tabs[0]?.value ?? \"\";\n const queryKey = node.props.queryKey;\n const orientation = node.props.orientation;\n const isVertical = orientation === \"vertical\";\n const serverActiveValue = node.props.activeValue;\n const defaultValue = node.props.defaultValue ?? firstValue;\n const tablistRef = useRef<HTMLDivElement>(null);\n const [activeValue, setActiveTabValue] = useState(\n () => serverActiveValue || (queryValue(queryKey, tabs) ?? defaultValue) || firstValue,\n );\n\n function selectTab(tab: TabItem): void {\n if (tab.confirm?.required) {\n router.visit(queryUrl(queryKey, tab.value), {\n preserveScroll: true,\n });\n\n return;\n }\n\n setActiveTabValue(tab.value);\n replaceQueryValue(queryKey, tab.value);\n }\n\n function selectTabValue(value: string): void {\n const tab = tabs.find((item) => item.value === value);\n\n if (tab) {\n selectTab(tab);\n }\n }\n\n function onTablistKeyDown(event: KeyboardEvent<HTMLButtonElement>): void {\n const nextKey = isVertical ? \"ArrowDown\" : \"ArrowRight\";\n const prevKey = isVertical ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (\n event.key !== nextKey &&\n event.key !== prevKey &&\n event.key !== \"Home\" &&\n event.key !== \"End\"\n ) {\n return;\n }\n\n const buttons = Array.from(\n tablistRef.current?.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]') ?? [],\n );\n\n if (buttons.length === 0) {\n return;\n }\n\n event.preventDefault();\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n\n let index: number;\n if (event.key === \"Home\") {\n index = 0;\n } else if (event.key === \"End\") {\n index = buttons.length - 1;\n } else {\n const delta = event.key === nextKey ? 1 : -1;\n const base = current < 0 ? 0 : current;\n index = (base + delta + buttons.length) % buttons.length;\n }\n\n buttons[index]?.focus();\n }\n\n return (\n <TabsContext.Provider value={{ activeValue, setActiveValue: selectTabValue }}>\n <div\n className={cn(\"gap-6\", isVertical ? \"flex\" : \"grid\")}\n data-lattice-tabs={node.key ?? node.id}\n >\n <div\n aria-label={t(\"a11y.tabs\", \"Tabs\")}\n aria-orientation={orientation}\n className={cn(\n \"gap-1 rounded-lt bg-lt-muted p-1\",\n isVertical ? \"flex flex-col\" : \"inline-flex w-fit max-w-full overflow-x-auto\",\n )}\n ref={tablistRef}\n role=\"tablist\"\n >\n {tabs.map((tab) => {\n const isActive = activeValue === tab.value;\n\n return (\n <button\n aria-controls={`${tab.value}-panel`}\n aria-selected={isActive}\n data-test={`tab-${tab.value}`}\n className={cn(\n \"whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors\",\n isActive\n ? \"bg-lt-bg text-lt-fg shadow-lt-xs\"\n : \"text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg\",\n isVertical && \"text-left\",\n )}\n id={`${tab.value}-tab`}\n key={tab.value}\n onClick={() => selectTab(tab)}\n onKeyDown={onTablistKeyDown}\n role=\"tab\"\n tabIndex={isActive ? 0 : -1}\n type=\"button\"\n >\n {tab.label}\n </button>\n );\n })}\n </div>\n\n <div className={cn(\"min-w-0\", isVertical && \"flex-1\")}>{children}</div>\n </div>\n </TabsContext.Provider>\n );\n};\n\nconst TabComponent: RendererComponent<\"tab\"> = ({ children, node }) => {\n const { activeValue } = useTabsContext();\n const value = node.props.value;\n const isActive = activeValue === value;\n const [hasOpened, setHasOpened] = useState(isActive);\n\n useEffect(() => {\n if (isActive) {\n setHasOpened(true);\n }\n }, [isActive]);\n\n return (\n <section\n aria-labelledby={`${value}-tab`}\n className={cn(\"space-y-8\", !isActive && \"hidden\")}\n hidden={!isActive}\n id={`${value}-panel`}\n role=\"tabpanel\"\n tabIndex={0}\n >\n {hasOpened ? (children as ReactNode) : null}\n </section>\n );\n};\n\nexport default TabComponent;\n"],"mappings":"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"}
|
|
@@ -5,9 +5,25 @@ var textAlignments = {
|
|
|
5
5
|
center: "text-center",
|
|
6
6
|
left: "text-left"
|
|
7
7
|
};
|
|
8
|
+
var textColors = {
|
|
9
|
+
default: "text-lt-fg",
|
|
10
|
+
muted: "text-lt-muted-fg",
|
|
11
|
+
primary: "text-lt-primary",
|
|
12
|
+
success: "text-lt-success",
|
|
13
|
+
info: "text-lt-info",
|
|
14
|
+
warning: "text-lt-warning",
|
|
15
|
+
danger: "text-lt-danger"
|
|
16
|
+
};
|
|
17
|
+
var textSizes = {
|
|
18
|
+
xs: "text-xs leading-5",
|
|
19
|
+
sm: "text-sm leading-6",
|
|
20
|
+
md: "text-base leading-7",
|
|
21
|
+
lg: "text-lg leading-8",
|
|
22
|
+
xl: "text-xl leading-8"
|
|
23
|
+
};
|
|
8
24
|
var TextComponent = ({ node }) => {
|
|
9
25
|
return /* @__PURE__ */ jsx("p", {
|
|
10
|
-
className: cn("max-w-2xl
|
|
26
|
+
className: cn("m-0", "max-w-2xl", textAlignments[node.props.align ?? "left"] ?? textAlignments.left, textColors[node.props.color], textSizes[node.props.size]),
|
|
11
27
|
children: node.props.text
|
|
12
28
|
});
|
|
13
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../../resources/js/core/components/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice/lattice/core/types\";\nimport { cn } from \"@lattice/lattice/lib/utils\";\n\nconst textAlignments: Record<string, string> = {\n center: \"text-center\",\n left: \"text-left\",\n};\n\nconst TextComponent: RendererComponent<\"text\"> = ({ node }) => {\n const align = node.props.align ?? \"left\";\n\n return (\n <p\n className={cn(\n \"max-w-2xl
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../../resources/js/core/components/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Color, Size } from \"@lattice-php/lattice/types/generated\";\n\nconst textAlignments: Record<string, string> = {\n center: \"text-center\",\n left: \"text-left\",\n};\n\nconst textColors: Record<Color, string> = {\n default: \"text-lt-fg\",\n muted: \"text-lt-muted-fg\",\n primary: \"text-lt-primary\",\n success: \"text-lt-success\",\n info: \"text-lt-info\",\n warning: \"text-lt-warning\",\n danger: \"text-lt-danger\",\n};\n\nconst textSizes: Record<Size, string> = {\n xs: \"text-xs leading-5\",\n sm: \"text-sm leading-6\",\n md: \"text-base leading-7\",\n lg: \"text-lg leading-8\",\n xl: \"text-xl leading-8\",\n};\n\nconst TextComponent: RendererComponent<\"text\"> = ({ node }) => {\n const align = node.props.align ?? \"left\";\n\n return (\n <p\n className={cn(\n \"m-0\",\n \"max-w-2xl\",\n textAlignments[align] ?? textAlignments.left,\n textColors[node.props.color],\n textSizes[node.props.size],\n )}\n >\n {node.props.text}\n </p>\n );\n};\n\nexport default TextComponent;\n"],"mappings":";;;AAIA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,MAAM;AACR;AAEA,IAAM,aAAoC;CACxC,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,MAAM;CACN,SAAS;CACT,QAAQ;AACV;AAEA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAG7D,OACE,oBAAC,KAAD;EACE,WAAW,GACT,OACA,aACA,eAPQ,KAAK,MAAM,SAAS,WAOH,eAAe,MACxC,WAAW,KAAK,MAAM,QACtB,UAAU,KAAK,MAAM,KACvB;YAEC,KAAK,MAAM;CACX,CAAA;AAEP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withHeaders(componentRef?: string, headers?: Record<string, string>): Record<string, string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { localeHeader } from "../i18n/locale.js";
|
|
2
|
+
import { withRefHeader } from "./component-ref.js";
|
|
3
|
+
//#region resources/js/core/headers.ts
|
|
4
|
+
function withHeaders(componentRef = "", headers = {}) {
|
|
5
|
+
return {
|
|
6
|
+
...localeHeader(),
|
|
7
|
+
...withRefHeader(componentRef),
|
|
8
|
+
...headers
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { withHeaders };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","names":[],"sources":["../../resources/js/core/headers.ts"],"sourcesContent":["import { localeHeader } from \"../i18n/locale\";\nimport { withRefHeader } from \"./component-ref\";\n\nexport function withHeaders(\n componentRef = \"\",\n headers: Record<string, string> = {},\n): Record<string, string> {\n return {\n ...localeHeader(),\n ...withRefHeader(componentRef),\n ...headers,\n };\n}\n"],"mappings":";;;AAGA,SAAgB,YACd,eAAe,IACf,UAAkC,CAAC,GACX;CACxB,OAAO;EACL,GAAG,aAAa;EAChB,GAAG,cAAc,YAAY;EAC7B,GAAG;CACL;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentRegistry, Registry } from './registry';
|
|
2
|
+
import { ColumnRegistry } from '../table/registry';
|
|
3
|
+
import { EffectHandlerRegistry } from '../effects/registry';
|
|
4
|
+
/**
|
|
5
|
+
* Holds the active Registry for the current Provider subtree. Extracted into
|
|
6
|
+
* its own module to break the circular reference between provider.tsx (which
|
|
7
|
+
* imports the default registry instance) and use-effect-dispatcher.ts (which
|
|
8
|
+
* imports the context selector). Neither file imports from the other; both
|
|
9
|
+
* import from here.
|
|
10
|
+
*
|
|
11
|
+
* The context default is null. Selectors fall back to `_defaultRegistry`,
|
|
12
|
+
* which provider.tsx sets at module evaluation time (after registry.ts has
|
|
13
|
+
* finished loading). This avoids a synchronous evaluation cycle while
|
|
14
|
+
* preserving the pre-existing behaviour that components work without a
|
|
15
|
+
* surrounding <Provider>.
|
|
16
|
+
*/
|
|
17
|
+
export declare const RegistryContext: import('react').Context<Registry | null>;
|
|
18
|
+
export declare function setDefaultRegistry(registry: Registry): void;
|
|
19
|
+
export declare function useComponentRegistry(): ComponentRegistry;
|
|
20
|
+
export declare function useColumnRegistry(): ColumnRegistry;
|
|
21
|
+
export declare function useEffectHandlerRegistry(): EffectHandlerRegistry;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region resources/js/core/registry-context.tsx
|
|
3
|
+
/**
|
|
4
|
+
* Holds the active Registry for the current Provider subtree. Extracted into
|
|
5
|
+
* its own module to break the circular reference between provider.tsx (which
|
|
6
|
+
* imports the default registry instance) and use-effect-dispatcher.ts (which
|
|
7
|
+
* imports the context selector). Neither file imports from the other; both
|
|
8
|
+
* import from here.
|
|
9
|
+
*
|
|
10
|
+
* The context default is null. Selectors fall back to `_defaultRegistry`,
|
|
11
|
+
* which provider.tsx sets at module evaluation time (after registry.ts has
|
|
12
|
+
* finished loading). This avoids a synchronous evaluation cycle while
|
|
13
|
+
* preserving the pre-existing behaviour that components work without a
|
|
14
|
+
* surrounding <Provider>.
|
|
15
|
+
*/
|
|
16
|
+
var RegistryContext = createContext(null);
|
|
17
|
+
/**
|
|
18
|
+
* Called by provider.tsx at module-evaluation time, after registry.ts finishes
|
|
19
|
+
* loading. The constraint is on CALLING this setter, not on importing this
|
|
20
|
+
* module: do not call setDefaultRegistry from any module that evaluates before
|
|
21
|
+
* registry.ts completes. (use-effect-dispatcher.ts safely imports the selectors
|
|
22
|
+
* below — that import is exactly why this module was extracted.)
|
|
23
|
+
*/
|
|
24
|
+
var _defaultRegistry = null;
|
|
25
|
+
function setDefaultRegistry(registry) {
|
|
26
|
+
_defaultRegistry = registry;
|
|
27
|
+
}
|
|
28
|
+
function useComponentRegistry() {
|
|
29
|
+
return (useContext(RegistryContext) ?? _defaultRegistry)?.components ?? {};
|
|
30
|
+
}
|
|
31
|
+
function useColumnRegistry() {
|
|
32
|
+
return (useContext(RegistryContext) ?? _defaultRegistry)?.columns ?? {};
|
|
33
|
+
}
|
|
34
|
+
function useEffectHandlerRegistry() {
|
|
35
|
+
return (useContext(RegistryContext) ?? _defaultRegistry)?.effects ?? {};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { RegistryContext, setDefaultRegistry, useColumnRegistry, useComponentRegistry, useEffectHandlerRegistry };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=registry-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-context.js","names":[],"sources":["../../resources/js/core/registry-context.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ComponentRegistry, Registry } from \"./registry\";\nimport type { ColumnRegistry } from \"../table/registry\";\nimport type { EffectHandlerRegistry } from \"../effects/registry\";\n\n/**\n * Holds the active Registry for the current Provider subtree. Extracted into\n * its own module to break the circular reference between provider.tsx (which\n * imports the default registry instance) and use-effect-dispatcher.ts (which\n * imports the context selector). Neither file imports from the other; both\n * import from here.\n *\n * The context default is null. Selectors fall back to `_defaultRegistry`,\n * which provider.tsx sets at module evaluation time (after registry.ts has\n * finished loading). This avoids a synchronous evaluation cycle while\n * preserving the pre-existing behaviour that components work without a\n * surrounding <Provider>.\n */\nexport const RegistryContext = createContext<Registry | null>(null);\n\n/**\n * Called by provider.tsx at module-evaluation time, after registry.ts finishes\n * loading. The constraint is on CALLING this setter, not on importing this\n * module: do not call setDefaultRegistry from any module that evaluates before\n * registry.ts completes. (use-effect-dispatcher.ts safely imports the selectors\n * below — that import is exactly why this module was extracted.)\n */\nlet _defaultRegistry: Registry | null = null;\n\nexport function setDefaultRegistry(registry: Registry): void {\n _defaultRegistry = registry;\n}\n\nexport function useComponentRegistry(): ComponentRegistry {\n const registry = useContext(RegistryContext) ?? _defaultRegistry;\n return registry?.components ?? {};\n}\n\nexport function useColumnRegistry(): ColumnRegistry {\n const registry = useContext(RegistryContext) ?? _defaultRegistry;\n return registry?.columns ?? {};\n}\n\nexport function useEffectHandlerRegistry(): EffectHandlerRegistry {\n const registry = useContext(RegistryContext) ?? _defaultRegistry;\n return registry?.effects ?? {};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAa,kBAAkB,cAA+B,IAAI;;;;;;;;AASlE,IAAI,mBAAoC;AAExC,SAAgB,mBAAmB,UAA0B;CAC3D,mBAAmB;AACrB;AAEA,SAAgB,uBAA0C;CAExD,QADiB,WAAW,eAAe,KAAK,mBAC/B,cAAc,CAAC;AAClC;AAEA,SAAgB,oBAAoC;CAElD,QADiB,WAAW,eAAe,KAAK,mBAC/B,WAAW,CAAC;AAC/B;AAEA,SAAgB,2BAAkD;CAEhE,QADiB,WAAW,eAAe,KAAK,mBAC/B,WAAW,CAAC;AAC/B"}
|
package/dist/core/registry.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LazyExoticComponent } from 'react';
|
|
2
2
|
import { RendererComponent, RendererComponentModule } from './types';
|
|
3
|
-
import { ColumnRegistry } from '../table/
|
|
3
|
+
import { ColumnRegistry } from '../table/registry';
|
|
4
|
+
import { EffectHandlerRegistry } from '../effects/registry';
|
|
4
5
|
export type EagerComponentRegistration = {
|
|
5
6
|
component: RendererComponent;
|
|
6
7
|
mode: "eager";
|
|
@@ -17,10 +18,12 @@ export type Plugin = {
|
|
|
17
18
|
name: string;
|
|
18
19
|
components?: ComponentRegistry;
|
|
19
20
|
columns?: ColumnRegistry;
|
|
21
|
+
effects?: EffectHandlerRegistry;
|
|
20
22
|
};
|
|
21
23
|
export type Registry = {
|
|
22
24
|
components: ComponentRegistry;
|
|
23
25
|
columns: ColumnRegistry;
|
|
26
|
+
effects: EffectHandlerRegistry;
|
|
24
27
|
};
|
|
25
28
|
export type LazyComponentOptions<TType extends string> = {
|
|
26
29
|
fallback?: RendererComponent<TType>;
|
package/dist/core/registry.js
CHANGED
|
@@ -27,10 +27,15 @@ function createRegistry(...plugins) {
|
|
|
27
27
|
columns: {
|
|
28
28
|
...registry.columns,
|
|
29
29
|
...plugin.columns
|
|
30
|
+
},
|
|
31
|
+
effects: {
|
|
32
|
+
...registry.effects,
|
|
33
|
+
...plugin.effects
|
|
30
34
|
}
|
|
31
35
|
}), {
|
|
32
36
|
components: {},
|
|
33
|
-
columns: {}
|
|
37
|
+
columns: {},
|
|
38
|
+
effects: {}
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
function extendRegistry(registry, ...plugins) {
|
|
@@ -43,6 +48,10 @@ function extendRegistry(registry, ...plugins) {
|
|
|
43
48
|
columns: {
|
|
44
49
|
...registry.columns,
|
|
45
50
|
...merged.columns
|
|
51
|
+
},
|
|
52
|
+
effects: {
|
|
53
|
+
...registry.effects,
|
|
54
|
+
...merged.effects
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","names":[],"sources":["../../resources/js/core/registry.ts"],"sourcesContent":["import { lazy } from \"react\";\nimport type { LazyExoticComponent } from \"react\";\nimport type { RendererComponent, RendererComponentModule } from \"./types\";\nimport type { ColumnRegistry } from \"../table/
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../../resources/js/core/registry.ts"],"sourcesContent":["import { lazy } from \"react\";\nimport type { LazyExoticComponent } from \"react\";\nimport type { RendererComponent, RendererComponentModule } from \"./types\";\nimport type { ColumnRegistry } from \"../table/registry\";\nimport type { EffectHandlerRegistry } from \"../effects/registry\";\n\nexport type EagerComponentRegistration = {\n component: RendererComponent;\n mode: \"eager\";\n};\n\nexport type LazyComponentRegistration = {\n component: LazyExoticComponent<RendererComponent>;\n fallback?: RendererComponent;\n load: () => Promise<RendererComponentModule>;\n mode: \"lazy\";\n};\n\nexport type ComponentRegistration = EagerComponentRegistration | LazyComponentRegistration;\n\nexport type ComponentRegistry = Record<string, ComponentRegistration>;\n\nexport type Plugin = {\n name: string;\n components?: ComponentRegistry;\n columns?: ColumnRegistry;\n effects?: EffectHandlerRegistry;\n};\n\nexport type Registry = {\n components: ComponentRegistry;\n columns: ColumnRegistry;\n effects: EffectHandlerRegistry;\n};\n\nexport type LazyComponentOptions<TType extends string> = {\n fallback?: RendererComponent<TType>;\n};\n\nexport function eagerComponent<TType extends string>(\n component: RendererComponent<TType>,\n): EagerComponentRegistration {\n return {\n component: component as unknown as RendererComponent,\n mode: \"eager\",\n };\n}\n\nexport function lazyComponent<TType extends string>(\n load: () => Promise<RendererComponentModule<TType>>,\n options: LazyComponentOptions<TType> = {},\n): LazyComponentRegistration {\n const erasedLoader = load as unknown as () => Promise<RendererComponentModule>;\n\n return {\n component: lazy(erasedLoader),\n fallback: options.fallback as RendererComponent | undefined,\n load: erasedLoader,\n mode: \"lazy\",\n };\n}\n\nexport function createPlugin(plugin: Plugin): Plugin {\n return plugin;\n}\n\nexport function createRegistry(...plugins: Plugin[]): Registry {\n return plugins.reduce<Registry>(\n (registry, plugin) => ({\n components: { ...registry.components, ...plugin.components },\n columns: { ...registry.columns, ...plugin.columns },\n effects: { ...registry.effects, ...plugin.effects },\n }),\n { components: {}, columns: {}, effects: {} },\n );\n}\n\nexport function extendRegistry(registry: Registry, ...plugins: Plugin[]): Registry {\n const merged = createRegistry(...plugins);\n\n return {\n components: { ...registry.components, ...merged.components },\n columns: { ...registry.columns, ...merged.columns },\n effects: { ...registry.effects, ...merged.effects },\n };\n}\n"],"mappings":";;AAuCA,SAAgB,eACd,WAC4B;CAC5B,OAAO;EACM;EACX,MAAM;CACR;AACF;AAEA,SAAgB,cACd,MACA,UAAuC,CAAC,GACb;CAC3B,MAAM,eAAe;CAErB,OAAO;EACL,WAAW,KAAK,YAAY;EAC5B,UAAU,QAAQ;EAClB,MAAM;EACN,MAAM;CACR;AACF;AAEA,SAAgB,aAAa,QAAwB;CACnD,OAAO;AACT;AAEA,SAAgB,eAAe,GAAG,SAA6B;CAC7D,OAAO,QAAQ,QACZ,UAAU,YAAY;EACrB,YAAY;GAAE,GAAG,SAAS;GAAY,GAAG,OAAO;EAAW;EAC3D,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,OAAO;EAAQ;EAClD,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,OAAO;EAAQ;CACpD,IACA;EAAE,YAAY,CAAC;EAAG,SAAS,CAAC;EAAG,SAAS,CAAC;CAAE,CAC7C;AACF;AAEA,SAAgB,eAAe,UAAoB,GAAG,SAA6B;CACjF,MAAM,SAAS,eAAe,GAAG,OAAO;CAExC,OAAO;EACL,YAAY;GAAE,GAAG,SAAS;GAAY,GAAG,OAAO;EAAW;EAC3D,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,OAAO;EAAQ;EAClD,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,OAAO;EAAQ;CACpD;AACF"}
|
package/dist/core/renderer.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fallback: ReactNode;
|
|
6
|
-
missingComponent: UnknownComponent;
|
|
7
|
-
registry: ComponentRegistry;
|
|
8
|
-
};
|
|
9
|
-
export declare function useRendererContext(): RendererContextValue;
|
|
10
|
-
export declare function Renderer({ fallback, missingComponent: UnknownComponent, nodes, registry, }: {
|
|
11
|
-
fallback?: ReactNode;
|
|
12
|
-
missingComponent?: UnknownComponent;
|
|
2
|
+
import { Node } from './types';
|
|
3
|
+
/** Renders a schema (list of nodes) against the active component registry. */
|
|
4
|
+
export declare function Renderer({ nodes }: {
|
|
13
5
|
nodes: Node[];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {}
|
|
6
|
+
}): ReactNode;
|
|
7
|
+
/** Renders a single node against the active component registry. */
|
|
8
|
+
export declare function RenderNode({ node }: {
|
|
9
|
+
node: Node;
|
|
10
|
+
}): ReactNode;
|
package/dist/core/renderer.js
CHANGED
|
@@ -1,41 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useComponentRegistry } from "./registry-context.js";
|
|
2
|
+
import { useCollapsed } from "./collapsed-context.js";
|
|
3
|
+
import { Suspense } from "react";
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
//#region resources/js/core/renderer.tsx
|
|
4
6
|
function MissingComponent({ node }) {
|
|
5
7
|
return null;
|
|
6
8
|
}
|
|
7
|
-
var RendererContext = createContext(null);
|
|
8
|
-
function useRendererContext() {
|
|
9
|
-
const context = useContext(RendererContext);
|
|
10
|
-
if (!context) throw new Error("Renderer context is not available.");
|
|
11
|
-
return context;
|
|
12
|
-
}
|
|
13
9
|
function nodeKey(node, index) {
|
|
14
10
|
return node.key ?? node.id ?? `${node.type}-${index}`;
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
registry,
|
|
24
|
-
UnknownComponent
|
|
25
|
-
]);
|
|
26
|
-
return /* @__PURE__ */ jsx(RendererContext.Provider, {
|
|
27
|
-
value: context,
|
|
28
|
-
children: nodes.map((node, index) => /* @__PURE__ */ jsx(NodeRenderer, { node }, nodeKey(node, index)))
|
|
29
|
-
});
|
|
12
|
+
/** Renders a schema (list of nodes) against the active component registry. */
|
|
13
|
+
function Renderer({ nodes }) {
|
|
14
|
+
return nodes.map((node, index) => /* @__PURE__ */ jsx(NodeRenderer, { node }, nodeKey(node, index)));
|
|
15
|
+
}
|
|
16
|
+
/** Renders a single node against the active component registry. */
|
|
17
|
+
function RenderNode({ node }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(NodeRenderer, { node });
|
|
30
19
|
}
|
|
31
20
|
function NodeRenderer({ node }) {
|
|
32
|
-
const
|
|
33
|
-
const registration =
|
|
34
|
-
if (
|
|
21
|
+
const collapsed = useCollapsed();
|
|
22
|
+
const registration = useComponentRegistry()[node.type];
|
|
23
|
+
if (collapsed && node.props?.hideWhenCollapsed === true) return null;
|
|
24
|
+
if (!registration) return /* @__PURE__ */ jsx(MissingComponent, { node });
|
|
35
25
|
const Component = registration.component;
|
|
36
26
|
const renderedComponent = /* @__PURE__ */ jsx(Component, {
|
|
37
27
|
node,
|
|
38
|
-
children: node.schema?.length ?
|
|
28
|
+
children: node.schema?.length ? /* @__PURE__ */ jsx(Renderer, { nodes: node.schema }) : null
|
|
39
29
|
});
|
|
40
30
|
if (registration.mode === "lazy") {
|
|
41
31
|
const FallbackComponent = registration.fallback;
|
|
@@ -43,13 +33,13 @@ function NodeRenderer({ node }) {
|
|
|
43
33
|
fallback: FallbackComponent ? /* @__PURE__ */ jsx(FallbackComponent, {
|
|
44
34
|
node,
|
|
45
35
|
children: null
|
|
46
|
-
}) :
|
|
36
|
+
}) : null,
|
|
47
37
|
children: renderedComponent
|
|
48
38
|
});
|
|
49
39
|
}
|
|
50
40
|
return renderedComponent;
|
|
51
41
|
}
|
|
52
42
|
//#endregion
|
|
53
|
-
export {
|
|
43
|
+
export { RenderNode, Renderer };
|
|
54
44
|
|
|
55
45
|
//# sourceMappingURL=renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","names":[],"sources":["../../resources/js/core/renderer.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"renderer.js","names":[],"sources":["../../resources/js/core/renderer.tsx"],"sourcesContent":["import { Suspense } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { Node } from \"./types\";\nimport { useCollapsed } from \"./collapsed-context\";\nimport { useComponentRegistry } from \"./registry-context\";\n\nfunction MissingComponent({ node }: { node: Node }) {\n if (!import.meta.env.DEV) {\n return null;\n }\n\n return <div data-lattice-missing-component={node.type}>Missing component: {node.type}</div>;\n}\n\nfunction nodeKey(node: Node, index: number): string {\n return node.key ?? node.id ?? `${node.type}-${index}`;\n}\n\n/** Renders a schema (list of nodes) against the active component registry. */\nexport function Renderer({ nodes }: { nodes: Node[] }): ReactNode {\n return nodes.map((node, index) => <NodeRenderer key={nodeKey(node, index)} node={node} />);\n}\n\n/** Renders a single node against the active component registry. */\nexport function RenderNode({ node }: { node: Node }): ReactNode {\n return <NodeRenderer node={node} />;\n}\n\nfunction NodeRenderer({ node }: { node: Node }) {\n const collapsed = useCollapsed();\n const registry = useComponentRegistry();\n const registration = registry[node.type];\n\n if (collapsed && node.props?.hideWhenCollapsed === true) {\n return null;\n }\n\n if (!registration) {\n return <MissingComponent node={node} />;\n }\n\n const Component = registration.component;\n const children = node.schema?.length ? <Renderer nodes={node.schema} /> : null;\n const renderedComponent = <Component node={node}>{children}</Component>;\n\n if (registration.mode === \"lazy\") {\n const FallbackComponent = registration.fallback;\n const fallback = FallbackComponent ? (\n <FallbackComponent node={node}>{null}</FallbackComponent>\n ) : null;\n\n return <Suspense fallback={fallback}>{renderedComponent}</Suspense>;\n }\n\n return renderedComponent;\n}\n"],"mappings":";;;;;AAMA,SAAS,iBAAiB,EAAE,QAAwB;CAEhD,OAAO;AAIX;AAEA,SAAS,QAAQ,MAAY,OAAuB;CAClD,OAAO,KAAK,OAAO,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG;AAChD;;AAGA,SAAgB,SAAS,EAAE,SAAuC;CAChE,OAAO,MAAM,KAAK,MAAM,UAAU,oBAAC,cAAD,EAA+C,KAAO,GAAnC,QAAQ,MAAM,KAAK,CAAgB,CAAC;AAC3F;;AAGA,SAAgB,WAAW,EAAE,QAAmC;CAC9D,OAAO,oBAAC,cAAD,EAAoB,KAAO,CAAA;AACpC;AAEA,SAAS,aAAa,EAAE,QAAwB;CAC9C,MAAM,YAAY,aAAa;CAE/B,MAAM,eADW,qBACI,EAAS,KAAK;CAEnC,IAAI,aAAa,KAAK,OAAO,sBAAsB,MACjD,OAAO;CAGT,IAAI,CAAC,cACH,OAAO,oBAAC,kBAAD,EAAwB,KAAO,CAAA;CAGxC,MAAM,YAAY,aAAa;CAE/B,MAAM,oBAAoB,oBAAC,WAAD;EAAiB;EAAO,UADjC,KAAK,QAAQ,SAAS,oBAAC,UAAD,EAAU,OAAO,KAAK,OAAS,CAAA,IAAI;CACJ,CAAA;CAEtE,IAAI,aAAa,SAAS,QAAQ;EAChC,MAAM,oBAAoB,aAAa;EAKvC,OAAO,oBAAC,UAAD;GAAoB,UAJV,oBACf,oBAAC,mBAAD;IAAyB;cAAO;GAAwB,CAAA,IACtD;aAEkC;EAA4B,CAAA;CACpE;CAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Node } from './types';
|
|
2
|
+
type IdentifiedNode = Pick<Node, "id" | "key">;
|
|
3
|
+
export declare function testIdentity(value: string | null | undefined): string | undefined;
|
|
4
|
+
export declare function nodeIdentity(node: IdentifiedNode): string | undefined;
|
|
5
|
+
export declare function leafTestIdentity(value: string | null | undefined): string | undefined;
|
|
6
|
+
export declare function prefixedTestId(prefix: string, value: string | null | undefined): string | undefined;
|
|
7
|
+
export declare function prefixedNodeTestId(prefix: string, node: IdentifiedNode): string | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region resources/js/core/test-id.ts
|
|
2
|
+
function testIdentity(value) {
|
|
3
|
+
return value === void 0 || value === null || value === "" ? void 0 : value;
|
|
4
|
+
}
|
|
5
|
+
function nodeIdentity(node) {
|
|
6
|
+
return testIdentity(node.key) ?? testIdentity(node.id);
|
|
7
|
+
}
|
|
8
|
+
function leafTestIdentity(value) {
|
|
9
|
+
return testIdentity(value)?.split(".").at(-1);
|
|
10
|
+
}
|
|
11
|
+
function prefixedTestId(prefix, value) {
|
|
12
|
+
const identity = leafTestIdentity(value);
|
|
13
|
+
return identity ? `${prefix}-${identity}` : void 0;
|
|
14
|
+
}
|
|
15
|
+
function prefixedNodeTestId(prefix, node) {
|
|
16
|
+
return prefixedTestId(prefix, nodeIdentity(node));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { leafTestIdentity, nodeIdentity, prefixedNodeTestId, prefixedTestId, testIdentity };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=test-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-id.js","names":[],"sources":["../../resources/js/core/test-id.ts"],"sourcesContent":["import type { Node } from \"./types\";\n\ntype IdentifiedNode = Pick<Node, \"id\" | \"key\">;\n\nexport function testIdentity(value: string | null | undefined): string | undefined {\n return value === undefined || value === null || value === \"\" ? undefined : value;\n}\n\nexport function nodeIdentity(node: IdentifiedNode): string | undefined {\n return testIdentity(node.key) ?? testIdentity(node.id);\n}\n\nexport function leafTestIdentity(value: string | null | undefined): string | undefined {\n return testIdentity(value)?.split(\".\").at(-1);\n}\n\nexport function prefixedTestId(\n prefix: string,\n value: string | null | undefined,\n): string | undefined {\n const identity = leafTestIdentity(value);\n\n return identity ? `${prefix}-${identity}` : undefined;\n}\n\nexport function prefixedNodeTestId(prefix: string, node: IdentifiedNode): string | undefined {\n return prefixedTestId(prefix, nodeIdentity(node));\n}\n"],"mappings":";AAIA,SAAgB,aAAa,OAAsD;CACjF,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,KAAK,KAAA,IAAY;AAC7E;AAEA,SAAgB,aAAa,MAA0C;CACrE,OAAO,aAAa,KAAK,GAAG,KAAK,aAAa,KAAK,EAAE;AACvD;AAEA,SAAgB,iBAAiB,OAAsD;CACrF,OAAO,aAAa,KAAK,GAAG,MAAM,GAAG,EAAE,GAAG,EAAE;AAC9C;AAEA,SAAgB,eACd,QACA,OACoB;CACpB,MAAM,WAAW,iBAAiB,KAAK;CAEvC,OAAO,WAAW,GAAG,OAAO,GAAG,aAAa,KAAA;AAC9C;AAEA,SAAgB,mBAAmB,QAAgB,MAA0C;CAC3F,OAAO,eAAe,QAAQ,aAAa,IAAI,CAAC;AAClD"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ComponentType as ReactComponentType, ReactNode } from 'react';
|
|
2
|
-
import { Node as WireNode, NodeType, Option, PageContainer as KnownPageContainer } from '../types/generated';
|
|
2
|
+
import { Node as WireNode, NodeType, Option, PageContainer as KnownPageContainer, ListenerPayload } from '../types/generated';
|
|
3
3
|
export type { KnownPageContainer, NodeType, WireNode };
|
|
4
4
|
/** Loose props bag for nodes whose `type` is not a generated built-in. */
|
|
5
5
|
export type NodeProps = Record<string, unknown>;
|
|
6
|
+
export type CommonNodeProps = {
|
|
7
|
+
dataBindings?: Record<string, string> | null;
|
|
8
|
+
hideWhenCollapsed?: boolean | null;
|
|
9
|
+
};
|
|
6
10
|
/** A `{ label, value }` pair used by the choice, select and segmented controls. */
|
|
7
11
|
export type { Option };
|
|
8
12
|
/**
|
|
@@ -25,18 +29,23 @@ export type LooseNode<TType extends string = string> = {
|
|
|
25
29
|
*/
|
|
26
30
|
export interface ComponentProps {
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Resolves a registry `type` string to its payload: consumer augmentations
|
|
34
|
+
* (`TAugment`) first, then generated built-ins (`TBuiltins`), then a loose
|
|
35
|
+
* fallback. Shared by the component, column, chat-part and effect type maps so
|
|
36
|
+
* every extensible kind resolves the same way.
|
|
37
|
+
*/
|
|
38
|
+
export type ResolveProps<TAugment, TBuiltins, TType extends string, TFallback> = TType extends keyof TAugment ? TAugment[TType] : TType extends keyof TBuiltins ? TBuiltins[TType] : TFallback;
|
|
39
|
+
type WireNodeProps = {
|
|
40
|
+
[TNode in WireNode as TNode["type"]]: TNode extends {
|
|
41
|
+
props: infer TProps;
|
|
42
|
+
} ? TProps : never;
|
|
43
|
+
};
|
|
35
44
|
/**
|
|
36
45
|
* Resolves a wire `type` to its props: consumer augmentations
|
|
37
46
|
* (`ComponentProps`) first, then generated built-ins, then a loose bag.
|
|
38
47
|
*/
|
|
39
|
-
export type PropsOf<TType extends string> =
|
|
48
|
+
export type PropsOf<TType extends string> = ResolveProps<ComponentProps, WireNodeProps, TType, NodeProps> & CommonNodeProps;
|
|
40
49
|
/**
|
|
41
50
|
* Resolves a wire `type` string to its node shape: built-ins narrow to their
|
|
42
51
|
* generated props, unknown types fall back to a loose props bag so custom
|
|
@@ -58,10 +67,17 @@ export type LayoutPayload = {
|
|
|
58
67
|
key: string;
|
|
59
68
|
schema: Schema;
|
|
60
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* The page payload the server hydrates onto `lattice` (see PHP `Page::toArray`).
|
|
72
|
+
* Hand-written rather than generated: its `schema`/`layout.schema` are component
|
|
73
|
+
* trees serialized eagerly during the request (to fire side effects before the
|
|
74
|
+
* final encode), so they cannot be derived from a value object as typed `Node[]`.
|
|
75
|
+
*/
|
|
61
76
|
export type PagePayload = {
|
|
62
77
|
breadcrumbs: PageBreadcrumb[];
|
|
63
78
|
container: PageContainer;
|
|
64
79
|
layout: LayoutPayload | null;
|
|
80
|
+
listeners?: ListenerPayload[];
|
|
65
81
|
schema: Schema;
|
|
66
82
|
title: string | null;
|
|
67
83
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SizableColumn } from './column-sizing';
|
|
3
|
+
type ResizeHandleProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
"aria-label": string;
|
|
5
|
+
"aria-orientation": "vertical";
|
|
6
|
+
"aria-valuemax": number;
|
|
7
|
+
"aria-valuemin": number;
|
|
8
|
+
"aria-valuenow": number;
|
|
9
|
+
role: "separator";
|
|
10
|
+
tabIndex: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function useColumnResizing({ columnGapPx, columns, enabled, leadingTracks, showIndicator, storageKey, trailingTracks, }: {
|
|
13
|
+
columnGapPx?: number;
|
|
14
|
+
columns: SizableColumn[];
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
leadingTracks?: string[];
|
|
17
|
+
showIndicator?: boolean;
|
|
18
|
+
storageKey?: string;
|
|
19
|
+
trailingTracks?: string[];
|
|
20
|
+
}): {
|
|
21
|
+
getResizeHandleProps: (column: SizableColumn) => ResizeHandleProps;
|
|
22
|
+
gridTemplateColumns: string;
|
|
23
|
+
hasOverrides: boolean;
|
|
24
|
+
resetColumns: () => void;
|
|
25
|
+
resetColumnWidth: (column: SizableColumn) => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|