@castlabs/ui 7.17.0 → 7.19.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.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/select-disabled.svg +1 -1
  3. package/dist/castlabs-ui-editor.css +1 -1
  4. package/dist/castlabs-ui-editor.umd.js +1 -1
  5. package/dist/castlabs-ui.common.js +3 -3
  6. package/dist/castlabs-ui.common.js.map +1 -1
  7. package/dist/castlabs-ui.core.js +97 -5
  8. package/dist/castlabs-ui.css +1 -1
  9. package/dist/castlabs-ui.module.d.ts +4 -0
  10. package/dist/castlabs-ui.module.js +97 -5
  11. package/dist/castlabs-ui.umd.js +4 -4
  12. package/dist/castlabs-ui.umd.js.map +1 -1
  13. package/dist/{select-disabled.c5e07724.svg → select-disabled.1065ea4c.svg} +1 -1
  14. package/dist/select.dark.efd5244b.svg +1 -0
  15. package/package.json +9 -9
  16. package/src/components/ClBadge/style.variables.scss +1 -1
  17. package/src/components/ClButton/style.scss +18 -0
  18. package/src/components/ClDropdown/style.scss +1 -1
  19. package/src/components/ClDropzone/style.scss +1 -1
  20. package/src/components/ClHighlight/style.scss +2 -4
  21. package/src/components/ClList/style.variables.scss +5 -0
  22. package/src/components/ClPagination/style.scss +2 -3
  23. package/src/components/ClToggle/style.scss +1 -1
  24. package/src/components/ClWizard/style.scss +4 -4
  25. package/src/components/form/ClField/style.scss +1 -1
  26. package/src/components/form/ClFieldCheck/style.scss +23 -8
  27. package/src/components/form/ClFieldGroup/style.scss +1 -1
  28. package/src/components/form/ClFieldInput/style.scss +3 -2
  29. package/src/components/modal/ClModal/style.scss +3 -1
  30. package/src/components/navigation/ClNavSide/ClNavDrawer/style.scss +3 -5
  31. package/src/components/navigation/ClNavSide/ClNavItemDarkMode/style.scss +44 -0
  32. package/src/components/navigation/ClNavTop/style.scss +5 -1
  33. package/src/components/widget/ClPage/style.scss +1 -1
  34. package/src/styles/_global.scss +1 -0
  35. package/src/styles/abstracts/button.scss +10 -1
  36. package/src/styles/abstracts/color.scss +51 -15
  37. package/src/styles/abstracts/typography.scss +3 -1
  38. package/src/styles/layout/color.scss +0 -38
  39. package/src/styles/layout/grid.scss +4 -3
  40. package/src/styles/layout/meta.scss +1 -1
  41. package/src/styles/layout/typography.scss +1 -1
  42. package/src/styles/themes/dark.scss +160 -0
  43. package/src/styles/themes/dark.variables.scss +33 -0
  44. package/src/styles/ui.scss +6 -0
  45. package/types/castlabs-ui.module.d.ts +4 -0
  46. package/types/index.d.ts +5 -0
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v7.17.0 */
1
+ /* @castlabs/ui v7.19.0 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -324,6 +324,7 @@ const CONST = {
324
324
  CLAY: '#cfc8c8',
325
325
  EGGSHELL: '#fbf9f2',
326
326
  HAZE: '#eeece6',
327
+ HAZEDARK: '#333947',
327
328
  HONEY: '#dc9404',
328
329
  LEAF: '#53965d',
329
330
  NIGHT: '#262a35',
@@ -359,6 +360,9 @@ const SERVICE = {
359
360
  CP: 'Content Platform',
360
361
  CP_TAGLINE: 'Access the Content Platform, manage, encode and watermark assets',
361
362
  CP_URN: 'urn:janus:service:76b6e8558263431d9d766779987d6410',
363
+ CPS: 'Content Platform Staging',
364
+ CPS_TAGLINE: 'Access the Content Platform, manage, encode and watermark assets',
365
+ CPS_URN: 'urn:janus:service:f57f4728d2a54a0d99b77b9bb7e04bf6',
362
366
  CS: 'Castlabs hub',
363
367
  CS_TAGLINE: 'Manage organizations, plans, downloads',
364
368
  CS_URN: 'urn:janus:service:OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO',
@@ -383,6 +387,9 @@ const SERVICE = {
383
387
  VTK: 'Video Toolkit',
384
388
  VTK_TAGLINE: 'Cloud encoding, packaging, watermarking',
385
389
  VTK_URN: 'urn:janus:service:a50e21d6a5e246809b636854abfbd34d',
390
+ VTKS: 'Video Toolkit Staging',
391
+ VTKS_TAGLINE: 'Cloud encoding, packaging, watermarking',
392
+ VTKS_URN: 'urn:janus:service:ca5bb34e8f39459796778e74fa097248',
386
393
  WM: 'STARDUSTmark',
387
394
  WM_TAGLINE: 'Video & image forensic watermarking',
388
395
  WM_URN: 'urn:janus:service:76b6e8558263431d9d766779987d64c4'
@@ -445,8 +452,6 @@ const ROLE = {
445
452
  DTS_DELIVERIES: 'Deliveries',
446
453
  DTS_DELIVERIES_URN: 'urn:janus:role:e79a8f99a96a45238283b3c049e7374b',
447
454
 
448
- VTK_ADMIN: 'Video Toolkit admin',
449
- VTK_ADMIN_URN: 'urn:janus:role:8ff40a162b834e96a36f7ddbfda475ef',
450
455
  VTK_USER: 'Video Toolkit user',
451
456
  VTK_USER_URN: 'urn:janus:role:33c9c2001ca14dde9c3b310d0748b8b4',
452
457
 
@@ -499,6 +504,18 @@ const APPS = {
499
504
  sidenav: false
500
505
  },
501
506
 
507
+ CPS: {
508
+ id: 'CPS',
509
+ subtitle: SERVICE.CPS_TAGLINE,
510
+ title: SERVICE.CPS,
511
+ services: [SERVICE.CPS_URN],
512
+ roles: [ROLE.CP_USER_URN],
513
+ urlManage: (env, oid) =>
514
+ `https://platform.content-stag.castlabs.com/#/o/${oid ?? ''}`,
515
+ urlPlan: (env, oid) => urlCS(env, oid),
516
+ sidenav: false
517
+ },
518
+
502
519
  CS: {
503
520
  id: 'CS',
504
521
  subtitle: SERVICE.CS_TAGLINE,
@@ -618,7 +635,7 @@ const APPS = {
618
635
  id: 'VTK',
619
636
  subtitle: SERVICE.VTK_TAGLINE,
620
637
  services: [SERVICE.VTK_URN],
621
- roles: [ROLE.VTK_USER_URN, ROLE.VTK_ADMIN_URN],
638
+ roles: [ROLE.VTK_USER_URN],
622
639
  title: SERVICE.VTK,
623
640
  urlManage: (env, oid) =>
624
641
  getEnvUrl(
@@ -628,6 +645,18 @@ const APPS = {
628
645
  ),
629
646
  urlPlan: (env, oid) => urlCS(env, oid, '/plans/vtk'),
630
647
  sidenav: true
648
+ },
649
+
650
+ VTKS: {
651
+ id: 'VTKS',
652
+ subtitle: SERVICE.VTKS_TAGLINE,
653
+ title: SERVICE.VTKS,
654
+ services: [SERVICE.VTKS_URN],
655
+ roles: [ROLE.VTK_USER_URN],
656
+ urlManage: (env, oid) =>
657
+ `https://vtks.castlabs.com/${oid}/jobs/`,
658
+ urlPlan: (env, oid) => urlCS(env, oid, '/plans/vtk'),
659
+ sidenav: false
631
660
  }
632
661
  }
633
662
 
@@ -756,7 +785,7 @@ function variant (service, license, oid, env, hasRole) {
756
785
  // no license = show subscribe ad
757
786
  if (!license) {
758
787
  // some items are hidden if there is no license
759
- if ([APPS.DTS.id].includes(service.id)) return null
788
+ if ([APPS.DTS.id, APPS.CPS.id, APPS.VTKS.id].includes(service.id)) return null
760
789
 
761
790
  // other items we hint the user to subscribe
762
791
  return subscribe(service, oid, env)
@@ -790,12 +819,16 @@ function csGetNavVariant (membership, service, oid, env) {
790
819
  function csParseMembership (membership, oid, env) {
791
820
  const nav = [subscribed(APPS.CS, oid, env)]
792
821
 
822
+ const cps = csGetNavVariant(membership, APPS.CPS, oid, env)
823
+ if (cps) nav.push(cps)
793
824
  nav.push(csGetNavVariant(membership, APPS.DT, oid, env))
794
825
  const dts = csGetNavVariant(membership, APPS.DTS, oid, env)
795
826
  if (dts) nav.push(dts)
796
827
  nav.push(csGetNavVariant(membership, APPS.PP, oid, env))
797
828
  nav.push(csGetNavVariant(membership, APPS.WM, oid, env))
798
829
  nav.push(csGetNavVariant(membership, APPS.VTK, oid, env))
830
+ const vtks = csGetNavVariant(membership, APPS.VTKS, oid, env)
831
+ if (vtks) nav.push(vtks)
799
832
 
800
833
  return nav
801
834
  }
@@ -909,6 +942,41 @@ function clScrollToId (id, smooth = true) {
909
942
  }, 0)
910
943
  }
911
944
 
945
+ function setDomainCookieJson (name, value, maxAge = 60 * 60 * 24 * (365 + 30)) {
946
+ const b64 = btoa(JSON.stringify(value))
947
+ document.cookie = `${name}=${b64}; max-age=${maxAge}; domain=${getDomain()}; path=/; SameSite=Lax;`
948
+ }
949
+
950
+ function getDomainCookieJson (name) {
951
+ for (const cookie of document?.cookie?.split(/; */) ?? []) {
952
+ const [key, value] = cookie.split('=')
953
+ if (key === name) {
954
+ try {
955
+ return JSON.parse(atob(value))
956
+ } catch (e) {
957
+ e.ignore?.() // ignore reason
958
+ return {}
959
+ }
960
+ }
961
+ }
962
+ return {}
963
+ }
964
+
965
+ function getDomain () {
966
+ if (window.location.hostname.match(/^[0-9]+.[0-9]+.[0-9]+.[0-9]+$/)) {
967
+ // IP domain
968
+ return window.location.hostname
969
+ }
970
+ const parts = window.location.hostname.split('.').reverse()
971
+ if (parts.length > 1) {
972
+ // regular multi-part domain name
973
+ return `.${parts[1]}.${parts[0]}`
974
+ } else {
975
+ // single-name domain like 'localhost'
976
+ return parts[0]
977
+ }
978
+ }
979
+
912
980
  // -----------------------------------------------------------------------------
