@studiocms/ui 1.0.0-beta.1 → 1.0.0-beta.3

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 (55) hide show
  1. package/dist/components/Accordion/accordion.css +6 -6
  2. package/dist/components/Badge/Badge.astro +12 -3
  3. package/dist/components/Badge/badge.css +15 -45
  4. package/dist/components/Breadcrumbs/breadcrumbs.css +2 -2
  5. package/dist/components/Center/Center.astro +1 -1
  6. package/dist/components/Checkbox/Checkbox.astro +6 -5
  7. package/dist/components/Checkbox/checkbox.css +9 -9
  8. package/dist/components/Checkbox/checkbox.js +1 -0
  9. package/dist/components/Dropdown/dropdown.css +12 -12
  10. package/dist/components/Footer/footer.css +4 -0
  11. package/dist/components/Icon/Icon.astro +14 -6
  12. package/dist/components/Icon/IconBase.astro +2 -0
  13. package/dist/components/Input/Input.astro +22 -20
  14. package/dist/components/Input/input.css +15 -19
  15. package/dist/components/Modal/modal.css +4 -4
  16. package/dist/components/Progress/Progress.astro +3 -2
  17. package/dist/components/Progress/progress.css +1 -1
  18. package/dist/components/RadioGroup/RadioGroup.astro +1 -1
  19. package/dist/components/RadioGroup/radiogroup.css +9 -9
  20. package/dist/components/RadioGroup/radiogroup.js +0 -2
  21. package/dist/components/Row/row.css +1 -1
  22. package/dist/components/SearchSelect/SearchSelect.astro +8 -4
  23. package/dist/components/SearchSelect/searchselect.css +3 -7
  24. package/dist/components/SearchSelect/searchselect.js +13 -6
  25. package/dist/components/Select/select.css +1 -5
  26. package/dist/components/Select/select.js +3 -3
  27. package/dist/components/Skeleton/skeleton.d.ts +6 -70
  28. package/dist/components/Tabs/TabItem.astro +8 -2
  29. package/dist/components/Tabs/Tabs.astro +8 -2
  30. package/dist/components/Tabs/tabs.css +2 -2
  31. package/dist/components/Textarea/textarea.css +4 -4
  32. package/dist/components/Toast/Toaster.astro +4 -4
  33. package/dist/components/Toast/toaster.css +9 -9
  34. package/dist/components/Toast/toaster.js +2 -2
  35. package/dist/components/Toggle/Toggle.astro +2 -2
  36. package/dist/components/Toggle/toggle.css +9 -9
  37. package/dist/components/Toggle/toggle.js +1 -0
  38. package/dist/components/User/User.astro +1 -1
  39. package/dist/components/User/user.css +2 -2
  40. package/dist/css/colors.css +80 -65
  41. package/dist/index.d.ts +7 -0
  42. package/dist/index.js +31 -41
  43. package/dist/toolbar/ColorPicker.js +4 -64
  44. package/dist/toolbar/icon.js +1 -1
  45. package/dist/toolbar/index.js +4 -4
  46. package/dist/utils/headers.d.ts +54 -8
  47. package/dist/utils/headers.js +8 -1
  48. package/dist/utils/stubs/icons-d-ts.stub +9 -0
  49. package/dist/utils/typegen.d.ts +6 -0
  50. package/dist/utils/typegen.js +14 -0
  51. package/package.json +16 -5
  52. package/dist/events.d.js +0 -0
  53. package/dist/utils/integration-utils.d.ts +0 -130
  54. package/dist/utils/integration-utils.js +0 -161
  55. package/dist/virtuals.d.js +0 -0
@@ -2,9 +2,9 @@
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  align-items: center;
5
- gap: .5rem;
5
+ gap: 0.5rem;
6
6
  position: relative;
7
- margin: .25rem 0;
7
+ margin: 0.25rem 0;
8
8
  }
9
9
  .sui-toggle-label.disabled {
10
10
  opacity: 0.5;
@@ -20,7 +20,7 @@
20
20
  display: flex;
21
21
  align-items: center;
22
22
  cursor: pointer;
23
- transition: all .15s ease;
23
+ transition: all 0.15s ease;
24
24
  background-color: var(--default-base);
25
25
  width: var(--toggle-width);
26
26
  height: var(--toggle-height);
@@ -30,11 +30,11 @@
30
30
  --switch: calc(var(--toggle-height) * 1.75);
31
31
  height: var(--switch);
32
32
  width: var(--switch);
33
- background-color: var(--text-muted);
33
+ background-color: var(--background-gray);
34
34
  border-radius: var(--radius-full);
35
35
  position: relative;
36
36
  left: 0;
37
- transition: all .15s ease;
37
+ transition: all 0.15s ease;
38
38
  will-change: transform;
39
39
  }
40
40
  .sui-toggle-switch:focus-visible {
@@ -60,7 +60,7 @@
60
60
  --switch: calc(var(--toggle-height) * 1.65);
61
61
  }
