minerva-design 1.9.0 → 1.11.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 +12 -0
- package/README.md +3 -1
- package/custom-elements.json +356 -0
- package/dist/angular/fesm2022/minerva-angular.mjs +744 -40
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +211 -0
- package/dist/core/contracts.cjs +1 -1
- package/dist/core/contracts.cjs.map +1 -1
- package/dist/core/contracts.js +1 -1
- package/dist/core/contracts.js.map +1 -1
- package/dist/icons/core.cjs +1 -1
- package/dist/icons/core.js +23 -9
- package/dist/icons/engine/canvas2d.cjs +1 -1
- package/dist/icons/engine/canvas2d.cjs.map +1 -1
- package/dist/icons/engine/canvas2d.d.cts +3 -3
- package/dist/icons/engine/canvas2d.d.ts +3 -3
- package/dist/icons/engine/canvas2d.js +37 -31
- package/dist/icons/engine/canvas2d.js.map +1 -1
- package/dist/icons/engine/define.cjs +1 -1
- package/dist/icons/engine/define.cjs.map +1 -1
- package/dist/icons/engine/define.js +5 -3
- package/dist/icons/engine/define.js.map +1 -1
- package/dist/icons/engine/icon-canvas.cjs +1 -1
- package/dist/icons/engine/icon-canvas.cjs.map +1 -1
- package/dist/icons/engine/icon-canvas.d.cts +1 -1
- package/dist/icons/engine/icon-canvas.d.ts +1 -1
- package/dist/icons/engine/icon-canvas.js +35 -30
- package/dist/icons/engine/icon-canvas.js.map +1 -1
- package/dist/icons/engine/icons/data.cjs +1 -1
- package/dist/icons/engine/icons/data.cjs.map +1 -1
- package/dist/icons/engine/icons/data.d.cts +1 -1
- package/dist/icons/engine/icons/data.d.ts +1 -1
- package/dist/icons/engine/icons/data.js +2 -8
- package/dist/icons/engine/icons/data.js.map +1 -1
- package/dist/icons/engine/icons/education.cjs +2 -0
- package/dist/icons/engine/icons/education.cjs.map +1 -0
- package/dist/icons/engine/icons/education.d.cts +61 -0
- package/dist/icons/engine/icons/education.d.ts +61 -0
- package/dist/icons/engine/icons/education.js +518 -0
- package/dist/icons/engine/icons/education.js.map +1 -0
- package/dist/icons/engine/icons/food.cjs +2 -0
- package/dist/icons/engine/icons/food.cjs.map +1 -0
- package/dist/icons/engine/icons/food.d.cts +57 -0
- package/dist/icons/engine/icons/food.d.ts +57 -0
- package/dist/icons/engine/icons/food.js +492 -0
- package/dist/icons/engine/icons/food.js.map +1 -0
- package/dist/icons/engine/icons/health.cjs +2 -0
- package/dist/icons/engine/icons/health.cjs.map +1 -0
- package/dist/icons/engine/icons/health.d.cts +33 -0
- package/dist/icons/engine/icons/health.d.ts +33 -0
- package/dist/icons/engine/icons/health.js +249 -0
- package/dist/icons/engine/icons/health.js.map +1 -0
- package/dist/icons/engine/icons/index.cjs +1 -0
- package/dist/icons/engine/icons/index.d.cts +13 -0
- package/dist/icons/engine/icons/index.d.ts +13 -0
- package/dist/icons/engine/icons/index.js +24 -0
- package/dist/icons/engine/icons/music.cjs +2 -0
- package/dist/icons/engine/icons/music.cjs.map +1 -0
- package/dist/icons/engine/icons/music.d.cts +37 -0
- package/dist/icons/engine/icons/music.d.ts +37 -0
- package/dist/icons/engine/icons/music.js +306 -0
- package/dist/icons/engine/icons/music.js.map +1 -0
- package/dist/icons/engine/icons/nature.cjs +2 -0
- package/dist/icons/engine/icons/nature.cjs.map +1 -0
- package/dist/icons/engine/icons/nature.d.cts +33 -0
- package/dist/icons/engine/icons/nature.d.ts +33 -0
- package/dist/icons/engine/icons/nature.js +265 -0
- package/dist/icons/engine/icons/nature.js.map +1 -0
- package/dist/icons/engine/icons/palette.cjs +2 -0
- package/dist/icons/engine/icons/palette.cjs.map +1 -0
- package/dist/icons/engine/icons/palette.d.cts +17 -0
- package/dist/icons/engine/icons/palette.d.ts +17 -0
- package/dist/icons/engine/icons/palette.js +22 -0
- package/dist/icons/engine/icons/palette.js.map +1 -0
- package/dist/icons/engine/icons/people.cjs +2 -0
- package/dist/icons/engine/icons/people.cjs.map +1 -0
- package/dist/icons/engine/icons/people.d.cts +57 -0
- package/dist/icons/engine/icons/people.d.ts +57 -0
- package/dist/icons/engine/icons/people.js +494 -0
- package/dist/icons/engine/icons/people.js.map +1 -0
- package/dist/icons/engine/icons/places.cjs +2 -0
- package/dist/icons/engine/icons/places.cjs.map +1 -0
- package/dist/icons/engine/icons/places.d.cts +63 -0
- package/dist/icons/engine/icons/places.d.ts +63 -0
- package/dist/icons/engine/icons/places.js +563 -0
- package/dist/icons/engine/icons/places.js.map +1 -0
- package/dist/icons/engine/icons/shapes.cjs +2 -0
- package/dist/icons/engine/icons/shapes.cjs.map +1 -0
- package/dist/icons/engine/icons/shapes.d.cts +63 -0
- package/dist/icons/engine/icons/shapes.d.ts +63 -0
- package/dist/icons/engine/icons/shapes.js +382 -0
- package/dist/icons/engine/icons/shapes.js.map +1 -0
- package/dist/icons/engine/icons/shopping.cjs +2 -0
- package/dist/icons/engine/icons/shopping.cjs.map +1 -0
- package/dist/icons/engine/icons/shopping.d.cts +33 -0
- package/dist/icons/engine/icons/shopping.d.ts +33 -0
- package/dist/icons/engine/icons/shopping.js +234 -0
- package/dist/icons/engine/icons/shopping.js.map +1 -0
- package/dist/icons/engine/icons/sports.cjs +2 -0
- package/dist/icons/engine/icons/sports.cjs.map +1 -0
- package/dist/icons/engine/icons/sports.d.cts +37 -0
- package/dist/icons/engine/icons/sports.d.ts +37 -0
- package/dist/icons/engine/icons/sports.js +344 -0
- package/dist/icons/engine/icons/sports.js.map +1 -0
- package/dist/icons/engine/icons/text.cjs +2 -0
- package/dist/icons/engine/icons/text.cjs.map +1 -0
- package/dist/icons/engine/icons/text.d.cts +63 -0
- package/dist/icons/engine/icons/text.d.ts +63 -0
- package/dist/icons/engine/icons/text.js +508 -0
- package/dist/icons/engine/icons/text.js.map +1 -0
- package/dist/icons/engine/icons/tools.cjs +2 -0
- package/dist/icons/engine/icons/tools.cjs.map +1 -0
- package/dist/icons/engine/icons/tools.d.cts +37 -0
- package/dist/icons/engine/icons/tools.d.ts +37 -0
- package/dist/icons/engine/icons/tools.js +270 -0
- package/dist/icons/engine/icons/tools.js.map +1 -0
- package/dist/icons/engine/icons/weather.cjs +2 -0
- package/dist/icons/engine/icons/weather.cjs.map +1 -0
- package/dist/icons/engine/icons/weather.d.cts +33 -0
- package/dist/icons/engine/icons/weather.d.ts +33 -0
- package/dist/icons/engine/icons/weather.js +249 -0
- package/dist/icons/engine/icons/weather.js.map +1 -0
- package/dist/icons/engine/layers.cjs +2 -0
- package/dist/icons/engine/layers.cjs.map +1 -0
- package/dist/icons/engine/layers.d.cts +8 -0
- package/dist/icons/engine/layers.d.ts +8 -0
- package/dist/icons/engine/layers.js +31 -0
- package/dist/icons/engine/layers.js.map +1 -0
- package/dist/icons/engine/registry.cjs +1 -1
- package/dist/icons/engine/registry.cjs.map +1 -1
- package/dist/icons/engine/registry.js +37 -11
- package/dist/icons/engine/registry.js.map +1 -1
- package/dist/icons/engine/surface.cjs +1 -1
- package/dist/icons/engine/surface.cjs.map +1 -1
- package/dist/icons/engine/surface.js +71 -69
- package/dist/icons/engine/surface.js.map +1 -1
- package/dist/icons/engine/svg.cjs +1 -1
- package/dist/icons/engine/svg.cjs.map +1 -1
- package/dist/icons/engine/svg.js +4 -1
- package/dist/icons/engine/svg.js.map +1 -1
- package/dist/icons/engine/types.d.cts +7 -1
- package/dist/icons/engine/types.d.ts +7 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.js +26 -12
- package/dist/icons/react/Icon.cjs +1 -1
- package/dist/icons/react/Icon.cjs.map +1 -1
- package/dist/icons/react/Icon.js +3 -2
- package/dist/icons/react/Icon.js.map +1 -1
- package/dist/icons/react/icons.cjs +1 -1
- package/dist/icons/react/icons.cjs.map +1 -1
- package/dist/icons/react/icons.d.cts +1188 -0
- package/dist/icons/react/icons.d.ts +1188 -0
- package/dist/icons/react/icons.js +21 -7
- package/dist/icons/react/icons.js.map +1 -1
- package/dist/vue/icon/DynamicIcon.vue.d.ts +68 -0
- package/dist/vue/icon/DynamicIcon.vue.js +7 -0
- package/dist/vue/icon/DynamicIcon.vue.js.map +1 -0
- package/dist/vue/icon/DynamicIcon.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/vue/icon/DynamicIcon.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/icon/Icon.vue.d.ts +69 -0
- package/dist/vue/icon/Icon.vue.js +7 -0
- package/dist/vue/icon/Icon.vue.js.map +1 -0
- package/dist/vue/icon/Icon.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/vue/icon/Icon.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/icon/IconCanvas.vue.d.ts +70 -0
- package/dist/vue/icon/IconCanvas.vue.js +7 -0
- package/dist/vue/icon/IconCanvas.vue.js.map +1 -0
- package/dist/vue/icon/IconCanvas.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/vue/icon/IconCanvas.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/icon/createIcon.d.ts +30 -0
- package/dist/vue/icon/createIcon.js +15 -0
- package/dist/vue/icon/createIcon.js.map +1 -0
- package/dist/vue/icon/icons.d.ts +499 -0
- package/dist/vue/icon/icons.js +8 -0
- package/dist/vue/icon/icons.js.map +1 -0
- package/dist/vue/icon/index.d.ts +6 -0
- package/dist/vue/icon/index.js +6 -0
- package/dist/vue/icon/props.d.ts +38 -0
- package/dist/vue/icon/props.js +28 -0
- package/dist/vue/icon/props.js.map +1 -0
- package/dist/vue/icons-global.d.ts +9 -0
- package/dist/vue/icons.d.ts +20 -0
- package/dist/vue/icons.js +23 -0
- package/dist/vue/icons.js.map +1 -0
- package/dist/web-components/components/icon/icon-canvas.d.ts +59 -0
- package/dist/web-components/components/icon/icon-canvas.js +89 -0
- package/dist/web-components/components/icon/icon-canvas.js.map +1 -0
- package/dist/web-components/components/icon/icon.d.ts +63 -0
- package/dist/web-components/components/icon/icon.js +116 -0
- package/dist/web-components/components/icon/icon.js.map +1 -0
- package/dist/web-components/components/icon/renderer.d.ts +25 -0
- package/dist/web-components/components/icon/renderer.js +21 -0
- package/dist/web-components/components/icon/renderer.js.map +1 -0
- package/dist/web-components/elements/icon.d.ts +4 -0
- package/dist/web-components/elements/icon.js +8 -0
- package/dist/web-components/elements/icon.js.map +1 -0
- package/dist/web-components/html-custom-data.json +110 -0
- package/dist/web-components/types/react.d.ts +18 -0
- package/dist/web-components/types/solid.d.ts +12 -0
- package/dist/web-components/types/svelte.d.ts +12 -0
- package/dist/web-components/types/vue.d.ts +14 -0
- package/package.json +12 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { nothing, PropertyValues } from 'lit';
|
|
2
|
+
import { IconDefinition, IconRendererKind } from '../../../icons/core.js';
|
|
3
|
+
import { MinervaElement } from '../../internal/minerva-element.js';
|
|
4
|
+
import { IconRenderer } from './renderer.js';
|
|
5
|
+
/**
|
|
6
|
+
* An icon of minerva-design/icons (the `<Icon>` of React): inline SVG by
|
|
7
|
+
* default (crisp at any size, styled by CSS, server-renderable), or a
|
|
8
|
+
* canvas drawn with WebGPU, WebGL2, WebGL or Canvas2D (`renderer`) by a
|
|
9
|
+
* backend shared by every canvas icon of the page. Set a built-in icon by
|
|
10
|
+
* `name` (`search`, `arrow-up`...) or any icon, custom ones made with
|
|
11
|
+
* `defineIcon` included, as the `icon` property. The stroke follows the
|
|
12
|
+
* text color unless `color` is set.
|
|
13
|
+
*
|
|
14
|
+
* Without `label` the icon is decorative (hidden from assistive
|
|
15
|
+
* technologies); with one it is an image with that accessible name. In
|
|
16
|
+
* canvas mode the host gets `data-renderer` with the backend drawing.
|
|
17
|
+
*
|
|
18
|
+
* Published as the optional entry `minerva-design/web-components/icon`
|
|
19
|
+
* (not part of the all-in-one entry nor the CDN bundle: it loads the icon
|
|
20
|
+
* set `minerva-design/icons/core`).
|
|
21
|
+
*
|
|
22
|
+
* @summary Icon of the Minerva icon set, as inline SVG or on a GPU canvas.
|
|
23
|
+
* @tag minerva-icon
|
|
24
|
+
* @fires minerva-renderer-change - Canvas mode: the backend drew the icon (or fell back after a GPU loss); detail: { renderer }
|
|
25
|
+
* @csspart icon - The <svg> (or the <canvas> in canvas mode) drawing the icon
|
|
26
|
+
*/
|
|
27
|
+
export declare class MinervaIcon extends MinervaElement {
|
|
28
|
+
static tagName: string;
|
|
29
|
+
static styles: import('lit').CSSResultGroup[];
|
|
30
|
+
/** Name of a built-in icon (`search`, `arrow-up`...); the `icon` property wins over it */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Icon definition (a built-in icon constant, or a custom icon of `defineIcon`); wins over `name`; property only */
|
|
33
|
+
icon?: IconDefinition;
|
|
34
|
+
/** Width and height in pixels */
|
|
35
|
+
size: number;
|
|
36
|
+
/** Stroke color, any CSS color (`currentColor` follows the text color) */
|
|
37
|
+
color: string;
|
|
38
|
+
/** Stroke width on the 24×24 grid (scales with the size unless `absolute-stroke-width`) */
|
|
39
|
+
strokeWidth: number;
|
|
40
|
+
/** Keeps the stroke width in pixels whatever the size */
|
|
41
|
+
absoluteStrokeWidth: boolean;
|
|
42
|
+
/** Accessible name: the icon becomes an image (role=img); without it the icon is hidden from assistive technologies */
|
|
43
|
+
label?: string;
|
|
44
|
+
/** `svg` (inline SVG), or a canvas drawn with the backend preference (`auto` follows the page default) */
|
|
45
|
+
renderer: IconRenderer;
|
|
46
|
+
private surface;
|
|
47
|
+
private surfaceCanvas;
|
|
48
|
+
private readonly drawn;
|
|
49
|
+
/** Backend drawing the canvas (`webgpu`, `webgl2`, `webgl`, `canvas2d`); `null` in SVG mode or until drawn */
|
|
50
|
+
getRenderer(): IconRendererKind | null;
|
|
51
|
+
private definition;
|
|
52
|
+
disconnectedCallback(): void;
|
|
53
|
+
protected updated(changed: PropertyValues): void;
|
|
54
|
+
/** Creates, updates or releases the canvas surface after a render */
|
|
55
|
+
private syncSurface;
|
|
56
|
+
private releaseSurface;
|
|
57
|
+
protected render(): typeof nothing | import('lit').TemplateResult<1>;
|
|
58
|
+
}
|
|
59
|
+
declare global {
|
|
60
|
+
interface HTMLElementTagNameMap {
|
|
61
|
+
"minerva-icon": MinervaIcon;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { DEV as e, devWarn as t } from "../../internal/dev.js";
|
|
2
|
+
import { MinervaElement as n, hostStyles as r } from "../../internal/minerva-element.js";
|
|
3
|
+
import i from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { RendererReporter as a, canvasRenderer as o } from "./renderer.js";
|
|
5
|
+
import { css as s, html as c, nothing as l, svg as u } from "lit";
|
|
6
|
+
import { property as d } from "lit/decorators.js";
|
|
7
|
+
import { styleMap as f } from "lit/directives/style-map.js";
|
|
8
|
+
import { ifDefined as p } from "lit/directives/if-defined.js";
|
|
9
|
+
import { createIconSurface as m, getIcon as h } from "../../../icons/core.js";
|
|
10
|
+
//#region src/components/icon/icon.ts
|
|
11
|
+
var g = 24, _ = 2, v = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, y = class i extends n {
|
|
12
|
+
constructor(...e) {
|
|
13
|
+
super(...e), this.size = 24, this.color = "currentColor", this.strokeWidth = 2, this.absoluteStrokeWidth = !1, this.renderer = "svg", this.surface = null, this.surfaceCanvas = null, this.drawn = new a(this, (e) => this.emit("minerva-renderer-change", { renderer: e }));
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.tagName = "minerva-icon";
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = [r, s`
|
|
20
|
+
:host{
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
flex: none;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
line-height: 0;
|
|
27
|
+
}
|
|
28
|
+
svg,
|
|
29
|
+
canvas{
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
`];
|
|
33
|
+
}
|
|
34
|
+
getRenderer() {
|
|
35
|
+
return this.drawn.current;
|
|
36
|
+
}
|
|
37
|
+
definition() {
|
|
38
|
+
if (this.icon) return this.icon;
|
|
39
|
+
if (!this.name) return;
|
|
40
|
+
let n = h(this.name);
|
|
41
|
+
return !n && e && t(i.tagName, `unknown icon name "${this.name}": nothing is rendered (see icons of minerva-design/icons/core).`), n;
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback(), this.releaseSurface();
|
|
45
|
+
}
|
|
46
|
+
updated(e) {
|
|
47
|
+
super.updated(e), this.syncSurface();
|
|
48
|
+
}
|
|
49
|
+
syncSurface() {
|
|
50
|
+
let e = this.renderRoot.querySelector("canvas[part=icon]"), t = this.definition(), n = o(this.renderer);
|
|
51
|
+
if (!this.isConnected || !e || !t || !n) {
|
|
52
|
+
this.releaseSurface();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.surfaceCanvas !== e && this.releaseSurface();
|
|
56
|
+
let r = v(this.size, g), i = v(this.strokeWidth, _), a = {
|
|
57
|
+
icon: t,
|
|
58
|
+
size: r,
|
|
59
|
+
color: this.color || "currentColor",
|
|
60
|
+
strokeWidth: this.absoluteStrokeWidth ? i * 24 / r : i,
|
|
61
|
+
renderer: n,
|
|
62
|
+
onRendererChange: (e) => this.drawn.report(e)
|
|
63
|
+
};
|
|
64
|
+
this.surface ? this.surface.update(a) : (this.surface = m(e, a), this.surfaceCanvas = e);
|
|
65
|
+
}
|
|
66
|
+
releaseSurface() {
|
|
67
|
+
this.surface?.destroy(), this.surface = null, this.surfaceCanvas = null, this.drawn.clear();
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
let e = this.definition();
|
|
71
|
+
if (!e) return l;
|
|
72
|
+
let t = v(this.size, g), n = this.label || void 0;
|
|
73
|
+
if (o(this.renderer)) return c`<canvas
|
|
74
|
+
part="icon"
|
|
75
|
+
data-icon=${e.name}
|
|
76
|
+
role=${p(n && "img")}
|
|
77
|
+
aria-label=${p(n)}
|
|
78
|
+
aria-hidden=${p(n ? void 0 : "true")}
|
|
79
|
+
style=${f({
|
|
80
|
+
width: `${t}px`,
|
|
81
|
+
height: `${t}px`
|
|
82
|
+
})}
|
|
83
|
+
></canvas>`;
|
|
84
|
+
let r = this.absoluteStrokeWidth ? "non-scaling-stroke" : void 0;
|
|
85
|
+
return c`<svg
|
|
86
|
+
part="icon"
|
|
87
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
88
|
+
width=${t}
|
|
89
|
+
height=${t}
|
|
90
|
+
viewBox="0 0 24 24"
|
|
91
|
+
fill="none"
|
|
92
|
+
stroke=${this.color || "currentColor"}
|
|
93
|
+
stroke-width=${v(this.strokeWidth, _)}
|
|
94
|
+
stroke-linecap="round"
|
|
95
|
+
stroke-linejoin="round"
|
|
96
|
+
data-icon=${e.name}
|
|
97
|
+
role=${p(n && "img")}
|
|
98
|
+
aria-label=${p(n)}
|
|
99
|
+
aria-hidden=${p(n ? void 0 : "true")}
|
|
100
|
+
>
|
|
101
|
+
${n ? u`<title>${n}</title>` : l}
|
|
102
|
+
${e.paths.map((t, n) => u`<path d=${t} stroke=${p(e.colors?.[n])} vector-effect=${p(r)}></path>`)}
|
|
103
|
+
</svg>`;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
i([d()], y.prototype, "name", void 0), i([d({ attribute: !1 })], y.prototype, "icon", void 0), i([d({ type: Number })], y.prototype, "size", void 0), i([d()], y.prototype, "color", void 0), i([d({
|
|
107
|
+
type: Number,
|
|
108
|
+
attribute: "stroke-width"
|
|
109
|
+
})], y.prototype, "strokeWidth", void 0), i([d({
|
|
110
|
+
type: Boolean,
|
|
111
|
+
attribute: "absolute-stroke-width"
|
|
112
|
+
})], y.prototype, "absoluteStrokeWidth", void 0), i([d()], y.prototype, "label", void 0), i([d()], y.prototype, "renderer", void 0);
|
|
113
|
+
//#endregion
|
|
114
|
+
export { y as MinervaIcon };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","names":["_decorate","__decorate","DEFAULT_SIZE","DEFAULT_STROKE_WIDTH","positive","value","fallback","MinervaIcon","MinervaElement","_args","RendererReporter","hostStyles","icon","getIcon","DEV","devWarn","changed","canvas","renderer","canvasRenderer","size","strokeWidth","options","kind","createIconSurface","nothing","label","ifDefined","styleMap","scaling","d","i","property"],"sources":["../../../../../web-components/src/components/icon/icon.ts"],"sourcesContent":["import { css, html, nothing, svg, type PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport {\n createIconSurface,\n getIcon,\n type IconDefinition,\n type IconRendererKind,\n type IconSurface,\n type IconSurfaceOptions,\n} from \"minerva-design/icons/core\";\nimport { DEV, devWarn } from \"../../internal/dev\";\nimport { MinervaElement, hostStyles } from \"../../internal/minerva-element\";\nimport {\n RendererReporter,\n canvasRenderer,\n type IconRenderer,\n} from \"./renderer\";\n\nconst DEFAULT_SIZE = 24;\nconst DEFAULT_STROKE_WIDTH = 2;\n\nconst positive = (value: number | undefined, fallback: number) =>\n typeof value === \"number\" && Number.isFinite(value) && value > 0\n ? value\n : fallback;\n\n/**\n * An icon of minerva-design/icons (the `<Icon>` of React): inline SVG by\n * default (crisp at any size, styled by CSS, server-renderable), or a\n * canvas drawn with WebGPU, WebGL2, WebGL or Canvas2D (`renderer`) by a\n * backend shared by every canvas icon of the page. Set a built-in icon by\n * `name` (`search`, `arrow-up`...) or any icon, custom ones made with\n * `defineIcon` included, as the `icon` property. The stroke follows the\n * text color unless `color` is set.\n *\n * Without `label` the icon is decorative (hidden from assistive\n * technologies); with one it is an image with that accessible name. In\n * canvas mode the host gets `data-renderer` with the backend drawing.\n *\n * Published as the optional entry `minerva-design/web-components/icon`\n * (not part of the all-in-one entry nor the CDN bundle: it loads the icon\n * set `minerva-design/icons/core`).\n *\n * @summary Icon of the Minerva icon set, as inline SVG or on a GPU canvas.\n * @tag minerva-icon\n * @fires minerva-renderer-change - Canvas mode: the backend drew the icon (or fell back after a GPU loss); detail: { renderer }\n * @csspart icon - The <svg> (or the <canvas> in canvas mode) drawing the icon\n */\nexport class MinervaIcon extends MinervaElement {\n static override tagName = \"minerva-icon\";\n static override styles = [\n hostStyles,\n css`\n:host{\ndisplay: inline-flex;\nflex: none;\nalign-items: center;\njustify-content: center;\nvertical-align: middle;\nline-height: 0;\n}\nsvg,\ncanvas{\ndisplay: block;\n}\n`,\n ];\n\n /** Name of a built-in icon (`search`, `arrow-up`...); the `icon` property wins over it */\n @property()\n name?: string;\n\n /** Icon definition (a built-in icon constant, or a custom icon of `defineIcon`); wins over `name`; property only */\n @property({ attribute: false })\n icon?: IconDefinition;\n\n /** Width and height in pixels */\n @property({ type: Number })\n size = 24;\n\n /** Stroke color, any CSS color (`currentColor` follows the text color) */\n @property()\n color = \"currentColor\";\n\n /** Stroke width on the 24×24 grid (scales with the size unless `absolute-stroke-width`) */\n @property({ type: Number, attribute: \"stroke-width\" })\n strokeWidth = 2;\n\n /** Keeps the stroke width in pixels whatever the size */\n @property({ type: Boolean, attribute: \"absolute-stroke-width\" })\n absoluteStrokeWidth = false;\n\n /** Accessible name: the icon becomes an image (role=img); without it the icon is hidden from assistive technologies */\n @property()\n label?: string;\n\n /** `svg` (inline SVG), or a canvas drawn with the backend preference (`auto` follows the page default) */\n @property()\n renderer: IconRenderer = \"svg\";\n\n private surface: IconSurface | null = null;\n private surfaceCanvas: HTMLCanvasElement | null = null;\n private readonly drawn = new RendererReporter(this, (renderer) =>\n this.emit(\"minerva-renderer-change\", { renderer }),\n );\n\n /** Backend drawing the canvas (`webgpu`, `webgl2`, `webgl`, `canvas2d`); `null` in SVG mode or until drawn */\n getRenderer(): IconRendererKind | null {\n return this.drawn.current;\n }\n\n private definition(): IconDefinition | undefined {\n if (this.icon) return this.icon;\n if (!this.name) return undefined;\n const icon = getIcon(this.name);\n if (!icon && DEV) {\n devWarn(\n MinervaIcon.tagName,\n `unknown icon name \"${this.name}\": nothing is rendered (see icons of minerva-design/icons/core).`,\n );\n }\n return icon;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.releaseSurface();\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.syncSurface();\n }\n\n /** Creates, updates or releases the canvas surface after a render */\n private syncSurface(): void {\n const canvas =\n this.renderRoot.querySelector<HTMLCanvasElement>(\"canvas[part=icon]\");\n const icon = this.definition();\n const renderer = canvasRenderer(this.renderer);\n if (!this.isConnected || !canvas || !icon || !renderer) {\n this.releaseSurface();\n return;\n }\n if (this.surfaceCanvas !== canvas) this.releaseSurface();\n const size = positive(this.size, DEFAULT_SIZE);\n const strokeWidth = positive(this.strokeWidth, DEFAULT_STROKE_WIDTH);\n const options: IconSurfaceOptions = {\n icon,\n size,\n color: this.color || \"currentColor\",\n strokeWidth: this.absoluteStrokeWidth\n ? (strokeWidth * 24) / size\n : strokeWidth,\n renderer,\n onRendererChange: (kind) => this.drawn.report(kind),\n };\n if (this.surface) {\n this.surface.update(options);\n } else {\n this.surface = createIconSurface(canvas, options);\n this.surfaceCanvas = canvas;\n }\n }\n\n private releaseSurface(): void {\n this.surface?.destroy();\n this.surface = null;\n this.surfaceCanvas = null;\n this.drawn.clear();\n }\n\n protected override render() {\n const icon = this.definition();\n if (!icon) return nothing;\n const size = positive(this.size, DEFAULT_SIZE);\n const label = this.label || undefined;\n if (canvasRenderer(this.renderer)) {\n return html`<canvas\npart=\"icon\"\ndata-icon=${icon.name}\nrole=${ifDefined(label && \"img\")}\naria-label=${ifDefined(label)}\naria-hidden=${ifDefined(label ? undefined : \"true\")}\nstyle=${styleMap({ width: `${size}px`, height: `${size}px` })}\n></canvas>`;\n }\n const scaling = this.absoluteStrokeWidth ? \"non-scaling-stroke\" : undefined;\n return html`<svg\npart=\"icon\"\nxmlns=\"http://www.w3.org/2000/svg\"\nwidth=${size}\nheight=${size}\nviewBox=\"0 0 24 24\"\nfill=\"none\"\nstroke=${this.color || \"currentColor\"}\nstroke-width=${positive(this.strokeWidth, DEFAULT_STROKE_WIDTH)}\nstroke-linecap=\"round\"\nstroke-linejoin=\"round\"\ndata-icon=${icon.name}\nrole=${ifDefined(label && \"img\")}\naria-label=${ifDefined(label)}\naria-hidden=${ifDefined(label ? undefined : \"true\")}\n>\n${label ? svg`<title>${label}</title>` : nothing}\n${icon.paths.map(\n (d, i) =>\n svg`<path d=${d} stroke=${ifDefined(icon.colors?.[i])} vector-effect=${ifDefined(scaling)}></path>`,\n )}\n</svg>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"minerva-icon\": MinervaIcon;\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IconRendererKind } from '../../../icons/core.js';
|
|
2
|
+
/**
|
|
3
|
+
* Backend preference of an icon canvas: `auto` (the page default set with
|
|
4
|
+
* `setDefaultIconRenderer`), or the backend tried first (falling back along
|
|
5
|
+
* WebGPU, WebGL2, WebGL, Canvas2D)
|
|
6
|
+
*/
|
|
7
|
+
export type IconCanvasRenderer = "auto" | "webgpu" | "webgl2" | "webgl" | "canvas2d";
|
|
8
|
+
/** How `<minerva-icon>` draws: inline SVG, or a canvas with a backend preference */
|
|
9
|
+
export type IconRenderer = "svg" | "auto" | "webgpu" | "webgl2" | "webgl" | "canvas2d";
|
|
10
|
+
/** The canvas preference of an attribute value; `null` for "svg" and unknown values */
|
|
11
|
+
export declare const canvasRenderer: (value: string | null | undefined) => IconCanvasRenderer | null;
|
|
12
|
+
/**
|
|
13
|
+
* Mirrors the backend drawing an element's canvas as its `data-renderer`
|
|
14
|
+
* host attribute (hydration-safe) and reports each change once.
|
|
15
|
+
*/
|
|
16
|
+
export declare class RendererReporter {
|
|
17
|
+
private kind;
|
|
18
|
+
private readonly host;
|
|
19
|
+
private readonly changed;
|
|
20
|
+
constructor(host: HTMLElement, changed: (kind: IconRendererKind) => void);
|
|
21
|
+
get current(): IconRendererKind | null;
|
|
22
|
+
report(kind: IconRendererKind): void;
|
|
23
|
+
/** Nothing draws anymore (SVG mode, no icon, disconnected) */
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { setHostAttribute as e } from "../../internal/hydration.js";
|
|
2
|
+
import { ICON_RENDERER_PREFERENCES as t } from "../../../icons/core.js";
|
|
3
|
+
//#region src/components/icon/renderer.ts
|
|
4
|
+
var n = new Set(t), r = (e) => e && n.has(e) ? e : null, i = class {
|
|
5
|
+
constructor(e, t) {
|
|
6
|
+
this.kind = null, this.host = e, this.changed = t;
|
|
7
|
+
}
|
|
8
|
+
get current() {
|
|
9
|
+
return this.kind;
|
|
10
|
+
}
|
|
11
|
+
report(t) {
|
|
12
|
+
this.kind !== t && (this.kind = t, e(this.host, "data-renderer", t), this.changed(t));
|
|
13
|
+
}
|
|
14
|
+
clear() {
|
|
15
|
+
this.kind && (this.kind = null, e(this.host, "data-renderer", null));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { i as RendererReporter, r as canvasRenderer };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","names":["CANVAS_RENDERERS","ICON_RENDERER_PREFERENCES","canvasRenderer","value","RendererReporter","host","changed","kind","setHostAttribute"],"sources":["../../../../../web-components/src/components/icon/renderer.ts"],"sourcesContent":["import {\n ICON_RENDERER_PREFERENCES,\n type IconRendererKind,\n} from \"minerva-design/icons/core\";\nimport { setHostAttribute } from \"../../internal/hydration\";\n\n/**\n * Backend preference of an icon canvas: `auto` (the page default set with\n * `setDefaultIconRenderer`), or the backend tried first (falling back along\n * WebGPU, WebGL2, WebGL, Canvas2D)\n */\nexport type IconCanvasRenderer =\n \"auto\" | \"webgpu\" | \"webgl2\" | \"webgl\" | \"canvas2d\";\n\n/** How `<minerva-icon>` draws: inline SVG, or a canvas with a backend preference */\nexport type IconRenderer =\n \"svg\" | \"auto\" | \"webgpu\" | \"webgl2\" | \"webgl\" | \"canvas2d\";\n\nconst CANVAS_RENDERERS: ReadonlySet<string> = new Set<IconCanvasRenderer>(\n ICON_RENDERER_PREFERENCES,\n);\n\n/** The canvas preference of an attribute value; `null` for \"svg\" and unknown values */\nexport const canvasRenderer = (\n value: string | null | undefined,\n): IconCanvasRenderer | null =>\n value && CANVAS_RENDERERS.has(value) ? (value as IconCanvasRenderer) : null;\n\n/**\n * Mirrors the backend drawing an element's canvas as its `data-renderer`\n * host attribute (hydration-safe) and reports each change once.\n */\nexport class RendererReporter {\n private kind: IconRendererKind | null = null;\n private readonly host: HTMLElement;\n private readonly changed: (kind: IconRendererKind) => void;\n\n constructor(host: HTMLElement, changed: (kind: IconRendererKind) => void) {\n this.host = host;\n this.changed = changed;\n }\n\n get current(): IconRendererKind | null {\n return this.kind;\n }\n\n report(kind: IconRendererKind): void {\n if (this.kind === kind) return;\n this.kind = kind;\n setHostAttribute(this.host, \"data-renderer\", kind);\n this.changed(kind);\n }\n\n /** Nothing draws anymore (SVG mode, no icon, disconnected) */\n clear(): void {\n if (!this.kind) return;\n this.kind = null;\n setHostAttribute(this.host, \"data-renderer\", null);\n }\n}\n"],"mappings":";;;AAkBA,IAAMA,IAAwC,IAAI,IAChDC,CACF,GAGaC,KACX,MAEAC,KAASH,EAAiB,IAAIG,CAAK,IAAKA,IAA+B,MAM5DC,IAAb,MAA8B;CAK5B,YAAY,GAAmB,GAA2C;EAExE,AANsC,KAAA,OAAA,MAKtC,KAAK,OAAOC,GACZ,KAAK,UAAUC;CACjB;CAEA,IAAI,UAAmC;EACrC,OAAO,KAAK;CACd;CAEA,OAAO,GAA8B;EACnC,AAAI,KAAK,SAASC,MAClB,KAAK,OAAOA,GACZC,EAAiB,KAAK,MAAM,iBAAiBD,CAAI,GACjD,KAAK,QAAQA,CAAI;CACnB;CAGA,QAAc;EACZ,AAAK,KAAK,SACV,KAAK,OAAO,MACZC,EAAiB,KAAK,MAAM,iBAAiB,IAAI;CACnD;AACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from '../components/icon/icon.js';
|
|
2
|
+
export * from '../components/icon/icon-canvas.js';
|
|
3
|
+
export type { IconCanvasRenderer, IconRenderer, } from '../components/icon/renderer.js';
|
|
4
|
+
export type { IconCanvasItem, IconDefinition, IconRendererKind, IconRendererPreference, } from '../../icons/core.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineElement as e } from "../internal/define.js";
|
|
2
|
+
import { MinervaIcon as t } from "../components/icon/icon.js";
|
|
3
|
+
import { MinervaIconCanvas as n } from "../components/icon/icon-canvas.js";
|
|
4
|
+
e(t), e(n);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { t as MinervaIcon, n as MinervaIconCanvas };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","names":["defineElement","MinervaIcon","MinervaIconCanvas"],"sources":["../../../../web-components/src/elements/icon.ts"],"sourcesContent":["// Registers <minerva-icon> and <minerva-icon-canvas>. Optional entry: not\n// part of the all-in-one entry nor of the CDN bundle, since it loads the\n// icon set (minerva-design/icons/core, shared with the React icons).\nimport { MinervaIcon } from \"../components/icon/icon\";\nimport { MinervaIconCanvas } from \"../components/icon/icon-canvas\";\nimport { defineElement } from \"../internal/define\";\n\ndefineElement(MinervaIcon);\ndefineElement(MinervaIconCanvas);\n\nexport * from \"../components/icon/icon\";\nexport * from \"../components/icon/icon-canvas\";\nexport type {\n IconCanvasRenderer,\n IconRenderer,\n} from \"../components/icon/renderer\";\n// the icon types used with the elements (the rest: minerva-design/icons/core)\nexport type {\n IconCanvasItem,\n IconDefinition,\n IconRendererKind,\n IconRendererPreference,\n} from \"minerva-design/icons/core\";\n"],"mappings":";;;AAOAA,EAAcC,CAAW,GACzBD,EAAcE,CAAiB"}
|
|
@@ -2839,6 +2839,67 @@
|
|
|
2839
2839
|
}
|
|
2840
2840
|
]
|
|
2841
2841
|
},
|
|
2842
|
+
{
|
|
2843
|
+
"name": "minerva-icon",
|
|
2844
|
+
"description": "Icon of the Minerva icon set, as inline SVG or on a GPU canvas.\n\nEvents: `minerva-renderer-change`",
|
|
2845
|
+
"attributes": [
|
|
2846
|
+
{
|
|
2847
|
+
"name": "name",
|
|
2848
|
+
"description": "Name of a built-in icon (`search`, `arrow-up`...); the `icon` property wins over it"
|
|
2849
|
+
},
|
|
2850
|
+
{
|
|
2851
|
+
"name": "size",
|
|
2852
|
+
"description": "Width and height in pixels\n\nDefault: 24"
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
"name": "color",
|
|
2856
|
+
"description": "Stroke color, any CSS color (`currentColor` follows the text color)\n\nDefault: \"currentColor\""
|
|
2857
|
+
},
|
|
2858
|
+
{
|
|
2859
|
+
"name": "stroke-width",
|
|
2860
|
+
"description": "Stroke width on the 24×24 grid (scales with the size unless `absolute-stroke-width`)\n\nDefault: 2"
|
|
2861
|
+
},
|
|
2862
|
+
{
|
|
2863
|
+
"name": "absolute-stroke-width",
|
|
2864
|
+
"description": "Keeps the stroke width in pixels whatever the size\n\nDefault: false",
|
|
2865
|
+
"valueSet": "v"
|
|
2866
|
+
},
|
|
2867
|
+
{
|
|
2868
|
+
"name": "label",
|
|
2869
|
+
"description": "Accessible name: the icon becomes an image (role=img); without it the icon is hidden from assistive technologies"
|
|
2870
|
+
},
|
|
2871
|
+
{
|
|
2872
|
+
"name": "renderer",
|
|
2873
|
+
"description": "`svg` (inline SVG), or a canvas drawn with the backend preference (`auto` follows the page default)\n\nDefault: \"svg\"",
|
|
2874
|
+
"values": [
|
|
2875
|
+
{
|
|
2876
|
+
"name": "svg"
|
|
2877
|
+
},
|
|
2878
|
+
{
|
|
2879
|
+
"name": "auto"
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
"name": "webgpu"
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
"name": "webgl2"
|
|
2886
|
+
},
|
|
2887
|
+
{
|
|
2888
|
+
"name": "webgl"
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
"name": "canvas2d"
|
|
2892
|
+
}
|
|
2893
|
+
]
|
|
2894
|
+
}
|
|
2895
|
+
],
|
|
2896
|
+
"references": [
|
|
2897
|
+
{
|
|
2898
|
+
"name": "Documentation",
|
|
2899
|
+
"url": "https://fwx5618177.github.io/minerva-design/web-components/icon"
|
|
2900
|
+
}
|
|
2901
|
+
]
|
|
2902
|
+
},
|
|
2842
2903
|
{
|
|
2843
2904
|
"name": "minerva-icon-button",
|
|
2844
2905
|
"description": "Icon-only button with a tooltip, toggle and loading states.\n\nEvents: `minerva-pressed-change`\n\nSlots: `(default)`",
|
|
@@ -2972,6 +3033,55 @@
|
|
|
2972
3033
|
}
|
|
2973
3034
|
]
|
|
2974
3035
|
},
|
|
3036
|
+
{
|
|
3037
|
+
"name": "minerva-icon-canvas",
|
|
3038
|
+
"description": "Thousands of icons on one GPU canvas.\n\nEvents: `minerva-renderer-change`",
|
|
3039
|
+
"attributes": [
|
|
3040
|
+
{
|
|
3041
|
+
"name": "renderer",
|
|
3042
|
+
"description": "Backend preference (`auto` follows the page default)\n\nDefault: \"auto\"",
|
|
3043
|
+
"values": [
|
|
3044
|
+
{
|
|
3045
|
+
"name": "auto"
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
"name": "webgpu"
|
|
3049
|
+
},
|
|
3050
|
+
{
|
|
3051
|
+
"name": "webgl2"
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
"name": "webgl"
|
|
3055
|
+
},
|
|
3056
|
+
{
|
|
3057
|
+
"name": "canvas2d"
|
|
3058
|
+
}
|
|
3059
|
+
]
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
"name": "width",
|
|
3063
|
+
"description": "Width of the canvas box: a number is in pixels, or any CSS size\n\nDefault: \"100%\""
|
|
3064
|
+
},
|
|
3065
|
+
{
|
|
3066
|
+
"name": "height",
|
|
3067
|
+
"description": "Height of the canvas box: a number is in pixels, or any CSS size\n\nDefault: 240"
|
|
3068
|
+
},
|
|
3069
|
+
{
|
|
3070
|
+
"name": "pixel-ratio",
|
|
3071
|
+
"description": "Device pixel ratio of the canvas; by default the screen's"
|
|
3072
|
+
},
|
|
3073
|
+
{
|
|
3074
|
+
"name": "label",
|
|
3075
|
+
"description": "Accessible name of the picture (role=img); without it the canvas is hidden from assistive technologies"
|
|
3076
|
+
}
|
|
3077
|
+
],
|
|
3078
|
+
"references": [
|
|
3079
|
+
{
|
|
3080
|
+
"name": "Documentation",
|
|
3081
|
+
"url": "https://fwx5618177.github.io/minerva-design/web-components/icon-canvas"
|
|
3082
|
+
}
|
|
3083
|
+
]
|
|
3084
|
+
},
|
|
2975
3085
|
{
|
|
2976
3086
|
"name": "minerva-input",
|
|
2977
3087
|
"description": "Text field with prefix / suffix, clear button and character count.\n\nEvents: `change`, `input`, `minerva-input`, `minerva-change`, `minerva-clear`\n\nSlots: `prefix`, `suffix`",
|
|
@@ -150,6 +150,10 @@ import type {
|
|
|
150
150
|
MinervaOrderBookHeatmap,
|
|
151
151
|
MinervaTimeAndSales,
|
|
152
152
|
} from "../elements/order-book.js";
|
|
153
|
+
import type {
|
|
154
|
+
MinervaIcon,
|
|
155
|
+
MinervaIconCanvas,
|
|
156
|
+
} from "../elements/icon.js";
|
|
153
157
|
import type {
|
|
154
158
|
MinervaTradingChart,
|
|
155
159
|
} from "../elements/trading-chart.js";
|
|
@@ -654,6 +658,13 @@ declare module "react" {
|
|
|
654
658
|
|
|
655
659
|
}
|
|
656
660
|
>;
|
|
661
|
+
"minerva-icon": MinervaIntrinsic<
|
|
662
|
+
MinervaIcon,
|
|
663
|
+
Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">>,
|
|
664
|
+
{
|
|
665
|
+
"onminerva-renderer-change"?: (event: CustomEvent) => void;
|
|
666
|
+
}
|
|
667
|
+
>;
|
|
657
668
|
"minerva-icon-button": MinervaIntrinsic<
|
|
658
669
|
MinervaIconButton,
|
|
659
670
|
Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">>,
|
|
@@ -661,6 +672,13 @@ declare module "react" {
|
|
|
661
672
|
"onminerva-pressed-change"?: (event: CustomEvent) => void;
|
|
662
673
|
}
|
|
663
674
|
>;
|
|
675
|
+
"minerva-icon-canvas": MinervaIntrinsic<
|
|
676
|
+
MinervaIconCanvas,
|
|
677
|
+
Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">>,
|
|
678
|
+
{
|
|
679
|
+
"onminerva-renderer-change"?: (event: CustomEvent) => void;
|
|
680
|
+
}
|
|
681
|
+
>;
|
|
664
682
|
"minerva-input": MinervaIntrinsic<
|
|
665
683
|
MinervaInput,
|
|
666
684
|
Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">>,
|
|
@@ -150,6 +150,10 @@ import type {
|
|
|
150
150
|
MinervaOrderBookHeatmap,
|
|
151
151
|
MinervaTimeAndSales,
|
|
152
152
|
} from "../elements/order-book.js";
|
|
153
|
+
import type {
|
|
154
|
+
MinervaIcon,
|
|
155
|
+
MinervaIconCanvas,
|
|
156
|
+
} from "../elements/icon.js";
|
|
153
157
|
import type {
|
|
154
158
|
MinervaTradingChart,
|
|
155
159
|
} from "../elements/trading-chart.js";
|
|
@@ -482,10 +486,18 @@ declare module "solid-js" {
|
|
|
482
486
|
Partial<Pick<MinervaHtmlPreview, "html" | "label" | "viewport" | "mobileWidth" | "height">> & {
|
|
483
487
|
|
|
484
488
|
};
|
|
489
|
+
"minerva-icon": Omit<JSX.HTMLAttributes<MinervaIcon>, keyof Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">>> &
|
|
490
|
+
Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">> & {
|
|
491
|
+
"on:minerva-renderer-change"?: (event: CustomEvent) => void;
|
|
492
|
+
};
|
|
485
493
|
"minerva-icon-button": Omit<JSX.HTMLAttributes<MinervaIconButton>, keyof Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">>> &
|
|
486
494
|
Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">> & {
|
|
487
495
|
"on:minerva-pressed-change"?: (event: CustomEvent) => void;
|
|
488
496
|
};
|
|
497
|
+
"minerva-icon-canvas": Omit<JSX.HTMLAttributes<MinervaIconCanvas>, keyof Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">>> &
|
|
498
|
+
Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">> & {
|
|
499
|
+
"on:minerva-renderer-change"?: (event: CustomEvent) => void;
|
|
500
|
+
};
|
|
489
501
|
"minerva-input": Omit<JSX.HTMLAttributes<MinervaInput>, keyof Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">>> &
|
|
490
502
|
Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">> & {
|
|
491
503
|
"on:change"?: (event: CustomEvent) => void;
|
|
@@ -150,6 +150,10 @@ import type {
|
|
|
150
150
|
MinervaOrderBookHeatmap,
|
|
151
151
|
MinervaTimeAndSales,
|
|
152
152
|
} from "../elements/order-book.js";
|
|
153
|
+
import type {
|
|
154
|
+
MinervaIcon,
|
|
155
|
+
MinervaIconCanvas,
|
|
156
|
+
} from "../elements/icon.js";
|
|
153
157
|
import type {
|
|
154
158
|
MinervaTradingChart,
|
|
155
159
|
} from "../elements/trading-chart.js";
|
|
@@ -480,10 +484,18 @@ declare module "svelte/elements" {
|
|
|
480
484
|
Partial<Pick<MinervaHtmlPreview, "html" | "label" | "viewport" | "mobileWidth" | "height">> & {
|
|
481
485
|
|
|
482
486
|
};
|
|
487
|
+
"minerva-icon": Omit<HTMLAttributes<MinervaIcon>, keyof Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">>> &
|
|
488
|
+
Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">> & {
|
|
489
|
+
"onminerva-renderer-change"?: (event: CustomEvent) => void;
|
|
490
|
+
};
|
|
483
491
|
"minerva-icon-button": Omit<HTMLAttributes<MinervaIconButton>, keyof Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">>> &
|
|
484
492
|
Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">> & {
|
|
485
493
|
"onminerva-pressed-change"?: (event: CustomEvent) => void;
|
|
486
494
|
};
|
|
495
|
+
"minerva-icon-canvas": Omit<HTMLAttributes<MinervaIconCanvas>, keyof Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">>> &
|
|
496
|
+
Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">> & {
|
|
497
|
+
"onminerva-renderer-change"?: (event: CustomEvent) => void;
|
|
498
|
+
};
|
|
487
499
|
"minerva-input": Omit<HTMLAttributes<MinervaInput>, keyof Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">>> &
|
|
488
500
|
Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">> & {
|
|
489
501
|
"onchange"?: (event: CustomEvent) => void;
|
|
@@ -150,6 +150,10 @@ import type {
|
|
|
150
150
|
MinervaOrderBookHeatmap,
|
|
151
151
|
MinervaTimeAndSales,
|
|
152
152
|
} from "../elements/order-book.js";
|
|
153
|
+
import type {
|
|
154
|
+
MinervaIcon,
|
|
155
|
+
MinervaIconCanvas,
|
|
156
|
+
} from "../elements/icon.js";
|
|
153
157
|
import type {
|
|
154
158
|
MinervaTradingChart,
|
|
155
159
|
} from "../elements/trading-chart.js";
|
|
@@ -535,11 +539,21 @@ declare module "vue" {
|
|
|
535
539
|
|
|
536
540
|
}
|
|
537
541
|
>;
|
|
542
|
+
"minerva-icon": DefineComponent<
|
|
543
|
+
Partial<Pick<MinervaIcon, "name" | "icon" | "size" | "color" | "strokeWidth" | "absoluteStrokeWidth" | "label" | "renderer">> & {
|
|
544
|
+
"onMinervaRendererChange"?: (event: CustomEvent) => void;
|
|
545
|
+
}
|
|
546
|
+
>;
|
|
538
547
|
"minerva-icon-button": DefineComponent<
|
|
539
548
|
Partial<Pick<MinervaIconButton, "label" | "color" | "variant" | "size" | "shape" | "disabled" | "loading" | "toggle" | "pressed" | "tooltip" | "tooltipPlacement" | "noTooltip" | "type">> & {
|
|
540
549
|
"onMinervaPressedChange"?: (event: CustomEvent) => void;
|
|
541
550
|
}
|
|
542
551
|
>;
|
|
552
|
+
"minerva-icon-canvas": DefineComponent<
|
|
553
|
+
Partial<Pick<MinervaIconCanvas, "items" | "renderer" | "width" | "height" | "pixelRatio" | "label">> & {
|
|
554
|
+
"onMinervaRendererChange"?: (event: CustomEvent) => void;
|
|
555
|
+
}
|
|
556
|
+
>;
|
|
543
557
|
"minerva-input": DefineComponent<
|
|
544
558
|
Partial<Pick<MinervaInput, "value" | "defaultValue" | "type" | "variant" | "size" | "invalid" | "placeholder" | "readOnly" | "minLength" | "maxLength" | "pattern" | "min" | "max" | "step" | "autocomplete" | "inputmode" | "clearable" | "clearLabel" | "showCharCount" | "showPasswordLabel" | "hidePasswordLabel" | "name" | "disabled" | "required">> & {
|
|
545
559
|
"onChange"?: (event: CustomEvent) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minerva-design",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Minerva Design: React, Vue, Angular, Web Components and native platform components with shared design tokens and contracts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "fwx5618177 <fwx5618177@gmail.com>",
|
|
@@ -913,6 +913,10 @@
|
|
|
913
913
|
"types": "./dist/web-components/elements/html-preview.d.ts",
|
|
914
914
|
"default": "./dist/web-components/elements/html-preview.js"
|
|
915
915
|
},
|
|
916
|
+
"./web-components/icon": {
|
|
917
|
+
"types": "./dist/web-components/elements/icon.d.ts",
|
|
918
|
+
"default": "./dist/web-components/elements/icon.js"
|
|
919
|
+
},
|
|
916
920
|
"./web-components/icon-button": {
|
|
917
921
|
"types": "./dist/web-components/elements/icon-button.d.ts",
|
|
918
922
|
"default": "./dist/web-components/elements/icon-button.js"
|
|
@@ -1094,12 +1098,19 @@
|
|
|
1094
1098
|
"types": "./dist/vue/charts.d.ts",
|
|
1095
1099
|
"default": "./dist/vue/charts.js"
|
|
1096
1100
|
},
|
|
1101
|
+
"./vue/icons": {
|
|
1102
|
+
"types": "./dist/vue/icons.d.ts",
|
|
1103
|
+
"default": "./dist/vue/icons.js"
|
|
1104
|
+
},
|
|
1097
1105
|
"./vue/global": {
|
|
1098
1106
|
"types": "./dist/vue/global.d.ts"
|
|
1099
1107
|
},
|
|
1100
1108
|
"./vue/charts-global": {
|
|
1101
1109
|
"types": "./dist/vue/charts-global.d.ts"
|
|
1102
1110
|
},
|
|
1111
|
+
"./vue/icons-global": {
|
|
1112
|
+
"types": "./dist/vue/icons-global.d.ts"
|
|
1113
|
+
},
|
|
1103
1114
|
"./custom-elements.json": "./custom-elements.json",
|
|
1104
1115
|
"./html-custom-data.json": "./dist/web-components/html-custom-data.json",
|
|
1105
1116
|
"./package.json": "./package.json"
|