@vuu-ui/vuu-utils 0.13.91 → 0.13.92

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.
@@ -5,6 +5,18 @@ const getCookieValue = (name) => {
5
5
  return globalThis.document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
6
6
  }
7
7
  };
8
+ function setCookieValue(name, value, days) {
9
+ let expires = "";
10
+ if (typeof days === "number") {
11
+ const date = /* @__PURE__ */ new Date();
12
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
13
+ expires = "; expires=" + date.toUTCString();
14
+ }
15
+ const encodedName = encodeURIComponent(name);
16
+ const encodedValue = encodeURIComponent(value);
17
+ document.cookie = `${encodedName}=${encodedValue}${expires};`;
18
+ }
8
19
 
9
20
  exports.getCookieValue = getCookieValue;
21
+ exports.setCookieValue = setCookieValue;
10
22
  //# sourceMappingURL=cookie-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-utils.js","sources":["../../../../../../packages/vuu-utils/src/cookie-utils.ts"],"sourcesContent":["export const getCookieValue = (name: string): string | number | undefined => {\n if (globalThis.document?.cookie !== undefined) {\n return globalThis.document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n }\n};\n"],"names":[],"mappings":";;AAAa,MAAA,cAAA,GAAiB,CAAC,IAA8C,KAAA;AAC3E,EAAI,IAAA,UAAA,CAAW,QAAU,EAAA,MAAA,KAAW,KAAW,CAAA,EAAA;AAC7C,IAAA,OAAO,WAAW,QAAS,CAAA,MAAA,CACxB,MAAM,IAAI,CAAA,CACV,KAAK,CAAC,GAAA,KAAQ,IAAI,UAAW,CAAA,CAAA,EAAG,IAAI,CAAG,CAAA,CAAA,CAAC,GACvC,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAAA;AAEpB;;;;"}
1
+ {"version":3,"file":"cookie-utils.js","sources":["../../../../../../packages/vuu-utils/src/cookie-utils.ts"],"sourcesContent":["export const getCookieValue = (name: string): string | number | undefined => {\n if (globalThis.document?.cookie !== undefined) {\n return globalThis.document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n }\n};\n\n/**\n * Sets a cookie value.\n *\n * @param {string} name - Cookie name\n * @param {string} value - Cookie value\n * @param {number} [days] - Optional: number of days until the cookie expires\n */\nexport function setCookieValue(name: string, value: string, days?: number) {\n let expires = \"\";\n\n if (typeof days === \"number\") {\n const date = new Date();\n // days -> milliseconds\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = \"; expires=\" + date.toUTCString();\n }\n\n const encodedName = encodeURIComponent(name);\n const encodedValue = encodeURIComponent(value);\n\n document.cookie = `${encodedName}=${encodedValue}${expires};`;\n}\n"],"names":[],"mappings":";;AAAa,MAAA,cAAA,GAAiB,CAAC,IAA8C,KAAA;AAC3E,EAAI,IAAA,UAAA,CAAW,QAAU,EAAA,MAAA,KAAW,KAAW,CAAA,EAAA;AAC7C,IAAA,OAAO,WAAW,QAAS,CAAA,MAAA,CACxB,MAAM,IAAI,CAAA,CACV,KAAK,CAAC,GAAA,KAAQ,IAAI,UAAW,CAAA,CAAA,EAAG,IAAI,CAAG,CAAA,CAAA,CAAC,GACvC,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAAA;AAEpB;AASgB,SAAA,cAAA,CAAe,IAAc,EAAA,KAAA,EAAe,IAAe,EAAA;AACzE,EAAA,IAAI,OAAU,GAAA,EAAA;AAEd,EAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,IAAM,MAAA,IAAA,uBAAW,IAAK,EAAA;AAEtB,IAAK,IAAA,CAAA,OAAA,CAAQ,KAAK,OAAQ,EAAA,GAAI,OAAO,EAAK,GAAA,EAAA,GAAK,KAAK,GAAI,CAAA;AACxD,IAAU,OAAA,GAAA,YAAA,GAAe,KAAK,WAAY,EAAA;AAAA;AAG5C,EAAM,MAAA,WAAA,GAAc,mBAAmB,IAAI,CAAA;AAC3C,EAAM,MAAA,YAAA,GAAe,mBAAmB,KAAK,CAAA;AAE7C,EAAA,QAAA,CAAS,SAAS,CAAG,EAAA,WAAW,CAAI,CAAA,EAAA,YAAY,GAAG,OAAO,CAAA,CAAA,CAAA;AAC5D;;;;;"}
@@ -172,6 +172,7 @@ exports.updateColumnRenderProps = columnUtils.updateColumnRenderProps;
172
172
  exports.updateColumnType = columnUtils.updateColumnType;