913
981
  // --- modals ------------------------------------------------------------------
914
982
  // -----------------------------------------------------------------------------
@@ -1710,6 +1778,30 @@ function clSleep (ms) {
1710
1778
  return new Promise(resolve => setTimeout(resolve, ms))
1711
1779
  }
1712
1780
 
1781
+ // -----------------------------------------------------------------------------
1782
+ // --- themes ------------------------------------------------------------------
1783
+ // -----------------------------------------------------------------------------
1784
+
1785
+ function clThemeSetup () {
1786
+ const settings = getDomainCookieJson('cl_ui_settings')
1787
+ const dark = settings?.theme === 'dark'
1788
+ clThemeSetDark(dark) // re-set to prolong expiration
1789
+ const checkbox = document.querySelector('#cl-mode-dark')
1790
+ if (checkbox) {
1791
+ checkbox.checked = dark
1792
+ checkbox.addEventListener('change', () => {
1793
+ clThemeSetDark(checkbox.checked)
1794
+ })
1795
+ }
1796
+ return dark
1797
+ }
1798
+
1799
+ function clThemeSetDark (dark) {
1800
+ const settings = getDomainCookieJson('cl_ui_settings')
1801
+ settings.theme = dark ? 'dark' : 'light'
1802
+ setDomainCookieJson('cl_ui_settings', settings)
1803
+ }
1804
+
1713
1805
  const NBSP = '✺' // non-breakable space for searching substrings
1714
1806
 
1715
1807
  let cache = {}