@sdata/web-vue 3.25.0 → 3.27.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/sd.css +4 -0
- package/dist/sd.min.css +1 -1
- package/es/_hooks/use-theme-mode.d.ts +1 -1
- package/es/_utils/date.js +5 -38
- package/es/components.d.ts +1 -0
- package/es/index.css +4 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/index.scss +1 -0
- package/es/locale/constant.d.ts +2 -0
- package/es/locale/constant.js +5 -0
- package/es/locale/index.d.ts +1 -0
- package/es/locale/index.js +6 -5
- package/es/locale/interface.d.ts +11 -0
- package/es/locale/lang/en-us.js +12 -1
- package/es/locale/lang/zh-cn.js +14 -2
- package/es/sd-vue.js +2 -0
- package/es/thinking-orb/engine/braid.d.ts +2 -0
- package/es/thinking-orb/engine/braid.js +52 -0
- package/es/thinking-orb/engine/core.d.ts +28 -0
- package/es/thinking-orb/engine/core.js +104 -0
- package/es/thinking-orb/engine/lattice.d.ts +4 -0
- package/es/thinking-orb/engine/lattice.js +188 -0
- package/es/thinking-orb/engine/morph.d.ts +2 -0
- package/es/thinking-orb/engine/morph.js +111 -0
- package/es/thinking-orb/engine/orbits.d.ts +2 -0
- package/es/thinking-orb/engine/orbits.js +65 -0
- package/es/thinking-orb/engine/profiles.d.ts +6 -0
- package/es/thinking-orb/engine/profiles.js +150 -0
- package/es/thinking-orb/engine/registry.d.ts +3 -0
- package/es/thinking-orb/engine/registry.js +20 -0
- package/es/thinking-orb/engine/ribbon.d.ts +2 -0
- package/es/thinking-orb/engine/ribbon.js +71 -0
- package/es/thinking-orb/engine/types.d.ts +3 -0
- package/es/thinking-orb/engine/web.d.ts +2 -0
- package/es/thinking-orb/engine/web.js +87 -0
- package/es/thinking-orb/index.d.ts +21 -0
- package/es/thinking-orb/index.js +10 -0
- package/es/thinking-orb/presets.d.ts +10 -0
- package/es/thinking-orb/presets.js +176 -0
- package/es/thinking-orb/style/css.js +2 -0
- package/es/thinking-orb/style/index.css +20 -0
- package/es/thinking-orb/style/index.d.ts +2 -0
- package/es/thinking-orb/style/index.js +2 -0
- package/es/thinking-orb/style/index.scss +8 -0
- package/es/thinking-orb/thinking-orb.js +5 -0
- package/es/thinking-orb/thinking-orb.vue.d.ts +4 -0
- package/es/thinking-orb/thinking-orb.vue_vue_type_script_setup_true_lang.js +140 -0
- package/es/thinking-orb/types.d.ts +12 -0
- package/json/vetur-attributes.json +17 -0
- package/json/vetur-tags.json +9 -0
- package/json/web-types.json +48 -1
- package/package.json +1 -1
- package/es/locale/lang/ar-eg.d.ts +0 -3
- package/es/locale/lang/ar-eg.js +0 -262
- package/es/locale/lang/de-de.d.ts +0 -3
- package/es/locale/lang/de-de.js +0 -262
- package/es/locale/lang/es-es.d.ts +0 -3
- package/es/locale/lang/es-es.js +0 -262
- package/es/locale/lang/fr-fr.d.ts +0 -3
- package/es/locale/lang/fr-fr.js +0 -262
- package/es/locale/lang/id-id.d.ts +0 -3
- package/es/locale/lang/id-id.js +0 -262
- package/es/locale/lang/it-it.d.ts +0 -3
- package/es/locale/lang/it-it.js +0 -262
- package/es/locale/lang/ja-jp.d.ts +0 -3
- package/es/locale/lang/ja-jp.js +0 -262
- package/es/locale/lang/km-kh.d.ts +0 -3
- package/es/locale/lang/km-kh.js +0 -262
- package/es/locale/lang/ko-kr.d.ts +0 -3
- package/es/locale/lang/ko-kr.js +0 -262
- package/es/locale/lang/ms-my.d.ts +0 -3
- package/es/locale/lang/ms-my.js +0 -262
- package/es/locale/lang/nl-nl.d.ts +0 -3
- package/es/locale/lang/nl-nl.js +0 -262
- package/es/locale/lang/pt-pt.d.ts +0 -3
- package/es/locale/lang/pt-pt.js +0 -262
- package/es/locale/lang/ru-ru.d.ts +0 -3
- package/es/locale/lang/ru-ru.js +0 -262
- package/es/locale/lang/th-th.d.ts +0 -3
- package/es/locale/lang/th-th.js +0 -262
- package/es/locale/lang/vi-vn.d.ts +0 -3
- package/es/locale/lang/vi-vn.js +0 -262
- package/es/locale/lang/zh-tw.d.ts +0 -3
- package/es/locale/lang/zh-tw.js +0 -272
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { fibDir, frac, hashD, lerp, makeProj, paint, paintLines, radiusScale, vnoise } from "./core.js";
|
|
2
|
+
//#region components/thinking-orb/engine/web.ts
|
|
3
|
+
var drawWeb = (ctx, size, t, dark, o) => {
|
|
4
|
+
var _o$spread, _o$rsPow, _o$nodeN, _o$thr, _o$nodeR, _o$nodeRDepth, _o$signals;
|
|
5
|
+
const cx = size / 2;
|
|
6
|
+
const cy = size / 2;
|
|
7
|
+
const R = size / 2 * .8 * ((_o$spread = o.spread) !== null && _o$spread !== void 0 ? _o$spread : 1);
|
|
8
|
+
const pt = makeProj(t * .12, .32, cx, cy, R);
|
|
9
|
+
const rs = radiusScale(size, (_o$rsPow = o.rsPow) !== null && _o$rsPow !== void 0 ? _o$rsPow : .6);
|
|
10
|
+
const nodeN = (_o$nodeN = o.nodeN) !== null && _o$nodeN !== void 0 ? _o$nodeN : 30;
|
|
11
|
+
const thr = (_o$thr = o.thr) !== null && _o$thr !== void 0 ? _o$thr : .72;
|
|
12
|
+
const nodeR = (_o$nodeR = o.nodeR) !== null && _o$nodeR !== void 0 ? _o$nodeR : 1.4;
|
|
13
|
+
const nodeRDepth = (_o$nodeRDepth = o.nodeRDepth) !== null && _o$nodeRDepth !== void 0 ? _o$nodeRDepth : 1.8;
|
|
14
|
+
const nodes = [];
|
|
15
|
+
for (let i = 0; i < nodeN; i++) {
|
|
16
|
+
const d = fibDir(i, nodeN);
|
|
17
|
+
const x = d[0] + .3 * (vnoise(i * .31 + 9, t * .24) - .5) * 2;
|
|
18
|
+
const y = d[1] + .3 * (vnoise(i * .53 + 27, t * .21) - .5) * 2;
|
|
19
|
+
const z = d[2] + .3 * (vnoise(i * .77 + 55, t * .27) - .5) * 2;
|
|
20
|
+
const l = Math.sqrt(x * x + y * y + z * z);
|
|
21
|
+
nodes.push([
|
|
22
|
+
x / l,
|
|
23
|
+
y / l,
|
|
24
|
+
z / l
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
const lines = [];
|
|
28
|
+
const dots = [];
|
|
29
|
+
for (let i = 0; i < nodeN; i++) for (let j = i + 1; j < nodeN; j++) {
|
|
30
|
+
var _o$lineW;
|
|
31
|
+
const dx = nodes[i][0] - nodes[j][0];
|
|
32
|
+
const dy = nodes[i][1] - nodes[j][1];
|
|
33
|
+
const dz = nodes[i][2] - nodes[j][2];
|
|
34
|
+
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
35
|
+
if (dist >= thr) continue;
|
|
36
|
+
const [x1, y1, z1] = pt(nodes[i][0], nodes[i][1], nodes[i][2]);
|
|
37
|
+
const [x2, y2, z2] = pt(nodes[j][0], nodes[j][1], nodes[j][2]);
|
|
38
|
+
const depth = ((z1 + z2) / 2 + 1) / 2;
|
|
39
|
+
lines.push({
|
|
40
|
+
x1,
|
|
41
|
+
y1,
|
|
42
|
+
x2,
|
|
43
|
+
y2,
|
|
44
|
+
white: .42,
|
|
45
|
+
a: (1 - dist / thr) * (.3 + .55 * depth),
|
|
46
|
+
w: Math.max(.6, ((_o$lineW = o.lineW) !== null && _o$lineW !== void 0 ? _o$lineW : .8) * rs)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
for (let i = 0; i < nodeN; i++) {
|
|
50
|
+
const [px, py, z] = pt(nodes[i][0], nodes[i][1], nodes[i][2]);
|
|
51
|
+
const depth = (z + 1) / 2;
|
|
52
|
+
const pulse = 1 + .25 * Math.sin(t * 1.4 + i * 2.7);
|
|
53
|
+
dots.push({
|
|
54
|
+
x: px,
|
|
55
|
+
y: py,
|
|
56
|
+
z,
|
|
57
|
+
r: (nodeR + nodeRDepth * depth) * pulse * rs,
|
|
58
|
+
white: .55 - .45 * depth
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const signals = (_o$signals = o.signals) !== null && _o$signals !== void 0 ? _o$signals : 5;
|
|
62
|
+
for (let s = 0; s < signals; s++) {
|
|
63
|
+
const seg = Math.floor(t * .55 + s * 7.31);
|
|
64
|
+
const a = Math.floor(hashD(seg, s * 3.1 + 1.7) * nodeN);
|
|
65
|
+
const b = Math.floor(hashD(seg, s * 5.7 + 4.2) * nodeN);
|
|
66
|
+
if (a === b) continue;
|
|
67
|
+
const f = frac(t * .55 + s * 7.31);
|
|
68
|
+
const x = lerp(nodes[a][0], nodes[b][0], f);
|
|
69
|
+
const y = lerp(nodes[a][1], nodes[b][1], f);
|
|
70
|
+
const z = lerp(nodes[a][2], nodes[b][2], f);
|
|
71
|
+
const l = Math.max(1e-6, Math.sqrt(x * x + y * y + z * z));
|
|
72
|
+
const [px, py, zr] = pt(x / l, y / l, z / l);
|
|
73
|
+
const depth = (zr + 1) / 2;
|
|
74
|
+
dots.push({
|
|
75
|
+
x: px,
|
|
76
|
+
y: py,
|
|
77
|
+
z: zr,
|
|
78
|
+
r: (nodeR * 1.5 + nodeRDepth * depth) * rs,
|
|
79
|
+
white: .05,
|
|
80
|
+
a: .5 + .5 * depth
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
paintLines(ctx, lines, dark);
|
|
84
|
+
paint(ctx, dots, dark, o.rMin);
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { drawWeb };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import type { SDOptions } from '../_utils/types';
|
|
3
|
+
import _ThinkingOrb from './thinking-orb.vue';
|
|
4
|
+
declare const ThinkingOrb: {
|
|
5
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types").ThinkingOrbProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
6
|
+
P: {};
|
|
7
|
+
B: {};
|
|
8
|
+
D: {};
|
|
9
|
+
C: {};
|
|
10
|
+
M: {};
|
|
11
|
+
Defaults: {};
|
|
12
|
+
}, Readonly<import("./types").ThinkingOrbProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
13
|
+
__isFragment?: never;
|
|
14
|
+
__isTeleport?: never;
|
|
15
|
+
__isSuspense?: never;
|
|
16
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./types").ThinkingOrbProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
17
|
+
install: (app: App, options?: SDOptions) => void;
|
|
18
|
+
};
|
|
19
|
+
export type ThinkingOrbInstance = InstanceType<typeof _ThinkingOrb>;
|
|
20
|
+
export type { ThinkingOrbProps, ThinkingOrbSize, ThinkingOrbState, ThinkingOrbTheme, } from './types';
|
|
21
|
+
export default ThinkingOrb;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getComponentPrefix, setGlobalConfig } from "../_utils/global-config.js";
|
|
2
|
+
import thinking_orb_default from "./thinking-orb.js";
|
|
3
|
+
//#region components/thinking-orb/index.ts
|
|
4
|
+
var ThinkingOrb = Object.assign(thinking_orb_default, { install: (app, options) => {
|
|
5
|
+
setGlobalConfig(app, options);
|
|
6
|
+
const componentPrefix = getComponentPrefix(options);
|
|
7
|
+
app.component(componentPrefix + thinking_orb_default.name, thinking_orb_default);
|
|
8
|
+
} });
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ThinkingOrb as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ModeOpts } from './engine/profiles';
|
|
2
|
+
import type { OrbSize, OrbState } from './types';
|
|
3
|
+
export type ModeKey = 'orbits' | 'globe' | 'rubik' | 'wave' | 'web' | 'braid' | 'ribbon' | 'ring' | 'morph';
|
|
4
|
+
export declare const STATE_TO_MODE: Record<OrbState, ModeKey>;
|
|
5
|
+
export interface Resolved {
|
|
6
|
+
mode: ModeKey;
|
|
7
|
+
speed: number;
|
|
8
|
+
opts: ModeOpts;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolvePreset(state: OrbState, size: OrbSize): Resolved;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { BASE_PROFILES, scaleCounts, scaleRadii } from "./engine/profiles.js";
|
|
3
|
+
//#region components/thinking-orb/presets.ts
|
|
4
|
+
var STATE_TO_MODE = {
|
|
5
|
+
working: "orbits",
|
|
6
|
+
searching: "globe",
|
|
7
|
+
solving: "rubik",
|
|
8
|
+
listening: "wave",
|
|
9
|
+
connecting: "web",
|
|
10
|
+
weaving: "braid",
|
|
11
|
+
composing: "ribbon",
|
|
12
|
+
breathing: "ring",
|
|
13
|
+
shaping: "morph"
|
|
14
|
+
};
|
|
15
|
+
var PRESETS = {
|
|
16
|
+
orbits: {
|
|
17
|
+
64: {
|
|
18
|
+
speed: 1.885,
|
|
19
|
+
count: 1,
|
|
20
|
+
size: 1
|
|
21
|
+
},
|
|
22
|
+
20: {
|
|
23
|
+
speed: 3.9,
|
|
24
|
+
count: .238,
|
|
25
|
+
size: 2.4
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
globe: {
|
|
29
|
+
64: {
|
|
30
|
+
speed: 2.015,
|
|
31
|
+
count: .42,
|
|
32
|
+
size: 1.15,
|
|
33
|
+
extra: {
|
|
34
|
+
scanMul: 4.08,
|
|
35
|
+
dimBase: .45
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
20: {
|
|
39
|
+
speed: 2.665,
|
|
40
|
+
count: .105,
|
|
41
|
+
size: 1.75,
|
|
42
|
+
extra: {
|
|
43
|
+
scanMul: 4.335,
|
|
44
|
+
dimBase: .45
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
rubik: {
|
|
49
|
+
64: {
|
|
50
|
+
speed: 1.82,
|
|
51
|
+
count: .35,
|
|
52
|
+
size: 1.05
|
|
53
|
+
},
|
|
54
|
+
20: {
|
|
55
|
+
speed: 1.95,
|
|
56
|
+
count: .088,
|
|
57
|
+
size: 1.9
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
wave: {
|
|
61
|
+
64: {
|
|
62
|
+
speed: 4.388,
|
|
63
|
+
count: .341,
|
|
64
|
+
size: 1
|
|
65
|
+
},
|
|
66
|
+
20: {
|
|
67
|
+
speed: 3.998,
|
|
68
|
+
count: .105,
|
|
69
|
+
size: 1.6
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
web: {
|
|
73
|
+
64: {
|
|
74
|
+
speed: 3.315,
|
|
75
|
+
count: 1.35,
|
|
76
|
+
size: .95
|
|
77
|
+
},
|
|
78
|
+
20: {
|
|
79
|
+
speed: 6.63,
|
|
80
|
+
count: .25,
|
|
81
|
+
size: 1.52
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
braid: {
|
|
85
|
+
64: {
|
|
86
|
+
speed: 1.625,
|
|
87
|
+
count: .5,
|
|
88
|
+
size: 1
|
|
89
|
+
},
|
|
90
|
+
20: {
|
|
91
|
+
speed: 2.75,
|
|
92
|
+
count: .1125,
|
|
93
|
+
size: 1.36
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
ribbon: {
|
|
97
|
+
64: {
|
|
98
|
+
speed: 2.34,
|
|
99
|
+
count: .25,
|
|
100
|
+
size: .85,
|
|
101
|
+
extra: {
|
|
102
|
+
spin: 0,
|
|
103
|
+
bandMul: 3.9,
|
|
104
|
+
wobMul: 1
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
20: {
|
|
108
|
+
speed: 3.12,
|
|
109
|
+
count: .051,
|
|
110
|
+
size: 1.073,
|
|
111
|
+
extra: {
|
|
112
|
+
spin: 0,
|
|
113
|
+
bandMul: 4.94,
|
|
114
|
+
wobMul: 1
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
ring: {
|
|
119
|
+
64: {
|
|
120
|
+
speed: 3.24,
|
|
121
|
+
count: .25,
|
|
122
|
+
size: .956,
|
|
123
|
+
extra: {
|
|
124
|
+
spin: 0,
|
|
125
|
+
bandMul: 3.627,
|
|
126
|
+
wobMul: .368
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
20: {
|
|
130
|
+
speed: 3.78,
|
|
131
|
+
count: .028,
|
|
132
|
+
size: 1.622,
|
|
133
|
+
extra: {
|
|
134
|
+
spin: 0,
|
|
135
|
+
bandMul: 3.968,
|
|
136
|
+
wobMul: .565
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
morph: {
|
|
141
|
+
64: {
|
|
142
|
+
speed: 2.405,
|
|
143
|
+
count: .702,
|
|
144
|
+
size: .395,
|
|
145
|
+
extra: { spread: 1.45 }
|
|
146
|
+
},
|
|
147
|
+
20: {
|
|
148
|
+
speed: 2.08,
|
|
149
|
+
count: .53,
|
|
150
|
+
size: 1.011,
|
|
151
|
+
extra: { spread: 1.45 }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var cache = /* @__PURE__ */ new Map();
|
|
156
|
+
/** Resolve a (state, size) pair to its mode + fully-scaled draw options. */
|
|
157
|
+
function resolvePreset(state, size) {
|
|
158
|
+
const key = `${state}-${size}`;
|
|
159
|
+
const hit = cache.get(key);
|
|
160
|
+
if (hit) return hit;
|
|
161
|
+
const mode = STATE_TO_MODE[state];
|
|
162
|
+
const preset = PRESETS[mode][size];
|
|
163
|
+
let opts = _objectSpread2({}, BASE_PROFILES[mode]);
|
|
164
|
+
if (preset.count !== 1) opts = scaleCounts(opts, preset.count);
|
|
165
|
+
if (preset.size !== 1) opts = scaleRadii(opts, preset.size);
|
|
166
|
+
if (preset.extra) opts = _objectSpread2(_objectSpread2({}, opts), preset.extra);
|
|
167
|
+
const resolved = {
|
|
168
|
+
mode,
|
|
169
|
+
speed: preset.speed,
|
|
170
|
+
opts
|
|
171
|
+
};
|
|
172
|
+
cache.set(key, resolved);
|
|
173
|
+
return resolved;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
export { STATE_TO_MODE, resolvePreset };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/******** borderSize *******/
|
|
2
|
+
/******** borderStyle *******/
|
|
3
|
+
/******** radius *******/
|
|
4
|
+
/******** shadow distance *******/
|
|
5
|
+
/******** size *******/
|
|
6
|
+
/******** spacing *******/
|
|
7
|
+
/******** shadow *******/
|
|
8
|
+
/******** opacity *******/
|
|
9
|
+
/******** fontSize *******/
|
|
10
|
+
/******** fontWeight ********/
|
|
11
|
+
/******** Primary *******/
|
|
12
|
+
/******** success *******/
|
|
13
|
+
/******** warning *******/
|
|
14
|
+
/******** danger *******/
|
|
15
|
+
/******** link *******/
|
|
16
|
+
/******** radius *******/
|
|
17
|
+
/********* icon hover *********/
|
|
18
|
+
.sd-thinking-orb {
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import thinking_orb_vue_vue_type_script_setup_true_lang_default from "./thinking-orb.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region components/thinking-orb/thinking-orb.vue
|
|
3
|
+
var thinking_orb_default = thinking_orb_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { thinking_orb_default as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThinkingOrbProps } from './types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ThinkingOrbProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ThinkingOrbProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { getPrefixCls } from "../_utils/global-config.js";
|
|
3
|
+
import { useI18n } from "../locale/index.js";
|
|
4
|
+
import { useThemeMode } from "../_hooks/use-theme-mode.js";
|
|
5
|
+
import { MODE_DRAWS } from "./engine/registry.js";
|
|
6
|
+
import { resolvePreset } from "./presets.js";
|
|
7
|
+
import { computed, createElementBlock, defineComponent, mergeProps, onMounted, onUnmounted, openBlock, ref, shallowRef, useAttrs, watch } from "vue";
|
|
8
|
+
//#region components/thinking-orb/thinking-orb.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
var thinking_orb_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
|
|
10
|
+
name: "ThinkingOrb",
|
|
11
|
+
inheritAttrs: false
|
|
12
|
+
}), {}, {
|
|
13
|
+
__name: "thinking-orb",
|
|
14
|
+
props: {
|
|
15
|
+
state: { default: "working" },
|
|
16
|
+
size: { default: 64 },
|
|
17
|
+
theme: { default: "auto" },
|
|
18
|
+
speed: { default: 1 },
|
|
19
|
+
paused: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const attrs = useAttrs();
|
|
26
|
+
const canvasRef = ref(null);
|
|
27
|
+
const inheritedTheme = useThemeMode(canvasRef);
|
|
28
|
+
const reducedMotion = shallowRef(false);
|
|
29
|
+
const prefixCls = getPrefixCls("thinking-orb");
|
|
30
|
+
const { t } = useI18n();
|
|
31
|
+
const isDark = computed(() => __props.theme === "auto" ? inheritedTheme.value === "dark" : __props.theme === "dark");
|
|
32
|
+
const resolvedSize = computed(() => __props.size === 20 || __props.size === 64 ? __props.size : 64);
|
|
33
|
+
const canvasAttrs = computed(() => mergeProps({
|
|
34
|
+
"class": prefixCls,
|
|
35
|
+
"role": "img",
|
|
36
|
+
"aria-label": t(`a11y.thinkingOrb.${__props.state}`),
|
|
37
|
+
"data-theme": isDark.value ? "dark" : "light",
|
|
38
|
+
"data-state": __props.state,
|
|
39
|
+
"style": {
|
|
40
|
+
width: `${resolvedSize.value}px`,
|
|
41
|
+
height: `${resolvedSize.value}px`
|
|
42
|
+
}
|
|
43
|
+
}, attrs));
|
|
44
|
+
let stopRenderer;
|
|
45
|
+
let stopReducedMotion;
|
|
46
|
+
function setupRenderer() {
|
|
47
|
+
stopRenderer === null || stopRenderer === void 0 || stopRenderer();
|
|
48
|
+
stopRenderer = void 0;
|
|
49
|
+
const canvas = canvasRef.value;
|
|
50
|
+
if (!canvas) return;
|
|
51
|
+
const representativePhase = .6;
|
|
52
|
+
const sz = resolvedSize.value;
|
|
53
|
+
const dpr = Math.min(2, window.devicePixelRatio || 1);
|
|
54
|
+
canvas.width = Math.round(sz * dpr);
|
|
55
|
+
canvas.height = Math.round(sz * dpr);
|
|
56
|
+
const context = canvas.getContext("2d");
|
|
57
|
+
if (!context) return;
|
|
58
|
+
const { mode, speed: presetSpeed, opts } = resolvePreset(__props.state, sz);
|
|
59
|
+
const draw = MODE_DRAWS[mode];
|
|
60
|
+
const effectiveSpeed = presetSpeed * __props.speed;
|
|
61
|
+
const drawFrame = (time) => {
|
|
62
|
+
context.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
63
|
+
context.clearRect(0, 0, sz, sz);
|
|
64
|
+
draw(context, sz, time, isDark.value, opts);
|
|
65
|
+
};
|
|
66
|
+
if (reducedMotion.value) {
|
|
67
|
+
drawFrame(representativePhase);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let animationFrame = 0;
|
|
71
|
+
let running = false;
|
|
72
|
+
let visible = true;
|
|
73
|
+
const loop = () => {
|
|
74
|
+
drawFrame(performance.now() / 1e3 * effectiveSpeed);
|
|
75
|
+
if (running) animationFrame = requestAnimationFrame(loop);
|
|
76
|
+
};
|
|
77
|
+
const start = () => {
|
|
78
|
+
if (running || __props.paused) return;
|
|
79
|
+
running = true;
|
|
80
|
+
animationFrame = requestAnimationFrame(loop);
|
|
81
|
+
};
|
|
82
|
+
const stop = () => {
|
|
83
|
+
running = false;
|
|
84
|
+
cancelAnimationFrame(animationFrame);
|
|
85
|
+
};
|
|
86
|
+
drawFrame(__props.paused ? representativePhase : performance.now() / 1e3 * effectiveSpeed);
|
|
87
|
+
const observer = typeof IntersectionObserver === "undefined" ? void 0 : new IntersectionObserver(([entry]) => {
|
|
88
|
+
var _entry$isIntersecting;
|
|
89
|
+
visible = (_entry$isIntersecting = entry === null || entry === void 0 ? void 0 : entry.isIntersecting) !== null && _entry$isIntersecting !== void 0 ? _entry$isIntersecting : false;
|
|
90
|
+
if (visible && document.visibilityState !== "hidden") start();
|
|
91
|
+
else stop();
|
|
92
|
+
});
|
|
93
|
+
observer === null || observer === void 0 || observer.observe(canvas);
|
|
94
|
+
const handleVisibilityChange = () => {
|
|
95
|
+
if (document.visibilityState === "hidden") stop();
|
|
96
|
+
else if (visible) start();
|
|
97
|
+
};
|
|
98
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
99
|
+
if (!observer) start();
|
|
100
|
+
stopRenderer = () => {
|
|
101
|
+
stop();
|
|
102
|
+
observer === null || observer === void 0 || observer.disconnect();
|
|
103
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function setupReducedMotion() {
|
|
107
|
+
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
108
|
+
const update = () => {
|
|
109
|
+
reducedMotion.value = mediaQuery.matches;
|
|
110
|
+
};
|
|
111
|
+
update();
|
|
112
|
+
mediaQuery.addEventListener("change", update);
|
|
113
|
+
stopReducedMotion = () => mediaQuery.removeEventListener("change", update);
|
|
114
|
+
}
|
|
115
|
+
watch([
|
|
116
|
+
() => __props.state,
|
|
117
|
+
resolvedSize,
|
|
118
|
+
() => __props.speed,
|
|
119
|
+
() => __props.paused,
|
|
120
|
+
isDark,
|
|
121
|
+
reducedMotion
|
|
122
|
+
], setupRenderer, { flush: "post" });
|
|
123
|
+
onMounted(() => {
|
|
124
|
+
setupReducedMotion();
|
|
125
|
+
setupRenderer();
|
|
126
|
+
});
|
|
127
|
+
onUnmounted(() => {
|
|
128
|
+
stopRenderer === null || stopRenderer === void 0 || stopRenderer();
|
|
129
|
+
stopReducedMotion === null || stopReducedMotion === void 0 || stopReducedMotion();
|
|
130
|
+
});
|
|
131
|
+
return (_ctx, _cache) => {
|
|
132
|
+
return openBlock(), createElementBlock("canvas", mergeProps({
|
|
133
|
+
ref_key: "canvasRef",
|
|
134
|
+
ref: canvasRef
|
|
135
|
+
}, canvasAttrs.value), null, 16);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
//#endregion
|
|
140
|
+
export { thinking_orb_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ThinkingOrbState = 'working' | 'searching' | 'solving' | 'listening' | 'connecting' | 'weaving' | 'composing' | 'breathing' | 'shaping';
|
|
2
|
+
export type ThinkingOrbSize = 20 | 64;
|
|
3
|
+
export type ThinkingOrbTheme = 'auto' | 'dark' | 'light';
|
|
4
|
+
export type OrbState = ThinkingOrbState;
|
|
5
|
+
export type OrbSize = ThinkingOrbSize;
|
|
6
|
+
export interface ThinkingOrbProps {
|
|
7
|
+
state?: ThinkingOrbState;
|
|
8
|
+
size?: ThinkingOrbSize;
|
|
9
|
+
theme?: ThinkingOrbTheme;
|
|
10
|
+
speed?: number;
|
|
11
|
+
paused?: boolean;
|
|
12
|
+
}
|
|
@@ -4000,6 +4000,23 @@
|
|
|
4000
4000
|
"sd-textarea/textarea-attrs": {
|
|
4001
4001
|
"description": "Attributes passed to textarea"
|
|
4002
4002
|
},
|
|
4003
|
+
"sd-thinking-orb/state": {
|
|
4004
|
+
"description": "Current thinking state"
|
|
4005
|
+
},
|
|
4006
|
+
"sd-thinking-orb/size": {
|
|
4007
|
+
"description": "Purpose-tuned rendered size"
|
|
4008
|
+
},
|
|
4009
|
+
"sd-thinking-orb/theme": {
|
|
4010
|
+
"description": "Theme mode; auto follows the nearest sd-theme container"
|
|
4011
|
+
},
|
|
4012
|
+
"sd-thinking-orb/speed": {
|
|
4013
|
+
"description": "Animation speed multiplier",
|
|
4014
|
+
"type": "number"
|
|
4015
|
+
},
|
|
4016
|
+
"sd-thinking-orb/paused": {
|
|
4017
|
+
"description": "Whether the animation is paused",
|
|
4018
|
+
"type": "boolean"
|
|
4019
|
+
},
|
|
4003
4020
|
"sd-time-picker/change": {
|
|
4004
4021
|
"description": "The component value changes"
|
|
4005
4022
|
},
|
package/json/vetur-tags.json
CHANGED
|
@@ -1657,6 +1657,15 @@
|
|
|
1657
1657
|
"sd-theme-provider": {
|
|
1658
1658
|
"attributes": []
|
|
1659
1659
|
},
|
|
1660
|
+
"sd-thinking-orb": {
|
|
1661
|
+
"attributes": [
|
|
1662
|
+
"state",
|
|
1663
|
+
"size",
|
|
1664
|
+
"theme",
|
|
1665
|
+
"speed",
|
|
1666
|
+
"paused"
|
|
1667
|
+
]
|
|
1668
|
+
},
|
|
1660
1669
|
"sd-time-picker": {
|
|
1661
1670
|
"attributes": [
|
|
1662
1671
|
"change",
|
package/json/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@sdata/web-vue",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.26.0",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -9796,6 +9796,53 @@
|
|
|
9796
9796
|
"events": [],
|
|
9797
9797
|
"slots": []
|
|
9798
9798
|
},
|
|
9799
|
+
{
|
|
9800
|
+
"name": "sd-thinking-orb",
|
|
9801
|
+
"attributes": [
|
|
9802
|
+
{
|
|
9803
|
+
"name": "state",
|
|
9804
|
+
"description": "Current thinking state",
|
|
9805
|
+
"value": {
|
|
9806
|
+
"type": "ThinkingOrbState",
|
|
9807
|
+
"kind": "expression"
|
|
9808
|
+
}
|
|
9809
|
+
},
|
|
9810
|
+
{
|
|
9811
|
+
"name": "size",
|
|
9812
|
+
"description": "Purpose-tuned rendered size",
|
|
9813
|
+
"value": {
|
|
9814
|
+
"type": "ThinkingOrbSize",
|
|
9815
|
+
"kind": "expression"
|
|
9816
|
+
}
|
|
9817
|
+
},
|
|
9818
|
+
{
|
|
9819
|
+
"name": "theme",
|
|
9820
|
+
"description": "Theme mode; auto follows the nearest sd-theme container",
|
|
9821
|
+
"value": {
|
|
9822
|
+
"type": "ThinkingOrbTheme",
|
|
9823
|
+
"kind": "expression"
|
|
9824
|
+
}
|
|
9825
|
+
},
|
|
9826
|
+
{
|
|
9827
|
+
"name": "speed",
|
|
9828
|
+
"description": "Animation speed multiplier",
|
|
9829
|
+
"value": {
|
|
9830
|
+
"type": "number",
|
|
9831
|
+
"kind": "expression"
|
|
9832
|
+
}
|
|
9833
|
+
},
|
|
9834
|
+
{
|
|
9835
|
+
"name": "paused",
|
|
9836
|
+
"description": "Whether the animation is paused",
|
|
9837
|
+
"value": {
|
|
9838
|
+
"type": "boolean",
|
|
9839
|
+
"kind": "expression"
|
|
9840
|
+
}
|
|
9841
|
+
}
|
|
9842
|
+
],
|
|
9843
|
+
"events": [],
|
|
9844
|
+
"slots": []
|
|
9845
|
+
},
|
|
9799
9846
|
{
|
|
9800
9847
|
"name": "sd-time-picker",
|
|
9801
9848
|
"attributes": [
|
package/package.json
CHANGED