@cos-design/radar-scan 4.0.0 → 4.1.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/core/packages/shared/src/element-options.d.ts +19 -0
- package/dist/core/packages/shared/src/index.d.ts +2 -0
- package/dist/element/index.js +15 -15
- package/dist/element/packages/shared/src/element-options.d.ts +19 -0
- package/dist/element/packages/shared/src/index.d.ts +2 -0
- package/dist/react/packages/shared/src/element-options.d.ts +19 -0
- package/dist/react/packages/shared/src/index.d.ts +2 -0
- package/dist/vue/index.js +23 -23
- package/dist/vue/packages/shared/src/element-options.d.ts +19 -0
- package/dist/vue/packages/shared/src/index.d.ts +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component attribute → Core options parsing (v4 Element adapters).
|
|
3
|
+
* Keeps behavior consistent across 91 components.
|
|
4
|
+
*/
|
|
5
|
+
export type BooleanAttrMode =
|
|
6
|
+
/** `options.key = el.hasAttribute(attr)` — always written */
|
|
7
|
+
'presence'
|
|
8
|
+
/** Only when attribute present: `raw !== 'false' && raw !== '0'` (omit when absent) */
|
|
9
|
+
| 'optional-true'
|
|
10
|
+
/** Only when attribute present; when absent leave `undefined` (controlled props like `flipped`) */
|
|
11
|
+
| 'optional-undefined';
|
|
12
|
+
export declare const camelToKebabAttr: (name: string) => string;
|
|
13
|
+
export declare function readStringAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
14
|
+
export declare function readNumberAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
15
|
+
export declare function readBooleanAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string, mode?: BooleanAttrMode): void;
|
|
16
|
+
export declare function readJsonAttr<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, attr?: string): void;
|
|
17
|
+
/** Property setters on the custom element class (`_prizes`, `_items`, …) override attributes. */
|
|
18
|
+
export declare function readPropertyOverride<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, backingKey: string): void;
|
|
19
|
+
export declare function optionCallbackDispatcher(el: HTMLElement, eventName: string): (...args: unknown[]) => void;
|
|
@@ -9,3 +9,5 @@ export type { PhotoItem, PhotoIndexChangeHandler, PhotoFaceChangeHandler } from
|
|
|
9
9
|
export { resolveCanvasBoxSize } from './canvas-box';
|
|
10
10
|
export type { CanvasBoxSizeInput, CanvasBoxSize } from './canvas-box';
|
|
11
11
|
export { applyCanvasHostBox, applyBlockHostBox, setHidden, optionsFingerprint, optionsVisualChanged, } from './host-layout';
|
|
12
|
+
export type { BooleanAttrMode } from './element-options';
|
|
13
|
+
export { camelToKebabAttr, optionCallbackDispatcher, readBooleanAttr, readJsonAttr, readNumberAttr, readPropertyOverride, readStringAttr, } from './element-options';
|
package/dist/element/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { bindVisibilityPause as e } from "@cos-design/shared";
|
|
1
|
+
import { bindVisibilityPause as e, readNumberAttr as t, readStringAttr as n } from "@cos-design/shared";
|
|
2
2
|
import './element.css';//#region src/components/radarScan/core/engine.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
3
|
+
var r = "cos-radar-scan";
|
|
4
|
+
function i(t, n = {}) {
|
|
5
5
|
let i = {
|
|
6
6
|
size: 300,
|
|
7
7
|
color: "#22d3ee",
|
|
8
8
|
blipCount: 5,
|
|
9
|
-
...
|
|
9
|
+
...n
|
|
10
10
|
}, a = !1, o = i.size ?? 300, s = 0, c = 0, l = typeof document < "u" ? document.hidden : !1, u = null, d = [], f = document.createElement("div");
|
|
11
|
-
f.className =
|
|
11
|
+
f.className = r;
|
|
12
12
|
let p = document.createElement("canvas");
|
|
13
|
-
p.className = `${
|
|
13
|
+
p.className = `${r}__canvas`, f.appendChild(p), t.appendChild(f);
|
|
14
14
|
let m = () => {
|
|
15
15
|
d.length = 0;
|
|
16
16
|
let e = i.blipCount ?? 5;
|
|
@@ -58,12 +58,12 @@ function n(n, r = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/components/radarScan/element/index.ts
|
|
61
|
-
var
|
|
62
|
-
function
|
|
63
|
-
let
|
|
64
|
-
return e
|
|
61
|
+
var a = "cos-radar-scan";
|
|
62
|
+
function o(e) {
|
|
63
|
+
let r = {};
|
|
64
|
+
return n(r, e, "color", "color"), t(r, e, "size", "size"), t(r, e, "blipCount", "blip-count"), r;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var s = class extends HTMLElement {
|
|
67
67
|
ctrl = null;
|
|
68
68
|
static get observedAttributes() {
|
|
69
69
|
return [
|
|
@@ -73,15 +73,15 @@ var a = class extends HTMLElement {
|
|
|
73
73
|
];
|
|
74
74
|
}
|
|
75
75
|
connectedCallback() {
|
|
76
|
-
this.ctrl =
|
|
76
|
+
this.ctrl = i(this, o(this));
|
|
77
77
|
}
|
|
78
78
|
disconnectedCallback() {
|
|
79
79
|
this.ctrl?.destroy(), this.ctrl = null;
|
|
80
80
|
}
|
|
81
81
|
attributeChangedCallback() {
|
|
82
|
-
this.ctrl?.update(
|
|
82
|
+
this.ctrl?.update(o(this));
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
typeof customElements < "u" && !customElements.get("cos-radar-scan") && customElements.define(
|
|
85
|
+
typeof customElements < "u" && !customElements.get("cos-radar-scan") && customElements.define(a, s);
|
|
86
86
|
//#endregion
|
|
87
|
-
export {
|
|
87
|
+
export { s as CosRadarScanElement, a as TAG };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component attribute → Core options parsing (v4 Element adapters).
|
|
3
|
+
* Keeps behavior consistent across 91 components.
|
|
4
|
+
*/
|
|
5
|
+
export type BooleanAttrMode =
|
|
6
|
+
/** `options.key = el.hasAttribute(attr)` — always written */
|
|
7
|
+
'presence'
|
|
8
|
+
/** Only when attribute present: `raw !== 'false' && raw !== '0'` (omit when absent) */
|
|
9
|
+
| 'optional-true'
|
|
10
|
+
/** Only when attribute present; when absent leave `undefined` (controlled props like `flipped`) */
|
|
11
|
+
| 'optional-undefined';
|
|
12
|
+
export declare const camelToKebabAttr: (name: string) => string;
|
|
13
|
+
export declare function readStringAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
14
|
+
export declare function readNumberAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
15
|
+
export declare function readBooleanAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string, mode?: BooleanAttrMode): void;
|
|
16
|
+
export declare function readJsonAttr<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, attr?: string): void;
|
|
17
|
+
/** Property setters on the custom element class (`_prizes`, `_items`, …) override attributes. */
|
|
18
|
+
export declare function readPropertyOverride<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, backingKey: string): void;
|
|
19
|
+
export declare function optionCallbackDispatcher(el: HTMLElement, eventName: string): (...args: unknown[]) => void;
|
|
@@ -9,3 +9,5 @@ export type { PhotoItem, PhotoIndexChangeHandler, PhotoFaceChangeHandler } from
|
|
|
9
9
|
export { resolveCanvasBoxSize } from './canvas-box';
|
|
10
10
|
export type { CanvasBoxSizeInput, CanvasBoxSize } from './canvas-box';
|
|
11
11
|
export { applyCanvasHostBox, applyBlockHostBox, setHidden, optionsFingerprint, optionsVisualChanged, } from './host-layout';
|
|
12
|
+
export type { BooleanAttrMode } from './element-options';
|
|
13
|
+
export { camelToKebabAttr, optionCallbackDispatcher, readBooleanAttr, readJsonAttr, readNumberAttr, readPropertyOverride, readStringAttr, } from './element-options';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component attribute → Core options parsing (v4 Element adapters).
|
|
3
|
+
* Keeps behavior consistent across 91 components.
|
|
4
|
+
*/
|
|
5
|
+
export type BooleanAttrMode =
|
|
6
|
+
/** `options.key = el.hasAttribute(attr)` — always written */
|
|
7
|
+
'presence'
|
|
8
|
+
/** Only when attribute present: `raw !== 'false' && raw !== '0'` (omit when absent) */
|
|
9
|
+
| 'optional-true'
|
|
10
|
+
/** Only when attribute present; when absent leave `undefined` (controlled props like `flipped`) */
|
|
11
|
+
| 'optional-undefined';
|
|
12
|
+
export declare const camelToKebabAttr: (name: string) => string;
|
|
13
|
+
export declare function readStringAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
14
|
+
export declare function readNumberAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
15
|
+
export declare function readBooleanAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string, mode?: BooleanAttrMode): void;
|
|
16
|
+
export declare function readJsonAttr<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, attr?: string): void;
|
|
17
|
+
/** Property setters on the custom element class (`_prizes`, `_items`, …) override attributes. */
|
|
18
|
+
export declare function readPropertyOverride<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, backingKey: string): void;
|
|
19
|
+
export declare function optionCallbackDispatcher(el: HTMLElement, eventName: string): (...args: unknown[]) => void;
|
|
@@ -9,3 +9,5 @@ export type { PhotoItem, PhotoIndexChangeHandler, PhotoFaceChangeHandler } from
|
|
|
9
9
|
export { resolveCanvasBoxSize } from './canvas-box';
|
|
10
10
|
export type { CanvasBoxSizeInput, CanvasBoxSize } from './canvas-box';
|
|
11
11
|
export { applyCanvasHostBox, applyBlockHostBox, setHidden, optionsFingerprint, optionsVisualChanged, } from './host-layout';
|
|
12
|
+
export type { BooleanAttrMode } from './element-options';
|
|
13
|
+
export { camelToKebabAttr, optionCallbackDispatcher, readBooleanAttr, readJsonAttr, readNumberAttr, readPropertyOverride, readStringAttr, } from './element-options';
|
package/dist/vue/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createElementBlock as e, defineComponent as t, onMounted as n, onUnmounted as r, openBlock as i, ref as a, watch as o } from "vue";
|
|
2
|
-
import { bindVisibilityPause as s
|
|
2
|
+
import { bindVisibilityPause as s } from "@cos-design/shared";
|
|
3
3
|
import './vue.css';//#region src/components/radarScan/core/engine.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var c = "cos-radar-scan";
|
|
5
|
+
function l(e, t = {}) {
|
|
6
6
|
let n = {
|
|
7
7
|
size: 300,
|
|
8
8
|
color: "#22d3ee",
|
|
9
9
|
blipCount: 5,
|
|
10
10
|
...t
|
|
11
|
-
}, r = !1, i = n.size ?? 300, a = 0, o = 0,
|
|
12
|
-
f.className =
|
|
11
|
+
}, r = !1, i = n.size ?? 300, a = 0, o = 0, l = typeof document < "u" ? document.hidden : !1, u = null, d = [], f = document.createElement("div");
|
|
12
|
+
f.className = c;
|
|
13
13
|
let p = document.createElement("canvas");
|
|
14
|
-
p.className = `${
|
|
14
|
+
p.className = `${c}__canvas`, f.appendChild(p), e.appendChild(f);
|
|
15
15
|
let m = () => {
|
|
16
16
|
d.length = 0;
|
|
17
17
|
let e = n.blipCount ?? 5;
|
|
@@ -28,23 +28,23 @@ function u(e, t = {}) {
|
|
|
28
28
|
let t = p.getContext("2d");
|
|
29
29
|
return t && t.setTransform(e, 0, 0, e, 0, 0), t;
|
|
30
30
|
}, _ = () => {
|
|
31
|
-
if (r || (a = requestAnimationFrame(_),
|
|
31
|
+
if (r || (a = requestAnimationFrame(_), l)) return;
|
|
32
32
|
let e = p.getContext("2d");
|
|
33
33
|
if (!e) return;
|
|
34
|
-
let t = n.color ?? "#22d3ee", s = i / 2,
|
|
34
|
+
let t = n.color ?? "#22d3ee", s = i / 2, c = i / 2, u = i / 2 - 10;
|
|
35
35
|
o += .03, e.fillStyle = "rgb(15 23 42 / 25%)", e.fillRect(0, 0, i, i);
|
|
36
|
-
for (let n = 1; n <= 4; n++) e.beginPath(), e.arc(s,
|
|
37
|
-
e.beginPath(), e.moveTo(s,
|
|
38
|
-
let f = o, m = e.createConicGradient(f - .5, s,
|
|
39
|
-
m.addColorStop(0, "transparent"), m.addColorStop(.15, `${t}66`), m.addColorStop(.3, "transparent"), e.beginPath(), e.moveTo(s,
|
|
36
|
+
for (let n = 1; n <= 4; n++) e.beginPath(), e.arc(s, c, u / 4 * n, 0, Math.PI * 2), e.strokeStyle = `${t}33`, e.lineWidth = 1, e.stroke();
|
|
37
|
+
e.beginPath(), e.moveTo(s, c - u), e.lineTo(s, c + u), e.moveTo(s - u, c), e.lineTo(s + u, c), e.strokeStyle = `${t}44`, e.stroke();
|
|
38
|
+
let f = o, m = e.createConicGradient(f - .5, s, c);
|
|
39
|
+
m.addColorStop(0, "transparent"), m.addColorStop(.15, `${t}66`), m.addColorStop(.3, "transparent"), e.beginPath(), e.moveTo(s, c), e.arc(s, c, u, f - .5, f), e.closePath(), e.fillStyle = m, e.fill(), e.beginPath(), e.moveTo(s, c), e.lineTo(s + Math.cos(f) * u, c + Math.sin(f) * u), e.strokeStyle = t, e.lineWidth = 2, e.stroke();
|
|
40
40
|
for (let n of d) {
|
|
41
|
-
let r = s + Math.cos(n.angle) * u * n.dist, i =
|
|
41
|
+
let r = s + Math.cos(n.angle) * u * n.dist, i = c + Math.sin(n.angle) * u * n.dist;
|
|
42
42
|
Math.abs((f - n.angle + Math.PI) % (Math.PI * 2) - Math.PI) < .3 ? n.alpha = Math.min(1, n.alpha + .05) : n.alpha = Math.max(.2, n.alpha - .01), e.beginPath(), e.arc(r, i, 4, 0, Math.PI * 2), e.fillStyle = t, e.globalAlpha = n.alpha, e.fill(), e.globalAlpha = 1;
|
|
43
43
|
}
|
|
44
|
-
e.beginPath(), e.arc(s,
|
|
44
|
+
e.beginPath(), e.arc(s, c, u, 0, Math.PI * 2), e.strokeStyle = t, e.lineWidth = 2, e.stroke();
|
|
45
45
|
};
|
|
46
46
|
return h(), g(), m(), u = s((e) => {
|
|
47
|
-
|
|
47
|
+
l = e;
|
|
48
48
|
}), _(), {
|
|
49
49
|
update(e) {
|
|
50
50
|
n = {
|
|
@@ -59,25 +59,25 @@ function u(e, t = {}) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/components/radarScan/vue/RadarScan.vue
|
|
62
|
-
var
|
|
62
|
+
var u = /* @__PURE__ */ t({
|
|
63
63
|
__name: "RadarScan",
|
|
64
64
|
props: {
|
|
65
65
|
size: {},
|
|
66
66
|
color: {},
|
|
67
67
|
blipCount: {}
|
|
68
68
|
},
|
|
69
|
-
setup(t, { expose: s, emit:
|
|
70
|
-
let
|
|
69
|
+
setup(t, { expose: s, emit: c }) {
|
|
70
|
+
let u = t, d = a(), f = null, p = () => ({ ...u });
|
|
71
71
|
return n(() => {
|
|
72
|
-
|
|
73
|
-
}), o(() =>
|
|
74
|
-
|
|
72
|
+
d.value && (f = l(d.value, p()));
|
|
73
|
+
}), o(() => ({ ...u }), () => f?.update(p()), { deep: !0 }), r(() => {
|
|
74
|
+
f?.destroy(), f = null;
|
|
75
75
|
}), s({}), (t, n) => (i(), e("div", {
|
|
76
76
|
ref_key: "hostRef",
|
|
77
|
-
ref:
|
|
77
|
+
ref: d,
|
|
78
78
|
class: "cos-radarScan-host"
|
|
79
79
|
}, null, 512));
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
//#endregion
|
|
83
|
-
export {
|
|
83
|
+
export { u as RadarScan };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Component attribute → Core options parsing (v4 Element adapters).
|
|
3
|
+
* Keeps behavior consistent across 91 components.
|
|
4
|
+
*/
|
|
5
|
+
export type BooleanAttrMode =
|
|
6
|
+
/** `options.key = el.hasAttribute(attr)` — always written */
|
|
7
|
+
'presence'
|
|
8
|
+
/** Only when attribute present: `raw !== 'false' && raw !== '0'` (omit when absent) */
|
|
9
|
+
| 'optional-true'
|
|
10
|
+
/** Only when attribute present; when absent leave `undefined` (controlled props like `flipped`) */
|
|
11
|
+
| 'optional-undefined';
|
|
12
|
+
export declare const camelToKebabAttr: (name: string) => string;
|
|
13
|
+
export declare function readStringAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
14
|
+
export declare function readNumberAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string): void;
|
|
15
|
+
export declare function readBooleanAttr<T extends object>(options: T, el: HTMLElement, key: keyof T & string, attr?: string, mode?: BooleanAttrMode): void;
|
|
16
|
+
export declare function readJsonAttr<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, attr?: string): void;
|
|
17
|
+
/** Property setters on the custom element class (`_prizes`, `_items`, …) override attributes. */
|
|
18
|
+
export declare function readPropertyOverride<T extends object, K extends keyof T & string>(options: T, el: HTMLElement, key: K, backingKey: string): void;
|
|
19
|
+
export declare function optionCallbackDispatcher(el: HTMLElement, eventName: string): (...args: unknown[]) => void;
|
|
@@ -9,3 +9,5 @@ export type { PhotoItem, PhotoIndexChangeHandler, PhotoFaceChangeHandler } from
|
|
|
9
9
|
export { resolveCanvasBoxSize } from './canvas-box';
|
|
10
10
|
export type { CanvasBoxSizeInput, CanvasBoxSize } from './canvas-box';
|
|
11
11
|
export { applyCanvasHostBox, applyBlockHostBox, setHidden, optionsFingerprint, optionsVisualChanged, } from './host-layout';
|
|
12
|
+
export type { BooleanAttrMode } from './element-options';
|
|
13
|
+
export { camelToKebabAttr, optionCallbackDispatcher, readBooleanAttr, readJsonAttr, readNumberAttr, readPropertyOverride, readStringAttr, } from './element-options';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cos-design/radar-scan",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "RadarScan component from cos-design",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/react/index.cjs",
|
|
@@ -84,6 +84,6 @@
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@cos-design/shared": "4.
|
|
87
|
+
"@cos-design/shared": "4.1.0"
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|