@ni/ok-components 0.4.3 → 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/dist/all-components-bundle.js +36 -36
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +6 -7
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +90 -78
- package/dist/custom-elements.md +17 -17
- package/dist/esm/all-components.d.ts +2 -2
- package/dist/esm/all-components.js +2 -2
- package/dist/esm/all-components.js.map +1 -1
- package/dist/esm/ex/all-ex.d.ts +1 -0
- package/dist/esm/ex/all-ex.js +2 -0
- package/dist/esm/ex/all-ex.js.map +1 -0
- package/dist/esm/{button → ex/button}/index.d.ts +3 -3
- package/dist/esm/ex/button/index.js +16 -0
- package/dist/esm/ex/button/index.js.map +1 -0
- package/dist/esm/{button → ex/button}/styles.js +1 -1
- package/dist/esm/ex/button/styles.js.map +1 -0
- package/dist/esm/ex/button/template.js.map +1 -0
- package/dist/esm/ts/all-ts.d.ts +1 -0
- package/dist/esm/ts/all-ts.js +2 -0
- package/dist/esm/ts/all-ts.js.map +1 -0
- package/dist/esm/{icon-dynamic → ts/icon-dynamic}/index.d.ts +6 -6
- package/dist/esm/{icon-dynamic → ts/icon-dynamic}/index.js +13 -13
- package/dist/esm/ts/icon-dynamic/index.js.map +1 -0
- package/dist/esm/{icon-dynamic → ts/icon-dynamic}/styles.js +2 -2
- package/dist/esm/ts/icon-dynamic/styles.js.map +1 -0
- package/dist/esm/ts/icon-dynamic/template.d.ts +2 -0
- package/dist/esm/ts/icon-dynamic/template.js.map +1 -0
- package/package.json +1 -1
- package/dist/esm/button/index.js +0 -16
- package/dist/esm/button/index.js.map +0 -1
- package/dist/esm/button/styles.js.map +0 -1
- package/dist/esm/button/template.js.map +0 -1
- package/dist/esm/icon-dynamic/index.js.map +0 -1
- package/dist/esm/icon-dynamic/styles.js.map +0 -1
- package/dist/esm/icon-dynamic/template.d.ts +0 -2
- package/dist/esm/icon-dynamic/template.js.map +0 -1
- /package/dist/esm/{button → ex/button}/styles.d.ts +0 -0
- /package/dist/esm/{button → ex/button}/template.d.ts +0 -0
- /package/dist/esm/{button → ex/button}/template.js +0 -0
- /package/dist/esm/{icon-dynamic → ts/icon-dynamic}/styles.d.ts +0 -0
- /package/dist/esm/{icon-dynamic → ts/icon-dynamic}/template.js +0 -0
|
@@ -10,44 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"kind": "javascript-module",
|
|
13
|
-
"path": "src/
|
|
14
|
-
"declarations": [
|
|
15
|
-
|
|
16
|
-
"kind": "class",
|
|
17
|
-
"description": "A Ok demo component (not for production use)",
|
|
18
|
-
"name": "Button",
|
|
19
|
-
"superclass": {
|
|
20
|
-
"name": "FoundationElement",
|
|
21
|
-
"package": "@ni/fast-foundation"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"kind": "variable",
|
|
26
|
-
"name": "buttonTag",
|
|
27
|
-
"type": {
|
|
28
|
-
"text": "string"
|
|
29
|
-
},
|
|
30
|
-
"default": "'ok-button'"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"exports": [
|
|
34
|
-
{
|
|
35
|
-
"kind": "js",
|
|
36
|
-
"name": "Button",
|
|
37
|
-
"declaration": {
|
|
38
|
-
"name": "Button",
|
|
39
|
-
"module": "src/button/index.ts"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"kind": "js",
|
|
44
|
-
"name": "buttonTag",
|
|
45
|
-
"declaration": {
|
|
46
|
-
"name": "buttonTag",
|
|
47
|
-
"module": "src/button/index.ts"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
13
|
+
"path": "src/ex/all-ex.ts",
|
|
14
|
+
"declarations": [],
|
|
15
|
+
"exports": []
|
|
51
16
|
},
|
|
52
17
|
{
|
|
53
18
|
"kind": "javascript-module",
|
|
@@ -57,68 +22,47 @@
|
|
|
57
22
|
},
|
|
58
23
|
{
|
|
59
24
|
"kind": "javascript-module",
|
|
60
|
-
"path": "src/
|
|
25
|
+
"path": "src/ts/all-ts.ts",
|
|
26
|
+
"declarations": [],
|
|
27
|
+
"exports": []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"kind": "javascript-module",
|
|
31
|
+
"path": "src/ex/button/index.ts",
|
|
61
32
|
"declarations": [
|
|
62
33
|
{
|
|
63
34
|
"kind": "class",
|
|
64
|
-
"description": "
|
|
65
|
-
"name": "
|
|
66
|
-
"members": [
|
|
67
|
-
{
|
|
68
|
-
"kind": "method",
|
|
69
|
-
"name": "registerIconDynamic",
|
|
70
|
-
"privacy": "public",
|
|
71
|
-
"static": true,
|
|
72
|
-
"return": {
|
|
73
|
-
"type": {
|
|
74
|
-
"text": "void"
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"parameters": [
|
|
78
|
-
{
|
|
79
|
-
"name": "tagName",
|
|
80
|
-
"type": {
|
|
81
|
-
"text": "string"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"name": "url",
|
|
86
|
-
"type": {
|
|
87
|
-
"text": "string"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
],
|
|
35
|
+
"description": "A Ok demo component (not for production use)",
|
|
36
|
+
"name": "ExButton",
|
|
93
37
|
"superclass": {
|
|
94
|
-
"name": "
|
|
95
|
-
"package": "@ni/
|
|
38
|
+
"name": "FoundationElement",
|
|
39
|
+
"package": "@ni/fast-foundation"
|
|
96
40
|
}
|
|
97
41
|
},
|
|
98
42
|
{
|
|
99
43
|
"kind": "variable",
|
|
100
|
-
"name": "
|
|
44
|
+
"name": "exButtonTag",
|
|
101
45
|
"type": {
|
|
102
46
|
"text": "string"
|
|
103
47
|
},
|
|
104
|
-
"default": "'ok-
|
|
48
|
+
"default": "'ok-ex-button'"
|
|
105
49
|
}
|
|
106
50
|
],
|
|
107
51
|
"exports": [
|
|
108
52
|
{
|
|
109
53
|
"kind": "js",
|
|
110
|
-
"name": "
|
|
54
|
+
"name": "ExButton",
|
|
111
55
|
"declaration": {
|
|
112
|
-
"name": "
|
|
113
|
-
"module": "src/
|
|
56
|
+
"name": "ExButton",
|
|
57
|
+
"module": "src/ex/button/index.ts"
|
|
114
58
|
}
|
|
115
59
|
},
|
|
116
60
|
{
|
|
117
61
|
"kind": "js",
|
|
118
|
-
"name": "
|
|
62
|
+
"name": "exButtonTag",
|
|
119
63
|
"declaration": {
|
|
120
|
-
"name": "
|
|
121
|
-
"module": "src/
|
|
64
|
+
"name": "exButtonTag",
|
|
65
|
+
"module": "src/ex/button/index.ts"
|
|
122
66
|
}
|
|
123
67
|
}
|
|
124
68
|
]
|
|
@@ -258,6 +202,74 @@
|
|
|
258
202
|
}
|
|
259
203
|
}
|
|
260
204
|
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"kind": "javascript-module",
|
|
208
|
+
"path": "src/ts/icon-dynamic/index.ts",
|
|
209
|
+
"declarations": [
|
|
210
|
+
{
|
|
211
|
+
"kind": "class",
|
|
212
|
+
"description": "Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:\n```\ncustomElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');\n```\nAfter calling successfully, the icon can be used like any other icon:\n```\n<ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>\n<nimble-mapping-icon icon=\"ok-ts-icon-dynamic-awesome\"></nimble-mapping-icon>\n```",
|
|
213
|
+
"name": "TsIconDynamic",
|
|
214
|
+
"members": [
|
|
215
|
+
{
|
|
216
|
+
"kind": "method",
|
|
217
|
+
"name": "registerIconDynamic",
|
|
218
|
+
"privacy": "public",
|
|
219
|
+
"static": true,
|
|
220
|
+
"return": {
|
|
221
|
+
"type": {
|
|
222
|
+
"text": "void"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"parameters": [
|
|
226
|
+
{
|
|
227
|
+
"name": "tagName",
|
|
228
|
+
"type": {
|
|
229
|
+
"text": "string"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "url",
|
|
234
|
+
"type": {
|
|
235
|
+
"text": "string"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"superclass": {
|
|
242
|
+
"name": "Icon",
|
|
243
|
+
"package": "@ni/nimble-components/dist/esm/icon-base"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"kind": "variable",
|
|
248
|
+
"name": "tsIconDynamicTag",
|
|
249
|
+
"type": {
|
|
250
|
+
"text": "string"
|
|
251
|
+
},
|
|
252
|
+
"default": "'ok-ts-icon-dynamic'"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"exports": [
|
|
256
|
+
{
|
|
257
|
+
"kind": "js",
|
|
258
|
+
"name": "TsIconDynamic",
|
|
259
|
+
"declaration": {
|
|
260
|
+
"name": "TsIconDynamic",
|
|
261
|
+
"module": "src/ts/icon-dynamic/index.ts"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"kind": "js",
|
|
266
|
+
"name": "tsIconDynamicTag",
|
|
267
|
+
"declaration": {
|
|
268
|
+
"name": "tsIconDynamicTag",
|
|
269
|
+
"module": "src/ts/icon-dynamic/index.ts"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
]
|
|
261
273
|
}
|
|
262
274
|
]
|
|
263
275
|
}
|
package/dist/custom-elements.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## class: `
|
|
1
|
+
## class: `ExButton`
|
|
2
2
|
|
|
3
3
|
### Superclass
|
|
4
4
|
|
|
@@ -8,22 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<hr/>
|
|
10
10
|
|
|
11
|
-
## class: `IconDynamic`
|
|
12
|
-
|
|
13
|
-
### Superclass
|
|
14
|
-
|
|
15
|
-
| Name | Module | Package |
|
|
16
|
-
| ------ | ------ | ---------------------------------------- |
|
|
17
|
-
| `Icon` | | @ni/nimble-components/dist/esm/icon-base |
|
|
18
|
-
|
|
19
|
-
### Static Methods
|
|
20
|
-
|
|
21
|
-
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
22
|
-
| --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
|
|
23
|
-
| `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
|
|
24
|
-
|
|
25
|
-
<hr/>
|
|
26
|
-
|
|
27
11
|
## class: `FvAccordionItem`
|
|
28
12
|
|
|
29
13
|
### Superclass
|
|
@@ -55,3 +39,19 @@
|
|
|
55
39
|
| `appearance` | appearance | |
|
|
56
40
|
|
|
57
41
|
<hr/>
|
|
42
|
+
|
|
43
|
+
## class: `TsIconDynamic`
|
|
44
|
+
|
|
45
|
+
### Superclass
|
|
46
|
+
|
|
47
|
+
| Name | Module | Package |
|
|
48
|
+
| ------ | ------ | ---------------------------------------- |
|
|
49
|
+
| `Icon` | | @ni/nimble-components/dist/esm/icon-base |
|
|
50
|
+
|
|
51
|
+
### Static Methods
|
|
52
|
+
|
|
53
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
54
|
+
| --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
|
|
55
|
+
| `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
|
|
56
|
+
|
|
57
|
+
<hr/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gDAAgD,CAAC;AAExD,OAAO,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gDAAgD,CAAC;AAExD,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC","sourcesContent":["/**\n * Import of all the web components available in Nimble, Spright, and Ok.\n * Production applications are encouraged to import only components\n * that are required instead of leveraging this file.\n */\n\nimport '@ni/spright-components/dist/esm/all-components';\n\nimport './fv/all-fv';\nimport './ex/all-ex';\nimport './ts/all-ts';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-ex.js","sourceRoot":"","sources":["../../../src/ex/all-ex.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC","sourcesContent":["import './button';\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FoundationElement } from '@ni/fast-foundation';
|
|
2
2
|
declare global {
|
|
3
3
|
interface HTMLElementTagNameMap {
|
|
4
|
-
'ok-button':
|
|
4
|
+
'ok-ex-button': ExButton;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A Ok demo component (not for production use)
|
|
9
9
|
*/
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class ExButton extends FoundationElement {
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const exButtonTag = "ok-ex-button";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
|
|
2
|
+
import { styles } from './styles';
|
|
3
|
+
import { template } from './template';
|
|
4
|
+
/**
|
|
5
|
+
* A Ok demo component (not for production use)
|
|
6
|
+
*/
|
|
7
|
+
export class ExButton extends FoundationElement {
|
|
8
|
+
}
|
|
9
|
+
const okExButton = ExButton.compose({
|
|
10
|
+
baseName: 'ex-button',
|
|
11
|
+
template,
|
|
12
|
+
styles
|
|
13
|
+
});
|
|
14
|
+
DesignSystem.getOrCreate().withPrefix('ok').register(okExButton());
|
|
15
|
+
export const exButtonTag = 'ok-ex-button';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ex/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB;CAAG;AAElD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,WAAW;IACrB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-ex-button': ExButton;\n }\n}\n\n/**\n * A Ok demo component (not for production use)\n */\nexport class ExButton extends FoundationElement {}\n\nconst okExButton = ExButton.compose({\n baseName: 'ex-button',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okExButton());\nexport const exButtonTag = 'ok-ex-button';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@ni/fast-element';
|
|
2
2
|
import { bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
3
|
-
import { display } from '
|
|
3
|
+
import { display } from '../../utilities/style/display';
|
|
4
4
|
export const styles = css `
|
|
5
5
|
${display('inline-block')}
|
|
6
6
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/ex/button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACxB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;4BAGD,gBAAgB;;;;;;;;6BAQf,qBAAqB;;;;gBAIlC,QAAQ;iBACP,aAAa;;;;iBAIb,qBAAqB;;CAErC,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n bodyDisabledFontColor,\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('inline-block')}\n\n :host {\n border: 2px solid ${borderHoverColor};\n }\n\n :host(:hover) {\n border-width: 4px;\n }\n\n :host([disabled]) {\n border-color: rgba(${borderRgbPartialColor}, 0.2);\n }\n\n slot {\n font: ${bodyFont};\n color: ${bodyFontColor};\n }\n\n :host([disabled]) slot {\n color: ${bodyDisabledFontColor};\n }\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/ex/button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAA,eAAe,CAAC","sourcesContent":["import { html } from '@ni/fast-element';\n\nexport const template = html`<slot></slot>`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './icon-dynamic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-ts.js","sourceRoot":"","sources":["../../../src/ts/all-ts.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC","sourcesContent":["import './icon-dynamic';\n"]}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Icon } from '@ni/nimble-components/dist/esm/icon-base';
|
|
2
2
|
declare global {
|
|
3
3
|
interface HTMLElementTagNameMap {
|
|
4
|
-
'ok-icon-dynamic':
|
|
4
|
+
'ok-ts-icon-dynamic': TsIconDynamic;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:
|
|
9
9
|
* ```
|
|
10
|
-
* customElements.get('ok-icon-dynamic').registerIconDynamic('ok-icon-dynamic-awesome', '<img data uri or arbitrary url>');
|
|
10
|
+
* customElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');
|
|
11
11
|
* ```
|
|
12
12
|
* After calling successfully, the icon can be used like any other icon:
|
|
13
13
|
* ```
|
|
14
|
-
* <ok-icon-dynamic-awesome></ok-icon-dynamic-awesome>
|
|
15
|
-
* <nimble-mapping-icon icon="ok-icon-dynamic-awesome"></nimble-mapping-icon>
|
|
14
|
+
* <ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>
|
|
15
|
+
* <nimble-mapping-icon icon="ok-ts-icon-dynamic-awesome"></nimble-mapping-icon>
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class TsIconDynamic extends Icon {
|
|
19
19
|
readonly url: string;
|
|
20
20
|
constructor(/** @internal */ url: string);
|
|
21
21
|
static registerIconDynamic(tagName: string, url: string): void;
|
|
22
22
|
}
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const tsIconDynamicTag = "ok-ts-icon-dynamic";
|
|
@@ -4,25 +4,25 @@ import { html, css } from '@ni/fast-element';
|
|
|
4
4
|
import { Icon } from '@ni/nimble-components/dist/esm/icon-base';
|
|
5
5
|
import { styles } from './styles';
|
|
6
6
|
import { template } from './template';
|
|
7
|
-
import { display } from '
|
|
7
|
+
import { display } from '../../utilities/style/display';
|
|
8
8
|
/**
|
|
9
9
|
* Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:
|
|
10
10
|
* ```
|
|
11
|
-
* customElements.get('ok-icon-dynamic').registerIconDynamic('ok-icon-dynamic-awesome', '<img data uri or arbitrary url>');
|
|
11
|
+
* customElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');
|
|
12
12
|
* ```
|
|
13
13
|
* After calling successfully, the icon can be used like any other icon:
|
|
14
14
|
* ```
|
|
15
|
-
* <ok-icon-dynamic-awesome></ok-icon-dynamic-awesome>
|
|
16
|
-
* <nimble-mapping-icon icon="ok-icon-dynamic-awesome"></nimble-mapping-icon>
|
|
15
|
+
* <ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>
|
|
16
|
+
* <nimble-mapping-icon icon="ok-ts-icon-dynamic-awesome"></nimble-mapping-icon>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export class
|
|
19
|
+
export class TsIconDynamic extends Icon {
|
|
20
20
|
constructor(/** @internal */ url) {
|
|
21
21
|
super();
|
|
22
22
|
this.url = url;
|
|
23
23
|
}
|
|
24
24
|
static registerIconDynamic(tagName, url) {
|
|
25
|
-
const tagPrefix = 'ok-icon-dynamic-';
|
|
25
|
+
const tagPrefix = 'ok-ts-icon-dynamic-';
|
|
26
26
|
if (!tagName.startsWith(tagPrefix)) {
|
|
27
27
|
throw new Error(`Icon tag name must start with '${tagPrefix}', provided name: ${tagName}`);
|
|
28
28
|
}
|
|
@@ -30,17 +30,17 @@ export class IconDynamic extends Icon {
|
|
|
30
30
|
if (!/^[a-z][a-z]+$/.test(name)) {
|
|
31
31
|
throw new Error(`Icon name must be lowercase [a-z] and at least two characters long, provided name: ${name}`);
|
|
32
32
|
}
|
|
33
|
-
const iconClassName = `
|
|
33
|
+
const iconClassName = `TsIconDynamic${name.charAt(0).toUpperCase() + name.slice(1)}`;
|
|
34
34
|
const iconClassContainer = {
|
|
35
35
|
// Class name for expression should come object literal assignment, helpful for stack traces, etc.
|
|
36
|
-
[iconClassName]: class extends
|
|
36
|
+
[iconClassName]: class extends TsIconDynamic {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(url);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const iconClass = iconClassContainer[iconClassName];
|
|
43
|
-
const baseName = `icon-dynamic-${name}`;
|
|
43
|
+
const baseName = `ts-icon-dynamic-${name}`;
|
|
44
44
|
const composedIcon = iconClass.compose({
|
|
45
45
|
baseName,
|
|
46
46
|
template,
|
|
@@ -49,11 +49,11 @@ export class IconDynamic extends Icon {
|
|
|
49
49
|
DesignSystem.getOrCreate().withPrefix('ok').register(composedIcon());
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
baseName: 'icon-dynamic',
|
|
52
|
+
const okTsIconDynamic = TsIconDynamic.compose({
|
|
53
|
+
baseName: 'ts-icon-dynamic',
|
|
54
54
|
template: html `<template></template>`,
|
|
55
55
|
styles: css `${display('none')}`
|
|
56
56
|
});
|
|
57
|
-
DesignSystem.getOrCreate().withPrefix('ok').register(
|
|
58
|
-
export const
|
|
57
|
+
DesignSystem.getOrCreate().withPrefix('ok').register(okTsIconDynamic());
|
|
58
|
+
export const tsIconDynamicTag = 'ok-ts-icon-dynamic';
|
|
59
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ts/icon-dynamic/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAQxD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAc,SAAQ,IAAI;IACnC,YAAmB,gBAAgB,CAAiB,GAAW;QAC3D,KAAK,EAAE,CAAC;QADwC,QAAG,GAAH,GAAG,CAAQ;IAE/D,CAAC;IAEM,MAAM,CAAC,mBAAmB,CAAC,OAAe,EAAE,GAAW;QAC1D,MAAM,SAAS,GAAG,qBAAqB,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,kCAAkC,SAAS,qBAAqB,OAAO,EAAE,CAAC,CAAC;QAC/F,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sFAAsF,IAAI,EAAE,CAAC,CAAC;QAClH,CAAC;QACD,MAAM,aAAa,GAAG,gBAAgB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,kBAAkB,GAAG;YACvB,kGAAkG;YAClG,CAAC,aAAa,CAAC,EAAE,KAAM,SAAQ,aAAa;gBACxC;oBACI,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,CAAC;aACJ;SACK,CAAC;QACX,MAAM,SAAS,GAAG,kBAAkB,CAAC,aAAa,CAAE,CAAC;QACrD,MAAM,QAAQ,GAAG,mBAAmB,IAAI,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC;YACnC,QAAQ;YACR,QAAQ;YACR,MAAM;SACT,CAAC,CAAC;QAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACzE,CAAC;CACJ;AAED,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC;IAC1C,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ,EAAE,IAAI,CAAA,uBAAuB;IACrC,MAAM,EAAE,GAAG,CAAA,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;CAClC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC","sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { DesignSystem } from '@ni/fast-foundation';\nimport { html, css } from '@ni/fast-element';\nimport { Icon } from '@ni/nimble-components/dist/esm/icon-base';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { display } from '../../utilities/style/display';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-ts-icon-dynamic': TsIconDynamic;\n }\n}\n\n/**\n * Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:\n * ```\n * customElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');\n * ```\n * After calling successfully, the icon can be used like any other icon:\n * ```\n * <ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>\n * <nimble-mapping-icon icon=\"ok-ts-icon-dynamic-awesome\"></nimble-mapping-icon>\n * ```\n */\nexport class TsIconDynamic extends Icon {\n public constructor(/** @internal */ public readonly url: string) {\n super();\n }\n\n public static registerIconDynamic(tagName: string, url: string): void {\n const tagPrefix = 'ok-ts-icon-dynamic-';\n if (!tagName.startsWith(tagPrefix)) {\n throw new Error(`Icon tag name must start with '${tagPrefix}', provided name: ${tagName}`);\n }\n const name = tagName.substring(tagPrefix.length);\n if (!/^[a-z][a-z]+$/.test(name)) {\n throw new Error(`Icon name must be lowercase [a-z] and at least two characters long, provided name: ${name}`);\n }\n const iconClassName = `TsIconDynamic${name.charAt(0).toUpperCase() + name.slice(1)}`;\n const iconClassContainer = {\n // Class name for expression should come object literal assignment, helpful for stack traces, etc.\n [iconClassName]: class extends TsIconDynamic {\n constructor() {\n super(url);\n }\n }\n } as const;\n const iconClass = iconClassContainer[iconClassName]!;\n const baseName = `ts-icon-dynamic-${name}`;\n const composedIcon = iconClass.compose({\n baseName,\n template,\n styles\n });\n\n DesignSystem.getOrCreate().withPrefix('ok').register(composedIcon());\n }\n}\n\nconst okTsIconDynamic = TsIconDynamic.compose({\n baseName: 'ts-icon-dynamic',\n template: html`<template></template>`,\n styles: css`${display('none')}`\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okTsIconDynamic());\nexport const tsIconDynamicTag = 'ok-ts-icon-dynamic';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@ni/fast-element';
|
|
2
2
|
import { iconSize, } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
3
|
-
import { display } from '
|
|
4
|
-
import { userSelectNone } from '
|
|
3
|
+
import { display } from '../../utilities/style/display';
|
|
4
|
+
import { userSelectNone } from '../../utilities/style/user-select';
|
|
5
5
|
export const styles = css `
|
|
6
6
|
${display('inline-flex')}
|
|
7
7
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/ts/icon-dynamic/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,QAAQ,GACX,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;UAIlB,cAAc;iBACP,QAAQ;kBACP,QAAQ;;;;;;;CAOzB,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n iconSize,\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\nimport { userSelectNone } from '../../utilities/style/user-select';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n align-items: center;\n ${userSelectNone}\n width: ${iconSize};\n height: ${iconSize};\n }\n\n img {\n width: 100%;\n height: 100%;\n }\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/ts/icon-dynamic/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe,+BAA+B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC","sourcesContent":["import { html } from '@ni/fast-element';\nimport type { TsIconDynamic } from '.';\n\nexport const template = html<TsIconDynamic>`<img aria-hidden=\"true\" src=${x => x.url}>`;\n"]}
|
package/package.json
CHANGED
package/dist/esm/button/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
|
|
2
|
-
import { styles } from './styles';
|
|
3
|
-
import { template } from './template';
|
|
4
|
-
/**
|
|
5
|
-
* A Ok demo component (not for production use)
|
|
6
|
-
*/
|
|
7
|
-
export class Button extends FoundationElement {
|
|
8
|
-
}
|
|
9
|
-
const okButton = Button.compose({
|
|
10
|
-
baseName: 'button',
|
|
11
|
-
template,
|
|
12
|
-
styles
|
|
13
|
-
});
|
|
14
|
-
DesignSystem.getOrCreate().withPrefix('ok').register(okButton());
|
|
15
|
-
export const buttonTag = 'ok-button';
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,iBAAiB;CAAG;AAEhD,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;IAC5B,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-button': Button;\n }\n}\n\n/**\n * A Ok demo component (not for production use)\n */\nexport class Button extends FoundationElement {}\n\nconst okButton = Button.compose({\n baseName: 'button',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okButton());\nexport const buttonTag = 'ok-button';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACxB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;4BAGD,gBAAgB;;;;;;;;6BAQf,qBAAqB;;;;gBAIlC,QAAQ;iBACP,aAAa;;;;iBAIb,qBAAqB;;CAErC,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n bodyDisabledFontColor,\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../utilities/style/display';\n\nexport const styles = css`\n ${display('inline-block')}\n\n :host {\n border: 2px solid ${borderHoverColor};\n }\n\n :host(:hover) {\n border-width: 4px;\n }\n\n :host([disabled]) {\n border-color: rgba(${borderRgbPartialColor}, 0.2);\n }\n\n slot {\n font: ${bodyFont};\n color: ${bodyFontColor};\n }\n\n :host([disabled]) slot {\n color: ${bodyDisabledFontColor};\n }\n`;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAA,eAAe,CAAC","sourcesContent":["import { html } from '@ni/fast-element';\n\nexport const template = html`<slot></slot>`;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon-dynamic/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAQrD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAI;IACjC,YAAmB,gBAAgB,CAAiB,GAAW;QAC3D,KAAK,EAAE,CAAC;QADwC,QAAG,GAAH,GAAG,CAAQ;IAE/D,CAAC;IAEM,MAAM,CAAC,mBAAmB,CAAC,OAAe,EAAE,GAAW;QAC1D,MAAM,SAAS,GAAG,kBAAkB,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,kCAAkC,SAAS,qBAAqB,OAAO,EAAE,CAAC,CAAC;QAC/F,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sFAAsF,IAAI,EAAE,CAAC,CAAC;QAClH,CAAC;QACD,MAAM,aAAa,GAAG,cAAc,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,MAAM,kBAAkB,GAAG;YACvB,kGAAkG;YAClG,CAAC,aAAa,CAAC,EAAE,KAAM,SAAQ,WAAW;gBACtC;oBACI,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,CAAC;aACJ;SACK,CAAC;QACX,MAAM,SAAS,GAAG,kBAAkB,CAAC,aAAa,CAAE,CAAC;QACrD,MAAM,QAAQ,GAAG,gBAAgB,IAAI,EAAE,CAAC;QACxC,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC;YACnC,QAAQ;YACR,QAAQ;YACR,MAAM;SACT,CAAC,CAAC;QAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACzE,CAAC;CACJ;AAED,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC;IACtC,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,IAAI,CAAA,uBAAuB;IACrC,MAAM,EAAE,GAAG,CAAA,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;CAClC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC","sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { DesignSystem } from '@ni/fast-foundation';\nimport { html, css } from '@ni/fast-element';\nimport { Icon } from '@ni/nimble-components/dist/esm/icon-base';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { display } from '../utilities/style/display';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-icon-dynamic': IconDynamic;\n }\n}\n\n/**\n * Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:\n * ```\n * customElements.get('ok-icon-dynamic').registerIconDynamic('ok-icon-dynamic-awesome', '<img data uri or arbitrary url>');\n * ```\n * After calling successfully, the icon can be used like any other icon:\n * ```\n * <ok-icon-dynamic-awesome></ok-icon-dynamic-awesome>\n * <nimble-mapping-icon icon=\"ok-icon-dynamic-awesome\"></nimble-mapping-icon>\n * ```\n */\nexport class IconDynamic extends Icon {\n public constructor(/** @internal */ public readonly url: string) {\n super();\n }\n\n public static registerIconDynamic(tagName: string, url: string): void {\n const tagPrefix = 'ok-icon-dynamic-';\n if (!tagName.startsWith(tagPrefix)) {\n throw new Error(`Icon tag name must start with '${tagPrefix}', provided name: ${tagName}`);\n }\n const name = tagName.substring(tagPrefix.length);\n if (!/^[a-z][a-z]+$/.test(name)) {\n throw new Error(`Icon name must be lowercase [a-z] and at least two characters long, provided name: ${name}`);\n }\n const iconClassName = `IconDynamic${name.charAt(0).toUpperCase() + name.slice(1)}`;\n const iconClassContainer = {\n // Class name for expression should come object literal assignment, helpful for stack traces, etc.\n [iconClassName]: class extends IconDynamic {\n constructor() {\n super(url);\n }\n }\n } as const;\n const iconClass = iconClassContainer[iconClassName]!;\n const baseName = `icon-dynamic-${name}`;\n const composedIcon = iconClass.compose({\n baseName,\n template,\n styles\n });\n\n DesignSystem.getOrCreate().withPrefix('ok').register(composedIcon());\n }\n}\n\nconst okIconDynamic = IconDynamic.compose({\n baseName: 'icon-dynamic',\n template: html`<template></template>`,\n styles: css`${display('none')}`\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okIconDynamic());\nexport const iconDynamicTag = 'ok-icon-dynamic';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/icon-dynamic/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,QAAQ,GACX,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;UAIlB,cAAc;iBACP,QAAQ;kBACP,QAAQ;;;;;;;CAOzB,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n iconSize,\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../utilities/style/display';\nimport { userSelectNone } from '../utilities/style/user-select';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n align-items: center;\n ${userSelectNone}\n width: ${iconSize};\n height: ${iconSize};\n }\n\n img {\n width: 100%;\n height: 100%;\n }\n`;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/icon-dynamic/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAa,+BAA+B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC","sourcesContent":["import { html } from '@ni/fast-element';\nimport type { IconDynamic } from '.';\n\nexport const template = html<IconDynamic>`<img aria-hidden=\"true\" src=${x => x.url}>`;\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|