62
62
  .sui-toggle-label.primary .sui-toggle-container:has(.sui-toggle-checkbox:checked) {
63
- background-color: var(--primary-base);
63
+ background-color: var(--primary-vibrant);
64
64
  }
65
65
  .sui-toggle-label.success .sui-toggle-container:has(.sui-toggle-checkbox:checked) {
66
66
  background-color: var(--success-base);
@@ -69,10 +69,10 @@
69
69
  background-color: var(--warning-base);
70
70
  }
71
71
  .sui-toggle-label.danger .sui-toggle-container:has(.sui-toggle-checkbox:checked) {
72
- background-color: var(--danger-base);
72
+ background-color: var(--danger-vibrant);
73
73
  }
74
74
  .sui-toggle-label.info .sui-toggle-container:has(.sui-toggle-checkbox:checked) {
75
- background-color: var(--info-base);
75
+ background-color: var(--info-vibrant);
76
76
  }
77
77
  .sui-toggle-label.mono .sui-toggle-container:has(.sui-toggle-checkbox:checked) {
78
78
  background-color: var(--mono-base);
@@ -81,7 +81,7 @@
81
81
  border: 1px solid var(--text-inverted);
82
82
  }
83
83
  .req-star {
84
- color: var(--danger-base);
84
+ color: var(--danger-vibrant);
85
85
  font-weight: 700;
86
86
  }
87
87
  .sui-toggle-checkbox {
@@ -17,6 +17,7 @@ function loadToggles() {
17
17
  box.dataset.initialized = "true";
18
18
  box.addEventListener("change", (e) => {
19
19
  box.previousSibling.ariaChecked = e.target.checked ? "true" : "false";
20
+ box.ariaChecked = e.target.checked ? "true" : "false";
20
21
  });
21
22
  }
22
23
  }
@@ -1,5 +1,5 @@
1
1
  ---
2
- // @ts-ignore
2
+ // @ts-expect-error
3
3
  import { Image } from 'astro:assets';
4
4
  import Icon from '../Icon/Icon.astro';
5
5
  import './user.css';
@@ -22,14 +22,14 @@
22
22
  .sui-text-content {
23
23
  display: flex;
24
24
  flex-direction: column;
25
- gap: .125rem;
25
+ gap: 0.125rem;
26
26
  }
27
27
  .sui-name {
28
28
  font-size: 1em;
29
29
  font-weight: 600;
30
30
  }
31
31
  .sui-description {
32
- font-size: .875em;
32
+ font-size: 0.875em;
33
33
  font-weight: 400;
34
34
  color: var(--text-muted);
35
35
  }
