@studiocms/ui 0.4.17 → 1.0.0-beta.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.
- package/dist/components/Accordion/Accordion.astro +1 -0
- package/dist/components/Accordion/Item.astro +8 -6
- package/dist/components/Accordion/accordion.css +35 -21
- package/dist/components/Accordion/accordion.d.ts +46 -1
- package/dist/components/Accordion/accordion.js +95 -70
- package/dist/components/Badge/Badge.astro +2 -2
- package/dist/components/Badge/badge.css +32 -32
- package/dist/components/Breadcrumbs/breadcrumbs.css +1 -1
- package/dist/components/Button/button.css +93 -93
- package/dist/components/Card/card.css +4 -4
- package/dist/components/Checkbox/checkbox.css +26 -26
- package/dist/components/Divider/Divider.astro +1 -1
- package/dist/components/Divider/divider.css +2 -2
- package/dist/components/Dropdown/Dropdown.astro +2 -2
- package/dist/components/Dropdown/dropdown.css +26 -26
- package/dist/components/Footer/footer.css +4 -4
- package/dist/components/Icon/Icon.astro +114 -6
- package/dist/components/Icon/IconBase.astro +108 -7
- package/dist/components/Icon/errors.d.ts +29 -0
- package/dist/components/Icon/errors.js +25 -0
- package/dist/components/Input/input.css +9 -9
- package/dist/components/Modal/Modal.astro +1 -1
- package/dist/components/Modal/modal.css +4 -4
- package/dist/components/Progress/progress.css +7 -7
- package/dist/components/RadioGroup/radiogroup.css +21 -21
- package/dist/components/SearchSelect/SearchSelect.astro +2 -2
- package/dist/components/SearchSelect/searchselect.css +28 -22
- package/dist/components/Select/Select.astro +2 -2
- package/dist/components/Select/select.css +36 -30
- package/dist/components/Sidebar/Double.astro +4 -4
- package/dist/components/Sidebar/Single.astro +2 -2
- package/dist/components/Skeleton/Skeleton.astro +61 -0
- package/dist/components/Skeleton/skeleton.css +111 -0
- package/dist/components/Skeleton/skeleton.d.ts +161 -0
- package/dist/components/Skeleton/skeleton.js +71 -0
- package/dist/components/Tabs/TabItem.astro +14 -9
- package/dist/components/Tabs/Tabs.astro +91 -54
- package/dist/components/Tabs/tabs.css +14 -14
- package/dist/components/Tabs/tabs.d.ts +17 -1
- package/dist/components/Tabs/tabs.js +99 -76
- package/dist/components/Textarea/textarea.css +8 -8
- package/dist/components/Toast/toaster.css +26 -23
- package/dist/components/Toast/toaster.js +4 -0
- package/dist/components/Toggle/toggle.css +13 -13
- package/dist/components/Tooltip/Tooltip.astro +119 -0
- package/dist/components/Tooltip/tooltip.css +187 -0
- package/dist/components/Tooltip/tooltip.d.ts +46 -0
- package/dist/components/Tooltip/tooltip.js +330 -0
- package/dist/components/User/User.astro +1 -1
- package/dist/components/User/user.css +3 -3
- package/dist/css/colors.css +85 -83
- package/dist/css/prose.css +360 -0
- package/dist/css/resets.css +3 -3
- package/dist/events.d.ts +104 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +120 -313
- package/dist/toolbar/index.js +5 -5
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/iconifyUtils.d.ts +1 -1
- package/dist/virtuals.d.js +0 -0
- package/dist/virtuals.d.ts +564 -0
- package/package.json +5 -1
- package/dist/components/Icon/iconType.d.ts +0 -2
- package/dist/components/ThemeToggle/ThemeToggle.astro +0 -21
- package/dist/components/ThemeToggle/themetoggle.css +0 -17
- package/dist/components/ThemeToggle/themetoggle.d.ts +0 -1
- package/dist/components/ThemeToggle/themetoggle.js +0 -4
- /package/dist/{components/Icon/iconType.js → events.d.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { icons as heroicons } from "@iconify-json/heroicons";
|
|
2
3
|
import transitionEventPolyfill from "astro-transition-event-polyfill";
|
|
3
4
|
import { studiocmsLogo } from "./toolbar/icon.js";
|
|
4
5
|
import { addVirtualImports, createResolver } from "./utils/integration-utils.js";
|
|
5
6
|
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 = [];
|
|
10
|
+
const availableIcons = [];
|
|
11
|
+
if (!icons) {
|
|
12
|
+
return {
|
|
13
|
+
iconCollections,
|
|
14
|
+
integrationCollections,
|
|
15
|
+
availableIcons
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
for (const [prefix, collection] of Object.entries(icons)) {
|
|
19
|
+
iconCollections.push(prefix);
|
|
20
|
+
integrationCollections.push(`export const ${prefix} = ${JSON.stringify(collection)};`);
|
|
21
|
+
for (const icon of Object.keys(collection.icons)) {
|
|
22
|
+
availableIcons.push(`${prefix}:${icon}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
iconCollections,
|
|
27
|
+
integrationCollections,
|
|
28
|
+
availableIcons
|
|
29
|
+
};
|
|
30
|
+
}
|
|
6
31
|
function integration(options = {}) {
|
|
7
32
|
const { resolve } = createResolver(import.meta.url);
|
|
33
|
+
const optIcons = {
|
|
34
|
+
heroicons
|
|
35
|
+
};
|
|
36
|
+
let icons = {
|
|
37
|
+
iconCollections: [],
|
|
38
|
+
integrationCollections: [],
|
|
39
|
+
availableIcons: []
|
|
40
|
+
};
|
|
8
41
|
return {
|
|
9
42
|
name: "@studiocms/ui",
|
|
10
43
|
hooks: {
|
|
@@ -14,6 +47,74 @@ function integration(options = {}) {
|
|
|
14
47
|
updateConfig({
|
|
15
48
|
integrations: [transitionEventPolyfill()]
|
|
16
49
|
});
|
|
50
|
+
if (options.icons) {
|
|
51
|
+
for (const [prefix, collection] of Object.entries(options.icons)) {
|
|
52
|
+
if (!optIcons[prefix]) {
|
|
53
|
+
optIcons[prefix] = collection;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
icons = createIconifyPrefixCollection(optIcons);
|
|
58
|
+
const componentMap = {
|
|
59
|
+
"studiocms:ui/components/button": `export { default as Button } from '${resolve("./components/Button/Button.astro")}';`,
|
|
60
|
+
"studiocms:ui/components/divider": `export { default as Divider } from '${resolve("./components/Divider/Divider.astro")}';`,
|
|
61
|
+
"studiocms:ui/components/input": `export { default as Input } from '${resolve("./components/Input/Input.astro")}';`,
|
|
62
|
+
"studiocms:ui/components/textarea": `export { default as Textarea } from '${resolve("./components/Textarea/Textarea.astro")}';`,
|
|
63
|
+
"studiocms:ui/components/row": `export { default as Row } from '${resolve("./components/Row/Row.astro")}';`,
|
|
64
|
+
"studiocms:ui/components/center": `export { default as Center } from '${resolve("./components/Center/Center.astro")}';`,
|
|
65
|
+
"studiocms:ui/components/checkbox": `export { default as Checkbox } from '${resolve("./components/Checkbox/Checkbox.astro")}';`,
|
|
66
|
+
"studiocms:ui/components/toggle": `export { default as Toggle } from '${resolve("./components/Toggle/Toggle.astro")}';`,
|
|
67
|
+
"studiocms:ui/components/radiogroup": `export { default as RadioGroup } from '${resolve("./components/RadioGroup/RadioGroup.astro")}';`,
|
|
68
|
+
"studiocms:ui/components/toaster": `
|
|
69
|
+
export { default as Toaster } from '${resolve("./components/Toast/Toaster.astro")}';
|
|
70
|
+
export { toast } from '${resolve("./components/Toast/toast.js")}';
|
|
71
|
+
`,
|
|
72
|
+
"studiocms:ui/components/card": `export { default as Card } from '${resolve("./components/Card/Card.astro")}';`,
|
|
73
|
+
"studiocms:ui/components/modal": `
|
|
74
|
+
export { default as Modal } from '${resolve("./components/Modal/Modal.astro")}';
|
|
75
|
+
export { ModalHelper } from '${resolve("./components/Modal/modal.js")}';
|
|
76
|
+
`,
|
|
77
|
+
"studiocms:ui/components/select": `
|
|
78
|
+
export { default as Select } from '${resolve("./components/Select/Select.astro")}';
|
|
79
|
+
export { default as SearchSelect } from '${resolve("./components/SearchSelect/SearchSelect.astro")}';
|
|
80
|
+
`,
|
|
81
|
+
"studiocms:ui/components/dropdown": `
|
|
82
|
+
export { default as Dropdown } from '${resolve("./components/Dropdown/Dropdown.astro")}';
|
|
83
|
+
export { DropdownHelper } from '${resolve("./components/Dropdown/dropdown.js")}';
|
|
84
|
+
`,
|
|
85
|
+
"studiocms:ui/components/user": `export { default as User } from '${resolve("./components/User/User.astro")}';`,
|
|
86
|
+
"studiocms:ui/components/tabs": `
|
|
87
|
+
export { default as Tabs } from '${resolve("./components/Tabs/Tabs.astro")}';
|
|
88
|
+
export { default as TabItem } from '${resolve("./components/Tabs/TabItem.astro")}';
|
|
89
|
+
`,
|
|
90
|
+
"studiocms:ui/components/accordion": `
|
|
91
|
+
export { default as Accordion } from '${resolve("./components/Accordion/Accordion.astro")}';
|
|
92
|
+
export { default as AccordionItem } from '${resolve("./components/Accordion/Item.astro")}';
|
|
93
|
+
`,
|
|
94
|
+
"studiocms:ui/components/footer": `export { default as Footer } from '${resolve("./components/Footer/Footer.astro")}';`,
|
|
95
|
+
"studiocms:ui/components/progress": `
|
|
96
|
+
export { default as Progress } from '${resolve("./components/Progress/Progress.astro")}';
|
|
97
|
+
export { ProgressHelper } from '${resolve("./components/Progress/helper.js")}';
|
|
98
|
+
`,
|
|
99
|
+
"studiocms:ui/components/sidebar": `
|
|
100
|
+
export { default as Sidebar } from '${resolve("./components/Sidebar/Single.astro")}';
|
|
101
|
+
export { default as DoubleSidebar } from '${resolve("./components/Sidebar/Double.astro")}';
|
|
102
|
+
export { SingleSidebarHelper, DoubleSidebarHelper } from '${resolve("./components/Sidebar/helpers.js")}';
|
|
103
|
+
`,
|
|
104
|
+
"studiocms:ui/components/breadcrumbs": `export { default as Breadcrumbs } from '${resolve("./components/Breadcrumbs/Breadcrumbs.astro")}';`,
|
|
105
|
+
"studiocms:ui/components/group": `export { default as Group } from '${resolve("./components/Group/Group.astro")}';`,
|
|
106
|
+
"studiocms:ui/components/badge": `export { default as Badge } from '${resolve("./components/Badge/Badge.astro")}';`,
|
|
107
|
+
"studiocms:ui/components/icon": `
|
|
108
|
+
export { default as Icon } from '${resolve("./components/Icon/Icon.astro")}';
|
|
109
|
+
export { default as IconBase } from '${resolve("./components/Icon/IconBase.astro")}';
|
|
110
|
+
`,
|
|
111
|
+
"studiocms:ui/components/skeleton": `export { default as Skeleton } from '${resolve("./components/Skeleton/Skeleton.astro")}';`,
|
|
112
|
+
"studiocms:ui/components/tooltip": `export { default as Tooltip } from '${resolve("./components/Tooltip/Tooltip.astro")}';`
|
|
113
|
+
};
|
|
114
|
+
const virtualComponents = {
|
|
115
|
+
...componentMap,
|
|
116
|
+
"studiocms:ui/components": Object.values(componentMap).join("\n")
|
|
117
|
+
};
|
|
17
118
|
addVirtualImports(params, {
|
|
18
119
|
name: "@studiocms/ui",
|
|
19
120
|
imports: {
|
|
@@ -21,6 +122,7 @@ function integration(options = {}) {
|
|
|
21
122
|
"studiocms:ui/version": `export default '${pkgJson.version}';`,
|
|
22
123
|
// Styles
|
|
23
124
|
"studiocms:ui/global-css": `import '${resolve("./css/global.css")}';`,
|
|
125
|
+
"studiocms:ui/prose": `import '${resolve("./css/prose.css")}';`,
|
|
24
126
|
"studiocms:ui/custom-css": `import '${rootResolve(options.customCss ? options.customCss : "")}';`,
|
|
25
127
|
// Scripts
|
|
26
128
|
"studiocms:ui/scripts/checkbox": `import '${resolve("./components/Checkbox/checkbox.js")}';`,
|
|
@@ -32,51 +134,20 @@ function integration(options = {}) {
|
|
|
32
134
|
"studiocms:ui/scripts/toaster": `import '${resolve("./components/Toast/toaster.js")}';`,
|
|
33
135
|
"studiocms:ui/scripts/toast": `import '${resolve("./components/Toast/toast.js")}';`,
|
|
34
136
|
"studiocms:ui/scripts/toggle": `import '${resolve("./components/Toggle/toggle.js")}';`,
|
|
137
|
+
"studiocms:ui/scripts/tooltip": `import '${resolve("./components/Tooltip/tooltip.js")}';`,
|
|
35
138
|
"studiocms:ui/scripts/accordion": `import '${resolve("./components/Accordion/accordion.js")}';`,
|
|
36
139
|
"studiocms:ui/scripts/progress": `import '${resolve("./components/Progress/progress.js")}';`,
|
|
37
140
|
// Components
|
|
38
|
-
|
|
39
|
-
export { default as Button } from '${resolve("./components/Button/Button.astro")}';
|
|
40
|
-
export { default as Divider } from '${resolve("./components/Divider/Divider.astro")}';
|
|
41
|
-
export { default as Input } from '${resolve("./components/Input/Input.astro")}';
|
|
42
|
-
export { default as Row } from '${resolve("./components/Row/Row.astro")}';
|
|
43
|
-
export { default as Center } from '${resolve("./components/Center/Center.astro")}';
|
|
44
|
-
export { default as Textarea } from '${resolve("./components/Textarea/Textarea.astro")}';
|
|
45
|
-
export { default as Checkbox } from '${resolve("./components/Checkbox/Checkbox.astro")}';
|
|
46
|
-
export { default as Toggle } from '${resolve("./components/Toggle/Toggle.astro")}';
|
|
47
|
-
export { default as RadioGroup } from '${resolve("./components/RadioGroup/RadioGroup.astro")}';
|
|
48
|
-
export { default as Toaster } from '${resolve("./components/Toast/Toaster.astro")}';
|
|
49
|
-
export { default as Card } from '${resolve("./components/Card/Card.astro")}';
|
|
50
|
-
export { default as Modal } from '${resolve("./components/Modal/Modal.astro")}';
|
|
51
|
-
export { default as Select } from '${resolve("./components/Select/Select.astro")}';
|
|
52
|
-
export { default as SearchSelect } from '${resolve("./components/SearchSelect/SearchSelect.astro")}';
|
|
53
|
-
export { default as Dropdown } from '${resolve("./components/Dropdown/Dropdown.astro")}';
|
|
54
|
-
export { default as User } from '${resolve("./components/User/User.astro")}';
|
|
55
|
-
export { default as ThemeToggle } from '${resolve("./components/ThemeToggle/ThemeToggle.astro")}';
|
|
56
|
-
export { default as Tabs } from '${resolve("./components/Tabs/Tabs.astro")}';
|
|
57
|
-
export { default as TabItem } from '${resolve("./components/Tabs/TabItem.astro")}';
|
|
58
|
-
export { default as Accordion } from '${resolve("./components/Accordion/Accordion.astro")}';
|
|
59
|
-
export { default as AccordionItem } from '${resolve("./components/Accordion/Item.astro")}';
|
|
60
|
-
export { default as Footer } from '${resolve("./components/Footer/Footer.astro")}';
|
|
61
|
-
export { default as Progress } from '${resolve("./components/Progress/Progress.astro")}';
|
|
62
|
-
export { default as Sidebar } from '${resolve("./components/Sidebar/Single.astro")}';
|
|
63
|
-
export { default as DoubleSidebar } from '${resolve("./components/Sidebar/Double.astro")}';
|
|
64
|
-
export { default as Breadcrumbs } from '${resolve("./components/Breadcrumbs/Breadcrumbs.astro")}';
|
|
65
|
-
export { default as Group } from '${resolve("./components/Group/Group.astro")}';
|
|
66
|
-
export { default as Badge } from '${resolve("./components/Badge/Badge.astro")}';
|
|
67
|
-
export { default as Icon } from '${resolve("./components/Icon/Icon.astro")}';
|
|
68
|
-
export { default as IconBase } from '${resolve("./components/Icon/IconBase.astro")}';
|
|
69
|
-
|
|
70
|
-
export { ProgressHelper } from '${resolve("./components/Progress/helper.js")}';
|
|
71
|
-
export { SingleSidebarHelper, DoubleSidebarHelper } from '${resolve("./components/Sidebar/helpers.js")}';
|
|
72
|
-
export { toast } from '${resolve("./components/Toast/toast.js")}';
|
|
73
|
-
export { ModalHelper } from '${resolve("./components/Modal/modal.js")}';
|
|
74
|
-
export { DropdownHelper } from '${resolve("./components/Dropdown/dropdown.js")}';
|
|
75
|
-
|
|
76
|
-
export * from '${resolve("./components/Icon/iconType.js")}';
|
|
77
|
-
`,
|
|
141
|
+
...virtualComponents,
|
|
78
142
|
"studiocms:ui/utils": `
|
|
79
143
|
export { ThemeHelper, Theme } from '${resolve("./utils/ThemeHelper.js")}';
|
|
144
|
+
`,
|
|
145
|
+
"studiocms:ui/icons": `
|
|
146
|
+
${icons.integrationCollections.join("\n")}
|
|
147
|
+
|
|
148
|
+
export const availableIcons = ${JSON.stringify(icons.availableIcons)};
|
|
149
|
+
|
|
150
|
+
export const iconCollections = ${JSON.stringify(icons.iconCollections)};
|
|
80
151
|
`
|
|
81
152
|
}
|
|
82
153
|
});
|
|
@@ -95,282 +166,18 @@ function integration(options = {}) {
|
|
|
95
166
|
},
|
|
96
167
|
"astro:config:done": ({ injectTypes }) => {
|
|
97
168
|
injectTypes({
|
|
98
|
-
filename: "
|
|
169
|
+
filename: "icons.d.ts",
|
|
99
170
|
content: `
|
|
100
|
-
declare module 'studiocms:ui/
|
|
101
|
-
const
|
|
102
|
-
export
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
declare module 'studiocms:ui/global-css' {}
|
|
106
|
-
|
|
107
|
-
declare module 'studiocms:ui/custom-css' {}
|
|
108
|
-
|
|
109
|
-
declare module 'studiocms:ui/scripts/*' {}
|
|
110
|
-
|
|
111
|
-
declare module 'studiocms:ui/components' {
|
|
112
|
-
export const Button: typeof import('${resolve("./components/Button/Button.astro")}').default;
|
|
113
|
-
export const Divider: typeof import('${resolve("./components/Divider/Divider.astro")}').default;
|
|
114
|
-
export const Input: typeof import('${resolve("./components/Input/Input.astro")}').default;
|
|
115
|
-
export const Row: typeof import('${resolve("./components/Row/Row.astro")}').default;
|
|
116
|
-
export const Center: typeof import('${resolve("./components/Center/Center.astro")}').default;
|
|
117
|
-
export const Textarea: typeof import('${resolve("./components/Textarea/Textarea.astro")}').default;
|
|
118
|
-
export const Checkbox: typeof import('${resolve("./components/Checkbox/Checkbox.astro")}').default;
|
|
119
|
-
export const Toggle: typeof import('${resolve("./components/Toggle/Toggle.astro")}').default;
|
|
120
|
-
export const RadioGroup: typeof import('${resolve("./components/RadioGroup/RadioGroup.astro")}').default;
|
|
121
|
-
export const Toaster: typeof import('${resolve("./components/Toast/Toaster.astro")}').default;
|
|
122
|
-
export const Card: typeof import('${resolve("./components/Card/Card.astro")}').default;
|
|
123
|
-
export const Modal: typeof import('${resolve("./components/Modal/Modal.astro")}').default;
|
|
124
|
-
export const Select: typeof import('${resolve("./components/Select/Select.astro")}').default;
|
|
125
|
-
export const SearchSelect: typeof import('${resolve("./components/SearchSelect/SearchSelect.astro")}').default;
|
|
126
|
-
export const Dropdown: typeof import('${resolve("./components/Dropdown/Dropdown.astro")}').default;
|
|
127
|
-
export const User: typeof import('${resolve("./components/User/User.astro")}').default;
|
|
128
|
-
export const ThemeToggle: typeof import('${resolve("./components/ThemeToggle/ThemeToggle.astro")}').default;
|
|
129
|
-
export const Tabs: typeof import('${resolve("./components/Tabs/Tabs.astro")}').default;
|
|
130
|
-
export const TabItem: typeof import('${resolve("./components/Tabs/TabItem.astro")}').default;
|
|
131
|
-
export const Accordion: typeof import('${resolve("./components/Accordion/Accordion.astro")}').default;
|
|
132
|
-
export const AccordionItem: typeof import('${resolve("./components/Accordion/Item.astro")}').default;
|
|
133
|
-
export const Footer: typeof import('${resolve("./components/Footer/Footer.astro")}').default;
|
|
134
|
-
export const Progress: typeof import('${resolve("./components/Progress/Progress.astro")}').default;
|
|
135
|
-
export const Sidebar: typeof import('${resolve("./components/Sidebar/Single.astro")}').default;
|
|
136
|
-
export const DoubleSidebar: typeof import('${resolve("./components/Sidebar/Double.astro")}').default;
|
|
137
|
-
export const Breadcrumbs: typeof import('${resolve("./components/Breadcrumbs/Breadcrumbs.astro")}').default;
|
|
138
|
-
export const Group: typeof import('${resolve("./components/Group/Group.astro")}').default;
|
|
139
|
-
export const Badge: typeof import('${resolve("./components/Badge/Badge.astro")}').default;
|
|
140
|
-
export const Icon: typeof import('${resolve("./components/Icon/Icon.astro")}').default;
|
|
141
|
-
export const IconBase: typeof import('${resolve("./components/Icon/IconBase.astro")}').default;
|
|
142
|
-
export const toast: typeof import('${resolve("./components/Toast/toast.js")}').toast;
|
|
143
|
-
export type HeroIconName = import('${resolve("./components/Icon/iconType.js")}').HeroIconName;
|
|
144
|
-
|
|
145
|
-
export class ModalHelper {
|
|
146
|
-
private element;
|
|
147
|
-
private cancelButton;
|
|
148
|
-
private confirmButton;
|
|
149
|
-
private isForm;
|
|
150
|
-
private modalForm;
|
|
151
|
-
/**
|
|
152
|
-
* A helper to manage modals.
|
|
153
|
-
* @param id The ID of the modal.
|
|
154
|
-
* @param triggerID The ID of the element that should trigger the modal.
|
|
155
|
-
*/
|
|
156
|
-
constructor(id: string, triggerID?: string);
|
|
157
|
-
/**
|
|
158
|
-
* A helper function which adds event listeners to the modal buttons to close the modal when clicked.
|
|
159
|
-
* @param id The ID of the modal.
|
|
160
|
-
* @param dismissable Whether the modal is dismissable.
|
|
161
|
-
*/
|
|
162
|
-
private addButtonListeners;
|
|
163
|
-
/**
|
|
164
|
-
* A helper function to close the modal when the user clicks outside of it.
|
|
165
|
-
*/
|
|
166
|
-
private addDismissiveClickListener;
|
|
167
|
-
/**
|
|
168
|
-
* A function to show the modal.
|
|
169
|
-
*/
|
|
170
|
-
show: () => void;
|
|
171
|
-
/**
|
|
172
|
-
* A function to hide the modal.
|
|
173
|
-
*/
|
|
174
|
-
hide: () => void;
|
|
175
|
-
/**
|
|
176
|
-
* A function to add another trigger to show the modal with.
|
|
177
|
-
* @param elementID The ID of the element that should trigger the modal when clicked.
|
|
178
|
-
*/
|
|
179
|
-
bindTrigger: (elementID: string) => void;
|
|
180
|
-
/**
|
|
181
|
-
* Registers a callback for the cancel button.
|
|
182
|
-
* @param func The callback function.
|
|
183
|
-
*/
|
|
184
|
-
registerCancelCallback: (func: () => void) => void;
|
|
185
|
-
/**
|
|
186
|
-
* Registers a callback for the confirm button.
|
|
187
|
-
* @param func The callback function. If the modal is a form, the function will be called with
|
|
188
|
-
* the form data as the first argument.
|
|
189
|
-
*/
|
|
190
|
-
registerConfirmCallback: (func: (data?: FormData | undefined) => void) => void;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export class DropdownHelper {
|
|
194
|
-
private container;
|
|
195
|
-
private toggleEl;
|
|
196
|
-
private dropdown;
|
|
197
|
-
private alignment;
|
|
198
|
-
private triggerOn;
|
|
199
|
-
private fullWidth;
|
|
200
|
-
private focusIndex;
|
|
201
|
-
active: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* A helper function to interact with dropdowns.
|
|
204
|
-
* @param id The ID of the dropdown.
|
|
205
|
-
* @param fullWidth Whether the dropdown should be full width. Not needed normally.
|
|
206
|
-
*/
|
|
207
|
-
constructor(id: string, fullWidth?: boolean);
|
|
208
|
-
/**
|
|
209
|
-
* Registers a click callback for the dropdown options. Whenever one of the options
|
|
210
|
-
* is clicked, the callback will be called with the value of the option.
|
|
211
|
-
* @param func The callback function.
|
|
212
|
-
*/
|
|
213
|
-
registerClickCallback: (func: (value: string) => void) => void;
|
|
214
|
-
/**
|
|
215
|
-
* Sets up all listeners for the dropdown.
|
|
216
|
-
*/
|
|
217
|
-
private initialBehaviorRegistration;
|
|
218
|
-
/**
|
|
219
|
-
* Registers callbacks to hide the dropdown when an option is clicked.
|
|
220
|
-
*/
|
|
221
|
-
private initialOptClickRegistration;
|
|
222
|
-
/**
|
|
223
|
-
* A function to toggle the dropdown.
|
|
224
|
-
*/
|
|
225
|
-
toggle: () => void;
|
|
226
|
-
/**
|
|
227
|
-
* A function to hide the dropdown.
|
|
228
|
-
*/
|
|
229
|
-
hide: () => void;
|
|
230
|
-
/**
|
|
231
|
-
* A function to show the dropdown.
|
|
232
|
-
*/
|
|
233
|
-
show: () => void;
|
|
234
|
-
/**
|
|
235
|
-
* A jQuery-like function to hide the dropdown when clicking outside of it.
|
|
236
|
-
* @param element The element to hide when clicking outside of it.
|
|
237
|
-
*/
|
|
238
|
-
private hideOnClickOutside;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export class ProgressHelper {
|
|
242
|
-
private bar;
|
|
243
|
-
private progress;
|
|
244
|
-
private value;
|
|
245
|
-
private max;
|
|
246
|
-
constructor(id: string);
|
|
247
|
-
getValue(): number;
|
|
248
|
-
setValue(value: number): void;
|
|
249
|
-
getMax(): number;
|
|
250
|
-
setMax(value: number): void;
|
|
251
|
-
getPercentage(): number;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export class SingleSidebarHelper {
|
|
255
|
-
private sidebar;
|
|
256
|
-
private sidebarToggle?;
|
|
257
|
-
/**
|
|
258
|
-
* A helper to manage the sidebar with.
|
|
259
|
-
* @param toggleID The ID of the element that should toggle the sidebar.
|
|
260
|
-
*/
|
|
261
|
-
constructor(toggleID?: string);
|
|
262
|
-
/**
|
|
263
|
-
* A helper function register an element which should toggle the sidebar.
|
|
264
|
-
* @param elementID The ID of the element that should toggle the sidebar.
|
|
265
|
-
*/
|
|
266
|
-
toggleSidebarOnClick: (elementID: string) => void;
|
|
267
|
-
/**
|
|
268
|
-
* A helper function to hide the sidebar when an element is clicked.
|
|
269
|
-
* @param elementID The ID of the element that should hide the sidebar.
|
|
270
|
-
*/
|
|
271
|
-
hideSidebarOnClick: (elementID: string) => void;
|
|
272
|
-
/**
|
|
273
|
-
* A helper function to show the sidebar when an element is clicked.
|
|
274
|
-
* @param elementID The ID of the element that should show the sidebar.
|
|
275
|
-
*/
|
|
276
|
-
showSidebarOnClick: (elementID: string) => void;
|
|
277
|
-
/**
|
|
278
|
-
* A function to hide the sidebar.
|
|
279
|
-
*/
|
|
280
|
-
hideSidebar: () => void;
|
|
281
|
-
/**
|
|
282
|
-
* A function to show the sidebar.
|
|
283
|
-
*/
|
|
284
|
-
showSidebar: () => void;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export class DoubleSidebarHelper {
|
|
288
|
-
private sidebarsContainer;
|
|
289
|
-
/**
|
|
290
|
-
* A helper to manage the double sidebar with.
|
|
291
|
-
*/
|
|
292
|
-
constructor();
|
|
293
|
-
/**
|
|
294
|
-
* A helper function to hide the sidebar when an element is clicked.
|
|
295
|
-
* @param elementID The ID of the element that should hide the sidebar.
|
|
296
|
-
*/
|
|
297
|
-
hideSidebarOnClick: (elementID: string) => void;
|
|
298
|
-
/**
|
|
299
|
-
* A helper function to show the outer sidebar when an element is clicked.
|
|
300
|
-
* @param elementID The ID of the element that should show the outer sidebar.
|
|
301
|
-
*/
|
|
302
|
-
showOuterOnClick: (elementID: string) => void;
|
|
303
|
-
/**
|
|
304
|
-
* A helper function to show the inner sidebar when an element is clicked.
|
|
305
|
-
* @param elementID The ID of the element that should show the inner sidebar.
|
|
306
|
-
*/
|
|
307
|
-
showInnerOnClick: (elementID: string) => void;
|
|
308
|
-
/**
|
|
309
|
-
* A function to show the inner sidebar.
|
|
310
|
-
*/
|
|
311
|
-
showInnerSidebar: () => void;
|
|
312
|
-
/**
|
|
313
|
-
* A function to show the outer sidebar.
|
|
314
|
-
*/
|
|
315
|
-
showOuterSidebar: () => void;
|
|
316
|
-
/**
|
|
317
|
-
* A function to hide the sidebar altogether.
|
|
318
|
-
*/
|
|
319
|
-
hideSidebar: () => void;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
declare module 'studiocms:ui/utils' {
|
|
324
|
-
export type Theme = import('${resolve("./utils/ThemeHelper.js")}').Theme;
|
|
171
|
+
declare module 'studiocms:ui/icons' {
|
|
172
|
+
export const availableIcons: ('${icons.availableIcons.join("'\n | '")}')[];
|
|
173
|
+
export const iconCollections: ('${icons.iconCollections.join("'\n | '")}')[];
|
|
325
174
|
|
|
326
|
-
|
|
175
|
+
${icons.iconCollections.map((collection) => {
|
|
176
|
+
return `export const ${collection}: import('@studiocms/ui/types').IconifyJSON;`;
|
|
177
|
+
}).join("\n")}
|
|
327
178
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
*/
|
|
331
|
-
export class ThemeHelper {
|
|
332
|
-
private themeManagerElement;
|
|
333
|
-
private observer;
|
|
334
|
-
private themeChangeCallbacks;
|
|
335
|
-
/**
|
|
336
|
-
* A helper to toggle, set and get the current StudioCMS UI theme.
|
|
337
|
-
* @param themeProvider The element that should carry the data-theme attribute (replaces the document root)
|
|
338
|
-
*/
|
|
339
|
-
constructor(themeProvider?: HTMLElement);
|
|
340
|
-
/**
|
|
341
|
-
* Get the current theme.
|
|
342
|
-
* @param {boolean} resolveSystemTheme Whether to resolve the \`system\` theme to the actual theme (\`dark\` or \`light\`)
|
|
343
|
-
* @returns {Theme} The current theme.
|
|
344
|
-
*/
|
|
345
|
-
getTheme: <T extends boolean>(resolveSystemTheme?: T) => T extends true ? "dark" | "light" : Theme;
|
|
346
|
-
/**
|
|
347
|
-
* Sets the current theme.
|
|
348
|
-
* @param theme The new theme. One of \`dark\`, \`light\` or \`system\`.
|
|
349
|
-
*/
|
|
350
|
-
setTheme: (theme: Theme) => void;
|
|
351
|
-
/**
|
|
352
|
-
* Toggles the current theme.
|
|
353
|
-
*
|
|
354
|
-
* If the theme is set to \`system\` (or no theme is set via the root element),
|
|
355
|
-
* the theme is set depending on the user's color scheme preference (set in the browser).
|
|
356
|
-
*/
|
|
357
|
-
toggleTheme: () => void;
|
|
358
|
-
/**
|
|
359
|
-
* Register an element to act as a toggle! When clicked, it will toggle the theme.
|
|
360
|
-
* @param toggle The HTML element that should act as the toggle
|
|
361
|
-
*/
|
|
362
|
-
registerToggle: (toggle: HTMLElement | null) => void;
|
|
363
|
-
/**
|
|
364
|
-
* Allows for adding a callback that gets called whenever the theme changes.
|
|
365
|
-
* @param callback The callback to be executed
|
|
366
|
-
*/
|
|
367
|
-
onThemeChange: (callback: ThemeChangeCallback) => void;
|
|
368
|
-
/**
|
|
369
|
-
* Simply gets the first mutation and calls all registered callbacks.
|
|
370
|
-
* @param mutations The mutations array from the observer. Due to the specified options, this will always be a 1-length array,
|
|
371
|
-
*/
|
|
372
|
-
private themeManagerMutationHandler;
|
|
373
|
-
}
|
|
179
|
+
export type AvailableIcons = (typeof availableIcons)[number];
|
|
180
|
+
export type IconCollections = (typeof iconCollections)[number];
|
|
374
181
|
}
|
|
375
182
|
`
|
|
376
183
|
});
|
package/dist/toolbar/index.js
CHANGED
|
@@ -76,9 +76,9 @@ function createStyles() {
|
|
|
76
76
|
transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
|
|
77
77
|
transition-timing-function: ease;
|
|
78
78
|
cursor: pointer;
|
|
79
|
-
background-color:
|
|
80
|
-
border-color:
|
|
81
|
-
color:
|
|
79
|
+
background-color: var(--primary-base);
|
|
80
|
+
border-color: var(--primary-base);
|
|
81
|
+
color: var(--text-inverted);
|
|
82
82
|
min-width: fit-content;
|
|
83
83
|
will-change: transform;
|
|
84
84
|
text-decoration: none;
|
|
@@ -89,11 +89,11 @@ function createStyles() {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
button:hover {
|
|
92
|
-
background-color:
|
|
92
|
+
background-color: var(--primary-hover);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
button:active {
|
|
96
|
-
background-color:
|
|
96
|
+
background-color: var(--primary-active);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
button:disabled {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ export interface IconifyIconBuildResult {
|
|
|
115
115
|
/**
|
|
116
116
|
* Check if value should be unset. Allows multiple keywords
|
|
117
117
|
*/
|
|
118
|
-
export declare const isUnsetKeyword: (value: unknown) => value is "
|
|
118
|
+
export declare const isUnsetKeyword: (value: unknown) => value is "unset" | "undefined" | "none";
|
|
119
119
|
/**
|
|
120
120
|
* Replace IDs in SVG output with unique IDs
|
|
121
121
|
*/
|
|
File without changes
|