173
173
  exports.visibleColumnAtIndex = columnUtils.visibleColumnAtIndex;
174
174
  exports.getCookieValue = cookieUtils.getCookieValue;
175
+ exports.setCookieValue = cookieUtils.setCookieValue;
175
176
  exports.getCellConfigPanelRenderer = componentRegistry.getCellConfigPanelRenderer;
176
177
  exports.getCellRenderer = componentRegistry.getCellRenderer;
177
178
  exports.getCellRendererOptions = componentRegistry.getCellRendererOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const getLocalEntity = (key) => {
3
+ const getLocalEntity = (key, deleteOnRead = false) => {
4
4
  const data = localStorage.getItem(key);
5
- return data ? JSON.parse(data) : void 0;
5
+ if (data) {
6
+ if (deleteOnRead) {
7
+ localStorage.removeItem(key);
8
+ }
9
+ return JSON.parse(data);
10
+ }
6
11
  };
7
12
  const clearLocalEntity = (key) => {
8
13
  const doomedItem = localStorage.getItem(key);
@@ -14,9 +19,9 @@ const clearLocalEntity = (key) => {
14
19
  }
15
20
  };
16
21
  const getAllLocalEntity = (url) => Object.entries(localStorage).filter(([key]) => key.includes(url)).map(([, value]) => JSON.parse(value));
17
- const saveLocalEntity = (url, data) => {
22
+ const saveLocalEntity = (key, data) => {
18
23
  try {
19
- localStorage.setItem(url, JSON.stringify(data));
24
+ localStorage.setItem(key, JSON.stringify(data));
20
25
  return data;
21
26
  } catch {
22
27
  return void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"local-storage-utils.js","sources":["../../../../../../packages/vuu-utils/src/local-storage-utils.ts"],"sourcesContent":["export const getLocalEntity = <T>(key: string): T | undefined => {\n const data = localStorage.getItem(key);\n return data ? JSON.parse(data) : undefined;\n};\n\nexport const clearLocalEntity = (key: string) => {\n const doomedItem = localStorage.getItem(key);\n if (doomedItem) {\n localStorage.removeItem(key);\n return true;\n } else {\n return false;\n }\n};\n\nexport const getAllLocalEntity = <T>(url: string): T[] =>\n Object.entries(localStorage)\n .filter(([key]) => key.includes(url))\n .map(([, value]) => JSON.parse(value) as T);\n\nexport const saveLocalEntity = <T>(url: string, data: T): T | undefined => {\n try {\n localStorage.setItem(url, JSON.stringify(data));\n return data;\n } catch {\n return undefined;\n }\n};\n"],"names":[],"mappings":";;AAAa,MAAA,cAAA,GAAiB,CAAI,GAA+B,KAAA;AAC/D,EAAM,MAAA,IAAA,GAAO,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AACrC,EAAA,OAAO,IAAO,GAAA,IAAA,CAAK,KAAM,CAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AACnC;AAEa,MAAA,gBAAA,GAAmB,CAAC,GAAgB,KAAA;AAC/C,EAAM,MAAA,UAAA,GAAa,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AAC3C,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAC3B,IAAO,OAAA,IAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX;AAEa,MAAA,iBAAA,GAAoB,CAAI,GAAA,KACnC,MAAO,CAAA,OAAA,CAAQ,YAAY,CAAA,CACxB,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,SAAS,GAAG,CAAC,CACnC,CAAA,GAAA,CAAI,CAAC,GAAG,KAAK,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,KAAK,CAAM;AAEjC,MAAA,eAAA,GAAkB,CAAI,GAAA,EAAa,IAA2B,KAAA;AACzE,EAAI,IAAA;AACF,IAAA,YAAA,CAAa,OAAQ,CAAA,GAAA,EAAK,IAAK,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAC9C,IAAO,OAAA,IAAA;AAAA,GACD,CAAA,MAAA;AACN,IAAO,OAAA,KAAA,CAAA;AAAA;AAEX;;;;;;;"}
1
+ {"version":3,"file":"local-storage-utils.js","sources":["../../../../../../packages/vuu-utils/src/local-storage-utils.ts"],"sourcesContent":["export const getLocalEntity = <T>(\n key: string,\n deleteOnRead = false,\n): T | undefined => {\n const data = localStorage.getItem(key);\n if (data) {\n if (deleteOnRead) {\n localStorage.removeItem(key);\n }\n return JSON.parse(data);\n }\n};\n\nexport const clearLocalEntity = (key: string) => {\n const doomedItem = localStorage.getItem(key);\n if (doomedItem) {\n localStorage.removeItem(key);\n return true;\n } else {\n return false;\n }\n};\n\nexport const getAllLocalEntity = <T>(url: string): T[] =>\n Object.entries(localStorage)\n .filter(([key]) => key.includes(url))\n .map(([, value]) => JSON.parse(value) as T);\n\nexport const saveLocalEntity = <T>(key: string, data: T): T | undefined => {\n try {\n localStorage.setItem(key, JSON.stringify(data));\n return data;\n } catch {\n return undefined;\n }\n};\n"],"names":[],"mappings":";;AAAO,MAAM,cAAiB,GAAA,CAC5B,GACA,EAAA,YAAA,GAAe,KACG,KAAA;AAClB,EAAM,MAAA,IAAA,GAAO,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AACrC,EAAA,IAAI,IAAM,EAAA;AACR,IAAA,IAAI,YAAc,EAAA;AAChB,MAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAAA;AAE7B,IAAO,OAAA,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA;AAE1B;AAEa,MAAA,gBAAA,GAAmB,CAAC,GAAgB,KAAA;AAC/C,EAAM,MAAA,UAAA,GAAa,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AAC3C,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAC3B,IAAO,OAAA,IAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX;AAEa,MAAA,iBAAA,GAAoB,CAAI,GAAA,KACnC,MAAO,CAAA,OAAA,CAAQ,YAAY,CAAA,CACxB,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,SAAS,GAAG,CAAC,CACnC,CAAA,GAAA,CAAI,CAAC,GAAG,KAAK,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,KAAK,CAAM;AAEjC,MAAA,eAAA,GAAkB,CAAI,GAAA,EAAa,IAA2B,KAAA;AACzE,EAAI,IAAA;AACF,IAAA,YAAA,CAAa,OAAQ,CAAA,GAAA,EAAK,IAAK,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAC9C,IAAO,OAAA,IAAA;AAAA,GACD,CAAA,MAAA;AACN,IAAO,OAAA,KAAA,CAAA;AAAA;AAEX;;;;;;;"}
@@ -3,6 +3,17 @@ const getCookieValue = (name) => {
3
3
  return globalThis.document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
4
4
  }
5
5
  };
6
+ function setCookieValue(name, value, days) {
7
+ let expires = "";
8
+ if (typeof days === "number") {
9
+ const date = /* @__PURE__ */ new Date();
10
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
11
+ expires = "; expires=" + date.toUTCString();
12
+ }
13
+ const encodedName = encodeURIComponent(name);
14
+ const encodedValue = encodeURIComponent(value);
15
+ document.cookie = `${encodedName}=${encodedValue}${expires};`;
16
+ }
6
17
 
7
- export { getCookieValue };
18
+ export { getCookieValue, setCookieValue };
8
19
  //# sourceMappingURL=cookie-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-utils.js","sources":["../../../../../../packages/vuu-utils/src/cookie-utils.ts"],"sourcesContent":["export const getCookieValue = (name: string): string | number | undefined => {\n if (globalThis.document?.cookie !== undefined) {\n return globalThis.document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n }\n};\n"],"names":[],"mappings":"AAAa,MAAA,cAAA,GAAiB,CAAC,IAA8C,KAAA;AAC3E,EAAI,IAAA,UAAA,CAAW,QAAU,EAAA,MAAA,KAAW,KAAW,CAAA,EAAA;AAC7C,IAAA,OAAO,WAAW,QAAS,CAAA,MAAA,CACxB,MAAM,IAAI,CAAA,CACV,KAAK,CAAC,GAAA,KAAQ,IAAI,UAAW,CAAA,CAAA,EAAG,IAAI,CAAG,CAAA,CAAA,CAAC,GACvC,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAAA;AAEpB;;;;"}
1
+ {"version":3,"file":"cookie-utils.js","sources":["../../../../../../packages/vuu-utils/src/cookie-utils.ts"],"sourcesContent":["export const getCookieValue = (name: string): string | number | undefined => {\n if (globalThis.document?.cookie !== undefined) {\n return globalThis.document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n }\n};\n\n/**\n * Sets a cookie value.\n *\n * @param {string} name - Cookie name\n * @param {string} value - Cookie value\n * @param {number} [days] - Optional: number of days until the cookie expires\n */\nexport function setCookieValue(name: string, value: string, days?: number) {\n let expires = \"\";\n\n if (typeof days === \"number\") {\n const date = new Date();\n // days -> milliseconds\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = \"; expires=\" + date.toUTCString();\n }\n\n const encodedName = encodeURIComponent(name);\n const encodedValue = encodeURIComponent(value);\n\n document.cookie = `${encodedName}=${encodedValue}${expires};`;\n}\n"],"names":[],"mappings":"AAAa,MAAA,cAAA,GAAiB,CAAC,IAA8C,KAAA;AAC3E,EAAI,IAAA,UAAA,CAAW,QAAU,EAAA,MAAA,KAAW,KAAW,CAAA,EAAA;AAC7C,IAAA,OAAO,WAAW,QAAS,CAAA,MAAA,CACxB,MAAM,IAAI,CAAA,CACV,KAAK,CAAC,GAAA,KAAQ,IAAI,UAAW,CAAA,CAAA,EAAG,IAAI,CAAG,CAAA,CAAA,CAAC,GACvC,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAAA;AAEpB;AASgB,SAAA,cAAA,CAAe,IAAc,EAAA,KAAA,EAAe,IAAe,EAAA;AACzE,EAAA,IAAI,OAAU,GAAA,EAAA;AAEd,EAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,IAAM,MAAA,IAAA,uBAAW,IAAK,EAAA;AAEtB,IAAK,IAAA,CAAA,OAAA,CAAQ,KAAK,OAAQ,EAAA,GAAI,OAAO,EAAK,GAAA,EAAA,GAAK,KAAK,GAAI,CAAA;AACxD,IAAU,OAAA,GAAA,YAAA,GAAe,KAAK,WAAY,EAAA;AAAA;AAG5C,EAAM,MAAA,WAAA,GAAc,mBAAmB,IAAI,CAAA;AAC3C,EAAM,MAAA,YAAA,GAAe,mBAAmB,KAAK,CAAA;AAE7C,EAAA,QAAA,CAAS,SAAS,CAAG,EAAA,WAAW,CAAI,CAAA,EAAA,YAAY,GAAG,OAAO,CAAA,CAAA,CAAA;AAC5D;;;;"}
@@ -5,7 +5,7 @@ export { RestrictToHorizontalAxis } from '../../../node_modules/@dnd-kit/abstrac
5
5
  export { getAddedItems, getMissingItems, itemsChanged, itemsOrOrderChanged, moveItem, moveItemDeprecated, partition } from './array-utils.js';
6
6
  export { boxContainsPoint, getCenteredBox, getPositionWithinBox, isGridLayoutSplitDirection, pointPositionWithinRect } from './box-utils.js';
7
7
  export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, assertAllColumnsAreIncludedInSubscription, buildColumnMap, checkConfirmationPending, columnByAriaIndex, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupIcon, getGroupValue, getRuntimeColumnWidth, getTableHeadings, getTypeFormattingFromColumn, hasCustomRenderer, hasHeadings, hasValidationRules, isCalculatedColumn, isColumnTypeRenderer, isDataLoading, isDateTimeDataType, isDateTimeDataValue, isGroupColumn, isJsonAttribute, isJsonColumn, isJsonGroup, isLookupRenderer, isMappedValueTypeRenderer, isNotHidden, isNumericColumn, isPinned, isResizing, isStringColumn, isTextColumn, isTimeDataValue, isTimestampColumn, isTypeDescriptor, isValidColumnAlignment, isValidPinLocation, isValueListRenderer, isVuuColumnDataType, mapSortCriteria, measurePinnedColumns, metadataKeys, moveColumnTo, projectUpdates, removeSort, reorderColumnItems, replaceColumn, setAggregations, setCalculatedColumnExpression, setCalculatedColumnName, setCalculatedColumnType, sortPinnedColumns, subscribedOnly, toColumnDescriptor, toColumnName, toDataSourceColumns, updateColumn, updateColumnFormatting, updateColumnRenderProps, updateColumnType, visibleColumnAtIndex } from './column-utils.js';
8
- export { getCookieValue } from './cookie-utils.js';
8
+ export { getCookieValue, setCookieValue } from './cookie-utils.js';
9
9
  export { getCellConfigPanelRenderer, getCellRenderer, getCellRendererOptions, getColumnHeaderContentRenderer, getColumnHeaderLabelRenderer, getConfigurationEditor, getEditRuleValidator, getLayoutComponent, getRegisteredCellRenderers, getRowClassNameGenerator, isContainer, isLayoutComponent, isView, registerComponent, registerConfigurationEditor } from './component-registry.js';
10
10
  export { DataWindow } from './DataWindow.js';
11
11
  export { Clock } from './Clock.js';
@@ -1,6 +1,11 @@
1
- const getLocalEntity = (key) => {
1
+ const getLocalEntity = (key, deleteOnRead = false) => {
2
2
  const data = localStorage.getItem(key);
3
- return data ? JSON.parse(data) : void 0;
3
+ if (data) {
4
+ if (deleteOnRead) {
5
+ localStorage.removeItem(key);
6
+ }
7
+ return JSON.parse(data);
8
+ }
4
9
  };
5
10
  const clearLocalEntity = (key) => {
6
11
  const doomedItem = localStorage.getItem(key);
@@ -12,9 +17,9 @@ const clearLocalEntity = (key) => {
12
17
  }
13
18
  };
14
19
  const getAllLocalEntity = (url) => Object.entries(localStorage).filter(([key]) => key.includes(url)).map(([, value]) => JSON.parse(value));
15
- const saveLocalEntity = (url, data) => {
20
+ const saveLocalEntity = (key, data) => {
16
21
  try {
17
- localStorage.setItem(url, JSON.stringify(data));
22
+ localStorage.setItem(key, JSON.stringify(data));
18
23
  return data;
19
24
  } catch {
20
25
  return void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"local-storage-utils.js","sources":["../../../../../../packages/vuu-utils/src/local-storage-utils.ts"],"sourcesContent":["export const getLocalEntity = <T>(key: string): T | undefined => {\n const data = localStorage.getItem(key);\n return data ? JSON.parse(data) : undefined;\n};\n\nexport const clearLocalEntity = (key: string) => {\n const doomedItem = localStorage.getItem(key);\n if (doomedItem) {\n localStorage.removeItem(key);\n return true;\n } else {\n return false;\n }\n};\n\nexport const getAllLocalEntity = <T>(url: string): T[] =>\n Object.entries(localStorage)\n .filter(([key]) => key.includes(url))\n .map(([, value]) => JSON.parse(value) as T);\n\nexport const saveLocalEntity = <T>(url: string, data: T): T | undefined => {\n try {\n localStorage.setItem(url, JSON.stringify(data));\n return data;\n } catch {\n return undefined;\n }\n};\n"],"names":[],"mappings":"AAAa,MAAA,cAAA,GAAiB,CAAI,GAA+B,KAAA;AAC/D,EAAM,MAAA,IAAA,GAAO,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AACrC,EAAA,OAAO,IAAO,GAAA,IAAA,CAAK,KAAM,CAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AACnC;AAEa,MAAA,gBAAA,GAAmB,CAAC,GAAgB,KAAA;AAC/C,EAAM,MAAA,UAAA,GAAa,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AAC3C,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAC3B,IAAO,OAAA,IAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX;AAEa,MAAA,iBAAA,GAAoB,CAAI,GAAA,KACnC,MAAO,CAAA,OAAA,CAAQ,YAAY,CAAA,CACxB,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,SAAS,GAAG,CAAC,CACnC,CAAA,GAAA,CAAI,CAAC,GAAG,KAAK,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,KAAK,CAAM;AAEjC,MAAA,eAAA,GAAkB,CAAI,GAAA,EAAa,IAA2B,KAAA;AACzE,EAAI,IAAA;AACF,IAAA,YAAA,CAAa,OAAQ,CAAA,GAAA,EAAK,IAAK,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAC9C,IAAO,OAAA,IAAA;AAAA,GACD,CAAA,MAAA;AACN,IAAO,OAAA,KAAA,CAAA;AAAA;AAEX;;;;"}
1
+ {"version":3,"file":"local-storage-utils.js","sources":["../../../../../../packages/vuu-utils/src/local-storage-utils.ts"],"sourcesContent":["export const getLocalEntity = <T>(\n key: string,\n deleteOnRead = false,\n): T | undefined => {\n const data = localStorage.getItem(key);\n if (data) {\n if (deleteOnRead) {\n localStorage.removeItem(key);\n }\n return JSON.parse(data);\n }\n};\n\nexport const clearLocalEntity = (key: string) => {\n const doomedItem = localStorage.getItem(key);\n if (doomedItem) {\n localStorage.removeItem(key);\n return true;\n } else {\n return false;\n }\n};\n\nexport const getAllLocalEntity = <T>(url: string): T[] =>\n Object.entries(localStorage)\n .filter(([key]) => key.includes(url))\n .map(([, value]) => JSON.parse(value) as T);\n\nexport const saveLocalEntity = <T>(key: string, data: T): T | undefined => {\n try {\n localStorage.setItem(key, JSON.stringify(data));\n return data;\n } catch {\n return undefined;\n }\n};\n"],"names":[],"mappings":"AAAO,MAAM,cAAiB,GAAA,CAC5B,GACA,EAAA,YAAA,GAAe,KACG,KAAA;AAClB,EAAM,MAAA,IAAA,GAAO,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AACrC,EAAA,IAAI,IAAM,EAAA;AACR,IAAA,IAAI,YAAc,EAAA;AAChB,MAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAAA;AAE7B,IAAO,OAAA,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA;AAE1B;AAEa,MAAA,gBAAA,GAAmB,CAAC,GAAgB,KAAA;AAC/C,EAAM,MAAA,UAAA,GAAa,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AAC3C,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,YAAA,CAAa,WAAW,GAAG,CAAA;AAC3B,IAAO,OAAA,IAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX;AAEa,MAAA,iBAAA,GAAoB,CAAI,GAAA,KACnC,MAAO,CAAA,OAAA,CAAQ,YAAY,CAAA,CACxB,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,SAAS,GAAG,CAAC,CACnC,CAAA,GAAA,CAAI,CAAC,GAAG,KAAK,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,KAAK,CAAM;AAEjC,MAAA,eAAA,GAAkB,CAAI,GAAA,EAAa,IAA2B,KAAA;AACzE,EAAI,IAAA;AACF,IAAA,YAAA,CAAa,OAAQ,CAAA,GAAA,EAAK,IAAK,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAC9C,IAAO,OAAA,IAAA;AAAA,GACD,CAAA,MAAA;AACN,IAAO,OAAA,KAAA,CAAA;AAAA;AAEX;;;;"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
- "version": "0.13.91",
2
+ "version": "0.13.92",
3
3
  "author": "heswell",
4
4
  "license": "Apache-2.0",
5
5
  "types": "types/index.d.ts",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-data-types": "0.13.91",
8
- "@vuu-ui/vuu-table-types": "0.13.91",
9
- "@vuu-ui/vuu-filter-types": "0.13.91",
10
- "@vuu-ui/vuu-protocol-types": "0.13.91"
7
+ "@vuu-ui/vuu-data-types": "0.13.92",
8
+ "@vuu-ui/vuu-table-types": "0.13.92",
9
+ "@vuu-ui/vuu-filter-types": "0.13.92",
10
+ "@vuu-ui/vuu-protocol-types": "0.13.92"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@internationalized/date": "^3.0.0",
14
- "@vuu-ui/vuu-filter-parser": "0.13.91",
14
+ "@vuu-ui/vuu-filter-parser": "0.13.92",
15
15
  "clsx": "^2.0.0",
16
16
  "react": "^19.2.3",
17
17
  "react-dom": "^19.2.3"
@@ -1 +1,9 @@
1
1
  export declare const getCookieValue: (name: string) => string | number | undefined;
2
+ /**
3
+ * Sets a cookie value.
4
+ *
5
+ * @param {string} name - Cookie name
6
+ * @param {string} value - Cookie value
7
+ * @param {number} [days] - Optional: number of days until the cookie expires
8
+ */
9
+ export declare function setCookieValue(name: string, value: string, days?: number): void;
@@ -1,4 +1,4 @@
1
- export declare const getLocalEntity: <T>(key: string) => T | undefined;
1
+ export declare const getLocalEntity: <T>(key: string, deleteOnRead?: boolean) => T | undefined;
2
2
  export declare const clearLocalEntity: (key: string) => boolean;
3
3
  export declare const getAllLocalEntity: <T>(url: string) => T[];
4
- export declare const saveLocalEntity: <T>(url: string, data: T) => T | undefined;
4
+ export declare const saveLocalEntity: <T>(key: string, data: T) => T | undefined;