@@ -9,89 +9,104 @@
9
9
  :root {
10
10
  --background-base: hsl(0 0% 6%);
11
11
  --background-step-1: hsl(0 0% 8%);
12
- --background-step-2: hsl(0 0% 10%);
13
- --background-step-3: hsl(0 0% 14%);
12
+ --background-step-2: hsl(0, 0%, 9%);
13
+ --background-step-3: hsl(0, 0%, 12%);
14
+ --background-gray: hsl(0 0% 50%);
14
15
  --text-normal: hsl(0 0% 100%);
15
- --text-dimmed: hsl(0 0% 80%);
16
- --text-muted: hsl(0 0% 54%);
16
+ --text-dimmed: hsl(0 0% 100% / 0.8);
17
+ --text-muted: hsl(0 0% 100% / 0.75);
17
18
  --text-inverted: hsl(0 0% 0%);
19
+ --text-inverted-dimmed: hsl(0 0% 0% / 0.7);
20
+ --text-inverted-muted: hsl(0 0% 0% / 0.65);
18
21
  --border: hsl(240 5% 17%);
19
- --shadow: hsl(0 0% 0% / 0.5);
20
- --default-base: hsl(0 0% 14%);
21
- --default-hover: hsl(0 0% 21%);
22
- --default-active: hsl(0 0% 15%);
23
- --primary-base: hsl(259 83% 73%);
24
- --primary-hover: hsl(259 77% 78%);
25
- --primary-active: hsl(259 73% 67%);
26
- --success-base: hsl(142 71% 46%);
27
- --success-hover: hsl(142 72% 61%);
28
- --success-active: hsl(142 87% 52%);
29
- --warning-base: hsl(48 96% 53%);
30
- --warning-hover: hsl(48 97% 70%);
31
- --warning-active: hsl(48 100% 61%);
32
- --danger-base: hsl(339 97% 31%);
33
- --danger-hover: hsl(337 98% 37%);
34
- --danger-active: hsl(337 88% 32%);
35
- --info-base: hsl(217 92% 52%);
36
- --info-hover: hsl(214 95% 58%);
37
- --info-active: hsl(214 85% 52%);
22
+ --shadow: hsl(0 0% 0% / 0.6);
23
+ --default-base: hsl(0, 0%, 12%);
24
+ --default-hover: hsl(0, 0%, 17%);
25
+ --default-active: hsl(0, 0%, 14%);
26
+ --primary-base: hsl(259, 60%, 71%);
27
+ --primary-hover: hsl(259, 71%, 79%);
28
+ --primary-active: hsl(259, 75%, 74%);
29
+ --primary-vibrant: hsl(259, 75%, 74%);
30
+ --success-base: hsl(142, 69%, 46%);
31
+ --success-hover: hsl(142, 67%, 59%);
32
+ --success-active: hsl(142, 84%, 55%);
33
+ --warning-base: hsl(48, 92%, 55%);
34
+ --warning-hover: hsl(48, 95%, 66%);
35
+ --warning-active: hsl(48, 93%, 58%);
36
+ --danger-base: hsl(339, 91%, 22%);
37
+ --danger-hover: hsl(337, 90%, 27%);
38
+ --danger-active: hsl(337, 90%, 25%);
39
+ --danger-vibrant: hsl(339, 91%, 42%);
40
+ --info-base: hsl(214, 96%, 22%);
41
+ --info-hover: hsl(214, 92%, 26%);
42
+ --info-active: hsl(214, 94%, 24%);
43
+ --info-vibrant: hsl(214, 84%, 49%);
38
44
  --mono-base: hsl(0 0% 100%);
39
45
  --mono-hover: hsl(0 0% 90%);
40
46
  --mono-active: hsl(0 0% 95%);
41
47
  --text-light: hsl(0 0% 100%);
42
48
  --text-dark: hsl(0 0% 0%);
43
49
  --default-flat: hsl(0 0% 14% / 0.5);
44
- --default-flat-hover: hsl(0 0% 14% / 0.75);
45
- --default-flat-active: hsl(0 0% 14% / 0.85);
50
+ --default-flat-hover: hsl(0 0% 14% / 0.85);
51
+ --default-flat-active: hsl(0 0% 14% / 0.75);
46
52
  --primary-flat: hsl(259 83% 73% / 0.1);
47
- --primary-flat-hover: hsl(259 83% 73% / 0.25);
48
- --primary-flat-active: hsl(259 83% 73% / 0.35);
53
+ --primary-flat-hover: hsl(259 83% 73% / 0.35);
54
+ --primary-flat-active: hsl(259 83% 73% / 0.25);
49
55
  --success-flat: hsl(142 71% 46% / 0.1);
50
- --success-flat-hover: hsl(142 71% 46% / 0.25);
51
- --success-flat-active: hsl(142 71% 46% / 0.35);
56
+ --success-flat-hover: hsl(142 71% 46% / 0.35);
57
+ --success-flat-active: hsl(142 71% 46% / 0.25);
52
58
  --warning-flat: hsl(48 96% 53% / 0.1);
53
- --warning-flat-hover: hsl(48 96% 53% / 0.25);
54
- --warning-flat-active: hsl(48 96% 53% / 0.35);
59
+ --warning-flat-hover: hsl(48 96% 53% / 0.35);
60
+ --warning-flat-active: hsl(48 96% 53% / 0.25);
55
61
  --danger-flat: hsl(339 97% 31% / 0.1);
56
- --danger-flat-hover: hsl(339 97% 31% / 0.25);
57
- --danger-flat-active: hsl(339 97% 31% / 0.35);
62
+ --danger-flat-hover: hsl(339 97% 31% / 0.35);
63
+ --danger-flat-active: hsl(339 97% 31% / 0.25);
58
64
  --info-flat: hsl(217 92% 52% / 0.1);
59
- --info-flat-hover: hsl(217 92% 52% / 0.25);
60
- --info-flat-active: hsl(217 92% 52% / 0.35);
61
- --mono-flat: hsl(0 0% 100% / 0.1);
62
- --mono-flat-hover: hsl(0 0% 100% / 0.25);
63
- --mono-flat-active: hsl(0 0% 100% / 0.35);
65
+ --info-flat-hover: hsl(217 92% 52% / 0.35);
66
+ --info-flat-active: hsl(217 92% 52% / 0.25);
67
+ --mono-flat: hsl(0 0% 70% / 0.1);
68
+ --mono-flat-hover: hsl(0 0% 70% / 0.35);
69
+ --mono-flat-active: hsl(0 0% 70% / 0.25);
64
70
  }
