@thebuoyant-tsdev/mui-ts-library 3.4.0 → 3.6.1

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.
@@ -0,0 +1,12 @@
1
+ export type SqlQueryHistoryEntry = {
2
+ sql: string;
3
+ timestamp: number;
4
+ };
5
+ export declare function loadQueryHistory(storageKey: string): SqlQueryHistoryEntry[];
6
+ export declare function saveQueryHistory(storageKey: string, history: SqlQueryHistoryEntry[]): void;
7
+ /**
8
+ * Adds a new entry to the front of the history. An existing entry with the
9
+ * same SQL is moved to the front instead of duplicated. Result is capped at
10
+ * maxEntries.
11
+ */
12
+ export declare function addQueryToHistory(history: SqlQueryHistoryEntry[], sql: string, maxEntries: number): SqlQueryHistoryEntry[];
@@ -0,0 +1,28 @@
1
+ //#region src/components/sql-editor/util/sqlQueryHistory.util.ts
2
+ function e(e) {
3
+ if (typeof window > "u") return [];
4
+ try {
5
+ let t = window.localStorage.getItem(e);
6
+ if (!t) return [];
7
+ let n = JSON.parse(t);
8
+ return Array.isArray(n) ? n.filter((e) => typeof e?.sql == "string" && typeof e?.timestamp == "number") : [];
9
+ } catch {
10
+ return [];
11
+ }
12
+ }
13
+ function t(e, t) {
14
+ if (!(typeof window > "u")) try {
15
+ window.localStorage.setItem(e, JSON.stringify(t));
16
+ } catch {}
17
+ }
18
+ function n(e, t, n) {
19
+ let r = t.trim();
20
+ if (!r) return e;
21
+ let i = e.filter((e) => e.sql !== r);
22
+ return [{
23
+ sql: r,
24
+ timestamp: Date.now()
25
+ }, ...i].slice(0, Math.max(0, n));
26
+ }
27
+ //#endregion
28
+ export { n as addQueryToHistory, e as loadQueryHistory, t as saveQueryHistory };
@@ -20,10 +20,12 @@ export type TagSelectionTranslation = {
20
20
  backgroundColorLabel: string;
21
21
  textColorLabel: string;
22
22
  autoTextColorLabel: string;
23
- confirmCreateLabel: string;
24
- cancelCreateLabel: string;
23
+ /** @since 3.4.0 — optional for backward compatibility with full-literal objects typed before this field existed. */
24
+ confirmCreateLabel?: string;
25
+ /** @since 3.4.0 — optional for backward compatibility with full-literal objects typed before this field existed. */
26
+ cancelCreateLabel?: string;
25
27
  };
26
- export declare const DEFAULT_TAG_SELECTION_TRANSLATION: TagSelectionTranslation;
28
+ export declare const DEFAULT_TAG_SELECTION_TRANSLATION: Required<TagSelectionTranslation>;
27
29
  export type TagSelectionProps = {
28
30
  allowCreate?: boolean;
29
31
  chipSize?: "small" | "medium";
@@ -4,7 +4,7 @@ type TagSelectionAutocompleteProps = {
4
4
  chipSize: "medium" | "small";
5
5
  availableTags: TagSelectionItem[];
6
6
  searchValue: string;
7
- translation: TagSelectionTranslation;
7
+ translation: Required<TagSelectionTranslation>;
8
8
  onSearchChange: (value: string) => void;
9
9
  onTagSelect: (tag: TagSelectionItem) => void;
10
10
  onTagCreate?: (tag: TagSelectionItem) => void;
@@ -1,7 +1,7 @@
1
1
  import type { TagSelectionItem, TagSelectionTranslation } from "./TagSelection.types";
2
2
  type TagSelectionSelectedTagsProps = {
3
3
  selectedTags: TagSelectionItem[];
4
- translation: TagSelectionTranslation;
4
+ translation: Required<TagSelectionTranslation>;
5
5
  onTagDelete: (tag: TagSelectionItem) => void;
6
6
  showSelectedTagsLabel: boolean;
7
7
  chipSize: "small" | "medium";