@littlebox/strapi-suite 1.0.52 → 1.0.55

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.
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-60sq8G6p.js");
2
+ const index = require("../_chunks/index-Ml4j6jxD.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { j } from "../_chunks/index-DQ3vX9So.mjs";
1
+ import { j } from "../_chunks/index-Do7CxfkQ.mjs";
2
2
  export {
3
3
  j as default
4
4
  };
@@ -0,0 +1,53 @@
1
+ export declare const TABS_PLUGIN_KEY = "littlebox-strapi-suite";
2
+ export declare const TABS_HASH_PARAM = "ltbTab";
3
+ export declare const TABS_BAR_FIELD_TYPE = "ltb-tabs-bar";
4
+ export declare const TABS_SECTION_FIELD_TYPE = "ltb-tab-section";
5
+ export interface LtbTab {
6
+ id: string;
7
+ name: string;
8
+ }
9
+ export type LayoutField = {
10
+ name: string;
11
+ attribute?: unknown;
12
+ [key: string]: unknown;
13
+ };
14
+ export type LayoutPanel = LayoutField[][];
15
+ export type TabsValidationError = 'name.required' | 'key.empty' | 'key.duplicated';
16
+ export declare function toTabKey(name: string): string;
17
+ export declare function generateTabId(): string;
18
+ export declare function readTabs(pluginOptions: unknown): LtbTab[];
19
+ /**
20
+ * Tabs value to store in the form. The content type builder applies the modal values to its state
21
+ * with lodash `merge`, which merges arrays by index, so a shorter array would keep the removed
22
+ * tabs. Padding with `null` up to the previous length overwrites them; `readTabs` ignores nulls
23
+ * and `cleanContentTypeSchema` drops them on save.
24
+ */
25
+ export declare function padTabs(next: LtbTab[], previous: unknown): (LtbTab | null)[];
26
+ export declare function readAttributeTabId(attribute: unknown): string | null;
27
+ /** Tabs whose API key matches a field or system key; the server does not group them. */
28
+ export declare function getConflictingTabIds(tabs: LtbTab[], attributes: unknown): Set<string>;
29
+ export declare function validateTabs(tabs: LtbTab[]): TabsValidationError | null;
30
+ export declare function cleanContentTypeSchema<T>(schema: T): T;
31
+ export declare function resolveActiveTab(tabs: LtbTab[], requested: unknown): LtbTab | null;
32
+ export declare function groupLayoutByTabs(panels: LayoutPanel[], tabs: LtbTab[]): {
33
+ rootPanels: LayoutPanel[];
34
+ sections: {
35
+ tab: LtbTab;
36
+ panels: LayoutPanel[];
37
+ }[];
38
+ };
39
+ type ComponentLayouts = Record<string, {
40
+ layout?: LayoutField[][];
41
+ } | undefined>;
42
+ /**
43
+ * Name borrowed by the tabs bar and section fields. The content manager checks field
44
+ * permissions by name, and permissions only list component leaves (e.g. `seo.metaTitle`).
45
+ */
46
+ export declare function findAnchorName(panels: LayoutPanel[], components?: ComponentLayouts): string | null;
47
+ export declare function readTabFromHash(hash: string): string | null;
48
+ export declare function pickInitialTab(keys: string[], hashKey: string | null, currentKey: string | null): string | null;
49
+ export declare function tabHash(key: string): string;
50
+ export declare function mapFieldsToTabKeys(panels: LayoutPanel[], tabs: LtbTab[]): Record<string, string>;
51
+ export declare function countErrorsByTab(errors: unknown, fieldTabKeys: Record<string, string>): Record<string, number>;
52
+ export declare function isEditViewPath(pathname: string): boolean;
53
+ export {};
@@ -0,0 +1,31 @@
1
+ type IntlMessage = {
2
+ id: string;
3
+ defaultMessage: string;
4
+ };
5
+ type TabSelectOption = {
6
+ key: string;
7
+ value: string;
8
+ metadatas: {
9
+ intlLabel: IntlMessage;
10
+ disabled?: boolean;
11
+ hidden?: boolean;
12
+ };
13
+ };
14
+ type TabSelectProps = {
15
+ name: string;
16
+ value?: string | null;
17
+ error?: string;
18
+ intlLabel: IntlMessage;
19
+ description?: IntlMessage;
20
+ options?: TabSelectOption[];
21
+ onChange: (event: {
22
+ target: {
23
+ name: string;
24
+ value: string;
25
+ type: string;
26
+ };
27
+ }) => void;
28
+ };
29
+ /** Tab select for the field advanced settings; the built-in select does not allow styling its label. */
30
+ declare const TabSelect: ({ name, value, error, intlLabel, description, options, onChange, }: TabSelectProps) => import("react/jsx-runtime").JSX.Element;
31
+ export default TabSelect;
@@ -0,0 +1,21 @@
1
+ import { LtbTab } from '../core/utils/tabs';
2
+ type IntlMessage = {
3
+ id: string;
4
+ defaultMessage: string;
5
+ values?: Record<string, string | number>;
6
+ };
7
+ type TabsEditorProps = {
8
+ name: string;
9
+ value?: unknown;
10
+ error?: string;
11
+ intlLabel: IntlMessage;
12
+ description?: IntlMessage;
13
+ onChange: (event: {
14
+ target: {
15
+ name: string;
16
+ value: (LtbTab | null)[];
17
+ };
18
+ }) => void;
19
+ };
20
+ declare const TabsEditor: ({ name, value, error, intlLabel, description, onChange }: TabsEditorProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default TabsEditor;
@@ -0,0 +1 @@
1
+ export declare function registerTabsInContentTypeBuilder(app: any): void;
@@ -0,0 +1,14 @@
1
+ export declare function ctbContentTypeUid(pathname: string): string | null;
2
+ /** Maps each field that belongs to an existing tab to the tab name. */
3
+ export declare function buildFieldTabNames(contentType: any): Record<string, string>;
4
+ /**
5
+ * Adds, updates or removes the tab badge after the name of each top-level field row of the
6
+ * content type builder list. Rows of component sub-fields are left untouched.
7
+ */
8
+ export declare function syncTabBadges(root: ParentNode, fieldTabNames: Record<string, string>): void;
9
+ /**
10
+ * Shows the tab of each field in the content type builder list. The builder has no extension
11
+ * point there, so this watches the DOM and reads the builder state (including unsaved changes)
12
+ * from the admin redux store. If the markup changes in a future Strapi version, no badge shows.
13
+ */
14
+ export declare function startTabBadges(app: any): void;
@@ -0,0 +1,6 @@
1
+ type TabSectionProps = {
2
+ ltbTabKey?: string;
3
+ };
4
+ /** Invisible marker that hides or shows the panels of its tab. */
5
+ declare const TabSection: ({ ltbTabKey }: TabSectionProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default TabSection;
@@ -0,0 +1,10 @@
1
+ type TabsBarProps = {
2
+ ltbTabs?: {
3
+ id: string;
4
+ name: string;
5
+ key: string;
6
+ }[];
7
+ ltbFieldTabKeys?: Record<string, string>;
8
+ };
9
+ declare const TabsBar: ({ ltbTabs, ltbFieldTabKeys }: TabsBarProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default TabsBar;
@@ -0,0 +1,12 @@
1
+ type HookArgs = {
2
+ layout: any;
3
+ [key: string]: unknown;
4
+ };
5
+ /**
6
+ * Keeps every field in the layout and arranges it as: fields without a tab, the tabs bar,
7
+ * then one section per tab (a marker panel followed by the tab panels). Switching tabs only
8
+ * hides and shows sections at render time: the content manager recomputes this hook only when
9
+ * the URL query changes, and a query change triggers its unsaved-changes guard and a refetch.
10
+ */
11
+ export declare function mutateEditViewLayout<T extends HookArgs>(args: T, pathname?: string): T;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shows or hides the panels of a tab section. The content manager renders every panel of
3
+ * the edit layout as a direct child of one column; the section marker sits in its own panel,
4
+ * followed by the panels of its tab until the next marker. Returns that column, or null when
5
+ * the structure is not found, in which case nothing is hidden.
6
+ */
7
+ export declare function applySectionVisibility(marker: HTMLElement, visible: boolean): HTMLElement | null;
@@ -0,0 +1,13 @@
1
+ type Listener = () => void;
2
+ export declare function createTabsStore(): {
3
+ get: () => string | null;
4
+ set(key: string): void;
5
+ subscribe(listener: Listener): () => void;
6
+ };
7
+ /** Active tab shared by the tabs bar and the tab sections of the open edit view. */
8
+ export declare const tabsStore: {
9
+ get: () => string | null;
10
+ set(key: string): void;
11
+ subscribe(listener: Listener): () => void;
12
+ };
13
+ export {};