@lattice-php/lattice 0.19.0 → 0.20.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/core/index.js +2 -2
- package/dist/core/types.d.ts +16 -4
- package/dist/create-app.d.ts +31 -3
- package/dist/create-app.js +48 -10
- package/dist/create-app.js.map +1 -1
- package/dist/effects/registry.d.ts +3 -3
- package/dist/effects/registry.js +4 -4
- package/dist/effects/registry.js.map +1 -1
- package/dist/form/components/base/field.d.ts +2 -2
- package/dist/form/components/base/field.js +2 -2
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/fields/color-picker-field.d.ts +2 -0
- package/dist/form/components/fields/color-picker-field.js +57 -0
- package/dist/form/components/fields/color-picker-field.js.map +1 -0
- package/dist/form/components/fields/date-input.js +1 -1
- package/dist/form/components/fields/date-picker-field.js +1 -1
- package/dist/form/components/fields/date-time-input.js +1 -1
- package/dist/form/components/fields/file-upload.js +7 -12
- package/dist/form/components/fields/file-upload.js.map +1 -1
- package/dist/form/components/fields/number-input.js +1 -1
- package/dist/form/components/fields/rich-editor-field.js +35 -276
- package/dist/form/components/fields/rich-editor-field.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.js +2 -2
- package/dist/form/components/fields/row-action-menu.js.map +1 -1
- package/dist/form/components/fields/row-actions.js +3 -1
- package/dist/form/components/fields/row-actions.js.map +1 -1
- package/dist/form/components/fields/select.js +59 -16
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/table-rows.js +2 -2
- package/dist/form/components/fields/table-rows.js.map +1 -1
- package/dist/form/components/fields/text-input.js +8 -1
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/time-input.js +1 -1
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/components/index.js +2 -1
- package/dist/form/embed.d.ts +1 -0
- package/dist/form/embed.js +2 -1
- package/dist/form/hooks/use-form-resolver.js.map +1 -1
- package/dist/form/index.js +2 -1
- package/dist/form/lib/conditions.d.ts +4 -10
- package/dist/form/lib/conditions.js.map +1 -1
- package/dist/form/lib/field-props.d.ts +4 -18
- package/dist/form/lib/field-props.js.map +1 -1
- package/dist/form/plugin.js +2 -0
- package/dist/form/plugin.js.map +1 -1
- package/dist/form/rich-editor/builtins.d.ts +6 -0
- package/dist/form/rich-editor/builtins.js +400 -0
- package/dist/form/rich-editor/builtins.js.map +1 -0
- package/dist/form/rich-editor/index.d.ts +7 -0
- package/dist/form/rich-editor/index.js +3 -0
- package/dist/form/rich-editor/registry.d.ts +67 -0
- package/dist/form/rich-editor/registry.js +79 -0
- package/dist/form/rich-editor/registry.js.map +1 -0
- package/dist/form/rich-editor/toolbar-button.d.ts +12 -0
- package/dist/form/rich-editor/toolbar-button.js +28 -0
- package/dist/form/rich-editor/toolbar-button.js.map +1 -0
- package/dist/form/types.d.ts +1 -6
- package/dist/format/date-time.d.ts +3 -2
- package/dist/format/date-time.js.map +1 -1
- package/dist/i18n/backend.js +1 -1
- package/dist/i18n/date-time.d.ts +3 -2
- package/dist/i18n/date-time.js.map +1 -1
- package/dist/i18n/index.js +3 -2
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/page-props.d.ts +3 -2
- package/dist/i18n/page-props.js +1 -15
- package/dist/i18n/page-props.js.map +1 -1
- package/dist/i18n/shared-props.d.ts +7 -0
- package/dist/i18n/shared-props.js +25 -0
- package/dist/i18n/shared-props.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -6
- package/dist/lattice.css +107 -47
- package/dist/layout/components/breadcrumbs.js +3 -1
- package/dist/layout/components/breadcrumbs.js.map +1 -1
- package/dist/layout/components/callouts.js +1 -1
- package/dist/lib/color.d.ts +9 -0
- package/dist/lib/color.js +48 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/notifications/api.d.ts +6 -6
- package/dist/notifications/api.js.map +1 -1
- package/dist/notifications/types.d.ts +2 -10
- package/dist/provider-base.js +1 -1
- package/dist/realtime/build-effects.js +5 -5
- package/dist/realtime/build-effects.js.map +1 -1
- package/dist/realtime/listeners.d.ts +2 -2
- package/dist/realtime/listeners.js.map +1 -1
- package/dist/realtime/subscriptions.d.ts +2 -2
- package/dist/realtime/subscriptions.js.map +1 -1
- package/dist/table/components/bulk-bar.js +5 -5
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.js +4 -1
- package/dist/table/components/cells/badge-cell.js.map +1 -1
- package/dist/table/components/cells/boolean-cell.js +3 -1
- package/dist/table/components/cells/boolean-cell.js.map +1 -1
- package/dist/table/components/cells/icon-cell.js +5 -2
- package/dist/table/components/cells/icon-cell.js.map +1 -1
- package/dist/table/components/cells/image-cell.js +8 -9
- package/dist/table/components/cells/image-cell.js.map +1 -1
- package/dist/table/components/cells/money-cell.js +9 -1
- package/dist/table/components/cells/money-cell.js.map +1 -1
- package/dist/table/components/cells/number-cell.js +9 -1
- package/dist/table/components/cells/number-cell.js.map +1 -1
- package/dist/table/components/cells/text-cell.js +4 -1
- package/dist/table/components/cells/text-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.js +25 -32
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.d.ts +3 -3
- package/dist/table/components/column-header.js +5 -3
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/column-visibility-menu.js +6 -11
- package/dist/table/components/column-visibility-menu.js.map +1 -1
- package/dist/table/components/filter-bar.d.ts +2 -2
- package/dist/table/components/filter-bar.js +13 -22
- package/dist/table/components/filter-bar.js.map +1 -1
- package/dist/table/components/filter-controls.d.ts +2 -1
- package/dist/table/components/filter-controls.js +36 -35
- package/dist/table/components/filter-controls.js.map +1 -1
- package/dist/table/components/filter-value-input.d.ts +0 -1
- package/dist/table/components/filter-value-input.js +21 -20
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.js +16 -20
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.d.ts +3 -3
- package/dist/table/components/sort-bar.js +11 -12
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-search.d.ts +9 -0
- package/dist/table/components/table-search.js +75 -0
- package/dist/table/components/table-search.js.map +1 -0
- package/dist/table/components/table.js +72 -19
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/hooks/use-expanded-rows.d.ts +8 -0
- package/dist/table/hooks/use-expanded-rows.js +24 -0
- package/dist/table/hooks/use-expanded-rows.js.map +1 -0
- package/dist/table/hooks/use-table.d.ts +5 -3
- package/dist/table/hooks/use-table.js +56 -44
- package/dist/table/hooks/use-table.js.map +1 -1
- package/dist/table/lib/payload.d.ts +3 -2
- package/dist/table/lib/payload.js +16 -10
- package/dist/table/lib/payload.js.map +1 -1
- package/dist/table/lib/query.d.ts +5 -5
- package/dist/table/lib/query.js +20 -18
- package/dist/table/lib/query.js.map +1 -1
- package/dist/table/types.d.ts +3 -26
- package/dist/toast/callout.js +1 -3
- package/dist/toast/callout.js.map +1 -1
- package/dist/toast/toast.d.ts +1 -5
- package/dist/toast/toast.js +2 -7
- package/dist/toast/toast.js.map +1 -1
- package/dist/toast/toaster.js +2 -2
- package/dist/toast/toaster.js.map +1 -1
- package/dist/types/generated.d.ts +263 -188
- package/dist/ui/affix-group.d.ts +2 -1
- package/dist/ui/affix-group.js +9 -7
- package/dist/ui/affix-group.js.map +1 -1
- package/dist/ui/avatar.d.ts +3 -0
- package/dist/ui/avatar.js +52 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/button.d.ts +3 -1
- package/dist/ui/button.js +10 -3
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/chart-view.js +161 -11
- package/dist/ui/chart-view.js.map +1 -1
- package/dist/ui/click-behavior.d.ts +1 -1
- package/dist/ui/click-behavior.js.map +1 -1
- package/dist/ui/color-picker.d.ts +8 -0
- package/dist/ui/color-picker.js +59 -0
- package/dist/ui/color-picker.js.map +1 -0
- package/dist/ui/combobox.d.ts +11 -2
- package/dist/ui/combobox.js +51 -8
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/copyable-text.d.ts +7 -0
- package/dist/ui/copyable-text.js +21 -13
- package/dist/ui/copyable-text.js.map +1 -1
- package/dist/ui/fragment.js.map +1 -1
- package/dist/ui/heading.js +39 -21
- package/dist/ui/heading.js.map +1 -1
- package/dist/ui/icon-button.d.ts +22 -0
- package/dist/ui/icon-button.js +51 -0
- package/dist/ui/icon-button.js.map +1 -0
- package/dist/ui/icon.js +10 -11
- package/dist/ui/icon.js.map +1 -1
- package/dist/ui/image-preview.d.ts +12 -0
- package/dist/ui/image-preview.js +65 -0
- package/dist/ui/image-preview.js.map +1 -0
- package/dist/ui/image.d.ts +3 -0
- package/dist/ui/image.js +21 -0
- package/dist/ui/image.js.map +1 -0
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +4 -3
- package/dist/ui/info-tooltip.js +1 -1
- package/dist/ui/info-tooltip.js.map +1 -1
- package/dist/ui/input.d.ts +3 -1
- package/dist/ui/input.js +2 -2
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/modal.js +14 -2
- package/dist/ui/modal.js.map +1 -1
- package/dist/ui/native-select.d.ts +10 -0
- package/dist/ui/native-select.js +23 -0
- package/dist/ui/native-select.js.map +1 -0
- package/dist/ui/plugin.js +11 -1
- package/dist/ui/plugin.js.map +1 -1
- package/dist/ui/progress.d.ts +3 -0
- package/dist/ui/progress.js +114 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/separator.js +15 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/text.js +5 -10
- package/dist/ui/text.js.map +1 -1
- package/dist/ui/tree-context.d.ts +33 -0
- package/dist/ui/tree-context.js +137 -0
- package/dist/ui/tree-context.js.map +1 -0
- package/dist/ui/tree.d.ts +19 -0
- package/dist/ui/tree.js +187 -0
- package/dist/ui/tree.js.map +1 -0
- package/dist-standalone/chunks/chart-view-wJmnVu7L.js +36 -0
- package/dist-standalone/chunks/date-picker-field-VbH9xrQO.js +1 -0
- package/dist-standalone/chunks/jsx-runtime-Drll_-DD.js +1 -0
- package/dist-standalone/chunks/locale-CXqr7LPR.js +1 -0
- package/dist-standalone/chunks/page-props-AIa5UR6n.js +1 -0
- package/dist-standalone/chunks/rich-editor-field-DLQTyt36.js +154 -0
- package/dist-standalone/chunks/{subscriptions-B3UuDBmx.js → subscriptions-DY2tj9Im.js} +1 -1
- package/dist-standalone/chunks/use-effect-dispatcher-feEs0GCP.js +97 -0
- package/dist-standalone/lattice.css +1 -1
- package/dist-standalone/lattice.js +15 -15
- package/dist-standalone/manifest.json +11 -9
- package/dist-standalone/sprite.svg +1 -1
- package/package.json +6 -1
- package/resources/icons/code-xml.svg +17 -0
- package/resources/icons/heading.svg +17 -0
- package/dist-standalone/chunks/chart-view-CK5fKIkR.js +0 -36
- package/dist-standalone/chunks/date-picker-field-BlCPFhZd.js +0 -1
- package/dist-standalone/chunks/jsx-runtime-CJ_btYLc.js +0 -1
- package/dist-standalone/chunks/rich-editor-field-DH5dS5c1.js +0 -154
- package/dist-standalone/chunks/use-effect-dispatcher-k98Nzf9M.js +0 -97
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-button.js","names":[],"sources":["../../../resources/js/form/rich-editor/toolbar-button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { IconButton } from \"@lattice-php/lattice/ui/icon-button\";\n\n/**\n * The shared editor toolbar trigger: an {@link IconButton} that keeps focus in\n * the editor (mousedown is prevented so clicks don't blur it, which would\n * otherwise trigger a precognition request).\n */\nexport function ToolbarIconButton({\n active = false,\n icon,\n label,\n testId,\n ...props\n}: React.ComponentProps<\"button\"> & {\n active?: boolean;\n icon: string;\n label: string;\n testId: string;\n}) {\n return (\n <IconButton\n size=\"sm\"\n icon={icon}\n label={label}\n title={label}\n active={active}\n data-test={testId}\n {...props}\n onMouseDown={(event) => {\n event.preventDefault();\n props.onMouseDown?.(event);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,kBAAkB,EAChC,SAAS,OACT,MACA,OACA,QACA,GAAG,SAMF;CACD,OACE,oBAAC,YAAD;EACE,MAAK;EACC;EACC;EACP,OAAO;EACC;EACR,aAAW;EACX,GAAI;EACJ,cAAc,UAAU;GACtB,MAAM,eAAe;GACrB,MAAM,cAAc,KAAK;EAC3B;CACD,CAAA;AAEL"}
|
package/dist/form/types.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { Method } from '@inertiajs/core';
|
|
2
2
|
import { NodeUnionOf } from '../core/types.js';
|
|
3
3
|
import { FormFieldNodeType, FormNodeType } from '../types/generated.js';
|
|
4
|
-
export type { Checkbox, Choice, DateInput, DateTimeInput, Form, FormNodeType, HiddenInput, NumberInput, PasswordInput, RichEditor, Select, Textarea, TextInput, TimeInput, } from '../types/generated.js';
|
|
4
|
+
export type { Checkbox, Choice, DateInput, DateTimeInput, Form, FormNodeType, HiddenInput, LabelAction, NumberInput, PasswordInput, RichEditor, Select, Textarea, TextInput, TimeInput, } from '../types/generated.js';
|
|
5
5
|
export type FormFieldNode = NodeUnionOf<FormFieldNodeType>;
|
|
6
6
|
export type FormNode = NodeUnionOf<FormNodeType>;
|
|
7
7
|
export type FormMethod = Method;
|
|
8
|
-
export type FormLabelAction = {
|
|
9
|
-
href: string;
|
|
10
|
-
label: string;
|
|
11
|
-
tabIndex?: number;
|
|
12
|
-
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { DateTimeStyle } from '../types/generated.js';
|
|
1
2
|
export type FormatOptions = {
|
|
2
3
|
locale?: string;
|
|
3
4
|
timeZone?: string;
|
|
4
5
|
};
|
|
5
6
|
export type DateConfig = {
|
|
6
|
-
dateStyle:
|
|
7
|
-
timeStyle:
|
|
7
|
+
dateStyle: DateTimeStyle | null;
|
|
8
|
+
timeStyle: DateTimeStyle | null;
|
|
8
9
|
month?: string | null;
|
|
9
10
|
year?: string | null;
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.js","names":[],"sources":["../../resources/js/format/date-time.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"date-time.js","names":[],"sources":["../../resources/js/format/date-time.ts"],"sourcesContent":["import type { DateTimeStyle } from \"@lattice-php/lattice/types/generated\";\n\nexport type FormatOptions = {\n locale?: string;\n timeZone?: string;\n};\n\nexport type DateConfig = {\n dateStyle: DateTimeStyle | null;\n timeStyle: DateTimeStyle | null;\n month?: string | null;\n year?: string | null;\n};\n\nexport function formatDateValue(value: unknown, date: DateConfig, options?: FormatOptions): string {\n const parsed = new Date(String(value));\n\n if (Number.isNaN(parsed.getTime())) {\n return String(value ?? \"\");\n }\n\n const intl: Intl.DateTimeFormatOptions = { timeZone: options?.timeZone };\n\n if (date.dateStyle) {\n intl.dateStyle = date.dateStyle;\n }\n\n if (date.timeStyle) {\n intl.timeStyle = date.timeStyle;\n }\n\n if (date.month) {\n intl.month = date.month as Intl.DateTimeFormatOptions[\"month\"];\n }\n\n if (date.year) {\n intl.year = date.year as Intl.DateTimeFormatOptions[\"year\"];\n }\n\n return new Intl.DateTimeFormat(options?.locale, intl).format(parsed);\n}\n\nexport function preciseDateTime(value: unknown, options?: FormatOptions): string {\n const date = new Date(String(value));\n\n if (Number.isNaN(date.getTime())) {\n return \"\";\n }\n\n const formatted = new Intl.DateTimeFormat(options?.locale, {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n timeZone: options?.timeZone,\n timeZoneName: \"short\",\n }).format(date);\n\n return options?.timeZone ? `${formatted} (${options.timeZone})` : formatted;\n}\n"],"mappings":";AAcA,SAAgB,gBAAgB,OAAgB,MAAkB,SAAiC;CACjG,MAAM,SAAS,IAAI,KAAK,OAAO,KAAK,CAAC;CAErC,IAAI,OAAO,MAAM,OAAO,QAAQ,CAAC,GAC/B,OAAO,OAAO,SAAS,EAAE;CAG3B,MAAM,OAAmC,EAAE,UAAU,SAAS,SAAS;CAEvE,IAAI,KAAK,WACP,KAAK,YAAY,KAAK;CAGxB,IAAI,KAAK,WACP,KAAK,YAAY,KAAK;CAGxB,IAAI,KAAK,OACP,KAAK,QAAQ,KAAK;CAGpB,IAAI,KAAK,MACP,KAAK,OAAO,KAAK;CAGnB,OAAO,IAAI,KAAK,eAAe,SAAS,QAAQ,IAAI,EAAE,OAAO,MAAM;AACrE;AAEA,SAAgB,gBAAgB,OAAgB,SAAiC;CAC/E,MAAM,OAAO,IAAI,KAAK,OAAO,KAAK,CAAC;CAEnC,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAC7B,OAAO;CAGT,MAAM,YAAY,IAAI,KAAK,eAAe,SAAS,QAAQ;EACzD,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,UAAU,SAAS;EACnB,cAAc;CAChB,CAAC,EAAE,OAAO,IAAI;CAEd,OAAO,SAAS,WAAW,GAAG,UAAU,IAAI,QAAQ,SAAS,KAAK;AACpE"}
|
package/dist/i18n/backend.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { localeHeader } from "./locale.js";
|
|
2
1
|
import { setConfig } from "./config.js";
|
|
2
|
+
import { localeHeader } from "./locale.js";
|
|
3
3
|
import { ensureI18n, i18n, preloadLanguages } from "./instance.js";
|
|
4
4
|
import HttpBackend from "i18next-http-backend";
|
|
5
5
|
//#region resources/js/i18n/backend.ts
|
package/dist/i18n/date-time.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { DateTimeStyle } from '../types/generated.js';
|
|
2
3
|
export type DateTimeProps = {
|
|
3
4
|
value: unknown;
|
|
4
|
-
dateStyle?:
|
|
5
|
-
timeStyle?:
|
|
5
|
+
dateStyle?: DateTimeStyle | null;
|
|
6
|
+
timeStyle?: DateTimeStyle | null;
|
|
6
7
|
};
|
|
7
8
|
export declare function DateTime({ value, dateStyle, timeStyle, }: DateTimeProps): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.js","names":[],"sources":["../../resources/js/i18n/date-time.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n type FormatOptions,\n formatDateValue,\n preciseDateTime,\n} from \"@lattice-php/lattice/format/date-time\";\nimport { useLocale } from \"./locale\";\nimport { useTimezone } from \"./timezone\";\n\nexport type DateTimeProps = {\n value: unknown;\n dateStyle?:
|
|
1
|
+
{"version":3,"file":"date-time.js","names":[],"sources":["../../resources/js/i18n/date-time.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n type FormatOptions,\n formatDateValue,\n preciseDateTime,\n} from \"@lattice-php/lattice/format/date-time\";\nimport type { DateTimeStyle } from \"@lattice-php/lattice/types/generated\";\nimport { useLocale } from \"./locale\";\nimport { useTimezone } from \"./timezone\";\n\nexport type DateTimeProps = {\n value: unknown;\n dateStyle?: DateTimeStyle | null;\n timeStyle?: DateTimeStyle | null;\n};\n\nexport function DateTime({\n value,\n dateStyle = \"medium\",\n timeStyle = \"short\",\n}: DateTimeProps): ReactNode {\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n\n if (value === null || value === undefined || value === \"\") {\n return null;\n }\n\n const options: FormatOptions = { locale, timeZone: timezone };\n const text = formatDateValue(value, { dateStyle, timeStyle }, options);\n const iso = isoOrNull(value);\n const title = preciseDateTime(value, options);\n\n return (\n <time dateTime={iso ?? undefined} title={title || undefined}>\n {text}\n </time>\n );\n}\n\nfunction isoOrNull(value: unknown): string | null {\n const date = new Date(String(value));\n\n return Number.isNaN(date.getTime()) ? null : date.toISOString();\n}\n"],"mappings":";;;;;AAgBA,SAAgB,SAAS,EACvB,OACA,YAAY,UACZ,YAAY,WACe;CAC3B,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,EAAE,aAAa,YAAY;CAEjC,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,IACrD,OAAO;CAGT,MAAM,UAAyB;EAAE;EAAQ,UAAU;CAAS;CAC5D,MAAM,OAAO,gBAAgB,OAAO;EAAE;EAAW;CAAU,GAAG,OAAO;CACrE,MAAM,MAAM,UAAU,KAAK;CAC3B,MAAM,QAAQ,gBAAgB,OAAO,OAAO;CAE5C,OACE,oBAAC,QAAD;EAAM,UAAU,OAAO,KAAA;EAAW,OAAO,SAAS,KAAA;YAC/C;CACG,CAAA;AAEV;AAEA,SAAS,UAAU,OAA+B;CAChD,MAAM,OAAO,IAAI,KAAK,OAAO,KAAK,CAAC;CAEnC,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,OAAO,KAAK,YAAY;AAChE"}
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { currentLocale, localeHeader, setLocale, useLocale } from "./locale.js";
|
|
2
2
|
import { i18n, translate, useT } from "./instance.js";
|
|
3
3
|
import { configureI18n, enableBackend } from "./backend.js";
|
|
4
|
-
import { LocaleReload } from "./locale-reload.js";
|
|
5
4
|
import { LocaleSwitcher, useLocaleOptions } from "./locale-switcher.js";
|
|
6
|
-
import {
|
|
5
|
+
import { i18nConfigFromPageProps } from "./shared-props.js";
|
|
6
|
+
import { configureI18nFromPageProps } from "./page-props.js";
|
|
7
7
|
import { currentTimezone, setTimezone, useTimezone } from "./timezone.js";
|
|
8
8
|
import { DateTime } from "./date-time.js";
|
|
9
|
+
import { LocaleReload } from "./locale-reload.js";
|
|
9
10
|
export { DateTime, LocaleReload, LocaleSwitcher, configureI18n, configureI18nFromPageProps, currentLocale, currentTimezone, enableBackend, i18n, i18nConfigFromPageProps, localeHeader, setLocale, setTimezone, translate, useLocale, useLocaleOptions, useT, useTimezone };
|
package/dist/i18n/instance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { currentLocale, subscribeLocale, useLocale } from "./locale.js";
|
|
2
1
|
import { useConfig } from "./config.js";
|
|
2
|
+
import { currentLocale, subscribeLocale, useLocale } from "./locale.js";
|
|
3
3
|
import { useCallback, useSyncExternalStore } from "react";
|
|
4
4
|
import i18next from "i18next";
|
|
5
5
|
//#region resources/js/i18n/instance.ts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { ConfigureI18nOptions
|
|
2
|
-
|
|
1
|
+
import { ConfigureI18nOptions } from './backend.js';
|
|
2
|
+
import { i18nConfigFromPageProps } from './shared-props.js';
|
|
3
|
+
export { i18nConfigFromPageProps };
|
|
3
4
|
export declare function configureI18nFromPageProps(props: unknown, options?: ConfigureI18nOptions): Promise<void>;
|
package/dist/i18n/page-props.js
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { configureI18n } from "./backend.js";
|
|
2
|
+
import { i18nConfigFromPageProps } from "./shared-props.js";
|
|
2
3
|
//#region resources/js/i18n/page-props.ts
|
|
3
|
-
function isRecord(value) {
|
|
4
|
-
return typeof value === "object" && value !== null;
|
|
5
|
-
}
|
|
6
|
-
function isStringArray(value) {
|
|
7
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
8
|
-
}
|
|
9
|
-
function isI18nConfig(value) {
|
|
10
|
-
return isRecord(value) && typeof value.enabled === "boolean" && typeof value.saveMissing === "boolean" && isStringArray(value.locales) && isStringArray(value.preloadLocales) && (value.timezone === void 0 || value.timezone === null || typeof value.timezone === "string");
|
|
11
|
-
}
|
|
12
|
-
function i18nConfigFromPageProps(props) {
|
|
13
|
-
if (!isRecord(props)) return;
|
|
14
|
-
const shared = props.lattice;
|
|
15
|
-
const config = isRecord(shared) ? shared.i18n : void 0;
|
|
16
|
-
return isI18nConfig(config) ? config : void 0;
|
|
17
|
-
}
|
|
18
4
|
function configureI18nFromPageProps(props, options = {}) {
|
|
19
5
|
return configureI18n(i18nConfigFromPageProps(props), options);
|
|
20
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-props.js","names":[],"sources":["../../resources/js/i18n/page-props.ts"],"sourcesContent":["import { configureI18n, type ConfigureI18nOptions
|
|
1
|
+
{"version":3,"file":"page-props.js","names":[],"sources":["../../resources/js/i18n/page-props.ts"],"sourcesContent":["import { configureI18n, type ConfigureI18nOptions } from \"./backend\";\nimport { i18nConfigFromPageProps } from \"./shared-props\";\n\nexport { i18nConfigFromPageProps };\n\nexport function configureI18nFromPageProps(\n props: unknown,\n options: ConfigureI18nOptions = {},\n): Promise<void> {\n return configureI18n(i18nConfigFromPageProps(props), options);\n}\n"],"mappings":";;;AAKA,SAAgB,2BACd,OACA,UAAgC,CAAC,GAClB;CACf,OAAO,cAAc,wBAAwB,KAAK,GAAG,OAAO;AAC9D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { I18nConfig } from '../types/generated.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse the backend-shared `lattice.i18n` Inertia prop. Lives apart from the
|
|
4
|
+
* configure entrypoint so callers can inspect the prop without pulling the
|
|
5
|
+
* i18next backend into their bundle.
|
|
6
|
+
*/
|
|
7
|
+
export declare function i18nConfigFromPageProps(props: unknown): I18nConfig | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region resources/js/i18n/shared-props.ts
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null;
|
|
4
|
+
}
|
|
5
|
+
function isStringArray(value) {
|
|
6
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
7
|
+
}
|
|
8
|
+
function isI18nConfig(value) {
|
|
9
|
+
return isRecord(value) && typeof value.enabled === "boolean" && typeof value.saveMissing === "boolean" && isStringArray(value.locales) && isStringArray(value.preloadLocales) && (value.timezone === void 0 || value.timezone === null || typeof value.timezone === "string");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse the backend-shared `lattice.i18n` Inertia prop. Lives apart from the
|
|
13
|
+
* configure entrypoint so callers can inspect the prop without pulling the
|
|
14
|
+
* i18next backend into their bundle.
|
|
15
|
+
*/
|
|
16
|
+
function i18nConfigFromPageProps(props) {
|
|
17
|
+
if (!isRecord(props)) return;
|
|
18
|
+
const shared = props.lattice;
|
|
19
|
+
const config = isRecord(shared) ? shared.i18n : void 0;
|
|
20
|
+
return isI18nConfig(config) ? config : void 0;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i18nConfigFromPageProps };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=shared-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-props.js","names":[],"sources":["../../resources/js/i18n/shared-props.ts"],"sourcesContent":["import type { I18nConfig } from \"@lattice-php/lattice/types/generated\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\n\nfunction isI18nConfig(value: unknown): value is I18nConfig {\n return (\n isRecord(value) &&\n typeof value.enabled === \"boolean\" &&\n typeof value.saveMissing === \"boolean\" &&\n isStringArray(value.locales) &&\n isStringArray(value.preloadLocales) &&\n (value.timezone === undefined || value.timezone === null || typeof value.timezone === \"string\")\n );\n}\n\n/**\n * Parse the backend-shared `lattice.i18n` Inertia prop. Lives apart from the\n * configure entrypoint so callers can inspect the prop without pulling the\n * i18next backend into their bundle.\n */\nexport function i18nConfigFromPageProps(props: unknown): I18nConfig | undefined {\n if (!isRecord(props)) {\n return undefined;\n }\n\n const shared = props.lattice;\n const config = isRecord(shared) ? shared.i18n : undefined;\n\n return isI18nConfig(config) ? config : undefined;\n}\n"],"mappings":";AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEA,SAAS,cAAc,OAAmC;CACxD,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,SAAS,OAAO,SAAS,QAAQ;AAC/E;AAEA,SAAS,aAAa,OAAqC;CACzD,OACE,SAAS,KAAK,KACd,OAAO,MAAM,YAAY,aACzB,OAAO,MAAM,gBAAgB,aAC7B,cAAc,MAAM,OAAO,KAC3B,cAAc,MAAM,cAAc,MACjC,MAAM,aAAa,KAAA,KAAa,MAAM,aAAa,QAAQ,OAAO,MAAM,aAAa;AAE1F;;;;;;AAOA,SAAgB,wBAAwB,OAAwC;CAC9E,IAAI,CAAC,SAAS,KAAK,GACjB;CAGF,MAAM,SAAS,MAAM;CACrB,MAAM,SAAS,SAAS,MAAM,IAAI,OAAO,OAAO,KAAA;CAEhD,OAAO,aAAa,MAAM,IAAI,SAAS,KAAA;AACzC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ export { chatComponents } from './chat/plugin.js';
|
|
|
4
4
|
export { getActionEffects, isActionEffect, dispatchEffects, dispatchActionError, } from './effects/dispatch.js';
|
|
5
5
|
export { useEffectDispatcher } from './effects/use-effect-dispatcher.js';
|
|
6
6
|
export { builtinEffectHandlers, effectHandler, mergeEffectHandlers } from './effects/registry.js';
|
|
7
|
+
export { registerRichEditorExtension } from './form/rich-editor/registry.js';
|
|
7
8
|
export { initializeTheme, updateAppearance, useAppearance } from './appearance/index.js';
|
|
8
9
|
export { copyToClipboard, useClipboard } from './clipboard/index.js';
|
|
9
|
-
export { createLatticeApp, type CreateLatticeAppOptions } from './create-app.js';
|
|
10
|
+
export { createLatticeApp, type CreateLatticeAppI18nOptions, type CreateLatticeAppOptions, } from './create-app.js';
|
|
10
11
|
export { EventBridge } from './event-bridge.js';
|
|
11
12
|
export { Icon, IconRenderer, IconRendererProvider, SpriteProvider } from './icons/index.js';
|
|
12
13
|
export { createLayoutResolver, createPageResolver, pageComponentName, withVisitHeaders, } from './inertia.js';
|
|
@@ -25,13 +26,14 @@ export type { ButtonVariant } from './ui/button.js';
|
|
|
25
26
|
export type { ReloadComponentEvent } from './events/event-names.js';
|
|
26
27
|
export type { ComponentProps, KnownPageContainer, LayoutPayload, Node, NodeOfType, NodeProps, NodeType, PageContainer, PageBreadcrumb, PagePayload, PropsOf, RendererComponent, RendererComponentModule, RendererComponentProps, Schema, UnknownComponent, WireNode, } from './core/types.js';
|
|
27
28
|
export { RealtimeListeners } from './realtime/listeners.js';
|
|
28
|
-
export type { ChannelVisibility, DateFormat,
|
|
29
|
+
export type { ChannelVisibility, DateFormat, Listen, NumberFormat } from './types/generated.js';
|
|
29
30
|
export { columnCell } from './table/registry.js';
|
|
30
31
|
export type { ColumnCellArgs, ColumnCellComponent, ColumnRegistry } from './table/registry.js';
|
|
31
32
|
export type { ColumnProps, ColumnPropsOf } from './table/types.js';
|
|
32
33
|
export type { Method } from '@inertiajs/core';
|
|
33
34
|
export type { ActionEffect, ActionResponse } from './effects/dispatch.js';
|
|
34
|
-
export type { EffectHandler, EffectHandlerRegistry, EffectOf, EffectProps, } from './effects/registry.js';
|
|
35
|
+
export type { EffectHandler, EffectHandlerRegistry, EffectOf, EffectProps, EffectPropsOf, } from './effects/registry.js';
|
|
36
|
+
export type { EditorExtensionPayloadOf, EditorExtensionProps, RichEditorExtensionDefinition, ToolbarButton, ToolbarControl, ToolbarItem, } from './form/rich-editor/registry.js';
|
|
35
37
|
export type { Appearance, ResolvedAppearance, UseAppearanceReturn } from './appearance/index.js';
|
|
36
38
|
export type { CopiedValue, CopyFn, UseClipboardReturn } from './clipboard/index.js';
|
|
37
39
|
export type { Callout, ToastMessage, Variant } from './toast/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,16 +2,16 @@ import { initializeTheme, updateAppearance, useAppearance } from "./appearance/i
|
|
|
2
2
|
import { createPlugin, createRegistry, eagerComponent, extendRegistry, lazyComponent } from "./core/registry.js";
|
|
3
3
|
import { useColumnRegistry, useComponentRegistry } from "./core/registry-context.js";
|
|
4
4
|
import { LATTICE_EVENT } from "./events/event-names.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { onToast, showToast } from "./toast/toast.js";
|
|
6
|
+
import { onCallout } from "./toast/callout.js";
|
|
7
7
|
import { Icon, SpriteProvider } from "./icons/sprite.js";
|
|
8
8
|
import { IconRenderer, IconRendererProvider } from "./icons/icon-renderer.js";
|
|
9
9
|
import { CollapsedContext, useCollapsed } from "./core/collapsed-context.js";
|
|
10
10
|
import { Renderer } from "./core/renderer.js";
|
|
11
|
-
import { onToast, showToast } from "./toast/toast.js";
|
|
12
|
-
import { onCallout } from "./toast/callout.js";
|
|
13
|
-
import { EventBridge } from "./event-bridge.js";
|
|
14
11
|
import { Toaster } from "./toast/toaster.js";
|
|
12
|
+
import { EventBridge } from "./event-bridge.js";
|
|
13
|
+
import { LATTICE_REF_HEADER, withRefHeader } from "./core/component-ref.js";
|
|
14
|
+
import { withHeaders } from "./core/headers.js";
|
|
15
15
|
import Callouts from "./layout/components/callouts.js";
|
|
16
16
|
import { builtinEffectHandlers, effectHandler, mergeEffectHandlers } from "./effects/registry.js";
|
|
17
17
|
import { dispatchActionError, dispatchEffects, getActionEffects, isActionEffect } from "./effects/dispatch.js";
|
|
@@ -27,6 +27,7 @@ import { copyToClipboard } from "./ui/copyable-text.js";
|
|
|
27
27
|
import { columnCell } from "./table/registry.js";
|
|
28
28
|
import { registry } from "./registry.js";
|
|
29
29
|
import { createLatticeApp } from "./create-app.js";
|
|
30
|
+
import { registerRichEditorExtension } from "./form/rich-editor/registry.js";
|
|
30
31
|
import { useClipboard } from "./clipboard/index.js";
|
|
31
32
|
import { Provider } from "./provider.js";
|
|
32
|
-
export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatComponents, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, initializeTheme, isActionEffect, layoutComponents, lazyComponent, mergeEffectHandlers, onCallout, onToast, pageComponentName, registry, showToast, updateAppearance, useAppearance, useChat, useClipboard, useColumnRegistry, useComponentRegistry, useEffectDispatcher, useCollapsed as useSidebarCollapsed, withHeaders, withRefHeader, withVisitHeaders };
|
|
33
|
+
export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatComponents, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, initializeTheme, isActionEffect, layoutComponents, lazyComponent, mergeEffectHandlers, onCallout, onToast, pageComponentName, registerRichEditorExtension, registry, showToast, updateAppearance, useAppearance, useChat, useClipboard, useColumnRegistry, useComponentRegistry, useEffectDispatcher, useCollapsed as useSidebarCollapsed, withHeaders, withRefHeader, withVisitHeaders };
|
package/dist/lattice.css
CHANGED
|
@@ -286,12 +286,41 @@
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
289
|
+
* Named colours. Semantic names alias the theme tokens; hue names carry their
|
|
290
|
+
* own oklch values with `.dark` overrides. Renderers resolve a named colour to
|
|
291
|
+
* `var(--lt-color-<name>)` for paint, or to an `.lt-tone-<name>` class for the
|
|
292
|
+
* soft-background/strong-foreground pair used by badge and icon cells. Defined
|
|
293
|
+
* here (not as utility strings in the renderers) so the palette lives with the
|
|
294
|
+
* theme and can be overridden, and so a colour can be picked by name at
|
|
295
|
+
* runtime without Tailwind needing to see every class.
|
|
294
296
|
*/
|
|
297
|
+
:root {
|
|
298
|
+
--lt-color-default: var(--lt-fg);
|
|
299
|
+
--lt-color-muted: var(--lt-muted-fg);
|
|
300
|
+
--lt-color-primary: var(--lt-primary);
|
|
301
|
+
--lt-color-success: var(--lt-success);
|
|
302
|
+
--lt-color-info: var(--lt-info);
|
|
303
|
+
--lt-color-warning: var(--lt-warning);
|
|
304
|
+
--lt-color-danger: var(--lt-danger);
|
|
305
|
+
--lt-color-gray: var(--lt-muted-fg);
|
|
306
|
+
--lt-color-red: oklch(0.51 0.19 27);
|
|
307
|
+
--lt-color-orange: oklch(0.55 0.14 55);
|
|
308
|
+
--lt-color-yellow: oklch(0.52 0.1 85);
|
|
309
|
+
--lt-color-green: oklch(0.52 0.13 152);
|
|
310
|
+
--lt-color-blue: oklch(0.54 0.17 252);
|
|
311
|
+
--lt-color-purple: oklch(0.53 0.19 305);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
[data-theme="dark"],
|
|
315
|
+
.dark {
|
|
316
|
+
--lt-color-red: oklch(0.83 0.11 27);
|
|
317
|
+
--lt-color-orange: oklch(0.84 0.1 65);
|
|
318
|
+
--lt-color-yellow: oklch(0.87 0.11 100);
|
|
319
|
+
--lt-color-green: oklch(0.85 0.13 155);
|
|
320
|
+
--lt-color-blue: oklch(0.84 0.11 250);
|
|
321
|
+
--lt-color-purple: oklch(0.85 0.11 305);
|
|
322
|
+
}
|
|
323
|
+
|
|
295
324
|
.lt-cell-badge {
|
|
296
325
|
display: inline-flex;
|
|
297
326
|
align-items: center;
|
|
@@ -301,67 +330,98 @@
|
|
|
301
330
|
font-size: 0.75rem;
|
|
302
331
|
line-height: 1rem;
|
|
303
332
|
font-weight: 500;
|
|
304
|
-
background-color: var(--lt-
|
|
305
|
-
color: var(--lt-
|
|
333
|
+
background-color: var(--lt-tone-bg, var(--lt-muted));
|
|
334
|
+
color: var(--lt-tone-fg, var(--lt-muted-fg));
|
|
306
335
|
}
|
|
307
336
|
|
|
308
337
|
.lt-cell-icon {
|
|
309
338
|
display: inline-flex;
|
|
310
|
-
color: var(--lt-
|
|
339
|
+
color: var(--lt-tone-fg, var(--lt-fg));
|
|
311
340
|
}
|
|
312
341
|
|
|
313
|
-
.lt-
|
|
314
|
-
--lt-
|
|
315
|
-
--lt-
|
|
342
|
+
.lt-tone-gray {
|
|
343
|
+
--lt-tone-bg: var(--lt-muted);
|
|
344
|
+
--lt-tone-fg: var(--lt-color-gray);
|
|
345
|
+
}
|
|
346
|
+
.lt-tone-red {
|
|
347
|
+
--lt-tone-bg: oklch(0.94 0.03 25);
|
|
348
|
+
--lt-tone-fg: var(--lt-color-red);
|
|
349
|
+
}
|
|
350
|
+
.lt-tone-orange {
|
|
351
|
+
--lt-tone-bg: oklch(0.95 0.04 65);
|
|
352
|
+
--lt-tone-fg: var(--lt-color-orange);
|
|
353
|
+
}
|
|
354
|
+
.lt-tone-yellow {
|
|
355
|
+
--lt-tone-bg: oklch(0.96 0.05 100);
|
|
356
|
+
--lt-tone-fg: var(--lt-color-yellow);
|
|
357
|
+
}
|
|
358
|
+
.lt-tone-green {
|
|
359
|
+
--lt-tone-bg: oklch(0.95 0.05 155);
|
|
360
|
+
--lt-tone-fg: var(--lt-color-green);
|
|
361
|
+
}
|
|
362
|
+
.lt-tone-blue {
|
|
363
|
+
--lt-tone-bg: oklch(0.95 0.03 245);
|
|
364
|
+
--lt-tone-fg: var(--lt-color-blue);
|
|
365
|
+
}
|
|
366
|
+
.lt-tone-purple {
|
|
367
|
+
--lt-tone-bg: oklch(0.95 0.03 305);
|
|
368
|
+
--lt-tone-fg: var(--lt-color-purple);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.lt-tone-default,
|
|
372
|
+
.lt-tone-primary,
|
|
373
|
+
.lt-tone-success,
|
|
374
|
+
.lt-tone-info,
|
|
375
|
+
.lt-tone-warning,
|
|
376
|
+
.lt-tone-danger {
|
|
377
|
+
--lt-tone-bg: color-mix(in oklab, var(--lt-tone-fg) 12%, transparent);
|
|
378
|
+
}
|
|
379
|
+
.lt-tone-default {
|
|
380
|
+
--lt-tone-fg: var(--lt-color-default);
|
|
316
381
|
}
|
|
317
|
-
.lt-
|
|
318
|
-
--lt-
|
|
319
|
-
--lt-
|
|
382
|
+
.lt-tone-muted {
|
|
383
|
+
--lt-tone-bg: var(--lt-muted);
|
|
384
|
+
--lt-tone-fg: var(--lt-color-muted);
|
|
320
385
|
}
|
|
321
|
-
.lt-
|
|
322
|
-
--lt-
|
|
323
|
-
--lt-cell-fg: oklch(0.55 0.14 55);
|
|
386
|
+
.lt-tone-primary {
|
|
387
|
+
--lt-tone-fg: var(--lt-color-primary);
|
|
324
388
|
}
|
|
325
|
-
.lt-
|
|
326
|
-
--lt-
|
|
327
|
-
--lt-cell-fg: oklch(0.52 0.1 85);
|
|
389
|
+
.lt-tone-success {
|
|
390
|
+
--lt-tone-fg: var(--lt-color-success);
|
|
328
391
|
}
|
|
329
|
-
.lt-
|
|
330
|
-
--lt-
|
|
331
|
-
--lt-cell-fg: oklch(0.52 0.13 152);
|
|
392
|
+
.lt-tone-info {
|
|
393
|
+
--lt-tone-fg: var(--lt-color-info);
|
|
332
394
|
}
|
|
333
|
-
.lt-
|
|
334
|
-
--lt-
|
|
335
|
-
--lt-cell-fg: oklch(0.54 0.17 252);
|
|
395
|
+
.lt-tone-warning {
|
|
396
|
+
--lt-tone-fg: var(--lt-color-warning);
|
|
336
397
|
}
|
|
337
|
-
.lt-
|
|
338
|
-
--lt-
|
|
339
|
-
--lt-cell-fg: oklch(0.53 0.19 305);
|
|
398
|
+
.lt-tone-danger {
|
|
399
|
+
--lt-tone-fg: var(--lt-color-danger);
|
|
340
400
|
}
|
|
341
401
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
--lt-
|
|
402
|
+
[data-theme="dark"] .lt-tone-red,
|
|
403
|
+
.dark .lt-tone-red {
|
|
404
|
+
--lt-tone-bg: oklch(0.29 0.08 27);
|
|
345
405
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
--lt-
|
|
406
|
+
[data-theme="dark"] .lt-tone-orange,
|
|
407
|
+
.dark .lt-tone-orange {
|
|
408
|
+
--lt-tone-bg: oklch(0.3 0.07 65);
|
|
349
409
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
--lt-
|
|
410
|
+
[data-theme="dark"] .lt-tone-yellow,
|
|
411
|
+
.dark .lt-tone-yellow {
|
|
412
|
+
--lt-tone-bg: oklch(0.31 0.06 100);
|
|
353
413
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
--lt-
|
|
414
|
+
[data-theme="dark"] .lt-tone-green,
|
|
415
|
+
.dark .lt-tone-green {
|
|
416
|
+
--lt-tone-bg: oklch(0.3 0.07 155);
|
|
357
417
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
--lt-
|
|
418
|
+
[data-theme="dark"] .lt-tone-blue,
|
|
419
|
+
.dark .lt-tone-blue {
|
|
420
|
+
--lt-tone-bg: oklch(0.3 0.07 245);
|
|
361
421
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
--lt-
|
|
422
|
+
[data-theme="dark"] .lt-tone-purple,
|
|
423
|
+
.dark .lt-tone-purple {
|
|
424
|
+
--lt-tone-bg: oklch(0.3 0.07 305);
|
|
365
425
|
}
|
|
366
426
|
|
|
367
427
|
/*
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { useT } from "../../i18n/instance.js";
|
|
1
2
|
import { nodeIdentity } from "../../core/test-id.js";
|
|
2
3
|
import { Link, usePage } from "@inertiajs/react";
|
|
3
4
|
import { Fragment } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region resources/js/layout/components/breadcrumbs.tsx
|
|
6
7
|
var BreadcrumbsComponent = ({ node }) => {
|
|
8
|
+
const { t } = useT("lattice");
|
|
7
9
|
const crumbs = usePage().props.lattice?.breadcrumbs ?? [];
|
|
8
10
|
if (crumbs.length === 0) return null;
|
|
9
11
|
return /* @__PURE__ */ jsx("nav", {
|
|
10
|
-
"aria-label": "Breadcrumb",
|
|
12
|
+
"aria-label": t("common.breadcrumb", "Breadcrumb"),
|
|
11
13
|
"data-lattice-component": nodeIdentity(node),
|
|
12
14
|
children: /* @__PURE__ */ jsx("ol", {
|
|
13
15
|
className: "flex items-center gap-2 text-sm text-lt-muted-fg",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../../resources/js/layout/components/breadcrumbs.tsx"],"sourcesContent":["import { Link, usePage } from \"@inertiajs/react\";\nimport { Fragment } from \"react\";\nimport type { PagePayload, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\n\nconst BreadcrumbsComponent: RendererComponent<\"breadcrumbs\"> = ({ node }) => {\n const page = usePage();\n const crumbs = (page.props.lattice as PagePayload | undefined)?.breadcrumbs ?? [];\n\n if (crumbs.length === 0) {\n return null;\n }\n\n return (\n <nav
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../../resources/js/layout/components/breadcrumbs.tsx"],"sourcesContent":["import { Link, usePage } from \"@inertiajs/react\";\nimport { Fragment } from \"react\";\nimport type { PagePayload, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\nconst BreadcrumbsComponent: RendererComponent<\"breadcrumbs\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const page = usePage();\n const crumbs = (page.props.lattice as PagePayload | undefined)?.breadcrumbs ?? [];\n\n if (crumbs.length === 0) {\n return null;\n }\n\n return (\n <nav\n aria-label={t(\"common.breadcrumb\", \"Breadcrumb\")}\n data-lattice-component={nodeIdentity(node)}\n >\n <ol className=\"flex items-center gap-2 text-sm text-lt-muted-fg\">\n {crumbs.map((crumb, index) => {\n const isLast = index === crumbs.length - 1;\n\n return (\n <Fragment key={crumb.href}>\n <li>\n {isLast ? (\n <span aria-current=\"page\" className=\"text-lt-fg\">\n {crumb.title}\n </span>\n ) : (\n <Link className=\"hover:text-lt-fg\" href={crumb.href}>\n {crumb.title}\n </Link>\n )}\n </li>\n {isLast ? null : <li aria-hidden=\"true\">/</li>}\n </Fragment>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nexport default BreadcrumbsComponent;\n"],"mappings":";;;;;;AAMA,IAAM,wBAA0D,EAAE,WAAW;CAC3E,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,MAAM,SADO,QACG,EAAK,MAAM,SAAqC,eAAe,CAAC;CAEhF,IAAI,OAAO,WAAW,GACpB,OAAO;CAGT,OACE,oBAAC,OAAD;EACE,cAAY,EAAE,qBAAqB,YAAY;EAC/C,0BAAwB,aAAa,IAAI;YAEzC,oBAAC,MAAD;GAAI,WAAU;aACX,OAAO,KAAK,OAAO,UAAU;IAC5B,MAAM,SAAS,UAAU,OAAO,SAAS;IAEzC,OACE,qBAAC,UAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAA,UACG,SACC,oBAAC,QAAD;KAAM,gBAAa;KAAO,WAAU;eACjC,MAAM;IACH,CAAA,IAEN,oBAAC,MAAD;KAAM,WAAU;KAAmB,MAAM,MAAM;eAC5C,MAAM;IACH,CAAA,EAEN,CAAA,GACH,SAAS,OAAO,oBAAC,MAAD;KAAI,eAAY;eAAO;IAAK,CAAA,CACrC,EAAA,GAbK,MAAM,IAaX;GAEd,CAAC;EACC,CAAA;CACD,CAAA;AAET"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { onCallout } from "../../toast/callout.js";
|
|
1
2
|
import { cn } from "../../lib/utils.js";
|
|
2
3
|
import { Icon } from "../../icons/sprite.js";
|
|
3
4
|
import { RenderNode } from "../../core/renderer.js";
|
|
4
|
-
import { onCallout } from "../../toast/callout.js";
|
|
5
5
|
import { useT } from "../../i18n/instance.js";
|
|
6
6
|
import { variantStyles } from "../../toast/variant-styles.js";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { Color, ColorName } from '../types/generated.js';
|
|
3
|
+
export declare function namedColor(value: ColorName): Color;
|
|
4
|
+
export declare function coerceColor(value: unknown): Color | undefined;
|
|
5
|
+
export declare function colorValue(color: Color): string;
|
|
6
|
+
export declare function toneProps(color: Color): {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region resources/js/lib/color.ts
|
|
2
|
+
var names = new Set([
|
|
3
|
+
"default",
|
|
4
|
+
"muted",
|
|
5
|
+
"primary",
|
|
6
|
+
"success",
|
|
7
|
+
"info",
|
|
8
|
+
"warning",
|
|
9
|
+
"danger",
|
|
10
|
+
"gray",
|
|
11
|
+
"red",
|
|
12
|
+
"orange",
|
|
13
|
+
"yellow",
|
|
14
|
+
"green",
|
|
15
|
+
"blue",
|
|
16
|
+
"purple"
|
|
17
|
+
]);
|
|
18
|
+
function namedColor(value) {
|
|
19
|
+
return {
|
|
20
|
+
kind: "named",
|
|
21
|
+
value,
|
|
22
|
+
dark: null
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function coerceColor(value) {
|
|
26
|
+
if (typeof value === "string" && value !== "") return names.has(value) ? namedColor(value) : {
|
|
27
|
+
kind: "css",
|
|
28
|
+
value,
|
|
29
|
+
dark: null
|
|
30
|
+
};
|
|
31
|
+
if (typeof value === "object" && value !== null && "kind" in value && "value" in value) return value;
|
|
32
|
+
}
|
|
33
|
+
function colorValue(color) {
|
|
34
|
+
if (color.kind === "named") return `var(--lt-color-${color.value})`;
|
|
35
|
+
return color.dark === null ? color.value : `light-dark(${color.value}, ${color.dark})`;
|
|
36
|
+
}
|
|
37
|
+
function toneProps(color) {
|
|
38
|
+
if (color.kind === "named") return { className: `lt-tone-${color.value}` };
|
|
39
|
+
const paint = colorValue(color);
|
|
40
|
+
return { style: {
|
|
41
|
+
"--lt-tone-bg": `color-mix(in oklab, ${paint} 12%, transparent)`,
|
|
42
|
+
"--lt-tone-fg": paint
|
|
43
|
+
} };
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { coerceColor, colorValue, namedColor, toneProps };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","names":[],"sources":["../../resources/js/lib/color.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type { Color, ColorName } from \"@lattice-php/lattice/types/generated\";\n\nconst names: ReadonlySet<string> = new Set([\n \"default\",\n \"muted\",\n \"primary\",\n \"success\",\n \"info\",\n \"warning\",\n \"danger\",\n \"gray\",\n \"red\",\n \"orange\",\n \"yellow\",\n \"green\",\n \"blue\",\n \"purple\",\n] satisfies ColorName[]);\n\nexport function namedColor(value: ColorName): Color {\n return { kind: \"named\", value, dark: null };\n}\n\nexport function coerceColor(value: unknown): Color | undefined {\n if (typeof value === \"string\" && value !== \"\") {\n return names.has(value) ? namedColor(value as ColorName) : { kind: \"css\", value, dark: null };\n }\n\n if (typeof value === \"object\" && value !== null && \"kind\" in value && \"value\" in value) {\n return value as Color;\n }\n\n return undefined;\n}\n\nexport function colorValue(color: Color): string {\n if (color.kind === \"named\") {\n return `var(--lt-color-${color.value})`;\n }\n\n return color.dark === null ? color.value : `light-dark(${color.value}, ${color.dark})`;\n}\n\nexport function toneProps(color: Color): { className?: string; style?: CSSProperties } {\n if (color.kind === \"named\") {\n return { className: `lt-tone-${color.value}` };\n }\n\n const paint = colorValue(color);\n\n return {\n style: {\n \"--lt-tone-bg\": `color-mix(in oklab, ${paint} 12%, transparent)`,\n \"--lt-tone-fg\": paint,\n } as CSSProperties,\n };\n}\n"],"mappings":";AAGA,IAAM,QAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAuB;AAEvB,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAM;EAAS;EAAO,MAAM;CAAK;AAC5C;AAEA,SAAgB,YAAY,OAAmC;CAC7D,IAAI,OAAO,UAAU,YAAY,UAAU,IACzC,OAAO,MAAM,IAAI,KAAK,IAAI,WAAW,KAAkB,IAAI;EAAE,MAAM;EAAO;EAAO,MAAM;CAAK;CAG9F,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,WAAW,OAC/E,OAAO;AAIX;AAEA,SAAgB,WAAW,OAAsB;CAC/C,IAAI,MAAM,SAAS,SACjB,OAAO,kBAAkB,MAAM,MAAM;CAGvC,OAAO,MAAM,SAAS,OAAO,MAAM,QAAQ,cAAc,MAAM,MAAM,IAAI,MAAM,KAAK;AACtF;AAEA,SAAgB,UAAU,OAA6D;CACrF,IAAI,MAAM,SAAS,SACjB,OAAO,EAAE,WAAW,WAAW,MAAM,QAAQ;CAG/C,MAAM,QAAQ,WAAW,KAAK;CAE9B,OAAO,EACL,OAAO;EACL,gBAAgB,uBAAuB,MAAM;EAC7C,gBAAgB;CAClB,EACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function fetchNotifications(endpoint: string, page?: number): Promise<
|
|
3
|
-
export declare function markRead(endpoint: string, id: string): Promise<
|
|
4
|
-
export declare function markAllRead(endpoint: string): Promise<
|
|
5
|
-
export declare function dismiss(endpoint: string, id: string): Promise<
|
|
6
|
-
export declare function clearAll(endpoint: string): Promise<
|
|
1
|
+
import { NotificationList, UnreadCount } from './types.js';
|
|
2
|
+
export declare function fetchNotifications(endpoint: string, page?: number): Promise<NotificationList>;
|
|
3
|
+
export declare function markRead(endpoint: string, id: string): Promise<UnreadCount>;
|
|
4
|
+
export declare function markAllRead(endpoint: string): Promise<UnreadCount>;
|
|
5
|
+
export declare function dismiss(endpoint: string, id: string): Promise<UnreadCount>;
|
|
6
|
+
export declare function clearAll(endpoint: string): Promise<UnreadCount>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":[],"sources":["../../resources/js/notifications/api.ts"],"sourcesContent":["import { apiJson } from \"@lattice-php/lattice/core/api\";\nimport type {
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../resources/js/notifications/api.ts"],"sourcesContent":["import { apiJson } from \"@lattice-php/lattice/core/api\";\nimport type { NotificationList, UnreadCount } from \"./types\";\n\nexport function fetchNotifications(endpoint: string, page = 1): Promise<NotificationList> {\n return apiJson<NotificationList>(`${endpoint}?page=${page}`);\n}\n\nexport function markRead(endpoint: string, id: string): Promise<UnreadCount> {\n return apiJson<UnreadCount>(`${endpoint}/${id}/read`, { method: \"PATCH\" });\n}\n\nexport function markAllRead(endpoint: string): Promise<UnreadCount> {\n return apiJson<UnreadCount>(`${endpoint}/read-all`, { method: \"POST\" });\n}\n\nexport function dismiss(endpoint: string, id: string): Promise<UnreadCount> {\n return apiJson<UnreadCount>(`${endpoint}/${id}`, { method: \"DELETE\" });\n}\n\nexport function clearAll(endpoint: string): Promise<UnreadCount> {\n return apiJson<UnreadCount>(endpoint, { method: \"DELETE\" });\n}\n"],"mappings":";;AAGA,SAAgB,mBAAmB,UAAkB,OAAO,GAA8B;CACxF,OAAO,QAA0B,GAAG,SAAS,QAAQ,MAAM;AAC7D;AAEA,SAAgB,SAAS,UAAkB,IAAkC;CAC3E,OAAO,QAAqB,GAAG,SAAS,GAAG,GAAG,QAAQ,EAAE,QAAQ,QAAQ,CAAC;AAC3E;AAEA,SAAgB,YAAY,UAAwC;CAClE,OAAO,QAAqB,GAAG,SAAS,YAAY,EAAE,QAAQ,OAAO,CAAC;AACxE;AAEA,SAAgB,QAAQ,UAAkB,IAAkC;CAC1E,OAAO,QAAqB,GAAG,SAAS,GAAG,MAAM,EAAE,QAAQ,SAAS,CAAC;AACvE;AAEA,SAAgB,SAAS,UAAwC;CAC/D,OAAO,QAAqB,UAAU,EAAE,QAAQ,SAAS,CAAC;AAC5D"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import { NotificationItem } from '../types/generated.js';
|
|
2
|
-
export type { NotificationItem };
|
|
3
|
-
export type NotificationsResponse = {
|
|
4
|
-
notifications: NotificationItem[];
|
|
5
|
-
unreadCount: number;
|
|
6
|
-
hasMore: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type UnreadCountResponse = {
|
|
9
|
-
unreadCount: number;
|
|
10
|
-
};
|
|
1
|
+
import { NotificationItem, NotificationList, UnreadCount } from '../types/generated.js';
|
|
2
|
+
export type { NotificationItem, NotificationList, UnreadCount };
|
package/dist/provider-base.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { updateAppearance } from "./appearance/index.js";
|
|
2
2
|
import { RegistryContext } from "./core/registry-context.js";
|
|
3
3
|
import { SpriteProvider } from "./icons/sprite.js";
|
|
4
|
-
import { EventBridge } from "./event-bridge.js";
|
|
5
4
|
import { Toaster } from "./toast/toaster.js";
|
|
5
|
+
import { EventBridge } from "./event-bridge.js";
|
|
6
6
|
import { ActionInteractionProvider } from "./action/components/action-trigger-provider.js";
|
|
7
7
|
import { useFlashEffects } from "./effects/use-flash-effects.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|