65
71
  [data-theme=light] {
66
72
  --background-base: hsl(0 0% 97%);
67
- --background-step-1: hsl(0 0% 90%);
68
- --background-step-2: hsl(0 0% 85%);
69
- --background-step-3: hsl(0 0% 80%);
73
+ --background-step-1: hsl(0 0% 95%);
74
+ --background-step-2: hsl(0 0% 92%);
75
+ --background-step-3: hsl(0 0% 89%);
76
+ --background-gray: hsl(0 0% 50%);
70
77
  --text-normal: hsl(0 0% 0%);
71
- --text-dimmed: hsl(0 0% 12%);
72
- --text-muted: hsl(0 0% 24%);
78
+ --text-dimmed: hsl(0 0% 0% / 0.8);
79
+ --text-muted: hsl(0 0% 0% / 0.75);
73
80
  --text-inverted: hsl(0 0% 100%);
81
+ --text-inverted-dimmed: hsl(0 0% 100% / 0.85);
82
+ --text-inverted-muted: hsl(0 0% 100% / 0.75);
74
83
  --border: hsl(263 5% 68%);
75
- --shadow: hsl(0 0% 65% / 0.5);
76
- --default-base: hsl(0 0% 74%);
77
- --default-hover: hsl(0 0% 81%);
78
- --default-active: hsl(0 0% 91%);
79
- --primary-base: hsl(259 85% 61%);
80
- --primary-hover: hsl(259 78% 56%);
81
- --primary-active: hsl(259 71% 50%);
82
- --success-base: hsl(142 59% 47%);
83
- --success-hover: hsl(142 62% 56%);
84
- --success-active: hsl(142 87% 59%);
85
- --warning-base: hsl(48 92% 46%);
86
- --warning-hover: hsl(48 88% 43%);
87
- --warning-active: hsl(48 85% 40%);
88
- --danger-base: hsl(339 97% 31%);
89
- --danger-hover: hsl(337 98% 37%);
90
- --danger-active: hsl(337 88% 45%);
91
- --info-base: hsl(217 92% 52%);
92
- --info-hover: hsl(214 95% 58%);
93
- --info-active: hsl(214 85% 52%);
94
- --mono-base: hsl(0 0% 0%);
95
- --mono-hover: hsl(0 0% 10%);
96
- --mono-active: hsl(0 0% 5%);
84
+ --shadow: hsl(0 0% 65% / 0.6);
85
+ --default-base: hsl(0, 0%, 82%);
86
+ --default-hover: hsl(0, 0%, 91%);
87
+ --default-active: hsl(0, 0%, 86%);
88
+ --primary-base: hsl(259, 74%, 25%);
89
+ --primary-hover: hsl(259, 76%, 35%);
90
+ --primary-active: hsl(259, 76%, 32%);
91
+ --primary-vibrant: hsl(259, 75%, 45%);
92
+ --success-base: hsl(142, 60%, 44%);
93
+ --success-hover: hsl(142, 60%, 55%);
94
+ --success-active: hsl(142 60% 50%);
95
+ --warning-base: hsl(48, 84%, 42%);
96
+ --warning-hover: hsl(48, 85%, 49%);
97
+ --warning-active: hsl(48, 86%, 45%);
98
+ --danger-base: hsl(339, 93%, 15%);
99
+ --danger-hover: hsl(337, 88%, 22%);
100
+ --danger-active: hsl(337, 89%, 19%);
101
+ --danger-vibrant: hsl(339, 86%, 38%);
102
+ --info-base: hsl(214, 96%, 22%);
103
+ --info-hover: hsl(214, 92%, 26%);
104
+ --info-active: hsl(214, 94%, 24%);
105
+ --info-vibrant: hsl(214, 88%, 39%);
106
+ --mono-base: hsl(0 0% 10%);
107
+ --mono-hover: hsl(0 0% 16%);
108
+ --mono-active: hsl(0 0% 14%);
109
+ --default-flat: hsl(0 0% 70% / 0.5);
110
+ --default-flat-hover: hsl(0 0% 70% / 0.85);
111
+ --default-flat-active: hsl(0 0% 70% / 0.75);
97
112
  }
package/dist/index.d.ts CHANGED
@@ -35,6 +35,13 @@ type Options = {
35
35
  */
36
36
  icons?: Record<string, IconifyJSON>;
37
37
  };
