@sdata/web-vue 3.26.0 → 3.28.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 +8 -0
- package/dist/sd.min.css +2 -2
- package/es/_hooks/use-theme-mode.d.ts +1 -1
- package/es/_utils/date.js +5 -38
- package/es/_utils/grapheme.d.ts +5 -0
- package/es/_utils/grapheme.js +93 -0
- package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +33 -23
- package/es/basic-crud-table/index.d.ts +1 -1
- package/es/basic-crud-table/types.d.ts +9 -1
- package/es/components.d.ts +2 -0
- package/es/index.css +8 -0
- package/es/index.d.ts +6 -1
- package/es/index.js +6 -1
- package/es/index.scss +2 -0
- package/es/input/input.js +5 -6
- package/es/input-mask/index.d.ts +120 -0
- package/es/input-mask/index.js +12 -0
- package/es/input-mask/input-mask.js +5 -0
- package/es/input-mask/input-mask.vue.d.ts +49 -0
- package/es/input-mask/input-mask.vue_vue_type_script_setup_true_lang.js +346 -0
- package/es/input-mask/mask-engine.d.ts +18 -0
- package/es/input-mask/mask-engine.js +176 -0
- package/es/input-mask/presets.d.ts +2 -0
- package/es/input-mask/presets.js +220 -0
- package/es/input-mask/style/css.js +1 -0
- package/es/input-mask/style/index.css +20 -0
- package/es/input-mask/style/index.d.ts +2 -0
- package/es/input-mask/style/index.js +1 -0
- package/es/input-mask/style/index.scss +10 -0
- package/es/input-mask/style/token.scss +5 -0
- package/es/input-mask/types.d.ts +49 -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 +4 -0
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +5 -6
- 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/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +8 -10
- package/es/toolbar/types.d.ts +3 -0
- package/json/vetur-attributes.json +23 -0
- package/json/vetur-tags.json +14 -0
- package/json/web-types.json +70 -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,104 @@
|
|
|
1
|
+
//#region components/thinking-orb/engine/core.ts
|
|
2
|
+
function lerp(a, b, f) {
|
|
3
|
+
return a + (b - a) * f;
|
|
4
|
+
}
|
|
5
|
+
function frac(x) {
|
|
6
|
+
return x - Math.floor(x);
|
|
7
|
+
}
|
|
8
|
+
/** Value noise on a 2D lattice — smooth, deterministic, cheap. */
|
|
9
|
+
function vnoise(x, y) {
|
|
10
|
+
const xi = Math.floor(x);
|
|
11
|
+
const yi = Math.floor(y);
|
|
12
|
+
let fx = x - xi;
|
|
13
|
+
let fy = y - yi;
|
|
14
|
+
fx = fx * fx * (3 - 2 * fx);
|
|
15
|
+
fy = fy * fy * (3 - 2 * fy);
|
|
16
|
+
const a = hashD(xi, yi);
|
|
17
|
+
const b = hashD(xi + 1, yi);
|
|
18
|
+
const c = hashD(xi, yi + 1);
|
|
19
|
+
const d = hashD(xi + 1, yi + 1);
|
|
20
|
+
return a + (b - a) * fx + (c - a) * fy + (a - b - c + d) * fx * fy;
|
|
21
|
+
}
|
|
22
|
+
/** Deterministic hash in [0, 1). */
|
|
23
|
+
function hashD(a, b) {
|
|
24
|
+
const h = Math.sin(a * 12.9898 + b * 78.233) * 43758.5453;
|
|
25
|
+
return h - Math.floor(h);
|
|
26
|
+
}
|
|
27
|
+
/** Stable directions on a unit sphere (Fibonacci lattice). */
|
|
28
|
+
function fibDir(i, n) {
|
|
29
|
+
const golden = Math.PI * (3 - Math.sqrt(5));
|
|
30
|
+
const y = 1 - 2 * (i + .5) / n;
|
|
31
|
+
const rad = Math.sqrt(1 - y * y);
|
|
32
|
+
const a = i * golden;
|
|
33
|
+
return [
|
|
34
|
+
rad * Math.cos(a),
|
|
35
|
+
y,
|
|
36
|
+
rad * Math.sin(a)
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
/** Shortest signed angular distance, wrapped to (-π, π]. */
|
|
40
|
+
function angleDelta(a, b) {
|
|
41
|
+
return Math.atan2(Math.sin(a - b), Math.cos(a - b));
|
|
42
|
+
}
|
|
43
|
+
/** Shared spin + tilt + orthographic projection. */
|
|
44
|
+
function makeProj(yaw, tilt, cx, cy, scale) {
|
|
45
|
+
const st = Math.sin(tilt);
|
|
46
|
+
const ct = Math.cos(tilt);
|
|
47
|
+
const sy = Math.sin(yaw);
|
|
48
|
+
const cyw = Math.cos(yaw);
|
|
49
|
+
return (x, y, z) => {
|
|
50
|
+
const x1 = x * cyw + z * sy;
|
|
51
|
+
const z1 = -x * sy + z * cyw;
|
|
52
|
+
const y1 = y * ct - z1 * st;
|
|
53
|
+
const z2 = y * st + z1 * ct;
|
|
54
|
+
return [
|
|
55
|
+
cx + x1 * scale,
|
|
56
|
+
cy - y1 * scale,
|
|
57
|
+
z2
|
|
58
|
+
];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Painter: z-sort far→near, matte grayscale dots. On dark substrates the
|
|
63
|
+
* ink value is mirrored (1 - white) so near dots read bright — the same
|
|
64
|
+
* depth language on an inverted substrate.
|
|
65
|
+
*/
|
|
66
|
+
function paint(ctx, dots, dark, rMin = .3) {
|
|
67
|
+
dots.sort((a, b) => a.z - b.z);
|
|
68
|
+
for (const d of dots) {
|
|
69
|
+
var _d$a;
|
|
70
|
+
const alpha = (_d$a = d.a) !== null && _d$a !== void 0 ? _d$a : 1;
|
|
71
|
+
if (alpha < .02) continue;
|
|
72
|
+
const w = Math.min(1, Math.max(0, d.white));
|
|
73
|
+
const g = Math.round((dark ? 1 - w : w) * 255);
|
|
74
|
+
ctx.fillStyle = `rgba(${g},${g},${g},${alpha})`;
|
|
75
|
+
ctx.beginPath();
|
|
76
|
+
ctx.arc(d.x, d.y, Math.max(rMin, d.r), 0, Math.PI * 2);
|
|
77
|
+
ctx.fill();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Stroke pass for edge-based modes. Runs before `paint` so nodes sit on top. */
|
|
81
|
+
function paintLines(ctx, lines, dark) {
|
|
82
|
+
for (const l of lines) {
|
|
83
|
+
var _l$a;
|
|
84
|
+
const alpha = (_l$a = l.a) !== null && _l$a !== void 0 ? _l$a : 1;
|
|
85
|
+
if (alpha < .02) continue;
|
|
86
|
+
const w = Math.min(1, Math.max(0, l.white));
|
|
87
|
+
const g = Math.round((dark ? 1 - w : w) * 255);
|
|
88
|
+
ctx.strokeStyle = `rgba(${g},${g},${g},${alpha})`;
|
|
89
|
+
ctx.lineWidth = l.w;
|
|
90
|
+
ctx.beginPath();
|
|
91
|
+
ctx.moveTo(l.x1, l.y1);
|
|
92
|
+
ctx.lineTo(l.x2, l.y2);
|
|
93
|
+
ctx.stroke();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Dot radii were tuned for a 300pt frame; sub-linear scaling keeps small
|
|
98
|
+
* spinners legible. Lower pow = radii shrink less with size.
|
|
99
|
+
*/
|
|
100
|
+
function radiusScale(size, pow) {
|
|
101
|
+
return Math.pow(size / 300, pow);
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { angleDelta, fibDir, frac, hashD, lerp, makeProj, paint, paintLines, radiusScale, vnoise };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { angleDelta, hashD, makeProj, paint, radiusScale } from "./core.js";
|
|
2
|
+
//#region components/thinking-orb/engine/lattice.ts
|
|
3
|
+
function solveCycle(time, count, slotDur, rest) {
|
|
4
|
+
const tc = time % (2 * count * slotDur + rest);
|
|
5
|
+
const amount = Array(count).fill(0);
|
|
6
|
+
let active = -1;
|
|
7
|
+
if (tc < 2 * count * slotDur) {
|
|
8
|
+
const slot = Math.floor(tc / slotDur);
|
|
9
|
+
const p = (tc - slot * slotDur) / slotDur;
|
|
10
|
+
const cl = Math.min(1, p / .7);
|
|
11
|
+
const ep = 1 - Math.pow(1 - cl, 3);
|
|
12
|
+
if (slot < count) {
|
|
13
|
+
for (let i = 0; i < slot; i++) amount[i] = 1;
|
|
14
|
+
amount[slot] = ep;
|
|
15
|
+
active = slot;
|
|
16
|
+
} else {
|
|
17
|
+
const u = 2 * count - 1 - slot;
|
|
18
|
+
for (let i = 0; i < u; i++) amount[i] = 1;
|
|
19
|
+
amount[u] = 1 - ep;
|
|
20
|
+
active = u;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
amount,
|
|
25
|
+
active
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function applyMoves(pt3, moves, sc) {
|
|
29
|
+
let [x, y, z] = pt3;
|
|
30
|
+
let inActive = false;
|
|
31
|
+
for (let i = 0; i < moves.length; i++) {
|
|
32
|
+
if (sc.amount[i] <= 0) continue;
|
|
33
|
+
const mv = moves[i];
|
|
34
|
+
const coord = mv.axis === 0 ? x : mv.axis === 1 ? y : z;
|
|
35
|
+
if (coord < mv.lo || coord >= mv.hi) continue;
|
|
36
|
+
if (i === sc.active) inActive = true;
|
|
37
|
+
const a = mv.ang * sc.amount[i];
|
|
38
|
+
const ca = Math.cos(a);
|
|
39
|
+
const sa = Math.sin(a);
|
|
40
|
+
if (mv.axis === 0) {
|
|
41
|
+
const y2 = y * ca - z * sa;
|
|
42
|
+
z = y * sa + z * ca;
|
|
43
|
+
y = y2;
|
|
44
|
+
} else if (mv.axis === 1) {
|
|
45
|
+
const x2 = x * ca + z * sa;
|
|
46
|
+
z = -x * sa + z * ca;
|
|
47
|
+
x = x2;
|
|
48
|
+
} else {
|
|
49
|
+
const x2 = x * ca - y * sa;
|
|
50
|
+
y = x * sa + y * ca;
|
|
51
|
+
x = x2;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [
|
|
55
|
+
x,
|
|
56
|
+
y,
|
|
57
|
+
z,
|
|
58
|
+
inActive
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
function makeMoves(count) {
|
|
62
|
+
const moves = [];
|
|
63
|
+
for (let i = 0; i < count; i++) {
|
|
64
|
+
const axis = Math.min(2, Math.floor(hashD(i, 2.3) * 3));
|
|
65
|
+
const lo = -1 + .5 * Math.min(3, Math.floor(hashD(i, 5.9) * 4));
|
|
66
|
+
const dir = hashD(i, 7.7) < .5 ? 1 : -1;
|
|
67
|
+
moves.push({
|
|
68
|
+
axis,
|
|
69
|
+
lo,
|
|
70
|
+
hi: lo + .5,
|
|
71
|
+
ang: dir * Math.PI / 2
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return moves;
|
|
75
|
+
}
|
|
76
|
+
var drawGlobe = (ctx, size, t, dark, o) => {
|
|
77
|
+
var _o$scanMul, _o$rsPow, _o$dimBase, _o$latRings, _o$lonDensity;
|
|
78
|
+
const spin = .5;
|
|
79
|
+
const cx = size / 2;
|
|
80
|
+
const cy = size / 2;
|
|
81
|
+
const radius = size / 2 * .82;
|
|
82
|
+
const tilt = .4 + .06 * Math.sin(t * .35);
|
|
83
|
+
const pt = makeProj(t * spin, tilt, cx, cy, radius);
|
|
84
|
+
const scan = t * (spin + (1.7 - spin) * ((_o$scanMul = o.scanMul) !== null && _o$scanMul !== void 0 ? _o$scanMul : 1));
|
|
85
|
+
const rs = radiusScale(size, (_o$rsPow = o.rsPow) !== null && _o$rsPow !== void 0 ? _o$rsPow : .6);
|
|
86
|
+
const dimBase = (_o$dimBase = o.dimBase) !== null && _o$dimBase !== void 0 ? _o$dimBase : 1;
|
|
87
|
+
const dots = [];
|
|
88
|
+
const latRings = (_o$latRings = o.latRings) !== null && _o$latRings !== void 0 ? _o$latRings : 17;
|
|
89
|
+
const lonDensity = (_o$lonDensity = o.lonDensity) !== null && _o$lonDensity !== void 0 ? _o$lonDensity : 44;
|
|
90
|
+
for (let li = 0; li <= latRings; li++) {
|
|
91
|
+
const lat = -Math.PI / 2 + li / latRings * Math.PI;
|
|
92
|
+
const cosLat = Math.cos(lat);
|
|
93
|
+
const sinLat = Math.sin(lat);
|
|
94
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
95
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
96
|
+
var _o$rBase, _o$rDepth, _o$rBoost, _o$inkFar, _o$inkSpan;
|
|
97
|
+
const lon = lj / lonCount * 2 * Math.PI;
|
|
98
|
+
const [px, py, z] = pt(cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon));
|
|
99
|
+
const depth = (z + 1) / 2;
|
|
100
|
+
const d = angleDelta(lon + t * spin, scan);
|
|
101
|
+
const boost = Math.exp(-(d * d) / .18) * Math.max(0, z);
|
|
102
|
+
dots.push({
|
|
103
|
+
x: px,
|
|
104
|
+
y: py,
|
|
105
|
+
z,
|
|
106
|
+
r: (((_o$rBase = o.rBase) !== null && _o$rBase !== void 0 ? _o$rBase : .6) + ((_o$rDepth = o.rDepth) !== null && _o$rDepth !== void 0 ? _o$rDepth : 1.7) * depth + ((_o$rBoost = o.rBoost) !== null && _o$rBoost !== void 0 ? _o$rBoost : 1) * boost) * rs,
|
|
107
|
+
white: ((_o$inkFar = o.inkFar) !== null && _o$inkFar !== void 0 ? _o$inkFar : .62) - ((_o$inkSpan = o.inkSpan) !== null && _o$inkSpan !== void 0 ? _o$inkSpan : .54) * depth,
|
|
108
|
+
a: dimBase + (1 - dimBase) * Math.min(1, boost)
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
paint(ctx, dots, dark, o.rMin);
|
|
113
|
+
};
|
|
114
|
+
var drawRubik = (ctx, size, t, dark, o) => {
|
|
115
|
+
var _o$rsPow2, _o$moveCount, _o$latRings2, _o$lonDensity2;
|
|
116
|
+
const cx = size / 2;
|
|
117
|
+
const cy = size / 2;
|
|
118
|
+
const R = size / 2 * .82;
|
|
119
|
+
const pt = makeProj(t * .55, .35 + .1 * Math.sin(t * .9), cx, cy, R);
|
|
120
|
+
const rs = radiusScale(size, (_o$rsPow2 = o.rsPow) !== null && _o$rsPow2 !== void 0 ? _o$rsPow2 : .6);
|
|
121
|
+
const moveCount = (_o$moveCount = o.moveCount) !== null && _o$moveCount !== void 0 ? _o$moveCount : 14;
|
|
122
|
+
const moves = makeMoves(moveCount);
|
|
123
|
+
const sc = solveCycle(t, moveCount, .42, 1.2);
|
|
124
|
+
const dots = [];
|
|
125
|
+
const latRings = (_o$latRings2 = o.latRings) !== null && _o$latRings2 !== void 0 ? _o$latRings2 : 15;
|
|
126
|
+
const lonDensity = (_o$lonDensity2 = o.lonDensity) !== null && _o$lonDensity2 !== void 0 ? _o$lonDensity2 : 40;
|
|
127
|
+
for (let li = 0; li <= latRings; li++) {
|
|
128
|
+
const lat = -Math.PI / 2 + li / latRings * Math.PI;
|
|
129
|
+
const cosLat = Math.cos(lat);
|
|
130
|
+
const sinLat = Math.sin(lat);
|
|
131
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
132
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
133
|
+
var _o$rBase2, _o$rDepth2, _o$rActive, _o$inkFar2, _o$inkSpan2;
|
|
134
|
+
const lon = lj / lonCount * 2 * Math.PI;
|
|
135
|
+
const [x, y, z, inActive] = applyMoves([
|
|
136
|
+
cosLat * Math.cos(lon),
|
|
137
|
+
sinLat,
|
|
138
|
+
cosLat * Math.sin(lon)
|
|
139
|
+
], moves, sc);
|
|
140
|
+
const [px, py, zr] = pt(x, y, z);
|
|
141
|
+
const depth = (zr + 1) / 2;
|
|
142
|
+
dots.push({
|
|
143
|
+
x: px,
|
|
144
|
+
y: py,
|
|
145
|
+
z: zr,
|
|
146
|
+
r: (((_o$rBase2 = o.rBase) !== null && _o$rBase2 !== void 0 ? _o$rBase2 : .6) + ((_o$rDepth2 = o.rDepth) !== null && _o$rDepth2 !== void 0 ? _o$rDepth2 : 1.7) * depth + (inActive ? (_o$rActive = o.rActive) !== null && _o$rActive !== void 0 ? _o$rActive : .3 : 0)) * rs,
|
|
147
|
+
white: ((_o$inkFar2 = o.inkFar) !== null && _o$inkFar2 !== void 0 ? _o$inkFar2 : .62) - ((_o$inkSpan2 = o.inkSpan) !== null && _o$inkSpan2 !== void 0 ? _o$inkSpan2 : .54) * depth - (inActive ? .14 : 0)
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
paint(ctx, dots, dark, o.rMin);
|
|
152
|
+
};
|
|
153
|
+
var drawWave = (ctx, size, t, dark, o) => {
|
|
154
|
+
var _o$rsPow3, _o$rings, _o$lonDensity3;
|
|
155
|
+
const cx = size / 2;
|
|
156
|
+
const cy = size / 2;
|
|
157
|
+
const R = size / 2 * .874;
|
|
158
|
+
const pt = makeProj(t * .18, .38, cx, cy, 1);
|
|
159
|
+
const rs = radiusScale(size, (_o$rsPow3 = o.rsPow) !== null && _o$rsPow3 !== void 0 ? _o$rsPow3 : .6);
|
|
160
|
+
const dots = [];
|
|
161
|
+
const rings = (_o$rings = o.rings) !== null && _o$rings !== void 0 ? _o$rings : 15;
|
|
162
|
+
const lonDensity = (_o$lonDensity3 = o.lonDensity) !== null && _o$lonDensity3 !== void 0 ? _o$lonDensity3 : 40;
|
|
163
|
+
for (let ri = 0; ri <= rings; ri++) {
|
|
164
|
+
const lat = -Math.PI / 2 + ri / rings * Math.PI;
|
|
165
|
+
const cosLat = Math.cos(lat);
|
|
166
|
+
const sinLat = Math.sin(lat);
|
|
167
|
+
const w = .62 * Math.sin(t * 2.1 - ri * .52) + .38 * Math.sin(t * 1.27 + ri * .83);
|
|
168
|
+
const rr = R * (.88 + .105 * w);
|
|
169
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
170
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
171
|
+
var _o$rBase3, _o$rDepth3;
|
|
172
|
+
const lon = lj / lonCount * 2 * Math.PI;
|
|
173
|
+
const [px, py, z] = pt(cosLat * Math.cos(lon) * rr, sinLat * rr, cosLat * Math.sin(lon) * rr);
|
|
174
|
+
const depth = (z / R + 1) / 2;
|
|
175
|
+
const crest = Math.max(0, w);
|
|
176
|
+
dots.push({
|
|
177
|
+
x: px,
|
|
178
|
+
y: py,
|
|
179
|
+
z,
|
|
180
|
+
r: (((_o$rBase3 = o.rBase) !== null && _o$rBase3 !== void 0 ? _o$rBase3 : .6) + ((_o$rDepth3 = o.rDepth) !== null && _o$rDepth3 !== void 0 ? _o$rDepth3 : 1.7) * depth) * (1 + .4 * crest) * rs,
|
|
181
|
+
white: .66 - .56 * depth - .1 * crest
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
paint(ctx, dots, dark, o.rMin);
|
|
186
|
+
};
|
|
187
|
+
//#endregion
|
|
188
|
+
export { drawGlobe, drawRubik, drawWave };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { paint } from "./core.js";
|
|
2
|
+
//#region components/thinking-orb/engine/morph.ts
|
|
3
|
+
function smoothE(x) {
|
|
4
|
+
return x * x * (3 - 2 * x);
|
|
5
|
+
}
|
|
6
|
+
function polyPath(verts) {
|
|
7
|
+
const V = verts.length;
|
|
8
|
+
const L = [];
|
|
9
|
+
let total = 0;
|
|
10
|
+
for (let i = 0; i < V; i++) {
|
|
11
|
+
const a = verts[i];
|
|
12
|
+
const b = verts[(i + 1) % V];
|
|
13
|
+
const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
14
|
+
L.push(l);
|
|
15
|
+
total += l;
|
|
16
|
+
}
|
|
17
|
+
return (f) => {
|
|
18
|
+
let target = f * total;
|
|
19
|
+
let i = 0;
|
|
20
|
+
while (target > L[i] && i < V - 1) {
|
|
21
|
+
target -= L[i];
|
|
22
|
+
i++;
|
|
23
|
+
}
|
|
24
|
+
const a = verts[i];
|
|
25
|
+
const b = verts[(i + 1) % V];
|
|
26
|
+
const ff = L[i] ? Math.min(1, target / L[i]) : 0;
|
|
27
|
+
return [a[0] + (b[0] - a[0]) * ff, a[1] + (b[1] - a[1]) * ff];
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var CIRCLE = (f) => {
|
|
31
|
+
const a = -Math.PI / 2 + f * 2 * Math.PI;
|
|
32
|
+
return [Math.cos(a) * .24, Math.sin(a) * .24];
|
|
33
|
+
};
|
|
34
|
+
var CYCLE = [
|
|
35
|
+
CIRCLE,
|
|
36
|
+
polyPath([
|
|
37
|
+
[0, -.26],
|
|
38
|
+
[.24, .16],
|
|
39
|
+
[-.24, .16]
|
|
40
|
+
]),
|
|
41
|
+
polyPath([
|
|
42
|
+
[0, -.2],
|
|
43
|
+
[.2, -.2],
|
|
44
|
+
[.2, .2],
|
|
45
|
+
[-.2, .2],
|
|
46
|
+
[-.2, -.2]
|
|
47
|
+
])
|
|
48
|
+
];
|
|
49
|
+
function morphN(d) {
|
|
50
|
+
return Math.max(6, Math.round(34 * d));
|
|
51
|
+
}
|
|
52
|
+
var HOLD = 1.4;
|
|
53
|
+
var MORPH = .9;
|
|
54
|
+
var SEG = 2.3;
|
|
55
|
+
var drawMorph = (ctx, size, t, dark, o) => {
|
|
56
|
+
var _o$spread, _o$iconD, _o$rDot;
|
|
57
|
+
const K = CYCLE.length;
|
|
58
|
+
const tc = t % (SEG * K);
|
|
59
|
+
const k = Math.floor(tc / SEG);
|
|
60
|
+
const local = tc - k * SEG;
|
|
61
|
+
const m = local > HOLD ? smoothE((local - HOLD) / MORPH) : 0;
|
|
62
|
+
const sprd = (_o$spread = o.spread) !== null && _o$spread !== void 0 ? _o$spread : 1;
|
|
63
|
+
const pA = CYCLE[k];
|
|
64
|
+
const pB = CYCLE[(k + 1) % K];
|
|
65
|
+
const M = 160;
|
|
66
|
+
const pts = [];
|
|
67
|
+
for (let i = 0; i < M; i++) {
|
|
68
|
+
const f = i / M;
|
|
69
|
+
const a = pA(f);
|
|
70
|
+
const b = pB(f);
|
|
71
|
+
pts.push([(a[0] + (b[0] - a[0]) * m) * sprd, (a[1] + (b[1] - a[1]) * m) * sprd]);
|
|
72
|
+
}
|
|
73
|
+
const L = [];
|
|
74
|
+
let total = 0;
|
|
75
|
+
for (let i = 0; i < M; i++) {
|
|
76
|
+
const a = pts[i];
|
|
77
|
+
const b = pts[(i + 1) % M];
|
|
78
|
+
const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
79
|
+
L.push(l);
|
|
80
|
+
total += l;
|
|
81
|
+
}
|
|
82
|
+
const n = morphN((_o$iconD = o.iconD) !== null && _o$iconD !== void 0 ? _o$iconD : 1);
|
|
83
|
+
const re = ((_o$rDot = o.rDot) !== null && _o$rDot !== void 0 ? _o$rDot : .021) * 1.35 * sprd;
|
|
84
|
+
const pulse = 1 + .02 * Math.sin(local * 3.1);
|
|
85
|
+
const dots = [];
|
|
86
|
+
const c2 = size / 2;
|
|
87
|
+
let seg = 0;
|
|
88
|
+
let acc = 0;
|
|
89
|
+
for (let k2 = 0; k2 < n; k2++) {
|
|
90
|
+
const target = k2 / n * total;
|
|
91
|
+
while (acc + L[seg] < target && seg < M - 1) {
|
|
92
|
+
acc += L[seg];
|
|
93
|
+
seg++;
|
|
94
|
+
}
|
|
95
|
+
const a = pts[seg];
|
|
96
|
+
const b = pts[(seg + 1) % M];
|
|
97
|
+
const f = L[seg] ? Math.min(1, (target - acc) / L[seg]) : 0;
|
|
98
|
+
const x = (a[0] + (b[0] - a[0]) * f) * pulse;
|
|
99
|
+
const y = (a[1] + (b[1] - a[1]) * f) * pulse;
|
|
100
|
+
dots.push({
|
|
101
|
+
x: c2 + x * size,
|
|
102
|
+
y: c2 + y * size,
|
|
103
|
+
z: 0,
|
|
104
|
+
r: Math.max(.35, re * size),
|
|
105
|
+
white: .1
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
paint(ctx, dots, dark, o.rMin);
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
export { drawMorph };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { hashD, makeProj, paint, radiusScale } from "./core.js";
|
|
2
|
+
//#region components/thinking-orb/engine/orbits.ts
|
|
3
|
+
var drawOrbits = (ctx, size, t, dark, o) => {
|
|
4
|
+
var _o$rsPow, _o$orbitN, _o$ghostN, _o$particles;
|
|
5
|
+
const cx = size / 2;
|
|
6
|
+
const cy = size / 2;
|
|
7
|
+
const R = size / 2 * .82;
|
|
8
|
+
const pt = makeProj(t * .12, .3, cx, cy, 1);
|
|
9
|
+
const rs = radiusScale(size, (_o$rsPow = o.rsPow) !== null && _o$rsPow !== void 0 ? _o$rsPow : .6);
|
|
10
|
+
const dots = [];
|
|
11
|
+
const orbitN = (_o$orbitN = o.orbitN) !== null && _o$orbitN !== void 0 ? _o$orbitN : 12;
|
|
12
|
+
const ghostN = (_o$ghostN = o.ghostN) !== null && _o$ghostN !== void 0 ? _o$ghostN : 40;
|
|
13
|
+
const particles = (_o$particles = o.particles) !== null && _o$particles !== void 0 ? _o$particles : 3;
|
|
14
|
+
for (let orb = 0; orb < orbitN; orb++) {
|
|
15
|
+
const h1 = hashD(orb, 1.7);
|
|
16
|
+
const h2 = hashD(orb, 5.2);
|
|
17
|
+
const h3 = hashD(orb, 8.9);
|
|
18
|
+
const ro = R * (.45 + .52 * h1);
|
|
19
|
+
const th = h1 * 2 * Math.PI;
|
|
20
|
+
const phi = Math.acos(2 * h2 - 1);
|
|
21
|
+
const nx = Math.sin(phi) * Math.cos(th);
|
|
22
|
+
const ny = Math.cos(phi);
|
|
23
|
+
const nz = Math.sin(phi) * Math.sin(th);
|
|
24
|
+
let ux = -ny;
|
|
25
|
+
let uy = nx;
|
|
26
|
+
const uz = 0;
|
|
27
|
+
const ul = Math.max(1e-6, Math.sqrt(ux * ux + uy * uy));
|
|
28
|
+
ux /= ul;
|
|
29
|
+
uy /= ul;
|
|
30
|
+
const vx = ny * uz - nz * uy;
|
|
31
|
+
const vy = nz * ux - nx * uz;
|
|
32
|
+
const vz = nx * uy - ny * ux;
|
|
33
|
+
const speed = (.25 + .55 * h3) * (h3 > .5 ? 1 : -1);
|
|
34
|
+
for (let k = 0; k < ghostN; k++) {
|
|
35
|
+
var _o$ghostR, _o$ghostA;
|
|
36
|
+
const a = k / ghostN * 2 * Math.PI;
|
|
37
|
+
const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
|
|
38
|
+
const depth = (z / ro + 1) / 2;
|
|
39
|
+
dots.push({
|
|
40
|
+
x: px,
|
|
41
|
+
y: py,
|
|
42
|
+
z,
|
|
43
|
+
r: ((_o$ghostR = o.ghostR) !== null && _o$ghostR !== void 0 ? _o$ghostR : .9) * rs,
|
|
44
|
+
white: .72,
|
|
45
|
+
a: ((_o$ghostA = o.ghostA) !== null && _o$ghostA !== void 0 ? _o$ghostA : .5) * (.4 + .6 * depth)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
for (let m = 0; m < particles; m++) {
|
|
49
|
+
var _o$partR, _o$partRDepth;
|
|
50
|
+
const a = t * speed + m / particles * 2 * Math.PI + h2 * 6;
|
|
51
|
+
const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
|
|
52
|
+
const depth = (z / ro + 1) / 2;
|
|
53
|
+
dots.push({
|
|
54
|
+
x: px,
|
|
55
|
+
y: py,
|
|
56
|
+
z,
|
|
57
|
+
r: (((_o$partR = o.partR) !== null && _o$partR !== void 0 ? _o$partR : 1.2) + ((_o$partRDepth = o.partRDepth) !== null && _o$partRDepth !== void 0 ? _o$partRDepth : 1.6) * depth) * rs,
|
|
58
|
+
white: .3 - .22 * depth
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
paint(ctx, dots, dark, o.rMin);
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { drawOrbits };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ModeOpts {
|
|
2
|
+
[key: string]: number | undefined;
|
|
3
|
+
}
|
|
4
|
+
export declare function scaleCounts(opts: ModeOpts, scale: number): ModeOpts;
|
|
5
|
+
export declare function scaleRadii(opts: ModeOpts, scale: number): ModeOpts;
|
|
6
|
+
export declare const BASE_PROFILES: Record<string, ModeOpts>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
//#region components/thinking-orb/engine/profiles.ts
|
|
3
|
+
var COUNT_PAIRS = [
|
|
4
|
+
["latRings", "lonDensity"],
|
|
5
|
+
["rings", "lonDensity"],
|
|
6
|
+
["lanes", "segs"]
|
|
7
|
+
];
|
|
8
|
+
var COUNT_KEYS = [
|
|
9
|
+
"orbitN",
|
|
10
|
+
"ghostN",
|
|
11
|
+
"nodeN",
|
|
12
|
+
"strandN",
|
|
13
|
+
"signals"
|
|
14
|
+
];
|
|
15
|
+
var ICON_DENSITY_KEYS = ["iconD"];
|
|
16
|
+
var RADIUS_KEYS = [
|
|
17
|
+
"rBase",
|
|
18
|
+
"rDepth",
|
|
19
|
+
"rActive",
|
|
20
|
+
"rDot",
|
|
21
|
+
"ghostR",
|
|
22
|
+
"partR",
|
|
23
|
+
"partRDepth",
|
|
24
|
+
"nodeR",
|
|
25
|
+
"nodeRDepth"
|
|
26
|
+
];
|
|
27
|
+
function scaleCounts(opts, scale) {
|
|
28
|
+
const out = _objectSpread2({}, opts);
|
|
29
|
+
const done = /* @__PURE__ */ new Set();
|
|
30
|
+
const rt = Math.sqrt(scale);
|
|
31
|
+
for (const [a, b] of COUNT_PAIRS) {
|
|
32
|
+
const va = out[a];
|
|
33
|
+
const vb = out[b];
|
|
34
|
+
if (va != null && vb != null && !done.has(a) && !done.has(b)) {
|
|
35
|
+
out[a] = Math.max(2, Math.round(va * rt));
|
|
36
|
+
out[b] = Math.max(2, Math.round(vb * rt));
|
|
37
|
+
done.add(a);
|
|
38
|
+
done.add(b);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const k of COUNT_KEYS) {
|
|
42
|
+
const v = out[k];
|
|
43
|
+
if (v != null && v !== 0 && !done.has(k)) out[k] = Math.max(1, Math.round(v * scale));
|
|
44
|
+
}
|
|
45
|
+
for (const k of ICON_DENSITY_KEYS) {
|
|
46
|
+
const v = out[k];
|
|
47
|
+
if (v != null) out[k] = Math.max(.02, v * scale);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
function scaleRadii(opts, scale) {
|
|
52
|
+
var _out$rSizeMul;
|
|
53
|
+
const out = _objectSpread2({}, opts);
|
|
54
|
+
for (const k of RADIUS_KEYS) {
|
|
55
|
+
const v = out[k];
|
|
56
|
+
if (v != null) out[k] = v * scale;
|
|
57
|
+
}
|
|
58
|
+
out.rSizeMul = ((_out$rSizeMul = out.rSizeMul) !== null && _out$rSizeMul !== void 0 ? _out$rSizeMul : 1) * scale;
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/** Base (fine) profiles per mode, before preset multipliers. */
|
|
62
|
+
var BASE_PROFILES = {
|
|
63
|
+
globe: {
|
|
64
|
+
latRings: 17,
|
|
65
|
+
lonDensity: 44,
|
|
66
|
+
rBase: .6,
|
|
67
|
+
rDepth: 1.7,
|
|
68
|
+
rBoost: 1,
|
|
69
|
+
inkFar: .62,
|
|
70
|
+
inkSpan: .54,
|
|
71
|
+
rsPow: .6,
|
|
72
|
+
rMin: .3
|
|
73
|
+
},
|
|
74
|
+
orbits: {
|
|
75
|
+
orbitN: 12,
|
|
76
|
+
ghostN: 40,
|
|
77
|
+
ghostR: .9,
|
|
78
|
+
ghostA: .5,
|
|
79
|
+
particles: 3,
|
|
80
|
+
partR: 1.2,
|
|
81
|
+
partRDepth: 1.6,
|
|
82
|
+
rsPow: .6,
|
|
83
|
+
rMin: .3
|
|
84
|
+
},
|
|
85
|
+
rubik: {
|
|
86
|
+
latRings: 15,
|
|
87
|
+
lonDensity: 40,
|
|
88
|
+
moveCount: 14,
|
|
89
|
+
rBase: .6,
|
|
90
|
+
rDepth: 1.7,
|
|
91
|
+
rActive: .3,
|
|
92
|
+
inkFar: .62,
|
|
93
|
+
inkSpan: .54,
|
|
94
|
+
rsPow: .6,
|
|
95
|
+
rMin: .3
|
|
96
|
+
},
|
|
97
|
+
wave: {
|
|
98
|
+
rings: 15,
|
|
99
|
+
lonDensity: 40,
|
|
100
|
+
rBase: .6,
|
|
101
|
+
rDepth: 1.7,
|
|
102
|
+
rsPow: .6,
|
|
103
|
+
rMin: .3
|
|
104
|
+
},
|
|
105
|
+
web: {
|
|
106
|
+
nodeN: 30,
|
|
107
|
+
thr: .72,
|
|
108
|
+
signals: 5,
|
|
109
|
+
nodeR: 1.4,
|
|
110
|
+
nodeRDepth: 1.8,
|
|
111
|
+
lineW: .8,
|
|
112
|
+
rsPow: .6,
|
|
113
|
+
rMin: .3
|
|
114
|
+
},
|
|
115
|
+
braid: {
|
|
116
|
+
strandN: 52,
|
|
117
|
+
turns: 3,
|
|
118
|
+
ghostN: 150,
|
|
119
|
+
rBase: 1.2,
|
|
120
|
+
rDepth: 1.8,
|
|
121
|
+
rsPow: .6,
|
|
122
|
+
rMin: .3
|
|
123
|
+
},
|
|
124
|
+
ribbon: {
|
|
125
|
+
lanes: 5,
|
|
126
|
+
segs: 88,
|
|
127
|
+
ghostN: 150,
|
|
128
|
+
rBase: 1.1,
|
|
129
|
+
rDepth: 1.7,
|
|
130
|
+
rsPow: .6,
|
|
131
|
+
rMin: .3
|
|
132
|
+
},
|
|
133
|
+
ring: {
|
|
134
|
+
lanes: 5,
|
|
135
|
+
segs: 88,
|
|
136
|
+
ghostN: 0,
|
|
137
|
+
faceOn: 1,
|
|
138
|
+
rBase: 1.1,
|
|
139
|
+
rDepth: 1.7,
|
|
140
|
+
rsPow: .6,
|
|
141
|
+
rMin: .3
|
|
142
|
+
},
|
|
143
|
+
morph: {
|
|
144
|
+
rDot: .021,
|
|
145
|
+
iconD: 1,
|
|
146
|
+
rMin: .25
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { BASE_PROFILES, scaleCounts, scaleRadii };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { drawBraid } from "./braid.js";
|
|
2
|
+
import { drawGlobe, drawRubik, drawWave } from "./lattice.js";
|
|
3
|
+
import { drawMorph } from "./morph.js";
|
|
4
|
+
import { drawOrbits } from "./orbits.js";
|
|
5
|
+
import { drawRibbon } from "./ribbon.js";
|
|
6
|
+
import { drawWeb } from "./web.js";
|
|
7
|
+
//#region components/thinking-orb/engine/registry.ts
|
|
8
|
+
var MODE_DRAWS = {
|
|
9
|
+
orbits: drawOrbits,
|
|
10
|
+
globe: drawGlobe,
|
|
11
|
+
rubik: drawRubik,
|
|
12
|
+
wave: drawWave,
|
|
13
|
+
web: drawWeb,
|
|
14
|
+
braid: drawBraid,
|
|
15
|
+
ribbon: drawRibbon,
|
|
16
|
+
ring: drawRibbon,
|
|
17
|
+
morph: drawMorph
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { MODE_DRAWS };
|