@lmvz-ds/components 0.18.2 → 0.20.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/CHANGELOG.md +16 -0
- package/README.md +45 -100
- package/assets/icons/checkmark.svg +4 -0
- package/cjs/{aria-loader-CfFuAbJn.js → aria-loader-Cec1zR2g.js} +1 -1
- package/cjs/ds.constants-DSnxZ3ia.js +16 -0
- package/cjs/icons-BQASWgk-.js +80 -0
- package/cjs/{index--7IqZZqn.js → index-3g9Z9sfF.js} +765 -2854
- package/cjs/index.cjs.js +12 -12
- package/cjs/lmvz-button.cjs.entry.js +4 -4
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +113 -0
- package/cjs/lmvz-chip.cjs.entry.js +68 -4
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +3 -3
- package/cjs/lmvz-icon.cjs.entry.js +10 -8
- package/cjs/lmvz-input.cjs.entry.js +4 -4
- package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
- package/cjs/lmvz-select.cjs.entry.js +3 -3
- package/cjs/loader.cjs.js +1 -1
- package/cjs/{logger-Bn2yoZGP.js → logger-DsM6xg6V.js} +3063 -833
- package/cjs/{reactive-controller-host-CtaVAiYJ.js → reactive-controller-host-BA4ZhjKA.js} +10 -10
- package/cjs/svg-BMBduILB.js +125 -0
- package/collection/api/ds.constants.js +2 -0
- package/collection/assets/icons/checkmark.svg +4 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-button/lmvz-button.css +1 -2
- package/collection/components/lmvz-button/lmvz-button.js +6 -3
- package/collection/components/lmvz-card/lmvz-card.css +1 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +207 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +424 -0
- package/collection/components/lmvz-chip/lmvz-chip.css +84 -1
- package/collection/components/lmvz-chip/lmvz-chip.js +110 -13
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.css +11 -10
- package/collection/components/lmvz-icon/lmvz-icon.js +8 -7
- package/collection/components/lmvz-input/lmvz-input.js +4 -4
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +11 -5
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/index.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/utils/aria/aria-validation-controller.js +1 -0
- package/collection/utils/icons/icons.js +2 -13
- package/collection/utils/icons/icons.unit.js +3 -15
- package/collection/utils/reactive-controller-host.js +9 -9
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.d.ts +11 -0
- package/components/lmvz-checkbox.d.ts.bak +11 -0
- package/components/lmvz-checkbox.js +1 -0
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/p-0s99QfRy.js +12 -0
- package/components/{p-CBLAeife.js → p-BuFx0tTm.js} +1 -1
- package/components/p-CGmJG63p.js +1 -0
- package/components/p-CcxjkCOx.js +1 -0
- package/components/{p-DQEkWkMh.js → p-DIrAQ4IB.js} +1 -1
- package/esm/{aria-loader-BF_AYtbb.js → aria-loader-BVolm0lC.js} +1 -1
- package/esm/ds.constants-Bmi89ll1.js +9 -0
- package/esm/icons-CmuFKDRz.js +75 -0
- package/esm/{index-7Ru1khgk.js → index-Dh_9sN0q.js} +389 -2478
- package/esm/index.js +5 -11
- package/esm/lmvz-button.entry.js +4 -4
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +111 -0
- package/esm/lmvz-chip.entry.js +69 -5
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-icon.entry.js +10 -8
- package/esm/lmvz-input.entry.js +4 -4
- package/esm/lmvz-menuitem.entry.js +4 -4
- package/esm/lmvz-select.entry.js +3 -3
- package/esm/loader.js +1 -1
- package/esm/{logger-fiRXhuXK.js → logger-CGmJG63p.js} +2870 -765
- package/esm/{reactive-controller-host-sR2jJxNG.js → reactive-controller-host-DHcPpJW7.js} +10 -10
- package/esm/svg-B2YoIRuh.js +121 -0
- package/hydrate/index.js +2383 -42
- package/hydrate/index.mjs +2383 -42
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-5aa17cd2.entry.js → p-0f7a4236.entry.js} +1 -1
- package/lmvz-components/p-0s99QfRy.js +12 -0
- package/lmvz-components/{p-30b99f11.entry.js → p-2f83d7a2.entry.js} +1 -1
- package/lmvz-components/{p-6dbb3f13.entry.js → p-32171f4f.entry.js} +1 -1
- package/lmvz-components/{p-59383f3a.entry.js → p-400b2318.entry.js} +1 -1
- package/lmvz-components/p-851969bd.entry.js +1 -0
- package/lmvz-components/p-9f9d845d.entry.js +1 -0
- package/lmvz-components/p-Bmi89ll1.js +1 -0
- package/lmvz-components/p-CFsC37ww.js +1 -0
- package/lmvz-components/p-CGmJG63p.js +1 -0
- package/lmvz-components/p-CcxjkCOx.js +1 -0
- package/lmvz-components/{p-Bkfdgg0T.js → p-GdMr6Qlp.js} +1 -1
- package/lmvz-components/p-a12f95da.entry.js +1 -0
- package/lmvz-components/{p-84267405.entry.js → p-ab4437dc.entry.js} +1 -1
- package/lmvz-components/{p-7a6bec13.entry.js → p-d0a0e206.entry.js} +1 -1
- package/lmvz-components/{p-B3dnXEPG.js → p-dhVSUYqd.js} +1 -1
- package/manifest.json +544 -28
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +6 -1
- package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
- package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
- package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +39 -0
- package/types/components/lmvz-chip/lmvz-chip.d.ts +18 -3
- package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +0 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
- package/types/components/lmvz-select/lmvz-select.d.ts +0 -1
- package/types/components.d.ts +221 -12
- package/types/index.d.ts +1 -2
- package/types/utils/aria/aria-validation-controller.d.ts +1 -2
- package/types/utils/aria/element-activation-controller.d.ts +0 -1
- package/types/utils/aria/list-keyboard-controller.d.ts +0 -1
- package/types/utils/assets.d.ts +0 -1
- package/types/utils/component.d.ts +0 -1
- package/types/utils/environment.d.ts +0 -1
- package/types/utils/http.d.ts +0 -1
- package/types/utils/http.unit.d.ts +0 -1
- package/types/utils/icons/icons-registry.d.ts +0 -1
- package/types/utils/icons/icons.d.ts +0 -2
- package/types/utils/icons/icons.unit.d.ts +0 -1
- package/types/utils/icons/public.d.ts +0 -1
- package/types/utils/public.d.ts +0 -1
- package/types/utils/reactive-controller-host.d.ts +0 -1
- package/cjs/icons-swqMn6s2.js +0 -163
- package/components/p-DXOTa5VF.js +0 -12
- package/components/p-fiRXhuXK.js +0 -1
- package/esm/icons-Ca8oMiRa.js +0 -157
- package/lmvz-components/p-0a41cc24.entry.js +0 -1
- package/lmvz-components/p-5f150890.entry.js +0 -1
- package/lmvz-components/p-Bh2Epkwf.js +0 -1
- package/lmvz-components/p-DXOTa5VF.js +0 -12
- package/lmvz-components/p-fiRXhuXK.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lmvz-ds/components
|
|
2
2
|
|
|
3
|
+
## 0.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9f1fe1e: Checkbox Komponente hinzugefügt
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 8dac215: Farbfehler in <lmvz-menuitem> korrigiert (Regression)
|
|
12
|
+
|
|
13
|
+
## 0.19.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- a71b037: Chip Komponente hinzugefügt
|
|
18
|
+
|
|
3
19
|
## 0.18.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,43 +1,60 @@
|
|
|
1
|
-
[](https://stenciljs.com)
|
|
2
|
-
|
|
3
|
-
Stencil is a compiler for building web apps using Web Components.
|
|
4
|
-
|
|
5
1
|
# LMVZ Component Library
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## About
|
|
3
|
+
[](https://stenciljs.com)
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
It also uses **Effect** (aka. effect-ts) for improved type-safety error handling
|
|
5
|
+
Web components for the LMVZ Design System.
|
|
13
6
|
|
|
14
|
-
##
|
|
7
|
+
## About
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
This package uses **Stencil** to create web components for browser-native usage and to generate integration artifacts consumed by sibling framework packages.
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+
Please also read the Integration chapter of the Design Guide.
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
## Installation
|
|
21
14
|
|
|
22
15
|
```bash
|
|
23
16
|
npm i @lmvz-ds/components
|
|
24
17
|
```
|
|
25
18
|
|
|
19
|
+
> [!TIP]
|
|
20
|
+
> If you are building an Angular application, prefer the `@lmvz-ds/angular` wrapper package.
|
|
21
|
+
|
|
26
22
|
> [!TIP]
|
|
27
23
|
> Our @lmvz-ds/aria-validation sibling is only used for YOUR development mode, and thus, optional.
|
|
28
24
|
|
|
29
25
|
## Usage
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
Import individual components when you only need a subset:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import '@lmvz-ds/components/lmvz-button';
|
|
31
|
+
import '@lmvz-ds/components/lmvz-icon';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Register all components globally via the loader when that is a better fit for your app shell:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { defineCustomElements } from '@lmvz-ds/components/loader';
|
|
38
|
+
|
|
39
|
+
defineCustomElements(window);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If your app has no own build/bundling process, directly import from the CDN (unpkg.com) using `<script type="module" href="[cdnurl]">`.
|
|
43
|
+
|
|
44
|
+
The package also exposes a /hydrate entry for server-side rendering workflows.
|
|
45
|
+
|
|
46
|
+
### Icons
|
|
47
|
+
|
|
48
|
+
The `<lmvz-icon>` component requires an icon provider to be registered before use. See [@lmvz-ds/icons](https://www.npmjs.com/package/@lmvz-ds/icons) for setup instructions and available provider modes.
|
|
34
49
|
|
|
35
50
|
### Runtime ARIA Validation (Opt-in)
|
|
36
51
|
|
|
37
|
-
ARIA validation is disabled by default and can be enabled on demand
|
|
52
|
+
ARIA validation is disabled by default and can be enabled on demand for development-time accessibility checks:
|
|
38
53
|
|
|
39
54
|
```ts
|
|
40
|
-
import '@lmvz-ds/components
|
|
55
|
+
import { enableAriaValidation } from '@lmvz-ds/components';
|
|
56
|
+
|
|
57
|
+
enableAriaValidation();
|
|
41
58
|
```
|
|
42
59
|
|
|
43
60
|
This import enables validation globally for all LMVZ components, independent of integration mode.
|
|
@@ -45,25 +62,25 @@ This import enables validation globally for all LMVZ components, independent of
|
|
|
45
62
|
To disable it again at runtime:
|
|
46
63
|
|
|
47
64
|
```ts
|
|
48
|
-
import { disableAriaValidation } from '@lmvz-ds/components
|
|
65
|
+
import { disableAriaValidation } from '@lmvz-ds/components';
|
|
49
66
|
|
|
50
67
|
disableAriaValidation();
|
|
51
68
|
```
|
|
52
69
|
|
|
53
|
-
###
|
|
54
|
-
|
|
55
|
-
Components are built in standalone mode, using [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements). This way, you can import the components individually, wherever they are needed.
|
|
70
|
+
### Example
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
Import and register the component module before using its custom element:
|
|
58
73
|
|
|
59
74
|
```tsx
|
|
60
|
-
import '@lmvz-ds/components/
|
|
75
|
+
import { defineCustomElement as defineButtonElement } '@lmvz-ds/components/lmvz-button';
|
|
76
|
+
|
|
77
|
+
defineButtonElement();
|
|
61
78
|
|
|
62
79
|
function App() {
|
|
63
80
|
return (
|
|
64
81
|
<>
|
|
65
82
|
<div>
|
|
66
|
-
<
|
|
83
|
+
<lmvz-button variant="primary"></lmvz-button>
|
|
67
84
|
</div>
|
|
68
85
|
</>
|
|
69
86
|
);
|
|
@@ -72,81 +89,9 @@ function App() {
|
|
|
72
89
|
export default App;
|
|
73
90
|
```
|
|
74
91
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Making changes to this package
|
|
78
|
-
|
|
79
|
-
### Getting Started
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm install
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Workflow
|
|
86
|
-
|
|
87
|
-
See the parent project's readme for the overarching process' description.
|
|
88
|
-
|
|
89
|
-
### Guidelines
|
|
90
|
-
|
|
91
|
-
- Components must each be provided as stand-alone bundles.
|
|
92
|
-
- Components must bring their own, ds-aligned, default styles. This increases flexibility (as components are usable stand-alone) and is achieved by build-time injection of defaults (based on base- and light-theme-variables). There is no need for importing any variables definitions. Instead, add base variables to the plugin config's list (`stencil.base.config.ts`).
|
|
93
|
-
- Font file contents are exempt from bundling, to allow for browser-caching!
|
|
94
|
-
- To prevent styles from leaking out of your Components (into the global scope), wrap your own styles and `@import`s in `:host`.
|
|
95
|
-
- Components depending on Fragments must import them into their :host selector, for proper encapsulation.
|
|
96
|
-
- This use of CSS' @import syntax is invalid, but properly handled by postcss.
|
|
97
|
-
- Consider using custom-property abstractions instead of importing whole fragments!
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Configuration
|
|
101
|
-
|
|
102
|
-
Different Stencil configs are necessary, since we need the following constellations (which are not possible with a single config):
|
|
103
|
-
|
|
104
|
-
- local Stencil dev-server: classic dev build
|
|
105
|
-
- Storybook integration: prod build + source maps (dev build does not generate source files in dist/)
|
|
106
|
-
- release build: prod build without source maps
|
|
107
|
-
|
|
108
|
-
package.json exports should be generated along with the Stencil build (for new components).
|
|
109
|
-
|
|
110
|
-
### Development
|
|
111
|
-
|
|
112
|
-
Use the `pnpm run start:dev` script to start Stencil's dev server.
|
|
113
|
-
(`start` will be called from the Storybook sibling package and will only run a (watching) production build).
|
|
114
|
-
|
|
115
|
-
### Building
|
|
116
|
-
|
|
117
|
-
To build the components (and styles) for production, run the build script. This will also sync changes to the wrapper projects.
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
pnpm run build
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Creating New Components
|
|
124
|
-
|
|
125
|
-
Always use the `lmvz-` prefix when creating new components!
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
pnpm run @stencil/core generate lmvz-[component name]
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Testing
|
|
132
|
-
|
|
133
|
-
To run the unit tests for the components, run:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
npm test
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
#### Integration Testing
|
|
140
|
-
|
|
141
|
-
Since components can be integrated in various ways, always test integrations:
|
|
142
|
-
|
|
143
|
-
- Stencil dev mode and preview (see package scripts).
|
|
144
|
-
- With the Storybook package.
|
|
145
|
-
- Angular, React, ... wrappers
|
|
92
|
+
LMVZ component styles do not style native HTML elements outside the components. Import a theme, and any additional global style bundles you need, from `@lmvz-ds/styles` separately.
|
|
146
93
|
|
|
147
|
-
#### E2E
|
|
148
94
|
|
|
149
|
-
|
|
95
|
+
## Contributing
|
|
150
96
|
|
|
151
|
-
|
|
152
|
-
- Vitest-Browser + Stencil is bleeding edge and needs eval.
|
|
97
|
+
Contributor onboarding for local development, builds, testing, and authoring guidelines is in `DEVELOPMENT.md`.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
3
|
+
<path d="M3.75 12.5625L8.83079 17.625L20.4375 6.375" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -43,7 +43,7 @@ async function fetchRuntime() {
|
|
|
43
43
|
if (state.runtime)
|
|
44
44
|
return state.runtime;
|
|
45
45
|
if (!state.loadPromise) {
|
|
46
|
-
state.loadPromise = Promise.resolve().then(function () { return require('./index
|
|
46
|
+
state.loadPromise = Promise.resolve().then(function () { return require('./index-3g9Z9sfF.js'); }).catch(() => null);
|
|
47
47
|
}
|
|
48
48
|
const runtime = await state.loadPromise;
|
|
49
49
|
if (runtime) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sizes = ['xs', 'sm', 'md', 'lg'];
|
|
4
|
+
const textSizes = [...sizes, 'xl'];
|
|
5
|
+
const inputTypes = ['text', 'email', 'password', 'tel', 'url', 'search', 'number'];
|
|
6
|
+
const iconSizes = [...sizes, 'inherit'];
|
|
7
|
+
const iconWeights = ['thin', 'medium', 'bold', 'filled'];
|
|
8
|
+
const chipTypes = ['active', 'warning', 'success', 'error', 'neutral'];
|
|
9
|
+
const chipSizes = ['default', 'small'];
|
|
10
|
+
|
|
11
|
+
exports.chipSizes = chipSizes;
|
|
12
|
+
exports.chipTypes = chipTypes;
|
|
13
|
+
exports.iconSizes = iconSizes;
|
|
14
|
+
exports.iconWeights = iconWeights;
|
|
15
|
+
exports.inputTypes = inputTypes;
|
|
16
|
+
exports.textSizes = textSizes;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var svg = require('./svg-BMBduILB.js');
|
|
4
|
+
|
|
5
|
+
const IconProviderRegistryKey = Symbol.for('LMVZ__iconProviderRegistry');
|
|
6
|
+
const inMemoryRegistry = {};
|
|
7
|
+
function getRegistry() {
|
|
8
|
+
if (typeof window === 'undefined') {
|
|
9
|
+
return inMemoryRegistry;
|
|
10
|
+
}
|
|
11
|
+
return window[IconProviderRegistryKey] ?? (window[IconProviderRegistryKey] = {});
|
|
12
|
+
}
|
|
13
|
+
function registerIconProvider(id, provider) {
|
|
14
|
+
const registry = getRegistry();
|
|
15
|
+
const providerName = id;
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(registry, providerName)) {
|
|
17
|
+
console.warn(`Icon provider with name "${providerName}" is already registered. Overwriting existing provider.`);
|
|
18
|
+
}
|
|
19
|
+
registry[providerName] = provider;
|
|
20
|
+
}
|
|
21
|
+
function getRegisteredIconProvider(id) {
|
|
22
|
+
const registry = getRegistry();
|
|
23
|
+
if (id) {
|
|
24
|
+
return registry[id];
|
|
25
|
+
}
|
|
26
|
+
const providerNames = Object.keys(registry);
|
|
27
|
+
if (providerNames.length === 0) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (providerNames.length > 1) {
|
|
31
|
+
console.warn(`Multiple icon providers registered (${providerNames.join(', ')}). Using the first one: "${providerNames[0]}".`);
|
|
32
|
+
}
|
|
33
|
+
const firstProviderName = providerNames[0];
|
|
34
|
+
if (!firstProviderName) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return registry[firstProviderName];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function resolveIconSvg(options) {
|
|
41
|
+
const { icon, iconset } = options;
|
|
42
|
+
const iconSvg = await (async () => {
|
|
43
|
+
const provider = getRegisteredIconProvider(iconset);
|
|
44
|
+
if (!provider) {
|
|
45
|
+
console.warn(`No icon provider registered. Unable to resolve icon "${icon}"${iconset ? ` from set "${iconset}"` : ''}. Using default icon.`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const resolved = await Promise.resolve(provider.resolve(icon));
|
|
50
|
+
if (!resolved?.svg) {
|
|
51
|
+
console.warn(`Icon "${icon}"${iconset ? ` from set "${iconset}"` : ''} not found in provider. Using default icon.`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const validated = svg.toValidSvgStringWithFallback(resolved.svg);
|
|
55
|
+
if (validated) {
|
|
56
|
+
return validated;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(`Error resolving icon "${icon}" with provider:`, error);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
})();
|
|
65
|
+
if (iconSvg)
|
|
66
|
+
return iconSvg;
|
|
67
|
+
console.error(`Icon "${icon}" not found${iconset ? ` in set "${iconset}"` : ''}. Using default icon.`);
|
|
68
|
+
return svg.emptyDefaultSvg();
|
|
69
|
+
}
|
|
70
|
+
function typedIconFromSet(iconset, icon) {
|
|
71
|
+
return {
|
|
72
|
+
iconset,
|
|
73
|
+
icon,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.getRegisteredIconProvider = getRegisteredIconProvider;
|
|
78
|
+
exports.registerIconProvider = registerIconProvider;
|
|
79
|
+
exports.resolveIconSvg = resolveIconSvg;
|
|
80
|
+
exports.typedIconFromSet = typedIconFromSet;
|