38
+ type IconifyCollections = {
39
+ collections: Record<string, IconifyJSON>;
40
+ collectionNames: string[];
41
+ integrationCollections: string | undefined;
42
+ availableIcons: string[];
43
+ };
44
+ export declare function createIconifyCollection(icons?: Record<string, IconifyJSON>): IconifyCollections;
38
45
  /**
39
46
  * The Astro integration for StudioCMS UI.
40
47
  *
package/dist/index.js CHANGED
@@ -1,32 +1,26 @@
1
1
  import fs from "node:fs";
2
2
  import { icons as heroicons } from "@iconify-json/heroicons";
3
+ import { addVirtualImports, createResolver } from "astro-integration-kit";
3
4
  import transitionEventPolyfill from "astro-transition-event-polyfill";
4
5
  import { studiocmsLogo } from "./toolbar/icon.js";
5
- import { addVirtualImports, createResolver } from "./utils/integration-utils.js";
6
+ import { generateIconTypes } from "./utils/typegen.js";
6
7
  const pkgJson = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
7
- function createIconifyPrefixCollection(icons) {
8
- const iconCollections = [];
9
- const integrationCollections = [];
8
+ function createIconifyCollection(icons) {
9
+ const collections = {};
10
+ const collectionNames = [];
10
11
  const availableIcons = [];
11
12
  if (!icons) {
12
- return {
13
- iconCollections,
14
- integrationCollections,
15
- availableIcons
16
- };
13
+ return { collections, collectionNames, integrationCollections: void 0, availableIcons };
17
14
  }
18
15
  for (const [prefix, collection] of Object.entries(icons)) {
19
- iconCollections.push(prefix);
20
- integrationCollections.push(`export const ${prefix} = ${JSON.stringify(collection)};`);
16
+ collections[prefix] = collection;
17
+ collectionNames.push(prefix);
21
18
  for (const icon of Object.keys(collection.icons)) {
22
19
  availableIcons.push(`${prefix}:${icon}`);
23
20
  }
24
21
  }
25
- return {
26
- iconCollections,
27
- integrationCollections,
28
- availableIcons
29
- };
22
+ const integrationCollections = `export const collections = ${JSON.stringify(collections)};`;
23
+ return { collections, collectionNames, integrationCollections, availableIcons };
30
24
  }
31
25
  function integration(options = {}) {
32
26
  const { resolve } = createResolver(import.meta.url);
@@ -34,13 +28,16 @@ function integration(options = {}) {
34
28
  heroicons
35
29
  };
36
30
  let icons = {
37
- iconCollections: [],
38
- integrationCollections: [],
31
+ collections: {},
32
+ collectionNames: [],
33
+ integrationCollections: void 0,
39
34
  availableIcons: []
40
35
  };
41
36
  return {
42
37
  name: "@studiocms/ui",
43
38
  hooks: {
39
+ /* v8 ignore start */
40
+ /** Astro integrations cannot be properly tested for code coverage */
44
41
  "astro:config:setup": (params) => {
45
42
  const { addDevToolbarApp, injectScript, updateConfig } = params;
46
43
  const { resolve: rootResolve } = createResolver(params.config.root.pathname);
@@ -54,7 +51,7 @@ function integration(options = {}) {
54
51
  }
55
52
  }
56
53
  }
57
- icons = createIconifyPrefixCollection(optIcons);
54
+ icons = createIconifyCollection(optIcons);
58
55
  const componentMap = {
59
56
  "studiocms:ui/components/button": `export { default as Button } from '${resolve("./components/Button/Button.astro")}';`,
60
57
  "studiocms:ui/components/divider": `export { default as Divider } from '${resolve("./components/Divider/Divider.astro")}';`,
@@ -72,7 +69,7 @@ function integration(options = {}) {
72
69
  "studiocms:ui/components/card": `export { default as Card } from '${resolve("./components/Card/Card.astro")}';`,
73
70
  "studiocms:ui/components/modal": `
74
71
  export { default as Modal } from '${resolve("./components/Modal/Modal.astro")}';
75
- export { ModalHelper } from '${resolve("./components/Modal/modal.js")}';
72
+ export { ModalHelper } from '${resolve("./components/Modal/modal.js")}';
76
73
  `,
77
74
  "studiocms:ui/components/select": `
78
75
  export { default as Select } from '${resolve("./components/Select/Select.astro")}';
@@ -80,7 +77,7 @@ function integration(options = {}) {
80
77
  `,
81
78
  "studiocms:ui/components/dropdown": `
82
79
  export { default as Dropdown } from '${resolve("./components/Dropdown/Dropdown.astro")}';
83
- export { DropdownHelper } from '${resolve("./components/Dropdown/dropdown.js")}';
80
+ export { DropdownHelper } from '${resolve("./components/Dropdown/dropdown.js")}';
84
81
  `,
85
82
  "studiocms:ui/components/user": `export { default as User } from '${resolve("./components/User/User.astro")}';`,
86
83
  "studiocms:ui/components/tabs": `
@@ -143,11 +140,9 @@ function integration(options = {}) {
143
140
  export { ThemeHelper, Theme } from '${resolve("./utils/ThemeHelper.js")}';
144
141
  `,
145
142
  "studiocms:ui/icons": `
146
- ${icons.integrationCollections.join("\n")}
147
-
143
+ ${icons.integrationCollections ? icons.integrationCollections : ""}
148
144
  export const availableIcons = ${JSON.stringify(icons.availableIcons)};
149
-
150
- export const iconCollections = ${JSON.stringify(icons.iconCollections)};
145
+ export const iconCollections = ${JSON.stringify(icons.collectionNames)};
151
146
  `
152
147
  }
153
148
  });
@@ -165,26 +160,21 @@ function integration(options = {}) {
165
160
  });
166
161
  },
