@molecule/app-icons 1.0.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/LICENSE +115 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.d.ts +51 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +110 -0
- package/dist/provider.js.map +1 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the
|
|
45
|
+
original version of the Work and any modifications or additions
|
|
46
|
+
to that Work, that is intentionally submitted to the Licensor for
|
|
47
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
48
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
49
|
+
|
|
50
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
52
|
+
subsequently incorporated within the Work.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
58
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
59
|
+
Work and such Derivative Works in Source or Object form.
|
|
60
|
+
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
+
and otherwise transfer the Work.
|
|
66
|
+
|
|
67
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
69
|
+
modifications, and in Source or Object form, provided that You
|
|
70
|
+
meet the following conditions:
|
|
71
|
+
|
|
72
|
+
(a) You must give any other recipients of the Work or
|
|
73
|
+
Derivative Works a copy of this License; and
|
|
74
|
+
|
|
75
|
+
(b) You must cause any modified files to carry prominent notices
|
|
76
|
+
stating that You changed the files; and
|
|
77
|
+
|
|
78
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
79
|
+
that You distribute, all copyright, patent, trademark, and
|
|
80
|
+
attribution notices from the Source form of the Work,
|
|
81
|
+
excluding those notices that do not pertain to any part of
|
|
82
|
+
the Derivative Works; and
|
|
83
|
+
|
|
84
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
|
+
distribution, then any Derivative Works that You distribute must
|
|
86
|
+
include a readable copy of the attribution notices contained
|
|
87
|
+
within such NOTICE file.
|
|
88
|
+
|
|
89
|
+
5. Submission of Contributions.
|
|
90
|
+
|
|
91
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
93
|
+
|
|
94
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
97
|
+
|
|
98
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
99
|
+
any Contributor be liable to You for damages.
|
|
100
|
+
|
|
101
|
+
9. Accepting Warranty or Additional Liability.
|
|
102
|
+
|
|
103
|
+
Copyright 2026 Molecule Dev, Inc.
|
|
104
|
+
|
|
105
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
you may not use this file except in compliance with the License.
|
|
107
|
+
You may obtain a copy of the License at
|
|
108
|
+
|
|
109
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
|
|
111
|
+
Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
See the License for the specific language governing permissions and
|
|
115
|
+
limitations under the License.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic icon set interfaces for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Icon set bond packages (e.g. `@molecule/app-icons-molecule`) export an
|
|
5
|
+
* `IconSet` object which is bonded via {@link setIconSet} at application
|
|
6
|
+
* startup. Application code retrieves icons via {@link getIcon} /
|
|
7
|
+
* {@link getIconDataUrl}, both of which call {@link getIconSet} internally.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { setIconSet, getIconDataUrl } from '@molecule/app-icons'
|
|
12
|
+
* import { iconSet } from '@molecule/app-icons-molecule'
|
|
13
|
+
*
|
|
14
|
+
* setIconSet(iconSet) // once, at app startup — before anything renders an icon
|
|
15
|
+
*
|
|
16
|
+
* // In components, prefer your framework UI's Icon component
|
|
17
|
+
* // (e.g. <Icon name="check-circle" /> from the app's UI bundle), which reads
|
|
18
|
+
* // the bonded set. For CSS/background/favicon contexts:
|
|
19
|
+
* const url = getIconDataUrl('check-circle', '#16a34a')
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - **Bond the icon set before first render** — `getIcon()`/`getIconDataUrl()` (and
|
|
24
|
+
* any `Icon` component built on them) throw until `setIconSet()` has run; wire it
|
|
25
|
+
* in the app's bond setup, not lazily inside a component.
|
|
26
|
+
* - Icon names are kebab-case (`'arrow-right'`, `'x-mark'`) and type-checked against
|
|
27
|
+
* `IconName`. Don't invent names: an unknown name is a runtime error, not a blank.
|
|
28
|
+
* App-specific glyphs are added by merging `IconData` into the bonded set and
|
|
29
|
+
* augmenting `CustomIconNames` (see that interface) — never by inlining raw SVG
|
|
30
|
+
* per call site.
|
|
31
|
+
* - Icons are decorative by default — pair them with accessible text
|
|
32
|
+
* (`t('key', values, { defaultValue })` labels or `aria-label`), never as the only
|
|
33
|
+
* carrier of meaning.
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
export * from './provider.js';
|
|
38
|
+
export * from './types.js';
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic icon set interfaces for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Icon set bond packages (e.g. `@molecule/app-icons-molecule`) export an
|
|
5
|
+
* `IconSet` object which is bonded via {@link setIconSet} at application
|
|
6
|
+
* startup. Application code retrieves icons via {@link getIcon} /
|
|
7
|
+
* {@link getIconDataUrl}, both of which call {@link getIconSet} internally.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { setIconSet, getIconDataUrl } from '@molecule/app-icons'
|
|
12
|
+
* import { iconSet } from '@molecule/app-icons-molecule'
|
|
13
|
+
*
|
|
14
|
+
* setIconSet(iconSet) // once, at app startup — before anything renders an icon
|
|
15
|
+
*
|
|
16
|
+
* // In components, prefer your framework UI's Icon component
|
|
17
|
+
* // (e.g. <Icon name="check-circle" /> from the app's UI bundle), which reads
|
|
18
|
+
* // the bonded set. For CSS/background/favicon contexts:
|
|
19
|
+
* const url = getIconDataUrl('check-circle', '#16a34a')
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - **Bond the icon set before first render** — `getIcon()`/`getIconDataUrl()` (and
|
|
24
|
+
* any `Icon` component built on them) throw until `setIconSet()` has run; wire it
|
|
25
|
+
* in the app's bond setup, not lazily inside a component.
|
|
26
|
+
* - Icon names are kebab-case (`'arrow-right'`, `'x-mark'`) and type-checked against
|
|
27
|
+
* `IconName`. Don't invent names: an unknown name is a runtime error, not a blank.
|
|
28
|
+
* App-specific glyphs are added by merging `IconData` into the bonded set and
|
|
29
|
+
* augmenting `CustomIconNames` (see that interface) — never by inlining raw SVG
|
|
30
|
+
* per call site.
|
|
31
|
+
* - Icons are decorative by default — pair them with accessible text
|
|
32
|
+
* (`t('key', values, { defaultValue })` labels or `aria-label`), never as the only
|
|
33
|
+
* carrier of meaning.
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
export * from './provider.js';
|
|
38
|
+
export * from './types.js';
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon set bond accessor and icon lookup functions.
|
|
3
|
+
*
|
|
4
|
+
* Icon set bond packages (e.g. `@molecule/app-icons-molecule`) export an
|
|
5
|
+
* `IconSet` object which is bonded via `setIconSet()`. Application code
|
|
6
|
+
* uses `getIcon()` or `getIconDataUrl()` to retrieve individual icons.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { IconData, IconName, IconSet } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Registers an icon set as the active singleton. Called at application
|
|
13
|
+
* startup to wire an icon library.
|
|
14
|
+
*
|
|
15
|
+
* @param iconSet - The icon set (a record of icon names to icon data).
|
|
16
|
+
*/
|
|
17
|
+
export declare function setIconSet(iconSet: IconSet): void;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the bonded icon set, throwing if none is configured.
|
|
20
|
+
*
|
|
21
|
+
* @returns The bonded icon set.
|
|
22
|
+
* @throws {Error} If no icon set has been bonded — names {@link setIconSet}
|
|
23
|
+
* and a concrete icon set bond package as the fix, rather than the generic
|
|
24
|
+
* `@molecule/app-bond` "no provider bonded" message.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getIconSet(): IconSet;
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether an icon set is currently bonded.
|
|
29
|
+
*
|
|
30
|
+
* @returns `true` if an icon set is bonded.
|
|
31
|
+
*/
|
|
32
|
+
export declare function hasIconSet(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a single icon by name from the bonded icon set.
|
|
35
|
+
*
|
|
36
|
+
* @param name - The icon name to look up.
|
|
37
|
+
* @returns The icon data (paths, viewBox, stroke/fill attributes).
|
|
38
|
+
* @throws {Error} If no icon set is bonded or the icon name is not found.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getIcon(name: IconName): IconData;
|
|
41
|
+
/**
|
|
42
|
+
* Generates a CSS `url()` data URI containing an inline SVG for an icon.
|
|
43
|
+
* Useful for `backgroundImage` styling of native elements (e.g. `<select>`
|
|
44
|
+
* dropdown arrows) where SVG elements cannot be inserted.
|
|
45
|
+
*
|
|
46
|
+
* @param name - The icon name to render.
|
|
47
|
+
* @param color - The stroke/fill color for the SVG (defaults to `'#6b7280'`).
|
|
48
|
+
* @returns A CSS `url("data:image/svg+xml,...")` string.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getIconDataUrl(name: IconName, color?: string): string;
|
|
51
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAI7D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAWpC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAahD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,SAAY,GAAG,MAAM,CAmCxE"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon set bond accessor and icon lookup functions.
|
|
3
|
+
*
|
|
4
|
+
* Icon set bond packages (e.g. `@molecule/app-icons-molecule`) export an
|
|
5
|
+
* `IconSet` object which is bonded via `setIconSet()`. Application code
|
|
6
|
+
* uses `getIcon()` or `getIconDataUrl()` to retrieve individual icons.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { bond, get as bondGet, isBonded } from '@molecule/app-bond';
|
|
11
|
+
import { t } from '@molecule/app-i18n';
|
|
12
|
+
const BOND_TYPE = 'icon-set';
|
|
13
|
+
/**
|
|
14
|
+
* Registers an icon set as the active singleton. Called at application
|
|
15
|
+
* startup to wire an icon library.
|
|
16
|
+
*
|
|
17
|
+
* @param iconSet - The icon set (a record of icon names to icon data).
|
|
18
|
+
*/
|
|
19
|
+
export function setIconSet(iconSet) {
|
|
20
|
+
bond(BOND_TYPE, iconSet);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the bonded icon set, throwing if none is configured.
|
|
24
|
+
*
|
|
25
|
+
* @returns The bonded icon set.
|
|
26
|
+
* @throws {Error} If no icon set has been bonded — names {@link setIconSet}
|
|
27
|
+
* and a concrete icon set bond package as the fix, rather than the generic
|
|
28
|
+
* `@molecule/app-bond` "no provider bonded" message.
|
|
29
|
+
*/
|
|
30
|
+
export function getIconSet() {
|
|
31
|
+
const iconSet = bondGet(BOND_TYPE);
|
|
32
|
+
if (!iconSet) {
|
|
33
|
+
throw new Error(t('icons.error.noProvider', undefined, {
|
|
34
|
+
defaultValue: '@molecule/app-icons: No icon set bonded. Call setIconSet() with an IconSet (e.g. the export from @molecule/app-icons-molecule).',
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
return iconSet;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Checks whether an icon set is currently bonded.
|
|
41
|
+
*
|
|
42
|
+
* @returns `true` if an icon set is bonded.
|
|
43
|
+
*/
|
|
44
|
+
export function hasIconSet() {
|
|
45
|
+
return isBonded(BOND_TYPE);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves a single icon by name from the bonded icon set.
|
|
49
|
+
*
|
|
50
|
+
* @param name - The icon name to look up.
|
|
51
|
+
* @returns The icon data (paths, viewBox, stroke/fill attributes).
|
|
52
|
+
* @throws {Error} If no icon set is bonded or the icon name is not found.
|
|
53
|
+
*/
|
|
54
|
+
export function getIcon(name) {
|
|
55
|
+
const iconSet = getIconSet();
|
|
56
|
+
const icon = iconSet[name];
|
|
57
|
+
if (!icon) {
|
|
58
|
+
throw new Error(t('icons.error.notFound', { name }, { defaultValue: `Icon "${name}" not found in the current icon set.` }));
|
|
59
|
+
}
|
|
60
|
+
return icon;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generates a CSS `url()` data URI containing an inline SVG for an icon.
|
|
64
|
+
* Useful for `backgroundImage` styling of native elements (e.g. `<select>`
|
|
65
|
+
* dropdown arrows) where SVG elements cannot be inserted.
|
|
66
|
+
*
|
|
67
|
+
* @param name - The icon name to render.
|
|
68
|
+
* @param color - The stroke/fill color for the SVG (defaults to `'#6b7280'`).
|
|
69
|
+
* @returns A CSS `url("data:image/svg+xml,...")` string.
|
|
70
|
+
*/
|
|
71
|
+
export function getIconDataUrl(name, color = '#6b7280') {
|
|
72
|
+
const icon = getIcon(name);
|
|
73
|
+
const viewBox = icon.viewBox || '0 0 20 20';
|
|
74
|
+
const fill = icon.fill || 'currentColor';
|
|
75
|
+
const encodedColor = encodeURIComponent(color);
|
|
76
|
+
const pathsSvg = icon.svg
|
|
77
|
+
? icon.svg
|
|
78
|
+
: icon.paths
|
|
79
|
+
.map((p) => {
|
|
80
|
+
const attrs = [`d='${p.d}'`];
|
|
81
|
+
if (p.fill)
|
|
82
|
+
attrs.push(`fill='${encodeURIComponent(p.fill)}'`);
|
|
83
|
+
if (p.fillRule)
|
|
84
|
+
attrs.push(`fill-rule='${p.fillRule}'`);
|
|
85
|
+
if (p.clipRule)
|
|
86
|
+
attrs.push(`clip-rule='${p.clipRule}'`);
|
|
87
|
+
if (p.opacity !== undefined)
|
|
88
|
+
attrs.push(`opacity='${p.opacity}'`);
|
|
89
|
+
return `<path ${attrs.join(' ')} />`;
|
|
90
|
+
})
|
|
91
|
+
.join('');
|
|
92
|
+
const svgAttrs = [`xmlns='http://www.w3.org/2000/svg'`, `viewBox='${viewBox}'`];
|
|
93
|
+
if (icon.stroke || fill === 'none') {
|
|
94
|
+
svgAttrs.push(`fill='none'`);
|
|
95
|
+
svgAttrs.push(`stroke='${encodedColor}'`);
|
|
96
|
+
if (icon.strokeWidth)
|
|
97
|
+
svgAttrs.push(`stroke-width='${icon.strokeWidth}'`);
|
|
98
|
+
if (icon.strokeLinecap)
|
|
99
|
+
svgAttrs.push(`stroke-linecap='${icon.strokeLinecap}'`);
|
|
100
|
+
if (icon.strokeLinejoin)
|
|
101
|
+
svgAttrs.push(`stroke-linejoin='${icon.strokeLinejoin}'`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
svgAttrs.push(`fill='${encodedColor}'`);
|
|
105
|
+
}
|
|
106
|
+
const svg = `<svg ${svgAttrs.join(' ')}>${pathsSvg}</svg>`;
|
|
107
|
+
const encoded = svg.replace(/</g, '%3c').replace(/>/g, '%3e').replace(/#/g, '%23');
|
|
108
|
+
return `url("data:image/svg+xml,${encoded}")`;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAItC,MAAM,SAAS,GAAG,UAAU,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC1B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,OAAO,CAAU,SAAS,CAAC,CAAA;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,CAAC,CAAC,wBAAwB,EAAE,SAAS,EAAE;YACrC,YAAY,EACV,iIAAiI;SACpI,CAAC,CACH,CAAA;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAA;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,IAAc;IACpC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAC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
|
9
|
+
fill?: string;
|
|
10
|
+
fillRule?: 'evenodd' | 'nonzero';
|
|
11
|
+
clipRule?: 'evenodd' | 'nonzero';
|
|
12
|
+
opacity?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Complete icon definition — framework-agnostic SVG data. */
|
|
15
|
+
export interface IconData {
|
|
16
|
+
/** SVG path elements. */
|
|
17
|
+
paths: IconPath[];
|
|
18
|
+
/** viewBox attribute. Default: "0 0 20 20" */
|
|
19
|
+
viewBox?: string;
|
|
20
|
+
/** fill attribute. Default: "currentColor" */
|
|
21
|
+
fill?: string;
|
|
22
|
+
/** stroke attribute (for outlined icons). */
|
|
23
|
+
stroke?: string;
|
|
24
|
+
/** strokeWidth for outlined icons. */
|
|
25
|
+
strokeWidth?: number;
|
|
26
|
+
/** strokeLinecap for outlined icons. */
|
|
27
|
+
strokeLinecap?: 'round' | 'butt' | 'square';
|
|
28
|
+
/** strokeLinejoin for outlined icons. */
|
|
29
|
+
strokeLinejoin?: 'round' | 'miter' | 'bevel';
|
|
30
|
+
/** Raw inner SVG content for complex icons that can't be represented as paths alone. */
|
|
31
|
+
svg?: string;
|
|
32
|
+
}
|
|
33
|
+
/** A named set of icons. */
|
|
34
|
+
export interface IconSet {
|
|
35
|
+
[name: string]: IconData;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Augmentable registry of extra icon names beyond {@link ComponentIconName}.
|
|
39
|
+
*
|
|
40
|
+
* An icon set bond (or an app merging custom glyphs into the bonded set) that
|
|
41
|
+
* provides names beyond the required contract declares them here so
|
|
42
|
+
* `getIcon()` / `<Icon name="…" />` accept them type-safely:
|
|
43
|
+
*
|
|
44
|
+
* ```typescript
|
|
45
|
+
* declare module '@molecule/app-icons' {
|
|
46
|
+
* interface CustomIconNames {
|
|
47
|
+
* 'my-custom-glyph': true
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Keys are icon names; values are always `true` (the interface is a name
|
|
53
|
+
* registry, never instantiated).
|
|
54
|
+
*/
|
|
55
|
+
export interface CustomIconNames {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Every icon name known to the type system: the {@link ComponentIconName}
|
|
59
|
+
* contract every icon set must provide, plus any {@link CustomIconNames}
|
|
60
|
+
* augmentations. Use this for `getIcon()` arguments and `icon`/`name` props so
|
|
61
|
+
* a typo fails the type-check instead of throwing at render time.
|
|
62
|
+
*/
|
|
63
|
+
export type IconName = ComponentIconName | (keyof CustomIconNames & string);
|
|
64
|
+
/**
|
|
65
|
+
* Icons required by UI components.
|
|
66
|
+
* All icon set providers MUST include these.
|
|
67
|
+
*/
|
|
68
|
+
export type ComponentIconName = 'info-circle' | 'check-circle' | 'exclamation-triangle' | 'x-circle' | 'x-mark' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-down' | 'chevron-left' | 'chevron-right' | 'chevron-up' | 'chevron-down' | 'chevrons-left' | 'chevrons-right' | 'chevrons-up-down' | 'search' | 'plus' | 'minus' | 'check' | 'pencil' | 'trash' | 'copy' | 'download' | 'upload' | 'share' | 'link' | 'link-external' | 'filter' | 'sort-asc' | 'sort-desc' | 'sync' | 'ellipsis-horizontal' | 'eye' | 'eye-closed' | 'gear' | 'lock' | 'unlock' | 'home' | 'globe' | 'menu' | 'maximize' | 'minimize' | 'user' | 'people' | 'sign-in' | 'sign-out' | 'sun' | 'moon' | 'bell' | 'file' | 'folder' | 'calendar' | 'clock' | 'history' | 'tag' | 'star' | 'heart' | 'code' | 'mail' | 'bug' | 'lightbulb' | 'mention' | 'microphone' | 'paperclip' | 'question' | 'bookmark' | 'pin' | 'reply' | 'image' | 'table' | 'thumbsup' | 'thumbsdown' | 'logo-mark' | 'logo-dot' | 'github' | 'google' | 'gitlab' | 'twitter';
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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c,GACd,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAElB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,eAAe,GACf,QAAQ,GACR,UAAU,GACV,WAAW,GACX,MAAM,GAEN,qBAAqB,GACrB,KAAK,GACL,YAAY,GACZ,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,MAAM,GACN,UAAU,GACV,UAAU,GAEV,MAAM,GACN,QAAQ,GACR,SAAS,GACT,UAAU,GAEV,KAAK,GACL,MAAM,GAEN,MAAM,GAEN,MAAM,GACN,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SAAS,GACT,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GAEN,KAAK,GACL,WAAW,GACX,SAAS,GACT,YAAY,GACZ,WAAW,GACX,UAAU,GACV,UAAU,GACV,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,GAEZ,WAAW,GACX,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/app-icons",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Icon set interfaces for molecule.dev",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"icons",
|
|
25
|
+
"interfaces"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@molecule/app-bond": "^1.0.0",
|
|
30
|
+
"@molecule/app-i18n": "^1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@molecule/app-bond": "1.0.0",
|
|
34
|
+
"@types/node": "26.1.2",
|
|
35
|
+
"typescript": "6.0.3",
|
|
36
|
+
"vitest": "4.1.10"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
41
|
+
"directory": "packages/app/core/icons"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/app/core/icons",
|
|
44
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|