@castlabs/ui 8.5.1 → 8.5.2

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,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
- // this contains general non-vue types
3
+ // hint: this contains general non-vue types
4
+ // hint: methods starting in _ are lib-internal and should not be typed/exposed
4
5
 
5
6
  declare module '@castlabs/ui/dist/castlabs-ui.module.js' {
6
7
  export function clScrollToId (id: string, smooth?: boolean): void
@@ -24,8 +25,9 @@ declare module '@castlabs/ui/dist/castlabs-ui.module.js' {
24
25
  export function clFormAutofocus (id: string): void
25
26
 
26
27
  export function clFormatFilesize (bytes: number): string
28
+ export function clFormatDateUTC (date: Date): string
27
29
  export function clFormatDate (date: Date): string
28
- export function clFormatTimeUTC (date: Date): string
30
+ export function clFormatTimeUTC (date: Date, seconds?: boolean): string
29
31
  export function clFormatDateTimeUTC (date: Date, seconds?: boolean): string
30
32
  export function clFormatDateTimeTabularUTC (date: Date, year?:boolean, month?:boolean, day?:boolean, time?:boolean, seconds?:boolean): string
31
33
  export function clFormatDuration (from: Date, until: Date, seconds?: boolean, ms?: boolean): string
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v8.5.1 */
1
+ /* @castlabs/ui v8.5.2 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -112,7 +112,7 @@ function clSidenavInitiallyOpen () {
112
112
  }
113
113
  }
114
114
 
115
- import { clGetSettingsTable, clSetSettingsTable } from '../../../utils/ui'
115
+ import { _getSettingsTable, _setSettingsTable } from '../../../utils/ui'
116
116
 
117
117
  export function clTableSetupResize (id, auto = false) {
118
118
  document.querySelectorAll(`#${id} .cl-resizer`).forEach(resizer => {
@@ -170,9 +170,9 @@ function saveColWidth (id) {
170
170
 
171
171
  const widths = clTableGetColWidthArray(id)
172
172
 
173
- const settings = clGetSettingsTable(tableId) ?? {}
173
+ const settings = _getSettingsTable(tableId) ?? {}
174
174
  settings.w = widths
175
- clSetSettingsTable(tableId, settings)
175
+ _setSettingsTable(tableId, settings)
176
176
  }
177
177
  }
178
178
 
@@ -181,7 +181,7 @@ export function clTableRestoreColWidths (id, override = undefined) {
181
181
  const tableId = document.querySelector(`#${id}`)?.closest('.cl-table-scroll')?.id
182
182
  if (!tableId) return
183
183
 
184
- const widths = override ? override : ((clGetSettingsTable(tableId) ?? {}).w ?? [])
184
+ const widths = override ? override : ((_getSettingsTable(tableId) ?? {}).w ?? [])
185
185
  for (
186
186
  let colIndex = 1;
187
187
  colIndex <= document.querySelectorAll(`#${id} tr th`).length;
@@ -939,12 +939,12 @@ export function clScrollToId (id, smooth = true) {
939
939
  }, 0)
940
940
  }
941
941
 
942
- export function setDomainCookieJson (name, value, maxAge = 60 * 60 * 24 * (365 + 30)) {
942
+ export function _setDomainCookieJson (name, value, maxAge = 60 * 60 * 24 * (365 + 30)) {
943
943
  const b64 = btoa(JSON.stringify(value))
944
944
  document.cookie = `${name}=${b64}; max-age=${maxAge}; domain=${getDomain()}; path=/; SameSite=Lax;`
945
945
  }
946
946
 
947
- export function getDomainCookieJson (name) {
947
+ function _getDomainCookieJson (name) {
948
948
  for (const cookie of document?.cookie?.split(/; */) ?? []) {
949
949
  const [key, value] = cookie.split('=')
950
950
  if (key === name) {
@@ -1854,7 +1854,7 @@ export function clSleep (ms) {
1854
1854
  // -----------------------------------------------------------------------------
1855
1855
 
1856
1856
  export function clThemeSetup () {
1857
- const settings = getDomainCookieJson('cl_ui_settings')
1857
+ const settings = _getDomainCookieJson('cl_ui_settings')
1858
1858
  const dark = settings?.theme === 'dark'
1859
1859
  clThemeSetDark(dark) // re-set to prolong expiration
1860
1860
  const checkbox = document.querySelector('#cl-mode-dark')
@@ -1868,9 +1868,9 @@ export function clThemeSetup () {
1868
1868
  }
1869
1869
 
1870
1870
  export function clThemeSetDark (dark) {
1871
- const settings = getDomainCookieJson('cl_ui_settings')
1871
+ const settings = _getDomainCookieJson('cl_ui_settings')
1872
1872
  settings.theme = dark ? 'dark' : 'light'
1873
- setDomainCookieJson('cl_ui_settings', settings)
1873
+ _setDomainCookieJson('cl_ui_settings', settings)
1874
1874
  }
1875
1875
 
1876
1876
  // ------------------------------------------------------------------------
@@ -1893,12 +1893,12 @@ function clSetUISettings (settings) {
1893
1893
  return settings
1894
1894
  }
1895
1895
 
1896
- export function clGetSettingsTable (id) {
1896
+ export function _getSettingsTable (id) {
1897
1897
  const settings = clGetUISettings()
1898
1898
  return settings?.tables?.[id] ? settings?.tables?.[id] : {}
1899
1899
  }
1900
1900
 
1901
- export function clSetSettingsTable (id, table) {
1901
+ export function _setSettingsTable (id, table) {
1902
1902
  if (!id) return undefined
1903
1903
  const settings = clGetUISettings()
1904
1904
  if (!settings.tables) settings.tables = {}