167
162
  "astro:config:done": ({ injectTypes }) => {
168
- injectTypes({
169
- filename: "icons.d.ts",
170
- content: `
171
- declare module 'studiocms:ui/icons' {
172
- export const availableIcons: ('${icons.availableIcons.join("'\n | '")}')[];
173
- export const iconCollections: ('${icons.iconCollections.join("'\n | '")}')[];
174
-
175
- ${icons.iconCollections.map((collection) => {
176
- return `export const ${collection}: import('@studiocms/ui/types').IconifyJSON;`;
177
- }).join("\n")}
178
-
179
- export type AvailableIcons = (typeof availableIcons)[number];
180
- export type IconCollections = (typeof iconCollections)[number];
181
- }
182
- `
183
- });
163
+ injectTypes(
164
+ generateIconTypes("icons.d.ts", {
165
+ collections: icons.collections && Object.keys(icons.collections).length > 0 ? `${Object.keys(icons.collections).map((collection) => {
166
+ return `'${collection}': import('@studiocms/ui/types').IconifyJSON;`;
167
+ }).join("\n")}` : 'export const collections: Record<string, import("@studiocms/ui/types").IconifyJSON>;',
168
+ availableIcons: `('${icons.availableIcons.join("'\n | '")}')[]`,
169
+ iconCollections: `('${icons.collectionNames.join("'\n | '")}')[]`
170
+ })
171
+ );
184
172
  }
173
+ /* v8 ignore stop */
185
174
  }
186
175
  };
187
176
  }
188
177
  export {
178
+ createIconifyCollection,
189
179
  integration as default
190
180
  };
@@ -1,59 +1,3 @@
1
- function hex2rgb(hex) {
2
- const r = Number.parseInt(hex.slice(1, 3), 16);
3
- const g = Number.parseInt(hex.slice(3, 5), 16);
4
- const b = Number.parseInt(hex.slice(5, 7), 16);
5
- return [r, g, b];
6
- }
7
- function hueToRgb(p, q, t) {
8
- if (t < 0) t += 1;
9
- if (t > 1) t -= 1;
10
- if (t < 1 / 6) return p + (q - p) * 6 * t;
11
- if (t < 1 / 2) return q;
12
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
13
- return p;
14
- }
15
- function hsl2rgb(hsl) {
16
- const [h, sPercent, lPercent] = hsl;
17
- const s = sPercent / 100;
18
- const l = lPercent / 100;
19
- let r, g, b;
20
- if (s === 0) {
21
- r = g = b = l;
22
- } else {
23
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
24
- const p = 2 * l - q;
25
- const hueFraction = h / 360;
26
- r = hueToRgb(p, q, hueFraction + 1 / 3);
27
- g = hueToRgb(p, q, hueFraction);
28
- b = hueToRgb(p, q, hueFraction - 1 / 3);
29
- }
30
- return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
31
- }
32
- function rgb2hex(rgb) {
33
- const [r, g, b] = rgb;
34
- return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
35
- }
36
- function rgb2hsl(rgb) {
37
- const [r, g, b] = rgb.map((v) => v / 255);
38
- const max = Math.max(r, g, b);
39
- const min = Math.min(r, g, b);
40
- const l = (max + min) / 2;
41
- let s = 0;
42
- if (max !== min) {
43
- s = l > 0.5 ? (max - min) / (2 - max - min) : (max - min) / (max + min);
44
- }
45
- let h = 0;
46
- if (max !== min) {
47
- if (max === r) {
48
- h = ((g - b) / (max - min) + (g < b ? 6 : 0)) * 60;
49
- } else if (max === g) {
50
- h = ((b - r) / (max - min) + 2) * 60;
51
- } else {
52
- h = ((r - g) / (max - min) + 4) * 60;
53
- }
54
- }
55
- return [h, s * 100, l * 100];
56
- }
57
1
  class DevToolbarColorPicker extends HTMLElement {
58
2
  input;
59
3
  constructor() {
@@ -66,18 +10,14 @@ class DevToolbarColorPicker extends HTMLElement {
66
10
  });
67
11
  }
68
12
  connectedCallback() {
69
- this.input.value = rgb2hex(
70
- hsl2rgb(this.dataset.color.replaceAll("%", "").split(" ").map(Number))
71
- );
13
+ this.input.value = this.dataset.color;
72
14
  }
73
15
  getColor() {
74
- const rgb = hex2rgb(this.input.value);
75
- const hsl = rgb2hsl(rgb).map((v) => Math.round(v));
76
- const [h, s, l] = hsl;
77
- return `${h} ${s}% ${l}%`;
16
+ return this.input.value;
78
17
  }
79
18
  setColor(color) {
80
- this.input.value = rgb2hex(hsl2rgb(color.replaceAll("%", "").split(" ").map(Number)));
19
+ this.dataset.color = color;
20
+ this.input.value = color;
81
21
  }
82
22
  }
