@lattice-php/lattice 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +8 -0
- package/dist/action/components/action-form.d.ts +24 -0
- package/dist/action/components/action-form.js +270 -0
- package/dist/action/components/action-form.js.map +1 -0
- package/dist/action/components/action-group.d.ts +1 -8
- package/dist/action/components/action-group.js +24 -66
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action.d.ts +1 -24
- package/dist/action/components/action.js +61 -46
- package/dist/action/components/action.js.map +1 -1
- package/dist/action/effects.d.ts +6 -25
- package/dist/action/effects.js +2 -2
- package/dist/action/effects.js.map +1 -1
- package/dist/action/index.d.ts +1 -1
- package/dist/core/components/badge.d.ts +1 -8
- package/dist/core/components/badge.js +2 -3
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/button.d.ts +4 -12
- package/dist/core/components/button.js +6 -9
- package/dist/core/components/button.js.map +1 -1
- package/dist/core/components/card.d.ts +1 -9
- package/dist/core/components/card.js +1 -3
- package/dist/core/components/card.js.map +1 -1
- package/dist/core/components/confirm-dialog.d.ts +2 -3
- package/dist/core/components/confirm-dialog.js +19 -13
- package/dist/core/components/confirm-dialog.js.map +1 -1
- package/dist/core/components/fragment.d.ts +1 -10
- package/dist/core/components/fragment.js +5 -6
- package/dist/core/components/fragment.js.map +1 -1
- package/dist/core/components/grid.d.ts +1 -8
- package/dist/core/components/grid.js +1 -2
- package/dist/core/components/grid.js.map +1 -1
- package/dist/core/components/heading.d.ts +1 -9
- package/dist/core/components/heading.js +2 -3
- package/dist/core/components/heading.js.map +1 -1
- package/dist/core/components/icon.d.ts +3 -0
- package/dist/core/components/icon.js +30 -0
- package/dist/core/components/icon.js.map +1 -0
- package/dist/core/components/index.d.ts +1 -1
- package/dist/core/components/index.js +4 -0
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/link.d.ts +1 -12
- package/dist/core/components/link.js +4 -9
- package/dist/core/components/link.js.map +1 -1
- package/dist/core/components/modal.d.ts +1 -11
- package/dist/core/components/modal.js +27 -31
- package/dist/core/components/modal.js.map +1 -1
- package/dist/core/components/section.d.ts +3 -0
- package/dist/core/components/section.js +79 -0
- package/dist/core/components/section.js.map +1 -0
- package/dist/core/components/segmented-control.d.ts +1 -14
- package/dist/core/components/segmented-control.js +4 -7
- package/dist/core/components/segmented-control.js.map +1 -1
- package/dist/core/components/segmented-pills.d.ts +4 -2
- package/dist/core/components/segmented-pills.js +10 -1
- package/dist/core/components/segmented-pills.js.map +1 -1
- package/dist/core/components/spinner.js +8 -4
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/stack.d.ts +1 -11
- package/dist/core/components/stack.js +5 -5
- package/dist/core/components/stack.js.map +1 -1
- package/dist/core/components/tabs.d.ts +1 -19
- package/dist/core/components/tabs.js +45 -21
- package/dist/core/components/tabs.js.map +1 -1
- package/dist/core/components/text.d.ts +1 -9
- package/dist/core/components/text.js +2 -3
- package/dist/core/components/text.js.map +1 -1
- package/dist/core/registry.d.ts +9 -3
- package/dist/core/registry.js +21 -5
- package/dist/core/registry.js.map +1 -1
- package/dist/core/renderer.js +7 -13
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/types.d.ts +54 -26
- package/dist/form/components/base/checkbox.js +5 -2
- package/dist/form/components/base/checkbox.js.map +1 -1
- package/dist/form/components/base/field.d.ts +2 -1
- package/dist/form/components/base/field.js +5 -1
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/base/password-input.js +9 -2
- package/dist/form/components/base/password-input.js.map +1 -1
- package/dist/form/components/base/submit-button.d.ts +4 -4
- package/dist/form/components/base/submit-button.js +2 -2
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/conditions.d.ts +6 -9
- package/dist/form/components/conditions.js +10 -2
- package/dist/form/components/conditions.js.map +1 -1
- package/dist/form/components/context.d.ts +0 -4
- package/dist/form/components/context.js +1 -5
- package/dist/form/components/context.js.map +1 -1
- package/dist/form/components/field-props.d.ts +24 -0
- package/dist/form/components/field-props.js +15 -0
- package/dist/form/components/field-props.js.map +1 -0
- package/dist/form/components/fields/checkbox.d.ts +1 -15
- package/dist/form/components/fields/checkbox.js +16 -21
- package/dist/form/components/fields/checkbox.js.map +1 -1
- package/dist/form/components/fields/choice.d.ts +1 -13
- package/dist/form/components/fields/choice.js +13 -20
- package/dist/form/components/fields/choice.js.map +1 -1
- package/dist/form/components/fields/date-input.d.ts +1 -19
- package/dist/form/components/fields/date-input.js +11 -16
- package/dist/form/components/fields/date-input.js.map +1 -1
- package/dist/form/components/fields/hidden-input.d.ts +1 -9
- package/dist/form/components/fields/hidden-input.js +2 -3
- package/dist/form/components/fields/hidden-input.js.map +1 -1
- package/dist/form/components/fields/number-input.d.ts +1 -22
- package/dist/form/components/fields/number-input.js +38 -41
- package/dist/form/components/fields/number-input.js.map +1 -1
- package/dist/form/components/fields/password-input.d.ts +1 -28
- package/dist/form/components/fields/password-input.js +15 -24
- package/dist/form/components/fields/password-input.js.map +1 -1
- package/dist/form/components/fields/rich-editor.d.ts +1 -16
- package/dist/form/components/fields/rich-editor.js +57 -47
- package/dist/form/components/fields/rich-editor.js.map +1 -1
- package/dist/form/components/fields/select.d.ts +1 -22
- package/dist/form/components/fields/select.js +85 -74
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/simple-field.d.ts +9 -0
- package/dist/form/components/fields/simple-field.js +22 -0
- package/dist/form/components/fields/simple-field.js.map +1 -0
- package/dist/form/components/fields/text-input.d.ts +1 -20
- package/dist/form/components/fields/text-input.js +12 -17
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/textarea.d.ts +1 -19
- package/dist/form/components/fields/textarea.js +11 -16
- package/dist/form/components/fields/textarea.js.map +1 -1
- package/dist/form/components/form.d.ts +1 -20
- package/dist/form/components/form.js +29 -36
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/index.d.ts +0 -1
- package/dist/form/components/index.js +1 -2
- package/dist/form/components/resolved-nodes.d.ts +1 -1
- package/dist/form/components/resolved-nodes.js +2 -2
- package/dist/form/components/resolved-nodes.js.map +1 -1
- package/dist/form/components/types.d.ts +1 -0
- package/dist/form/components/use-controlled-field.d.ts +3 -9
- package/dist/form/components/use-controlled-field.js +5 -9
- package/dist/form/components/use-controlled-field.js.map +1 -1
- package/dist/form/components/use-dependent-field.d.ts +1 -1
- package/dist/form/components/use-dependent-field.js +8 -8
- package/dist/form/components/use-dependent-field.js.map +1 -1
- package/dist/form/components/use-form-resolver.d.ts +1 -1
- package/dist/form/components/use-form-resolver.js +8 -13
- package/dist/form/components/use-form-resolver.js.map +1 -1
- package/dist/form/components/use-seed-default.d.ts +5 -0
- package/dist/form/components/use-seed-default.js +23 -0
- package/dist/form/components/use-seed-default.js.map +1 -0
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +0 -1
- package/dist/form/index.js.map +1 -1
- package/dist/form/skeleton.d.ts +1 -1
- package/dist/form/skeleton.js +1 -1
- package/dist/form/skeleton.js.map +1 -1
- package/dist/i18n/backend.d.ts +24 -0
- package/dist/i18n/backend.js +39 -0
- package/dist/i18n/backend.js.map +1 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/instance.js +48 -0
- package/dist/i18n/instance.js.map +1 -0
- package/dist/icons/icon-renderer.js +30 -5
- package/dist/icons/icon-renderer.js.map +1 -1
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -1
- package/dist/icons/sprite.d.ts +30 -0
- package/dist/icons/sprite.js +40 -0
- package/dist/icons/sprite.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +7 -3
- package/dist/inertia.d.ts +1 -6
- package/dist/inertia.js +4 -8
- package/dist/inertia.js.map +1 -1
- package/dist/lattice.css +129 -5
- package/dist/layout/components.d.ts +1 -0
- package/dist/layout/components.js +19 -0
- package/dist/layout/components.js.map +1 -0
- package/dist/layout/context.d.ts +12 -0
- package/dist/layout/context.js +19 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +4 -0
- package/dist/layout/menu-item.d.ts +3 -0
- package/dist/layout/menu-item.js +130 -0
- package/dist/layout/menu-item.js.map +1 -0
- package/dist/layout/menu.d.ts +3 -0
- package/dist/layout/menu.js +13 -0
- package/dist/layout/menu.js.map +1 -0
- package/dist/layout/outlet.d.ts +6 -0
- package/dist/layout/outlet.js +14 -0
- package/dist/layout/outlet.js.map +1 -0
- package/dist/layout/schema-layout.d.ts +10 -0
- package/dist/layout/schema-layout.js +30 -0
- package/dist/layout/schema-layout.js.map +1 -0
- package/dist/layout/sidebar.d.ts +3 -0
- package/dist/layout/sidebar.js +48 -0
- package/dist/layout/sidebar.js.map +1 -0
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +1 -4
- package/dist/lib/utils.js.map +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.js +1982 -0
- package/dist/node_modules/i18next/dist/esm/i18next.js.map +1 -0
- package/dist/node_modules/i18next-http-backend/esm/index.js +352 -0
- package/dist/node_modules/i18next-http-backend/esm/index.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/context.js +23 -0
- package/dist/node_modules/react-i18next/dist/es/context.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/defaults.js +29 -0
- package/dist/node_modules/react-i18next/dist/es/defaults.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +10 -0
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +14 -0
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/unescape.js +30 -0
- package/dist/node_modules/react-i18next/dist/es/unescape.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +157 -0
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js.map +1 -0
- package/dist/node_modules/react-i18next/dist/es/utils.js +58 -0
- package/dist/node_modules/react-i18next/dist/es/utils.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +70 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +61 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +13 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/page.d.ts +1 -1
- package/dist/page.js +2 -2
- package/dist/page.js.map +1 -1
- package/dist/provider.d.ts +8 -3
- package/dist/provider.js +17 -9
- package/dist/provider.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +2 -1
- package/dist/registry.js.map +1 -1
- package/dist/table/bulk.d.ts +6 -10
- package/dist/table/bulk.js +13 -35
- package/dist/table/bulk.js.map +1 -1
- package/dist/table/column-registry.d.ts +9 -0
- package/dist/table/components/bulk-bar.js +34 -3
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.d.ts +5 -0
- package/dist/table/components/cells/badge-cell.js +16 -0
- package/dist/table/components/cells/badge-cell.js.map +1 -0
- package/dist/table/components/cells/icon-cell.d.ts +5 -0
- package/dist/table/components/cells/icon-cell.js +22 -0
- package/dist/table/components/cells/icon-cell.js.map +1 -0
- package/dist/table/components/cells/image-cell.d.ts +5 -0
- package/dist/table/components/cells/image-cell.js +24 -0
- package/dist/table/components/cells/image-cell.js.map +1 -0
- package/dist/table/components/cells/text-cell.d.ts +6 -0
- package/dist/table/components/cells/text-cell.js +50 -0
- package/dist/table/components/cells/text-cell.js.map +1 -0
- package/dist/table/components/column-filter-control.js +59 -96
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.js +22 -11
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/filter-stack-bar.d.ts +2 -2
- package/dist/table/components/filter-stack-bar.js +10 -8
- package/dist/table/components/filter-stack-bar.js.map +1 -1
- package/dist/table/components/filter-value-input.d.ts +5 -3
- package/dist/table/components/filter-value-input.js +25 -16
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.d.ts +1 -1
- package/dist/table/components/pagination.js +20 -8
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.d.ts +2 -2
- package/dist/table/components/sort-bar.js +12 -10
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-action-node.d.ts +1 -1
- package/dist/table/components/table-action-node.js +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 +24 -43
- package/dist/table/components/table-cell.js.map +1 -1
- package/dist/table/components/table.d.ts +6 -2
- package/dist/table/components/table.js +40 -17
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/format.js +5 -3
- package/dist/table/format.js.map +1 -1
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/table/payload.d.ts +1 -1
- package/dist/table/query.d.ts +0 -1
- package/dist/table/query.js +8 -9
- package/dist/table/query.js.map +1 -1
- package/dist/table/types.d.ts +38 -42
- package/dist/table/use-table.d.ts +3 -4
- package/dist/table/use-table.js +12 -23
- package/dist/table/use-table.js.map +1 -1
- package/dist/test-support.d.ts +14 -0
- package/dist/test-support.js +14 -0
- package/dist/test-support.js.map +1 -0
- package/dist/toast/index.d.ts +1 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/toaster.d.ts +3 -0
- package/dist/toast/toaster.js +126 -0
- package/dist/toast/toaster.js.map +1 -0
- package/dist/types/generated.d.ts +677 -0
- package/dist/types/generated.js +0 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +18 -3
- package/resources/icons/align-center.svg +17 -0
- package/resources/icons/align-justify.svg +17 -0
- package/resources/icons/align-left.svg +17 -0
- package/resources/icons/align-right.svg +17 -0
- package/resources/icons/arrow-down.svg +16 -0
- package/resources/icons/arrow-up.svg +16 -0
- package/resources/icons/bold.svg +15 -0
- package/resources/icons/check.svg +15 -0
- package/resources/icons/chevron-down.svg +15 -0
- package/resources/icons/chevron-right.svg +15 -0
- package/resources/icons/chevrons-up-down.svg +16 -0
- package/resources/icons/circle-alert.svg +17 -0
- package/resources/icons/circle-check.svg +16 -0
- package/resources/icons/circle-help.svg +17 -0
- package/resources/icons/circle-x.svg +17 -0
- package/resources/icons/code.svg +16 -0
- package/resources/icons/columns-3.svg +17 -0
- package/resources/icons/copy.svg +16 -0
- package/resources/icons/external-link.svg +17 -0
- package/resources/icons/eye-off.svg +18 -0
- package/resources/icons/eye.svg +16 -0
- package/resources/icons/filter.svg +15 -0
- package/resources/icons/heading-1.svg +18 -0
- package/resources/icons/heading-2.svg +18 -0
- package/resources/icons/heading-3.svg +19 -0
- package/resources/icons/highlighter.svg +16 -0
- package/resources/icons/info.svg +17 -0
- package/resources/icons/italic.svg +17 -0
- package/resources/icons/layout-dashboard.svg +18 -0
- package/resources/icons/link.svg +16 -0
- package/resources/icons/list-ordered.svg +20 -0
- package/resources/icons/list.svg +20 -0
- package/resources/icons/loader-2.svg +15 -0
- package/resources/icons/minus.svg +15 -0
- package/resources/icons/more-horizontal.svg +17 -0
- package/resources/icons/panel-left.svg +16 -0
- package/resources/icons/pencil-line.svg +17 -0
- package/resources/icons/pencil.svg +16 -0
- package/resources/icons/plus.svg +16 -0
- package/resources/icons/quote.svg +16 -0
- package/resources/icons/rows-3.svg +17 -0
- package/resources/icons/search.svg +16 -0
- package/resources/icons/send.svg +16 -0
- package/resources/icons/settings.svg +16 -0
- package/resources/icons/smile.svg +18 -0
- package/resources/icons/strikethrough.svg +17 -0
- package/resources/icons/table.svg +18 -0
- package/resources/icons/trash-2.svg +19 -0
- package/resources/icons/underline.svg +16 -0
- package/resources/icons/x.svg +16 -0
- package/dist/core/props.d.ts +0 -14
- package/dist/core/props.js +0 -30
- package/dist/core/props.js.map +0 -1
- package/dist/form/components/fields/submit-button.d.ts +0 -10
- package/dist/form/components/fields/submit-button.js +0 -14
- package/dist/form/components/fields/submit-button.js.map +0 -1
- package/dist/generated/types.d.ts +0 -17
- package/dist/icons/default-icons.d.ts +0 -3
- package/dist/icons/default-icons.js +0 -44
- package/dist/icons/default-icons.js.map +0 -1
- package/dist/icons/dynamic-lucide-renderer.d.ts +0 -2
- package/dist/icons/dynamic-lucide-renderer.js +0 -18
- package/dist/icons/dynamic-lucide-renderer.js.map +0 -1
- package/dist/menu/index.d.ts +0 -1
- package/dist/menu/index.js +0 -2
- package/dist/menu/use-menu.d.ts +0 -2
- package/dist/menu/use-menu.js +0 -9
- package/dist/menu/use-menu.js.map +0 -1
- /package/dist/{generated/types.js → table/column-registry.js} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { hasLoadedNamespace, isObject, isString, loadLanguages, loadNamespaces, warnOnce } from "./utils.js";
|
|
2
|
+
import { getDefaults } from "./defaults.js";
|
|
3
|
+
import { getI18n } from "./i18nInstance.js";
|
|
4
|
+
import { I18nContext, ReportNamespaces } from "./context.js";
|
|
5
|
+
import { require_shim } from "../../../use-sync-external-store/shim/index.js";
|
|
6
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
//#region node_modules/react-i18next/dist/es/useTranslation.js
|
|
8
|
+
var import_shim = require_shim();
|
|
9
|
+
var notReadyT = (k, optsOrDefaultValue) => {
|
|
10
|
+
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
11
|
+
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
12
|
+
if (typeof k === "function") return "";
|
|
13
|
+
if (Array.isArray(k)) {
|
|
14
|
+
const last = k[k.length - 1];
|
|
15
|
+
return typeof last === "function" ? "" : last;
|
|
16
|
+
}
|
|
17
|
+
return k;
|
|
18
|
+
};
|
|
19
|
+
var notReadySnapshot = {
|
|
20
|
+
t: notReadyT,
|
|
21
|
+
ready: false
|
|
22
|
+
};
|
|
23
|
+
var dummySubscribe = () => () => {};
|
|
24
|
+
var useTranslation = (ns, props = {}) => {
|
|
25
|
+
const { i18n: i18nFromProps } = props;
|
|
26
|
+
const { i18n: i18nFromContext, defaultNS: defaultNSFromContext } = useContext(I18nContext) || {};
|
|
27
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
28
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
29
|
+
if (!i18n) warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
30
|
+
const i18nOptions = useMemo(() => ({
|
|
31
|
+
...getDefaults(),
|
|
32
|
+
...i18n?.options?.react,
|
|
33
|
+
...props
|
|
34
|
+
}), [i18n, props]);
|
|
35
|
+
const { useSuspense, keyPrefix } = i18nOptions;
|
|
36
|
+
const nsOrContext = ns || defaultNSFromContext || i18n?.options?.defaultNS;
|
|
37
|
+
const unstableNamespaces = isString(nsOrContext) ? [nsOrContext] : nsOrContext || ["translation"];
|
|
38
|
+
const namespaces = useMemo(() => unstableNamespaces, unstableNamespaces);
|
|
39
|
+
i18n?.reportNamespaces?.addUsedNamespaces?.(namespaces);
|
|
40
|
+
const revisionRef = useRef(0);
|
|
41
|
+
const subscribe = useCallback((callback) => {
|
|
42
|
+
if (!i18n) return dummySubscribe;
|
|
43
|
+
const { bindI18n, bindI18nStore } = i18nOptions;
|
|
44
|
+
const wrappedCallback = () => {
|
|
45
|
+
revisionRef.current += 1;
|
|
46
|
+
callback();
|
|
47
|
+
};
|
|
48
|
+
if (bindI18n) i18n.on(bindI18n, wrappedCallback);
|
|
49
|
+
if (bindI18nStore) i18n.store.on(bindI18nStore, wrappedCallback);
|
|
50
|
+
return () => {
|
|
51
|
+
if (bindI18n) bindI18n.split(" ").forEach((e) => i18n.off(e, wrappedCallback));
|
|
52
|
+
if (bindI18nStore) bindI18nStore.split(" ").forEach((e) => i18n.store.off(e, wrappedCallback));
|
|
53
|
+
};
|
|
54
|
+
}, [i18n, i18nOptions]);
|
|
55
|
+
const snapshotRef = useRef();
|
|
56
|
+
const getSnapshot = useCallback(() => {
|
|
57
|
+
if (!i18n) return notReadySnapshot;
|
|
58
|
+
const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
59
|
+
const currentLng = props.lng || i18n.language;
|
|
60
|
+
const currentRevision = revisionRef.current;
|
|
61
|
+
const lastSnapshot = snapshotRef.current;
|
|
62
|
+
if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === currentLng && lastSnapshot.keyPrefix === keyPrefix && lastSnapshot.revision === currentRevision) return lastSnapshot;
|
|
63
|
+
const newSnapshot = {
|
|
64
|
+
t: i18n.getFixedT(currentLng, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix, { scopeNs: namespaces }),
|
|
65
|
+
ready: calculatedReady,
|
|
66
|
+
lng: currentLng,
|
|
67
|
+
keyPrefix,
|
|
68
|
+
revision: currentRevision
|
|
69
|
+
};
|
|
70
|
+
snapshotRef.current = newSnapshot;
|
|
71
|
+
return newSnapshot;
|
|
72
|
+
}, [
|
|
73
|
+
i18n,
|
|
74
|
+
namespaces,
|
|
75
|
+
keyPrefix,
|
|
76
|
+
i18nOptions,
|
|
77
|
+
props.lng
|
|
78
|
+
]);
|
|
79
|
+
const [loadCount, setLoadCount] = useState(0);
|
|
80
|
+
const { t, ready } = (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (i18n && !ready && !useSuspense) {
|
|
83
|
+
const onLoaded = () => setLoadCount((c) => c + 1);
|
|
84
|
+
if (props.lng) loadLanguages(i18n, props.lng, namespaces, onLoaded);
|
|
85
|
+
else loadNamespaces(i18n, namespaces, onLoaded);
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
i18n,
|
|
89
|
+
props.lng,
|
|
90
|
+
namespaces,
|
|
91
|
+
ready,
|
|
92
|
+
useSuspense,
|
|
93
|
+
loadCount
|
|
94
|
+
]);
|
|
95
|
+
const finalI18n = i18n || {};
|
|
96
|
+
const wrapperRef = useRef(null);
|
|
97
|
+
const wrapperLangRef = useRef();
|
|
98
|
+
const createI18nWrapper = (original) => {
|
|
99
|
+
const descriptors = Object.getOwnPropertyDescriptors(original);
|
|
100
|
+
if (descriptors.__original) delete descriptors.__original;
|
|
101
|
+
const wrapper = Object.create(Object.getPrototypeOf(original), descriptors);
|
|
102
|
+
if (!Object.prototype.hasOwnProperty.call(wrapper, "__original")) try {
|
|
103
|
+
Object.defineProperty(wrapper, "__original", {
|
|
104
|
+
value: original,
|
|
105
|
+
writable: false,
|
|
106
|
+
enumerable: false,
|
|
107
|
+
configurable: false
|
|
108
|
+
});
|
|
109
|
+
} catch (_) {}
|
|
110
|
+
return wrapper;
|
|
111
|
+
};
|
|
112
|
+
const ret = useMemo(() => {
|
|
113
|
+
const original = finalI18n;
|
|
114
|
+
const lang = original?.language;
|
|
115
|
+
let i18nWrapper = original;
|
|
116
|
+
if (original) if (wrapperRef.current && wrapperRef.current.__original === original) if (wrapperLangRef.current !== lang) {
|
|
117
|
+
i18nWrapper = createI18nWrapper(original);
|
|
118
|
+
wrapperRef.current = i18nWrapper;
|
|
119
|
+
wrapperLangRef.current = lang;
|
|
120
|
+
} else i18nWrapper = wrapperRef.current;
|
|
121
|
+
else {
|
|
122
|
+
i18nWrapper = createI18nWrapper(original);
|
|
123
|
+
wrapperRef.current = i18nWrapper;
|
|
124
|
+
wrapperLangRef.current = lang;
|
|
125
|
+
}
|
|
126
|
+
const effectiveT = !ready && !useSuspense ? (...args) => {
|
|
127
|
+
warnOnce(i18n, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.");
|
|
128
|
+
return t(...args);
|
|
129
|
+
} : t;
|
|
130
|
+
const arr = [
|
|
131
|
+
effectiveT,
|
|
132
|
+
i18nWrapper,
|
|
133
|
+
ready
|
|
134
|
+
];
|
|
135
|
+
arr.t = effectiveT;
|
|
136
|
+
arr.i18n = i18nWrapper;
|
|
137
|
+
arr.ready = ready;
|
|
138
|
+
return arr;
|
|
139
|
+
}, [
|
|
140
|
+
t,
|
|
141
|
+
finalI18n,
|
|
142
|
+
ready,
|
|
143
|
+
finalI18n.resolvedLanguage,
|
|
144
|
+
finalI18n.language,
|
|
145
|
+
finalI18n.languages
|
|
146
|
+
]);
|
|
147
|
+
if (i18n && useSuspense && !ready) throw new Promise((resolve) => {
|
|
148
|
+
const onLoaded = () => resolve();
|
|
149
|
+
if (props.lng) loadLanguages(i18n, props.lng, namespaces, onLoaded);
|
|
150
|
+
else loadNamespaces(i18n, namespaces, onLoaded);
|
|
151
|
+
});
|
|
152
|
+
return ret;
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
export { useTranslation };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=useTranslation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslation.js","names":[],"sources":["../../../../../node_modules/react-i18next/dist/es/useTranslation.js"],"sourcesContent":["import { useContext, useCallback, useMemo, useEffect, useRef, useState } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context.js';\nimport { warnOnce, loadNamespaces, loadLanguages, hasLoadedNamespace, isString, isObject } from './utils.js';\nconst notReadyT = (k, optsOrDefaultValue) => {\n if (isString(optsOrDefaultValue)) return optsOrDefaultValue;\n if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;\n if (typeof k === 'function') return '';\n if (Array.isArray(k)) {\n const last = k[k.length - 1];\n return typeof last === 'function' ? '' : last;\n }\n return k;\n};\nconst notReadySnapshot = {\n t: notReadyT,\n ready: false\n};\nconst dummySubscribe = () => () => {};\nexport const useTranslation = (ns, props = {}) => {\n const {\n i18n: i18nFromProps\n } = props;\n const {\n i18n: i18nFromContext,\n defaultNS: defaultNSFromContext\n } = useContext(I18nContext) || {};\n const i18n = i18nFromProps || i18nFromContext || getI18n();\n if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();\n if (!i18n) {\n warnOnce(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next');\n }\n const i18nOptions = useMemo(() => ({\n ...getDefaults(),\n ...i18n?.options?.react,\n ...props\n }), [i18n, props]);\n const {\n useSuspense,\n keyPrefix\n } = i18nOptions;\n const nsOrContext = ns || defaultNSFromContext || i18n?.options?.defaultNS;\n const unstableNamespaces = isString(nsOrContext) ? [nsOrContext] : nsOrContext || ['translation'];\n const namespaces = useMemo(() => unstableNamespaces, unstableNamespaces);\n i18n?.reportNamespaces?.addUsedNamespaces?.(namespaces);\n const revisionRef = useRef(0);\n const subscribe = useCallback(callback => {\n if (!i18n) return dummySubscribe;\n const {\n bindI18n,\n bindI18nStore\n } = i18nOptions;\n const wrappedCallback = () => {\n revisionRef.current += 1;\n callback();\n };\n if (bindI18n) i18n.on(bindI18n, wrappedCallback);\n if (bindI18nStore) i18n.store.on(bindI18nStore, wrappedCallback);\n return () => {\n if (bindI18n) bindI18n.split(' ').forEach(e => i18n.off(e, wrappedCallback));\n if (bindI18nStore) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, wrappedCallback));\n };\n }, [i18n, i18nOptions]);\n const snapshotRef = useRef();\n const getSnapshot = useCallback(() => {\n if (!i18n) {\n return notReadySnapshot;\n }\n const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));\n const currentLng = props.lng || i18n.language;\n const currentRevision = revisionRef.current;\n const lastSnapshot = snapshotRef.current;\n if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === currentLng && lastSnapshot.keyPrefix === keyPrefix && lastSnapshot.revision === currentRevision) {\n return lastSnapshot;\n }\n const calculatedT = i18n.getFixedT(currentLng, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix, {\n scopeNs: namespaces\n });\n const newSnapshot = {\n t: calculatedT,\n ready: calculatedReady,\n lng: currentLng,\n keyPrefix,\n revision: currentRevision\n };\n snapshotRef.current = newSnapshot;\n return newSnapshot;\n }, [i18n, namespaces, keyPrefix, i18nOptions, props.lng]);\n const [loadCount, setLoadCount] = useState(0);\n const {\n t,\n ready\n } = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n useEffect(() => {\n if (i18n && !ready && !useSuspense) {\n const onLoaded = () => setLoadCount(c => c + 1);\n if (props.lng) {\n loadLanguages(i18n, props.lng, namespaces, onLoaded);\n } else {\n loadNamespaces(i18n, namespaces, onLoaded);\n }\n }\n }, [i18n, props.lng, namespaces, ready, useSuspense, loadCount]);\n const finalI18n = i18n || {};\n const wrapperRef = useRef(null);\n const wrapperLangRef = useRef();\n const createI18nWrapper = original => {\n const descriptors = Object.getOwnPropertyDescriptors(original);\n if (descriptors.__original) delete descriptors.__original;\n const wrapper = Object.create(Object.getPrototypeOf(original), descriptors);\n if (!Object.prototype.hasOwnProperty.call(wrapper, '__original')) {\n try {\n Object.defineProperty(wrapper, '__original', {\n value: original,\n writable: false,\n enumerable: false,\n configurable: false\n });\n } catch (_) {}\n }\n return wrapper;\n };\n const ret = useMemo(() => {\n const original = finalI18n;\n const lang = original?.language;\n let i18nWrapper = original;\n if (original) {\n if (wrapperRef.current && wrapperRef.current.__original === original) {\n if (wrapperLangRef.current !== lang) {\n i18nWrapper = createI18nWrapper(original);\n wrapperRef.current = i18nWrapper;\n wrapperLangRef.current = lang;\n } else {\n i18nWrapper = wrapperRef.current;\n }\n } else {\n i18nWrapper = createI18nWrapper(original);\n wrapperRef.current = i18nWrapper;\n wrapperLangRef.current = lang;\n }\n }\n const effectiveT = !ready && !useSuspense ? (...args) => {\n warnOnce(i18n, 'USE_T_BEFORE_READY', 'useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.');\n return t(...args);\n } : t;\n const arr = [effectiveT, i18nWrapper, ready];\n arr.t = effectiveT;\n arr.i18n = i18nWrapper;\n arr.ready = ready;\n return arr;\n }, [t, finalI18n, ready, finalI18n.resolvedLanguage, finalI18n.language, finalI18n.languages]);\n if (i18n && useSuspense && !ready) {\n throw new Promise(resolve => {\n const onLoaded = () => resolve();\n if (props.lng) {\n loadLanguages(i18n, props.lng, namespaces, onLoaded);\n } else {\n loadNamespaces(i18n, namespaces, onLoaded);\n }\n });\n }\n return ret;\n};"],"x_google_ignoreList":[0],"mappings":"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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region node_modules/react-i18next/dist/es/utils.js
|
|
2
|
+
var warn = (i18n, code, msg, rest) => {
|
|
3
|
+
const args = [msg, {
|
|
4
|
+
code,
|
|
5
|
+
...rest || {}
|
|
6
|
+
}];
|
|
7
|
+
if (i18n?.services?.logger?.forward) return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
8
|
+
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
9
|
+
if (i18n?.services?.logger?.warn) i18n.services.logger.warn(...args);
|
|
10
|
+
else if (console?.warn) console.warn(...args);
|
|
11
|
+
};
|
|
12
|
+
var alreadyWarned = {};
|
|
13
|
+
var warnOnce = (i18n, code, msg, rest) => {
|
|
14
|
+
if (isString(msg) && alreadyWarned[msg]) return;
|
|
15
|
+
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
16
|
+
warn(i18n, code, msg, rest);
|
|
17
|
+
};
|
|
18
|
+
var loadedClb = (i18n, cb) => () => {
|
|
19
|
+
if (i18n.isInitialized) cb();
|
|
20
|
+
else {
|
|
21
|
+
const initialized = () => {
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
i18n.off("initialized", initialized);
|
|
24
|
+
}, 0);
|
|
25
|
+
cb();
|
|
26
|
+
};
|
|
27
|
+
i18n.on("initialized", initialized);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var loadNamespaces = (i18n, ns, cb) => {
|
|
31
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
32
|
+
};
|
|
33
|
+
var loadLanguages = (i18n, lng, ns, cb) => {
|
|
34
|
+
if (isString(ns)) ns = [ns];
|
|
35
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
36
|
+
ns.forEach((n) => {
|
|
37
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
38
|
+
});
|
|
39
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
40
|
+
};
|
|
41
|
+
var hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
42
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
43
|
+
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: i18n.languages });
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
47
|
+
lng: options.lng,
|
|
48
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
49
|
+
if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
var isString = (obj) => typeof obj === "string";
|
|
54
|
+
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { hasLoadedNamespace, isObject, isString, loadLanguages, loadNamespaces, warnOnce };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../../node_modules/react-i18next/dist/es/utils.js"],"sourcesContent":["export const warn = (i18n, code, msg, rest) => {\n const args = [msg, {\n code,\n ...(rest || {})\n }];\n if (i18n?.services?.logger?.forward) {\n return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true);\n }\n if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;\n if (i18n?.services?.logger?.warn) {\n i18n.services.logger.warn(...args);\n } else if (console?.warn) {\n console.warn(...args);\n }\n};\nconst alreadyWarned = {};\nexport const warnOnce = (i18n, code, msg, rest) => {\n if (isString(msg) && alreadyWarned[msg]) return;\n if (isString(msg)) alreadyWarned[msg] = new Date();\n warn(i18n, code, msg, rest);\n};\nconst loadedClb = (i18n, cb) => () => {\n if (i18n.isInitialized) {\n cb();\n } else {\n const initialized = () => {\n setTimeout(() => {\n i18n.off('initialized', initialized);\n }, 0);\n cb();\n };\n i18n.on('initialized', initialized);\n }\n};\nexport const loadNamespaces = (i18n, ns, cb) => {\n i18n.loadNamespaces(ns, loadedClb(i18n, cb));\n};\nexport const loadLanguages = (i18n, lng, ns, cb) => {\n if (isString(ns)) ns = [ns];\n if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);\n ns.forEach(n => {\n if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);\n });\n i18n.loadLanguages(lng, loadedClb(i18n, cb));\n};\nexport const hasLoadedNamespace = (ns, i18n, options = {}) => {\n if (!i18n.languages || !i18n.languages.length) {\n warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', {\n languages: i18n.languages\n });\n return true;\n }\n return i18n.hasLoadedNamespace(ns, {\n lng: options.lng,\n precheck: (i18nInstance, loadNotPending) => {\n if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;\n }\n });\n};\nexport const getDisplayName = Component => Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : 'Unknown');\nexport const isString = obj => typeof obj === 'string';\nexport const isObject = obj => typeof obj === 'object' && obj !== null;"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAa,QAAQ,MAAM,MAAM,KAAK,SAAS;CAC7C,MAAM,OAAO,CAAC,KAAK;EACjB;EACA,GAAI,QAAQ,CAAC;CACf,CAAC;CACD,IAAI,MAAM,UAAU,QAAQ,SAC1B,OAAO,KAAK,SAAS,OAAO,QAAQ,MAAM,QAAQ,mBAAmB,IAAI;CAE3E,IAAI,SAAS,KAAK,EAAE,GAAG,KAAK,KAAK,mBAAmB,KAAK;CACzD,IAAI,MAAM,UAAU,QAAQ,MAC1B,KAAK,SAAS,OAAO,KAAK,GAAG,IAAI;MAC5B,IAAI,SAAS,MAClB,QAAQ,KAAK,GAAG,IAAI;AAExB;AACA,IAAM,gBAAgB,CAAC;AACvB,IAAa,YAAY,MAAM,MAAM,KAAK,SAAS;CACjD,IAAI,SAAS,GAAG,KAAK,cAAc,MAAM;CACzC,IAAI,SAAS,GAAG,GAAG,cAAc,uBAAO,IAAI,KAAK;CACjD,KAAK,MAAM,MAAM,KAAK,IAAI;AAC5B;AACA,IAAM,aAAa,MAAM,aAAa;CACpC,IAAI,KAAK,eACP,GAAG;MACE;EACL,MAAM,oBAAoB;GACxB,iBAAiB;IACf,KAAK,IAAI,eAAe,WAAW;GACrC,GAAG,CAAC;GACJ,GAAG;EACL;EACA,KAAK,GAAG,eAAe,WAAW;CACpC;AACF;AACA,IAAa,kBAAkB,MAAM,IAAI,OAAO;CAC9C,KAAK,eAAe,IAAI,UAAU,MAAM,EAAE,CAAC;AAC7C;AACA,IAAa,iBAAiB,MAAM,KAAK,IAAI,OAAO;CAClD,IAAI,SAAS,EAAE,GAAG,KAAK,CAAC,EAAE;CAC1B,IAAI,KAAK,QAAQ,WAAW,KAAK,QAAQ,QAAQ,QAAQ,GAAG,IAAI,IAAI,OAAO,eAAe,MAAM,IAAI,EAAE;CACtG,GAAG,SAAQ,MAAK;EACd,IAAI,KAAK,QAAQ,GAAG,QAAQ,CAAC,IAAI,GAAG,KAAK,QAAQ,GAAG,KAAK,CAAC;CAC5D,CAAC;CACD,KAAK,cAAc,KAAK,UAAU,MAAM,EAAE,CAAC;AAC7C;AACA,IAAa,sBAAsB,IAAI,MAAM,UAAU,CAAC,MAAM;CAC5D,IAAI,CAAC,KAAK,aAAa,CAAC,KAAK,UAAU,QAAQ;EAC7C,SAAS,MAAM,gBAAgB,0CAA0C,EACvE,WAAW,KAAK,UAClB,CAAC;EACD,OAAO;CACT;CACA,OAAO,KAAK,mBAAmB,IAAI;EACjC,KAAK,QAAQ;EACb,WAAW,cAAc,mBAAmB;GAC1C,IAAI,QAAQ,YAAY,QAAQ,SAAS,QAAQ,kBAAkB,IAAI,MAAM,aAAa,SAAS,iBAAiB,WAAW,aAAa,wBAAwB,CAAC,eAAe,aAAa,sBAAsB,EAAE,GAAG,OAAO;EACrO;CACF,CAAC;AACH;AAEA,IAAa,YAAW,QAAO,OAAO,QAAQ;AAC9C,IAAa,YAAW,QAAO,OAAO,QAAQ,YAAY,QAAQ"}
|
package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* use-sync-external-store-shim.development.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
14
|
+
function is(x, y) {
|
|
15
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
16
|
+
}
|
|
17
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
18
|
+
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
19
|
+
var value = getSnapshot();
|
|
20
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
21
|
+
var cachedValue = getSnapshot();
|
|
22
|
+
objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
|
|
23
|
+
}
|
|
24
|
+
cachedValue = useState({ inst: {
|
|
25
|
+
value,
|
|
26
|
+
getSnapshot
|
|
27
|
+
} });
|
|
28
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
29
|
+
useLayoutEffect(function() {
|
|
30
|
+
inst.value = value;
|
|
31
|
+
inst.getSnapshot = getSnapshot;
|
|
32
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
33
|
+
}, [
|
|
34
|
+
subscribe,
|
|
35
|
+
value,
|
|
36
|
+
getSnapshot
|
|
37
|
+
]);
|
|
38
|
+
useEffect(function() {
|
|
39
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
40
|
+
return subscribe(function() {
|
|
41
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
42
|
+
});
|
|
43
|
+
}, [subscribe]);
|
|
44
|
+
useDebugValue(value);
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function checkIfSnapshotChanged(inst) {
|
|
48
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
49
|
+
inst = inst.value;
|
|
50
|
+
try {
|
|
51
|
+
var nextValue = latestGetSnapshot();
|
|
52
|
+
return !objectIs(inst, nextValue);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return !0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
58
|
+
return getSnapshot();
|
|
59
|
+
}
|
|
60
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
61
|
+
var React = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = !1, didWarnUncachedGetSnapshot = !1, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
62
|
+
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
63
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
64
|
+
})();
|
|
65
|
+
}));
|
|
66
|
+
//#endregion
|
|
67
|
+
export default require_use_sync_external_store_shim_development();
|
|
68
|
+
export { require_use_sync_external_store_shim_development };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=use-sync-external-store-shim.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.development.js","names":[],"sources":["../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n function useSyncExternalStore$2(subscribe, getSnapshot) {\n didWarnOld18Alpha ||\n void 0 === React.startTransition ||\n ((didWarnOld18Alpha = !0),\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.\"\n ));\n var value = getSnapshot();\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n objectIs(value, cachedValue) ||\n (console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n ),\n (didWarnUncachedGetSnapshot = !0));\n }\n cachedValue = useState({\n inst: { value: value, getSnapshot: getSnapshot }\n });\n var inst = cachedValue[0].inst,\n forceUpdate = cachedValue[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n }\n function checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n }\n function useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue,\n didWarnOld18Alpha = !1,\n didWarnUncachedGetSnapshot = !1,\n shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\n exports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;CAWA,iBAAA,QAAA,IAAA,aACG,WAAY;EACX,SAAS,GAAG,GAAG,GAAG;GAChB,OAAQ,MAAM,MAAM,MAAM,KAAK,IAAI,MAAM,IAAI,MAAQ,MAAM,KAAK,MAAM;EACxE;EACA,SAAS,uBAAuB,WAAW,aAAa;GACtD,qBACE,KAAK,MAAM,MAAM,oBACf,oBAAoB,CAAC,GACvB,QAAQ,MACN,gMACF;GACF,IAAI,QAAQ,YAAY;GACxB,IAAI,CAAC,4BAA4B;IAC/B,IAAI,cAAc,YAAY;IAC9B,SAAS,OAAO,WAAW,MACxB,QAAQ,MACP,sEACF,GACC,6BAA6B,CAAC;GACnC;GACA,cAAc,SAAS,EACrB,MAAM;IAAS;IAAoB;GAAY,EACjD,CAAC;GACD,IAAI,OAAO,YAAY,GAAG,MACxB,cAAc,YAAY;GAC5B,gBACE,WAAY;IACV,KAAK,QAAQ;IACb,KAAK,cAAc;IACnB,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;GAC5D,GACA;IAAC;IAAW;IAAO;GAAW,CAChC;GACA,UACE,WAAY;IACV,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;IAC1D,OAAO,UAAU,WAAY;KAC3B,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;IAC5D,CAAC;GACH,GACA,CAAC,SAAS,CACZ;GACA,cAAc,KAAK;GACnB,OAAO;EACT;EACA,SAAS,uBAAuB,MAAM;GACpC,IAAI,oBAAoB,KAAK;GAC7B,OAAO,KAAK;GACZ,IAAI;IACF,IAAI,YAAY,kBAAkB;IAClC,OAAO,CAAC,SAAS,MAAM,SAAS;GAClC,SAAS,OAAO;IACd,OAAO,CAAC;GACV;EACF;EACA,SAAS,uBAAuB,WAAW,aAAa;GACtD,OAAO,YAAY;EACrB;EACA,gBAAgB,OAAO,kCACrB,eACE,OAAO,+BAA+B,+BACxC,+BAA+B,4BAA4B,MAAM,CAAC;EACpE,IAAI,QAAA,UAAgB,OAAO,GACzB,WAAW,eAAe,OAAO,OAAO,KAAK,OAAO,KAAK,IACzD,WAAW,MAAM,UACjB,YAAY,MAAM,WAClB,kBAAkB,MAAM,iBACxB,gBAAgB,MAAM,eACtB,oBAAoB,CAAC,GACrB,6BAA6B,CAAC,GAC9B,OACE,gBAAgB,OAAO,UACvB,gBAAgB,OAAO,OAAO,YAC9B,gBAAgB,OAAO,OAAO,SAAS,gBACnC,yBACA;EACR,QAAQ,uBACN,KAAK,MAAM,MAAM,uBAAuB,MAAM,uBAAuB;EACvE,gBAAgB,OAAO,kCACrB,eACE,OAAO,+BAA+B,8BACxC,+BAA+B,2BAA2B,MAAM,CAAC;CACrE,GAAG"}
|
package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* use-sync-external-store-shim.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var require_use_sync_external_store_shim_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13
|
+
var React = __require("react");
|
|
14
|
+
function is(x, y) {
|
|
15
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
16
|
+
}
|
|
17
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
|
|
18
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
19
|
+
var value = getSnapshot(), _useState = useState({ inst: {
|
|
20
|
+
value,
|
|
21
|
+
getSnapshot
|
|
22
|
+
} }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
23
|
+
useLayoutEffect(function() {
|
|
24
|
+
inst.value = value;
|
|
25
|
+
inst.getSnapshot = getSnapshot;
|
|
26
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
27
|
+
}, [
|
|
28
|
+
subscribe,
|
|
29
|
+
value,
|
|
30
|
+
getSnapshot
|
|
31
|
+
]);
|
|
32
|
+
useEffect(function() {
|
|
33
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
34
|
+
return subscribe(function() {
|
|
35
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
36
|
+
});
|
|
37
|
+
}, [subscribe]);
|
|
38
|
+
useDebugValue(value);
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
function checkIfSnapshotChanged(inst) {
|
|
42
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
43
|
+
inst = inst.value;
|
|
44
|
+
try {
|
|
45
|
+
var nextValue = latestGetSnapshot();
|
|
46
|
+
return !objectIs(inst, nextValue);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return !0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
52
|
+
return getSnapshot();
|
|
53
|
+
}
|
|
54
|
+
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
55
|
+
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
56
|
+
}));
|
|
57
|
+
//#endregion
|
|
58
|
+
export default require_use_sync_external_store_shim_production();
|
|
59
|
+
export { require_use_sync_external_store_shim_production };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=use-sync-external-store-shim.production.js.map
|
package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.production.js","names":[],"sources":["../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;CAWA,IAAI,QAAA,UAAgB,OAAO;CAC3B,SAAS,GAAG,GAAG,GAAG;EAChB,OAAQ,MAAM,MAAM,MAAM,KAAK,IAAI,MAAM,IAAI,MAAQ,MAAM,KAAK,MAAM;CACxE;CACA,IAAI,WAAW,eAAe,OAAO,OAAO,KAAK,OAAO,KAAK,IAC3D,WAAW,MAAM,UACjB,YAAY,MAAM,WAClB,kBAAkB,MAAM,iBACxB,gBAAgB,MAAM;CACxB,SAAS,uBAAuB,WAAW,aAAa;EACtD,IAAI,QAAQ,YAAY,GACtB,YAAY,SAAS,EAAE,MAAM;GAAS;GAAoB;EAAY,EAAE,CAAC,GACzE,OAAO,UAAU,GAAG,MACpB,cAAc,UAAU;EAC1B,gBACE,WAAY;GACV,KAAK,QAAQ;GACb,KAAK,cAAc;GACnB,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;EAC5D,GACA;GAAC;GAAW;GAAO;EAAW,CAChC;EACA,UACE,WAAY;GACV,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;GAC1D,OAAO,UAAU,WAAY;IAC3B,uBAAuB,IAAI,KAAK,YAAY,EAAQ,KAAK,CAAC;GAC5D,CAAC;EACH,GACA,CAAC,SAAS,CACZ;EACA,cAAc,KAAK;EACnB,OAAO;CACT;CACA,SAAS,uBAAuB,MAAM;EACpC,IAAI,oBAAoB,KAAK;EAC7B,OAAO,KAAK;EACZ,IAAI;GACF,IAAI,YAAY,kBAAkB;GAClC,OAAO,CAAC,SAAS,MAAM,SAAS;EAClC,SAAS,OAAO;GACd,OAAO,CAAC;EACV;CACF;CACA,SAAS,uBAAuB,WAAW,aAAa;EACtD,OAAO,YAAY;CACrB;CACA,IAAI,OACF,gBAAgB,OAAO,UACvB,gBAAgB,OAAO,OAAO,YAC9B,gBAAgB,OAAO,OAAO,SAAS,gBACnC,yBACA;CACN,QAAQ,uBACN,KAAK,MAAM,MAAM,uBAAuB,MAAM,uBAAuB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_use_sync_external_store_shim_production } from "../cjs/use-sync-external-store-shim.production.js";
|
|
3
|
+
import { require_use_sync_external_store_shim_development } from "../cjs/use-sync-external-store-shim.development.js";
|
|
4
|
+
//#region node_modules/use-sync-external-store/shim/index.js
|
|
5
|
+
var require_shim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
if (process.env.NODE_ENV === "production") module.exports = require_use_sync_external_store_shim_production();
|
|
7
|
+
else module.exports = require_use_sync_external_store_shim_development();
|
|
8
|
+
}));
|
|
9
|
+
//#endregion
|
|
10
|
+
export default require_shim();
|
|
11
|
+
export { require_shim };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;CAEA,IAAA,QAAA,IAAA,aAA6B,cAC3B,OAAO,UAAA,gDAAA;MAEP,OAAO,UAAA,iDAAA"}
|
package/dist/page.d.ts
CHANGED
package/dist/page.js
CHANGED
|
@@ -8,7 +8,7 @@ function Page({ lattice }) {
|
|
|
8
8
|
const registry = useRegistry();
|
|
9
9
|
const content = /* @__PURE__ */ jsx(Renderer, {
|
|
10
10
|
fallback: null,
|
|
11
|
-
nodes: lattice.
|
|
11
|
+
nodes: lattice.schema,
|
|
12
12
|
registry
|
|
13
13
|
});
|
|
14
14
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Head, { title: lattice.title ?? void 0 }), lattice.container === "centered" ? /* @__PURE__ */ jsx("main", {
|
|
@@ -20,7 +20,7 @@ function Page({ lattice }) {
|
|
|
20
20
|
})
|
|
21
21
|
}) : /* @__PURE__ */ jsx("div", {
|
|
22
22
|
"data-testid": "lattice-default-container",
|
|
23
|
-
className: cn("w-full", { "px-4 py-6": lattice.layout
|
|
23
|
+
className: cn("w-full", { "px-4 py-6": lattice.layout !== null }),
|
|
24
24
|
children: content
|
|
25
25
|
})] });
|
|
26
26
|
}
|
package/dist/page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice/lattice/core/renderer\";\nimport { useRegistry } from \"@lattice/lattice/provider\";\nimport type { PagePayload } from \"@lattice/lattice\";\nimport { cn } from \"@lattice/lattice/lib/utils\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nexport default function Page({ lattice }: Props) {\n const registry = useRegistry();\n const content = <Renderer fallback={null} nodes={lattice.
|
|
1
|
+
{"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice/lattice/core/renderer\";\nimport { useRegistry } from \"@lattice/lattice/provider\";\nimport type { PagePayload } from \"@lattice/lattice\";\nimport { cn } from \"@lattice/lattice/lib/utils\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nexport default function Page({ lattice }: Props) {\n const registry = useRegistry();\n const content = <Renderer fallback={null} nodes={lattice.schema} registry={registry} />;\n\n return (\n <>\n <Head title={lattice.title ?? undefined} />\n\n {lattice.container === \"centered\" ? (\n <main className=\"min-h-svh bg-lt-bg text-lt-fg\">\n <div\n data-testid=\"lattice-centered-container\"\n className=\"mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10\"\n >\n {content}\n </div>\n </main>\n ) : (\n <div\n data-testid=\"lattice-default-container\"\n className={cn(\"w-full\", {\n \"px-4 py-6\": lattice.layout !== null,\n })}\n >\n {content}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAwB,KAAK,EAAE,WAAkB;CAC/C,MAAM,WAAW,YAAY;CAC7B,MAAM,UAAU,oBAAC,UAAD;EAAU,UAAU;EAAM,OAAO,QAAQ;EAAkB;CAAW,CAAA;CAEtF,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,MAAD,EAAM,OAAO,QAAQ,SAAS,KAAA,EAAY,CAAA,GAEzC,QAAQ,cAAc,aACrB,oBAAC,QAAD;EAAM,WAAU;YACd,oBAAC,OAAD;GACE,eAAY;GACZ,WAAU;aAET;EACE,CAAA;CACD,CAAA,IAEN,oBAAC,OAAD;EACE,eAAY;EACZ,WAAW,GAAG,UAAU,EACtB,aAAa,QAAQ,WAAW,KAClC,CAAC;YAEA;CACE,CAAA,CAEP,EAAA,CAAA;AAEN"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ComponentRegistry } from './core/registry';
|
|
3
|
-
|
|
2
|
+
import { ComponentRegistry, Registry } from './core/registry';
|
|
3
|
+
import { SpriteValue } from './icons/sprite';
|
|
4
|
+
import { ColumnRegistry } from './table/column-registry';
|
|
5
|
+
export declare function Provider({ children, registry, sprite, toaster, }: {
|
|
4
6
|
children: ReactNode;
|
|
5
|
-
registry?:
|
|
7
|
+
registry?: Registry;
|
|
8
|
+
sprite?: SpriteValue;
|
|
9
|
+
toaster?: boolean;
|
|
6
10
|
}): import("react").JSX.Element;
|
|
7
11
|
export declare function useRegistry(): ComponentRegistry;
|
|
12
|
+
export declare function useColumnRegistry(): ColumnRegistry;
|
package/dist/provider.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
import { SpriteProvider } from "./icons/sprite.js";
|
|
1
2
|
import { registry } from "./registry.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { Toaster } from "./toast/toaster.js";
|
|
4
|
+
import { createContext, useContext } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
//#region resources/js/provider.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
var defaultSprite = { href: "" };
|
|
8
|
+
var RegistryContext = createContext(registry);
|
|
9
|
+
function Provider({ children, registry: registry$1 = registry, sprite = defaultSprite, toaster = true }) {
|
|
8
10
|
return /* @__PURE__ */ jsx(RegistryContext.Provider, {
|
|
9
|
-
value,
|
|
10
|
-
children
|
|
11
|
+
value: registry$1,
|
|
12
|
+
children: /* @__PURE__ */ jsxs(SpriteProvider, {
|
|
13
|
+
sprite,
|
|
14
|
+
children: [children, toaster ? /* @__PURE__ */ jsx(Toaster, {}) : null]
|
|
15
|
+
})
|
|
11
16
|
});
|
|
12
17
|
}
|
|
13
18
|
function useRegistry() {
|
|
14
|
-
return useContext(RegistryContext).
|
|
19
|
+
return useContext(RegistryContext).components;
|
|
20
|
+
}
|
|
21
|
+
function useColumnRegistry() {
|
|
22
|
+
return useContext(RegistryContext).columns;
|
|
15
23
|
}
|
|
16
24
|
//#endregion
|
|
17
|
-
export { Provider, useRegistry };
|
|
25
|
+
export { Provider, useColumnRegistry, useRegistry };
|
|
18
26
|
|
|
19
27
|
//# sourceMappingURL=provider.js.map
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","names":[],"sources":["../resources/js/provider.tsx"],"sourcesContent":["import { createContext, useContext
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../resources/js/provider.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { ComponentRegistry, Registry } from \"./core/registry\";\nimport { SpriteProvider } from \"./icons/sprite\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport { registry as defaultRegistry } from \"./registry\";\nimport type { ColumnRegistry } from \"./table/column-registry\";\nimport { Toaster } from \"./toast\";\n\nconst defaultSprite: SpriteValue = { href: \"\" };\n\nconst RegistryContext = createContext<Registry>(defaultRegistry);\n\nexport function Provider({\n children,\n registry = defaultRegistry,\n sprite = defaultSprite,\n toaster = true,\n}: {\n children: ReactNode;\n registry?: Registry;\n sprite?: SpriteValue;\n toaster?: boolean;\n}) {\n return (\n <RegistryContext.Provider value={registry}>\n <SpriteProvider sprite={sprite}>\n {children}\n {toaster ? <Toaster /> : null}\n </SpriteProvider>\n </RegistryContext.Provider>\n );\n}\n\nexport function useRegistry(): ComponentRegistry {\n return useContext(RegistryContext).components;\n}\n\nexport function useColumnRegistry(): ColumnRegistry {\n return useContext(RegistryContext).columns;\n}\n"],"mappings":";;;;;;AASA,IAAM,gBAA6B,EAAE,MAAM,GAAG;AAE9C,IAAM,kBAAkB,cAAwB,QAAe;AAE/D,SAAgB,SAAS,EACvB,UACA,UAAA,aAAW,UACX,SAAS,eACT,UAAU,QAMT;CACD,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC/B,qBAAC,gBAAD;GAAwB;aAAxB,CACG,UACA,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI,IACX;;CACQ,CAAA;AAE9B;AAEA,SAAgB,cAAiC;CAC/C,OAAO,WAAW,eAAe,EAAE;AACrC;AAEA,SAAgB,oBAAoC;CAClD,OAAO,WAAW,eAAe,EAAE;AACrC"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const registry: import('
|
|
1
|
+
export declare const registry: import('./core/registry').Registry;
|
package/dist/registry.js
CHANGED
|
@@ -2,9 +2,10 @@ import { createRegistry } from "./core/registry.js";
|
|
|
2
2
|
import { actionComponents } from "./action/index.js";
|
|
3
3
|
import { coreComponents } from "./core/components/index.js";
|
|
4
4
|
import { formComponents } from "./form/index.js";
|
|
5
|
+
import { layoutComponents } from "./layout/components.js";
|
|
5
6
|
import { tableComponents } from "./table/index.js";
|
|
6
7
|
//#region resources/js/registry.ts
|
|
7
|
-
var registry = createRegistry(coreComponents, actionComponents, formComponents, tableComponents);
|
|
8
|
+
var registry = createRegistry(coreComponents, actionComponents, formComponents, layoutComponents, tableComponents);
|
|
8
9
|
//#endregion
|
|
9
10
|
export { registry };
|
|
10
11
|
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice/lattice/core/registry\";\nimport { actionComponents } from \"./action\";\nimport { coreComponents } from \"./core/components\";\nimport { formComponents } from \"./form\";\nimport { tableComponents } from \"./table\";\n\nexport const registry = createRegistry(\n coreComponents,\n actionComponents,\n formComponents,\n tableComponents,\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice/lattice/core/registry\";\nimport { actionComponents } from \"./action\";\nimport { coreComponents } from \"./core/components\";\nimport { formComponents } from \"./form\";\nimport { layoutComponents } from \"./layout/components\";\nimport { tableComponents } from \"./table\";\n\nexport const registry = createRegistry(\n coreComponents,\n actionComponents,\n formComponents,\n layoutComponents,\n tableComponents,\n);\n"],"mappings":";;;;;;;AAOA,IAAa,WAAW,eACtB,gBACA,kBACA,gBACA,kBACA,eACF"}
|
package/dist/table/bulk.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { Method } from '@inertiajs/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
cancelLabel?: string;
|
|
5
|
-
confirmLabel?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
};
|
|
2
|
+
import { Node } from '../core/types';
|
|
3
|
+
import { Action, ActionNode, ButtonVariant } from '../types/generated';
|
|
9
4
|
export type BulkAction = {
|
|
10
5
|
id: string;
|
|
11
6
|
label: string;
|
|
12
7
|
method: Method;
|
|
13
8
|
endpoint: string;
|
|
14
9
|
ref: string;
|
|
15
|
-
variant:
|
|
16
|
-
confirmation:
|
|
10
|
+
variant: ButtonVariant;
|
|
11
|
+
confirmation: Action["confirmation"];
|
|
12
|
+
form: Node | null;
|
|
17
13
|
};
|
|
18
|
-
export declare function getBulkActions(
|
|
14
|
+
export declare function getBulkActions(actions: ActionNode[] | undefined): BulkAction[];
|
package/dist/table/bulk.js
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
1
|
//#region resources/js/table/bulk.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"put"
|
|
8
|
-
];
|
|
9
|
-
function asString(value, fallback = "") {
|
|
10
|
-
return typeof value === "string" ? value : fallback;
|
|
11
|
-
}
|
|
12
|
-
function asMethod(value) {
|
|
13
|
-
return methods.includes(value) ? value : "post";
|
|
14
|
-
}
|
|
15
|
-
function asVariant(value) {
|
|
16
|
-
return typeof value === "string" ? value : "default";
|
|
17
|
-
}
|
|
18
|
-
function asConfirmation(value) {
|
|
19
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
function getBulkActions(value) {
|
|
23
|
-
if (!Array.isArray(value)) return [];
|
|
24
|
-
return value.flatMap((item) => {
|
|
25
|
-
if (typeof item !== "object" || item === null) return [];
|
|
26
|
-
const record = item;
|
|
27
|
-
const props = typeof record.props === "object" && record.props !== null ? record.props : {};
|
|
28
|
-
const endpoint = asString(props.endpoint);
|
|
29
|
-
if (endpoint === "") return [];
|
|
2
|
+
function getBulkActions(actions) {
|
|
3
|
+
return (actions ?? []).flatMap((node) => {
|
|
4
|
+
if (node.type === "action.group") return [];
|
|
5
|
+
const props = node.props;
|
|
6
|
+
if (!props.endpoint) return [];
|
|
30
7
|
return [{
|
|
31
|
-
id:
|
|
32
|
-
label:
|
|
33
|
-
method:
|
|
34
|
-
endpoint,
|
|
35
|
-
ref:
|
|
36
|
-
variant:
|
|
37
|
-
confirmation:
|
|
8
|
+
id: node.id ?? "",
|
|
9
|
+
label: props.label ?? "Run action",
|
|
10
|
+
method: props.method ?? "post",
|
|
11
|
+
endpoint: props.endpoint,
|
|
12
|
+
ref: props.ref ?? "",
|
|
13
|
+
variant: props.variant ?? "default",
|
|
14
|
+
confirmation: props.confirmation,
|
|
15
|
+
form: props.form ?? null
|
|
38
16
|
}];
|
|
39
17
|
});
|
|
40
18
|
}
|