83
23
  export {
@@ -1,4 +1,4 @@
1
- const studiocmsLogo = `<svg width="755" height="792" viewBox="0 0 755 792" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="295" width="460" height="466" rx="32" fill="white"/><path d="M272 434V166H180C162.327 166 148 180.327 148 198V597C148 614.673 162.327 629 180 629H577.5C595.173 629 609.5 614.673 609.5 597V490H328C297.072 490 272 464.928 272 434Z" fill="white"/><path d="M124 597V329H32C14.3269 329 0 343.327 0 361V760C0 777.673 14.3269 792 32 792H429.5C447.173 792 461.5 777.673 461.5 760V653H180C149.072 653 124 627.928 124 597Z" fill="white"/></svg>`;
1
+ const studiocmsLogo = `<svg width="109" height="108" viewBox="0 0 109 108" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M77.9531 26.9437C80.0114 26.9437 81.6806 28.612 81.6807 30.6703V77.348C81.6806 79.4063 80.0114 81.0746 77.9531 81.0746H31.791C29.733 81.0743 28.0645 79.4061 28.0645 77.348V30.6703C28.0645 28.6122 29.733 26.944 31.791 26.9437H77.9531ZM36.8643 39.6234V55.224C36.8643 57.9438 37.2779 60.2774 38.1045 62.224C38.9578 64.1704 40.2646 65.6635 42.0244 66.7035C43.811 67.7434 46.0911 68.263 48.8643 68.263C51.6109 68.263 53.865 67.7435 55.625 66.7035C57.3847 65.6635 58.6783 64.1704 59.5049 62.224C60.3315 60.2508 60.7441 57.9171 60.7441 55.224V39.6234H55.0244V55.5033C55.0244 56.7566 54.8515 57.9572 54.5049 59.1039C54.1582 60.2503 53.5449 61.1837 52.665 61.9037C51.785 62.597 50.531 62.9437 48.9043 62.9437C47.3044 62.9437 46.0378 62.5969 45.1045 61.9037C44.1979 61.1837 43.5445 60.2637 43.1445 59.1439C42.7712 57.9972 42.585 56.7833 42.585 55.5033V39.6234H36.8643ZM66.5566 39.6234V67.9437H72.2764V39.6234H66.5566Z" fill="white"/><path d="M25.3876 77.3545V46.2235H14.6646C12.6046 46.2235 10.9346 47.8875 10.9346 49.9405V96.2885C10.9346 98.3415 12.6046 100.006 14.6646 100.006H60.9956C63.0556 100.006 64.7256 98.3415 64.7256 96.2885V83.8595H31.9146C28.3106 83.8595 25.3876 80.9475 25.3876 77.3545Z" fill="white"/><path d="M84.3525 30.6455V61.7765H95.0755C97.1355 61.7765 98.8055 60.1125 98.8055 58.0595V11.7115C98.8055 9.65849 97.1355 7.99349 95.0755 7.99349H48.7445C46.6845 7.99349 45.0145 9.65849 45.0145 11.7115V24.1405H77.8255C81.4295 24.1405 84.3525 27.0525 84.3525 30.6455Z" fill="white"/></svg>`;
2
2
  export {
3
3
  studiocmsLogo
4
4
  };
@@ -45,9 +45,9 @@ function createRows(variables) {
45
45
  return row;
46
46
  });
47
47
  const observer = new MutationObserver((mutations) => {
48
- mutations.map((m) => {
48
+ mutations.forEach((m) => {
49
49
  if (m.type !== "attributes" || m.attributeName !== "data-theme") return;
50
- rows.map((row) => {
50
+ rows.forEach((row) => {
51
51
  const theme = document.documentElement.dataset.theme ?? "dark";
52
52
  const picker = row.children[1]?.firstElementChild;
53
53
  const variable = picker.dataset.variable;
@@ -216,7 +216,7 @@ function createRadiiTable() {
216
216
  resetButton.disabled = true;
217
217
  resetButton.addEventListener("click", () => {
218
218
  document.documentElement.style.setProperty(variable, initialValue);
219
- numberInput.value = (initialValue.includes("rem") ? Number.parseFloat(initialValue.split("rem")[0]) * 16 : Number.parseInt(initialValue.split("px")[0])).toString();
219
+ numberInput.value = (initialValue.includes("rem") ? Number.parseFloat(initialValue.split("rem")[0]) * 16 : Number.parseInt(initialValue.split("px")[0], 10)).toString();
220
220
  delete map.dark[variable];
221
221
  resetButton.disabled = true;
222
222
  });
@@ -225,7 +225,7 @@ function createRadiiTable() {
225
225
  numberInput.type = "number";
226
226
  numberInput.min = "0";
227
227
  numberInput.step = "1";
228
- numberInput.value = (initialValue.includes("rem") ? Number.parseFloat(initialValue.split("rem")[0]) * 16 : Number.parseInt(initialValue.split("px")[0])).toString();
228
+ numberInput.value = (initialValue.includes("rem") ? Number.parseFloat(initialValue.split("rem")[0]) * 16 : Number.parseInt(initialValue.split("px")[0], 10)).toString();
229
229
  numberInput.addEventListener("input", () => {
230
230
  const size = `${numberInput.value}px`;
231
231
  document.documentElement.style.setProperty(variable, `${numberInput.value}px`);
@@ -8,13 +8,13 @@ export declare const HeadConfigSchema: () => z.ZodDefault<z.ZodArray<z.ZodObject
8
8
  /** Content to place inside the tag (optional). */
9
9
  content: z.ZodDefault<z.ZodString>;
10
10
  }, "strip", z.ZodTypeAny, {
11
- content: string;
12
- tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
11
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
13
12
  attrs: Record<string, string | boolean | undefined>;
13
+ content: string;
14
14
  }, {
15
- tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
16
- content?: string | undefined;
15
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
17
16
  attrs?: Record<string, string | boolean | undefined> | undefined;
17
+ content?: string | undefined;
18
18
  }>, "many">>;
19
19
  /**
20
20
  * Default Head Tags for use with createHead() helper
@@ -29,15 +29,61 @@ export declare const HeadConfigSchema: () => z.ZodDefault<z.ZodArray<z.ZodObject
29
29
  * @returns
30
30
  */
31
31
  export declare const headDefaults: (title: string, description: string, Astro: AstroGlobalPartial, ogImage: string | undefined, canonical: URL | undefined) => {
32
- tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
33
- content?: string | undefined;
32
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
34
33
  attrs?: Record<string, string | boolean | undefined> | undefined;
34
+ content?: string | undefined;
35
35
  }[];
36
+ export declare const HeadSchema: z.ZodDefault<z.ZodArray<z.ZodObject<{
37
+ /** Name of the HTML tag to add to `<head>`, e.g. `'meta'`, `'link'`, or `'script'`. */
38
+ tag: z.ZodEnum<["title", "base", "link", "style", "meta", "script", "noscript", "template"]>;
39
+ /** Attributes to set on the tag, e.g. `{ rel: 'stylesheet', href: '/custom.css' }`. */
40
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
41
+ /** Content to place inside the tag (optional). */
42
+ content: z.ZodDefault<z.ZodString>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
45
+ attrs: Record<string, string | boolean | undefined>;
46
+ content: string;
47
+ }, {
48
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
49
+ attrs?: Record<string, string | boolean | undefined> | undefined;
50
+ content?: string | undefined;
51
+ }>, "many">>;
36
52
  export type HeadUserConfig = z.input<ReturnType<typeof HeadConfigSchema>>;
37
53
  export type HeadConfig = z.output<ReturnType<typeof HeadConfigSchema>>;
54
+ /**
55
+ * Test if a head config object contains a matching `<title>` or `<meta>` tag.
56
+ *
57
+ * For example, will return true if `head` already contains
58
+ * `<meta name="description" content="A">` and the passed `tag`
59
+ * is `<meta name="description" content="B">`. Tests against `name`,
60
+ * `property`, and `http-equiv` attributes for `<meta>` tags.
61
+ */
62
+ export declare function hasTag(head: HeadConfig, entry: HeadConfig[number]): boolean;
63
+ /**
64
+ * Test if a head config object contains a tag of the same type
65
+ * as `entry` and a matching attribute for one of the passed `keys`.
66
+ */
67
+ export declare function hasOneOf(head: HeadConfig, entry: HeadConfig[number], keys: string[]): boolean;
68
+ /** Find the first matching key–value pair in a head entry’s attributes. */
69
+ export declare function getAttr(keys: string[], entry: HeadConfig[number]): [key: string, value: string | boolean] | undefined;
70
+ /** Merge two heads, overwriting entries in the first head that exist in the second. */
71
+ export declare function mergeHead(oldHead: HeadConfig, newHead: HeadConfig): {
72
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
73
+ attrs: Record<string, string | boolean | undefined>;
74
+ content: string;
75
+ }[];
76
+ /** Sort head tags to place important tags first and relegate “SEO” meta tags. */
77
+ export declare function sortHead(head: HeadConfig): {
78
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
79
+ attrs: Record<string, string | boolean | undefined>;
80
+ content: string;
81
+ }[];
82
+ /** Get the relative importance of a specific head tag. */
83
+ export declare function getImportance(entry: HeadConfig[number]): 0 | 100 | 80 | 90 | 70;
38
84
  /** Create a fully parsed, merged, and sorted head entry array from multiple sources. */
39
85
  export declare function createHead(defaultHeaders: HeadUserConfig, ...heads: HeadConfig[]): {
40
- content: string;
41
- tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
86
+ tag: "link" | "base" | "meta" | "noscript" | "script" | "style" | "template" | "title";
42
87
  attrs: Record<string, string | boolean | undefined>;
88
+ content: string;
43
89
  }[];
@@ -124,6 +124,13 @@ function createHead(defaultHeaders, ...heads) {
124
124
  }
125
125
  export {
126
126
  HeadConfigSchema,
127
+ HeadSchema,
127
128
  createHead,
128
- headDefaults
129
+ getAttr,
130
+ getImportance,
131
+ hasOneOf,
132
+ hasTag,
133
+ headDefaults,
134
+ mergeHead,
135
+ sortHead
129
136
  };