@konitif/theme 0.284.2
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/LICENSE.md +21 -0
- package/README.md +56 -0
- package/package.json +56 -0
- package/reference/README.md +10 -0
- package/reference/catalog.json +129 -0
- package/reference/diagrams.json +60 -0
- package/src/ambient/SpatialAmbientCanvas.svelte +148 -0
- package/src/ambient/SpatialAmbientParticles.svelte +89 -0
- package/src/ambient/SpatialAmbientRuntime.svelte +306 -0
- package/src/ambient/SpatialProjectionGrid.svelte +252 -0
- package/src/ambient/shaders/noise.glsl +1 -0
- package/src/ambient/shaders/particleField.glsl +1 -0
- package/src/ambient/shaders/spatialAmbient.frag.glsl +1 -0
- package/src/ambient/shaders/spatialAmbient.vert.glsl +1 -0
- package/src/ambient/shaders/volumetricFog.glsl +1 -0
- package/src/ambient/spatialAmbientStore.ts +3 -0
- package/src/ambient/spatialAmbientTypes.ts +11 -0
- package/src/ambient/spatialProjectionGridModel.ts +276 -0
- package/src/ambient/spatialProjectionGridPresets.ts +152 -0
- package/src/ambient/spatialProjectionGridTypes.ts +72 -0
- package/src/ambient/themeToAmbientUniforms.ts +3 -0
- package/src/components/KonitifBadge.svelte +2 -0
- package/src/components/KonitifButton.svelte +2 -0
- package/src/components/KonitifCard.svelte +2 -0
- package/src/components/KonitifGlassSurface.svelte +3 -0
- package/src/components/KonitifIconFrame.svelte +2 -0
- package/src/components/KonitifPanel.svelte +2 -0
- package/src/depth/SpatialDepthLayer.svelte +49 -0
- package/src/depth/SpatialDepthStack.svelte +25 -0
- package/src/depth/spatialDepthTokens.css +82 -0
- package/src/depth/spatialDepthTypes.ts +79 -0
- package/src/focus/FocusPlaneProvider.svelte +43 -0
- package/src/focus/PerceptualSurface.svelte +146 -0
- package/src/focus/focusDepthMap.ts +33 -0
- package/src/focus/perceptualFocusStore.ts +98 -0
- package/src/focus/perceptualFocusTypes.ts +38 -0
- package/src/focus/usePerceptualFocus.ts +18 -0
- package/src/index.ts +22 -0
- package/src/konitifRuntimePhaseTokens.ts +15 -0
- package/src/konitifTheme.ts +2 -0
- package/src/konitifThemeAdapter.ts +13 -0
- package/src/konitifTokens.css +201 -0
- package/src/konitifWorkbenchThemeRuntime.ts +35 -0
- package/src/runtime/RuntimePhaseTintProvider.svelte +28 -0
- package/src/runtime/runtimePhaseIconMap.ts +1 -0
- package/src/runtime/runtimePhaseVisualMap.ts +37 -0
- package/src/runtime/runtimeSpatialReactivity.ts +307 -0
- package/src/runtime/runtimeSpatialStateStore.ts +53 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import type { AmbientQuality } from './spatialAmbientTypes';
|
|
2
|
+
import {
|
|
3
|
+
getSpatialProjectionGridPresetForPhase,
|
|
4
|
+
spatialProjectionGridPresets
|
|
5
|
+
} from './spatialProjectionGridPresets';
|
|
6
|
+
import type {
|
|
7
|
+
SpatialProjectionGridConfig,
|
|
8
|
+
SpatialProjectionGridGeometry,
|
|
9
|
+
SpatialProjectionGridLine,
|
|
10
|
+
SpatialProjectionGridLineKind,
|
|
11
|
+
SpatialProjectionGridNode,
|
|
12
|
+
SpatialProjectionGridResolveOptions
|
|
13
|
+
} from './spatialProjectionGridTypes';
|
|
14
|
+
|
|
15
|
+
const viewWidth = 1000;
|
|
16
|
+
const viewHeight = 1000;
|
|
17
|
+
|
|
18
|
+
type SpatialProjectionFrame = {
|
|
19
|
+
originX: number;
|
|
20
|
+
originY: number;
|
|
21
|
+
horizonX: number;
|
|
22
|
+
horizonY: number;
|
|
23
|
+
vanishingPointX: number;
|
|
24
|
+
vanishingPointY: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function resolveSpatialProjectionGridConfig(
|
|
28
|
+
options: SpatialProjectionGridResolveOptions = {}
|
|
29
|
+
): SpatialProjectionGridConfig {
|
|
30
|
+
const presetName = getSpatialProjectionGridPresetForPhase(options.phase);
|
|
31
|
+
const preset = spatialProjectionGridPresets[presetName];
|
|
32
|
+
const quality = options.quality ?? 'medium';
|
|
33
|
+
const qualityConfig = resolveQualityConfig(preset, quality);
|
|
34
|
+
const reducedMotionConfig = options.reducedMotion
|
|
35
|
+
? { ...qualityConfig, animationSpeed: 0 }
|
|
36
|
+
: qualityConfig;
|
|
37
|
+
|
|
38
|
+
return clampGridConfig({
|
|
39
|
+
...reducedMotionConfig,
|
|
40
|
+
...(options.config ?? {})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createSpatialProjectionGridGeometry(
|
|
45
|
+
config: SpatialProjectionGridConfig
|
|
46
|
+
): SpatialProjectionGridGeometry {
|
|
47
|
+
const frame = createProjectionFrame(config);
|
|
48
|
+
|
|
49
|
+
if (!config.enabled) {
|
|
50
|
+
return {
|
|
51
|
+
width: viewWidth,
|
|
52
|
+
height: viewHeight,
|
|
53
|
+
horizonY: frame.horizonY,
|
|
54
|
+
originX: frame.originX,
|
|
55
|
+
originY: frame.originY,
|
|
56
|
+
vanishingPointX: frame.vanishingPointX,
|
|
57
|
+
vanishingPointY: frame.vanishingPointY,
|
|
58
|
+
lines: [],
|
|
59
|
+
nodes: []
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const lines: SpatialProjectionGridLine[] = [];
|
|
64
|
+
const nodes: SpatialProjectionGridNode[] = [];
|
|
65
|
+
const minorSteps = Math.max(1, Math.round(config.visibleDepth * config.minorDivisions));
|
|
66
|
+
const depthLines = minorSteps + 1;
|
|
67
|
+
|
|
68
|
+
for (let depthIndex = 0; depthIndex < depthLines; depthIndex += 1) {
|
|
69
|
+
const depthRatio = depthIndex / minorSteps;
|
|
70
|
+
const y = projectDepthY(depthRatio, config.perspectiveTilt, frame);
|
|
71
|
+
const widthFactor = projectWidthFactor(depthRatio, config.perspectiveTilt);
|
|
72
|
+
const halfWidth = config.visibleWidth * config.majorStep * widthFactor;
|
|
73
|
+
const kind = depthIndex % config.minorDivisions === 0 ? 'major' : depthIndex % 2 === 0 ? 'minor' : 'tertiary';
|
|
74
|
+
const opacity = resolveLineOpacity(kind, depthRatio, 0, config);
|
|
75
|
+
|
|
76
|
+
lines.push({
|
|
77
|
+
id: `depth-${depthIndex}`,
|
|
78
|
+
kind,
|
|
79
|
+
x1: frame.originX - halfWidth,
|
|
80
|
+
y1: y,
|
|
81
|
+
x2: frame.originX + halfWidth,
|
|
82
|
+
y2: y,
|
|
83
|
+
opacity
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (let widthIndex = -config.visibleWidth; widthIndex <= config.visibleWidth; widthIndex += 1) {
|
|
88
|
+
const lateralRatio = Math.abs(widthIndex) / Math.max(1, config.visibleWidth);
|
|
89
|
+
const kind: SpatialProjectionGridLineKind = widthIndex === 0 ? 'axis' : 'major';
|
|
90
|
+
const bottomX = frame.originX + widthIndex * config.majorStep;
|
|
91
|
+
const horizonX = frame.horizonX + widthIndex * config.majorStep * 0.05;
|
|
92
|
+
|
|
93
|
+
lines.push({
|
|
94
|
+
id: `axis-${widthIndex}`,
|
|
95
|
+
kind,
|
|
96
|
+
x1: bottomX,
|
|
97
|
+
y1: viewHeight + 80,
|
|
98
|
+
x2: horizonX,
|
|
99
|
+
y2: frame.horizonY,
|
|
100
|
+
opacity: resolveLineOpacity(kind, 0.3, lateralRatio, config)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (let depthIndex = 0; depthIndex <= config.visibleDepth; depthIndex += 1) {
|
|
105
|
+
const depthRatio = depthIndex / Math.max(1, config.visibleDepth);
|
|
106
|
+
const y = projectDepthY(depthRatio, config.perspectiveTilt, frame);
|
|
107
|
+
|
|
108
|
+
for (let widthIndex = -config.visibleWidth; widthIndex <= config.visibleWidth; widthIndex += 2) {
|
|
109
|
+
const lateralRatio = Math.abs(widthIndex) / Math.max(1, config.visibleWidth);
|
|
110
|
+
const x = projectDepthX(widthIndex, depthRatio, config, frame);
|
|
111
|
+
const opacity = config.nodeOpacity * falloff(depthRatio, config.horizonFalloff) * falloff(lateralRatio, config.lateralFalloff);
|
|
112
|
+
|
|
113
|
+
if (opacity < 0.025) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
nodes.push({
|
|
118
|
+
id: `node-${depthIndex}-${widthIndex}`,
|
|
119
|
+
x,
|
|
120
|
+
y,
|
|
121
|
+
radius: widthIndex === 0 || depthIndex === 0 ? 1.6 : 0.9,
|
|
122
|
+
opacity
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
nodes.push({
|
|
128
|
+
id: 'origin',
|
|
129
|
+
x: frame.originX,
|
|
130
|
+
y: frame.originY,
|
|
131
|
+
radius: 3,
|
|
132
|
+
opacity: config.originNodeOpacity,
|
|
133
|
+
origin: true
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
width: viewWidth,
|
|
138
|
+
height: viewHeight,
|
|
139
|
+
horizonY: frame.horizonY,
|
|
140
|
+
originX: frame.originX,
|
|
141
|
+
originY: frame.originY,
|
|
142
|
+
vanishingPointX: frame.vanishingPointX,
|
|
143
|
+
vanishingPointY: frame.vanishingPointY,
|
|
144
|
+
lines,
|
|
145
|
+
nodes
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function resolveQualityConfig(
|
|
150
|
+
config: SpatialProjectionGridConfig,
|
|
151
|
+
quality: AmbientQuality
|
|
152
|
+
): SpatialProjectionGridConfig {
|
|
153
|
+
if (quality === 'off') {
|
|
154
|
+
return { ...config, enabled: false, animationSpeed: 0 };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (quality === 'low') {
|
|
158
|
+
return {
|
|
159
|
+
...config,
|
|
160
|
+
minorDivisions: Math.max(2, Math.round(config.minorDivisions * 0.55)),
|
|
161
|
+
visibleDepth: Math.max(7, Math.round(config.visibleDepth * 0.72)),
|
|
162
|
+
visibleWidth: Math.max(6, Math.round(config.visibleWidth * 0.74)),
|
|
163
|
+
majorLineOpacity: config.majorLineOpacity * 0.78,
|
|
164
|
+
minorLineOpacity: config.minorLineOpacity * 0.58,
|
|
165
|
+
nodeOpacity: config.nodeOpacity * 0.58,
|
|
166
|
+
glowIntensity: config.glowIntensity * 0.62,
|
|
167
|
+
fogIntensity: config.fogIntensity * 0.82,
|
|
168
|
+
animationSpeed: config.animationSpeed * 0.5
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (quality === 'high') {
|
|
173
|
+
return {
|
|
174
|
+
...config,
|
|
175
|
+
minorDivisions: Math.min(8, config.minorDivisions + 1),
|
|
176
|
+
visibleDepth: Math.round(config.visibleDepth * 1.12),
|
|
177
|
+
visibleWidth: Math.round(config.visibleWidth * 1.08),
|
|
178
|
+
majorLineOpacity: config.majorLineOpacity * 1.08,
|
|
179
|
+
minorLineOpacity: config.minorLineOpacity * 1.12,
|
|
180
|
+
nodeOpacity: config.nodeOpacity * 1.12,
|
|
181
|
+
glowIntensity: config.glowIntensity * 1.16
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return config;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function clampGridConfig(config: SpatialProjectionGridConfig): SpatialProjectionGridConfig {
|
|
189
|
+
return {
|
|
190
|
+
...config,
|
|
191
|
+
majorStep: clamp(config.majorStep, 48, 180),
|
|
192
|
+
minorDivisions: Math.round(clamp(config.minorDivisions, 1, 10)),
|
|
193
|
+
visibleDepth: Math.round(clamp(config.visibleDepth, 4, 24)),
|
|
194
|
+
visibleWidth: Math.round(clamp(config.visibleWidth, 4, 18)),
|
|
195
|
+
vanishingPointX: clamp(config.vanishingPointX, 0.08, 0.92),
|
|
196
|
+
vanishingPointY: clamp(config.vanishingPointY, 0.08, 0.72),
|
|
197
|
+
horizonY: clamp(config.horizonY, 0.12, 0.82),
|
|
198
|
+
originY: clamp(config.originY, 0.58, 1.05),
|
|
199
|
+
perspectiveTilt: clamp01(config.perspectiveTilt),
|
|
200
|
+
horizonFalloff: clamp01(config.horizonFalloff),
|
|
201
|
+
lateralFalloff: clamp01(config.lateralFalloff),
|
|
202
|
+
majorLineOpacity: clamp01(config.majorLineOpacity),
|
|
203
|
+
minorLineOpacity: clamp01(config.minorLineOpacity),
|
|
204
|
+
nodeOpacity: clamp01(config.nodeOpacity),
|
|
205
|
+
originNodeOpacity: clamp01(config.originNodeOpacity),
|
|
206
|
+
glowIntensity: clamp01(config.glowIntensity),
|
|
207
|
+
fogIntensity: clamp01(config.fogIntensity),
|
|
208
|
+
animationSpeed: clamp01(config.animationSpeed)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function resolveLineOpacity(
|
|
213
|
+
kind: SpatialProjectionGridLineKind,
|
|
214
|
+
depthRatio: number,
|
|
215
|
+
lateralRatio: number,
|
|
216
|
+
config: SpatialProjectionGridConfig
|
|
217
|
+
): number {
|
|
218
|
+
const baseOpacity =
|
|
219
|
+
kind === 'axis'
|
|
220
|
+
? config.majorLineOpacity * 1.35
|
|
221
|
+
: kind === 'major'
|
|
222
|
+
? config.majorLineOpacity
|
|
223
|
+
: kind === 'minor'
|
|
224
|
+
? config.minorLineOpacity
|
|
225
|
+
: config.minorLineOpacity * 0.45;
|
|
226
|
+
|
|
227
|
+
return clamp01(baseOpacity * falloff(depthRatio, config.horizonFalloff) * falloff(lateralRatio, config.lateralFalloff));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function createProjectionFrame(config: SpatialProjectionGridConfig): SpatialProjectionFrame {
|
|
231
|
+
return {
|
|
232
|
+
originX: config.vanishingPointX * viewWidth,
|
|
233
|
+
originY: config.originY * viewHeight,
|
|
234
|
+
horizonX: config.vanishingPointX * viewWidth,
|
|
235
|
+
horizonY: config.horizonY * viewHeight,
|
|
236
|
+
vanishingPointX: config.vanishingPointX * viewWidth,
|
|
237
|
+
vanishingPointY: config.vanishingPointY * viewHeight
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function projectDepthY(depthRatio: number, perspectiveTilt: number, frame: SpatialProjectionFrame): number {
|
|
242
|
+
const easedDepth = 1 - Math.pow(1 - clamp01(depthRatio), 1.8 + perspectiveTilt * 1.4);
|
|
243
|
+
return frame.originY - easedDepth * (frame.originY - frame.horizonY);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function projectWidthFactor(depthRatio: number, perspectiveTilt: number): number {
|
|
247
|
+
return 1 - clamp01(depthRatio) * (0.72 + perspectiveTilt * 0.18);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function projectDepthX(
|
|
251
|
+
widthIndex: number,
|
|
252
|
+
depthRatio: number,
|
|
253
|
+
config: SpatialProjectionGridConfig,
|
|
254
|
+
frame: SpatialProjectionFrame
|
|
255
|
+
): number {
|
|
256
|
+
const widthFactor = projectWidthFactor(depthRatio, config.perspectiveTilt);
|
|
257
|
+
const depthX = frame.originX + widthIndex * config.majorStep * widthFactor;
|
|
258
|
+
|
|
259
|
+
return depthX + (frame.horizonX - frame.originX) * depthRatio;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function falloff(value: number, amount: number): number {
|
|
263
|
+
return Math.pow(1 - clamp01(value), 0.7 + amount * 1.7);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function clamp01(value: number): number {
|
|
267
|
+
return clamp(value, 0, 1);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function clamp(value: number, min: number, max: number): number {
|
|
271
|
+
if (!Number.isFinite(value)) {
|
|
272
|
+
return min;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return Math.min(max, Math.max(min, value));
|
|
276
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { RuntimePhase } from '../konitifRuntimePhaseTokens';
|
|
2
|
+
import { normalizeKonitifRuntimePhase } from '../konitifRuntimePhaseTokens';
|
|
3
|
+
import type { SpatialProjectionGridConfig, SpatialProjectionGridPresetName } from './spatialProjectionGridTypes';
|
|
4
|
+
|
|
5
|
+
const defaultSpatialGridFrame = {
|
|
6
|
+
vanishingPointX: 0.5,
|
|
7
|
+
vanishingPointY: 0.47,
|
|
8
|
+
horizonY: 0.51,
|
|
9
|
+
originY: 0.82
|
|
10
|
+
} satisfies Pick<SpatialProjectionGridConfig, 'vanishingPointX' | 'vanishingPointY' | 'horizonY' | 'originY'>;
|
|
11
|
+
|
|
12
|
+
export const spatialProjectionGridPresets: Record<SpatialProjectionGridPresetName, SpatialProjectionGridConfig> = {
|
|
13
|
+
calm: {
|
|
14
|
+
enabled: true,
|
|
15
|
+
...defaultSpatialGridFrame,
|
|
16
|
+
majorStep: 96,
|
|
17
|
+
minorDivisions: 4,
|
|
18
|
+
visibleDepth: 11,
|
|
19
|
+
visibleWidth: 9,
|
|
20
|
+
perspectiveTilt: 0.66,
|
|
21
|
+
horizonFalloff: 0.78,
|
|
22
|
+
lateralFalloff: 0.72,
|
|
23
|
+
majorLineOpacity: 0.24,
|
|
24
|
+
minorLineOpacity: 0.08,
|
|
25
|
+
nodeOpacity: 0.28,
|
|
26
|
+
originNodeOpacity: 0.76,
|
|
27
|
+
glowIntensity: 0.32,
|
|
28
|
+
fogIntensity: 0.34,
|
|
29
|
+
animationSpeed: 0.08
|
|
30
|
+
},
|
|
31
|
+
focus: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
...defaultSpatialGridFrame,
|
|
34
|
+
majorStep: 96,
|
|
35
|
+
minorDivisions: 5,
|
|
36
|
+
visibleDepth: 12,
|
|
37
|
+
visibleWidth: 10,
|
|
38
|
+
perspectiveTilt: 0.68,
|
|
39
|
+
horizonFalloff: 0.72,
|
|
40
|
+
lateralFalloff: 0.68,
|
|
41
|
+
majorLineOpacity: 0.34,
|
|
42
|
+
minorLineOpacity: 0.1,
|
|
43
|
+
nodeOpacity: 0.38,
|
|
44
|
+
originNodeOpacity: 0.88,
|
|
45
|
+
glowIntensity: 0.46,
|
|
46
|
+
fogIntensity: 0.32,
|
|
47
|
+
animationSpeed: 0.1
|
|
48
|
+
},
|
|
49
|
+
runtime: {
|
|
50
|
+
enabled: true,
|
|
51
|
+
...defaultSpatialGridFrame,
|
|
52
|
+
majorStep: 92,
|
|
53
|
+
minorDivisions: 5,
|
|
54
|
+
visibleDepth: 13,
|
|
55
|
+
visibleWidth: 11,
|
|
56
|
+
perspectiveTilt: 0.7,
|
|
57
|
+
horizonFalloff: 0.74,
|
|
58
|
+
lateralFalloff: 0.7,
|
|
59
|
+
majorLineOpacity: 0.3,
|
|
60
|
+
minorLineOpacity: 0.1,
|
|
61
|
+
nodeOpacity: 0.36,
|
|
62
|
+
originNodeOpacity: 0.84,
|
|
63
|
+
glowIntensity: 0.42,
|
|
64
|
+
fogIntensity: 0.38,
|
|
65
|
+
animationSpeed: 0.16
|
|
66
|
+
},
|
|
67
|
+
analysis: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
...defaultSpatialGridFrame,
|
|
70
|
+
majorStep: 88,
|
|
71
|
+
minorDivisions: 6,
|
|
72
|
+
visibleDepth: 14,
|
|
73
|
+
visibleWidth: 12,
|
|
74
|
+
perspectiveTilt: 0.72,
|
|
75
|
+
horizonFalloff: 0.7,
|
|
76
|
+
lateralFalloff: 0.66,
|
|
77
|
+
majorLineOpacity: 0.38,
|
|
78
|
+
minorLineOpacity: 0.13,
|
|
79
|
+
nodeOpacity: 0.42,
|
|
80
|
+
originNodeOpacity: 0.9,
|
|
81
|
+
glowIntensity: 0.48,
|
|
82
|
+
fogIntensity: 0.36,
|
|
83
|
+
animationSpeed: 0.18
|
|
84
|
+
},
|
|
85
|
+
recovery: {
|
|
86
|
+
enabled: true,
|
|
87
|
+
...defaultSpatialGridFrame,
|
|
88
|
+
majorStep: 100,
|
|
89
|
+
minorDivisions: 4,
|
|
90
|
+
visibleDepth: 10,
|
|
91
|
+
visibleWidth: 9,
|
|
92
|
+
perspectiveTilt: 0.65,
|
|
93
|
+
horizonFalloff: 0.82,
|
|
94
|
+
lateralFalloff: 0.74,
|
|
95
|
+
majorLineOpacity: 0.28,
|
|
96
|
+
minorLineOpacity: 0.07,
|
|
97
|
+
nodeOpacity: 0.32,
|
|
98
|
+
originNodeOpacity: 0.78,
|
|
99
|
+
glowIntensity: 0.4,
|
|
100
|
+
fogIntensity: 0.42,
|
|
101
|
+
animationSpeed: 0.1
|
|
102
|
+
},
|
|
103
|
+
safeMode: {
|
|
104
|
+
enabled: true,
|
|
105
|
+
...defaultSpatialGridFrame,
|
|
106
|
+
majorStep: 112,
|
|
107
|
+
minorDivisions: 2,
|
|
108
|
+
visibleDepth: 8,
|
|
109
|
+
visibleWidth: 7,
|
|
110
|
+
perspectiveTilt: 0.62,
|
|
111
|
+
horizonFalloff: 0.88,
|
|
112
|
+
lateralFalloff: 0.82,
|
|
113
|
+
majorLineOpacity: 0.18,
|
|
114
|
+
minorLineOpacity: 0.04,
|
|
115
|
+
nodeOpacity: 0.16,
|
|
116
|
+
originNodeOpacity: 0.48,
|
|
117
|
+
glowIntensity: 0.16,
|
|
118
|
+
fogIntensity: 0.18,
|
|
119
|
+
animationSpeed: 0.02
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export function getSpatialProjectionGridPresetForPhase(
|
|
124
|
+
phase: RuntimePhase | string | null | undefined
|
|
125
|
+
): SpatialProjectionGridPresetName {
|
|
126
|
+
const resolvedPhase = normalizeKonitifRuntimePhase(phase);
|
|
127
|
+
|
|
128
|
+
switch (resolvedPhase) {
|
|
129
|
+
case 'BOOT':
|
|
130
|
+
case 'LAUNCH_GATE':
|
|
131
|
+
case 'CONTEXT_RESOLVED':
|
|
132
|
+
case 'SUSPENDING':
|
|
133
|
+
case 'SUSPENDED':
|
|
134
|
+
return 'calm';
|
|
135
|
+
case 'PREFLIGHT':
|
|
136
|
+
return 'analysis';
|
|
137
|
+
case 'PLANNED':
|
|
138
|
+
return 'focus';
|
|
139
|
+
case 'INITIALIZING':
|
|
140
|
+
case 'HYDRATING':
|
|
141
|
+
case 'RUNNING':
|
|
142
|
+
case 'RESUMING':
|
|
143
|
+
return 'runtime';
|
|
144
|
+
case 'TEARDOWN':
|
|
145
|
+
case 'RECOVERY':
|
|
146
|
+
return 'recovery';
|
|
147
|
+
case 'SAFE_MODE':
|
|
148
|
+
return 'safeMode';
|
|
149
|
+
default:
|
|
150
|
+
return 'calm';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { RuntimePhase } from '../konitifRuntimePhaseTokens';
|
|
2
|
+
import type { AmbientQuality } from './spatialAmbientTypes';
|
|
3
|
+
|
|
4
|
+
export type SpatialProjectionGridPresetName =
|
|
5
|
+
| 'calm'
|
|
6
|
+
| 'focus'
|
|
7
|
+
| 'runtime'
|
|
8
|
+
| 'analysis'
|
|
9
|
+
| 'recovery'
|
|
10
|
+
| 'safeMode';
|
|
11
|
+
|
|
12
|
+
export type SpatialProjectionGridConfig = {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
majorStep: number;
|
|
15
|
+
minorDivisions: number;
|
|
16
|
+
visibleDepth: number;
|
|
17
|
+
visibleWidth: number;
|
|
18
|
+
vanishingPointX: number;
|
|
19
|
+
vanishingPointY: number;
|
|
20
|
+
horizonY: number;
|
|
21
|
+
originY: number;
|
|
22
|
+
perspectiveTilt: number;
|
|
23
|
+
horizonFalloff: number;
|
|
24
|
+
lateralFalloff: number;
|
|
25
|
+
majorLineOpacity: number;
|
|
26
|
+
minorLineOpacity: number;
|
|
27
|
+
nodeOpacity: number;
|
|
28
|
+
originNodeOpacity: number;
|
|
29
|
+
glowIntensity: number;
|
|
30
|
+
fogIntensity: number;
|
|
31
|
+
animationSpeed: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type SpatialProjectionGridResolveOptions = {
|
|
35
|
+
phase?: RuntimePhase | string | null;
|
|
36
|
+
quality?: AmbientQuality;
|
|
37
|
+
reducedMotion?: boolean;
|
|
38
|
+
config?: Partial<SpatialProjectionGridConfig> | null;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type SpatialProjectionGridLineKind = 'major' | 'minor' | 'tertiary' | 'axis';
|
|
42
|
+
|
|
43
|
+
export type SpatialProjectionGridLine = {
|
|
44
|
+
id: string;
|
|
45
|
+
kind: SpatialProjectionGridLineKind;
|
|
46
|
+
x1: number;
|
|
47
|
+
y1: number;
|
|
48
|
+
x2: number;
|
|
49
|
+
y2: number;
|
|
50
|
+
opacity: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type SpatialProjectionGridNode = {
|
|
54
|
+
id: string;
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
radius: number;
|
|
58
|
+
opacity: number;
|
|
59
|
+
origin?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type SpatialProjectionGridGeometry = {
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
horizonY: number;
|
|
66
|
+
originX: number;
|
|
67
|
+
originY: number;
|
|
68
|
+
vanishingPointX: number;
|
|
69
|
+
vanishingPointY: number;
|
|
70
|
+
lines: SpatialProjectionGridLine[];
|
|
71
|
+
nodes: SpatialProjectionGridNode[];
|
|
72
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type KonitifAmbientUniforms={fogColor:[number,number,number];lightColor:[number,number,number];particleColor:[number,number,number];intensity:number;blurDepth:number;tiltStrength:number};
|
|
2
|
+
const hexToRgb01=(hex:string):[number,number,number]=>{const v=Number.parseInt(hex.replace('#',''),16);return[((v>>16)&255)/255,((v>>8)&255)/255,(v&255)/255];};
|
|
3
|
+
export function createKonitifAmbientUniforms(theme:'dark'|'light'):KonitifAmbientUniforms{return theme==='light'?{fogColor:hexToRgb01('#dce8ff'),lightColor:hexToRgb01('#ffffff'),particleColor:hexToRgb01('#8aa4c8'),intensity:.42,blurDepth:.32,tiltStrength:.35}:{fogColor:hexToRgb01('#145078'),lightColor:hexToRgb01('#22d3ee'),particleColor:hexToRgb01('#aadcff'),intensity:.72,blurDepth:.46,tiltStrength:.55};}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<script lang="ts">export let active=false;</script>
|
|
2
|
+
<div class:active class="konitif-glass"><slot /></div>
|
|
3
|
+
<style>.konitif-glass{border:1px solid var(--k-border-soft);background:var(--k-bg-surface);backdrop-filter:blur(18px) saturate(1.25);box-shadow:0 24px 80px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.06);border-radius:18px}.konitif-glass.active{box-shadow:0 0 0 1px var(--k-glow-primary),0 28px 90px rgba(0,0,0,.26),0 0 48px var(--k-glow-primary)}</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getSpatialDepthLayer } from './spatialDepthTypes';
|
|
3
|
+
import type { KonitifDepthLevel } from '../focus/perceptualFocusTypes';
|
|
4
|
+
|
|
5
|
+
export let depth: KonitifDepthLevel = 'workspace';
|
|
6
|
+
export let active = false;
|
|
7
|
+
export let parallax = true;
|
|
8
|
+
|
|
9
|
+
$: layer = getSpatialDepthLayer(depth);
|
|
10
|
+
$: layerStyle = [
|
|
11
|
+
`--k-depth-layer-z: ${layer.parallax * 120}px`,
|
|
12
|
+
`--k-depth-layer-parallax: ${parallax ? layer.parallax : 0}`,
|
|
13
|
+
`--k-depth-layer-light-response: ${layer.lightResponse}`
|
|
14
|
+
].join('; ');
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
class="konitif-depth-layer"
|
|
19
|
+
data-depth={depth}
|
|
20
|
+
data-active={active}
|
|
21
|
+
style={layerStyle}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<style>
|
|
27
|
+
.konitif-depth-layer {
|
|
28
|
+
position: relative;
|
|
29
|
+
opacity: var(--k-depth-layer-opacity, 1);
|
|
30
|
+
filter: blur(var(--k-depth-layer-blur, 0)) contrast(var(--k-depth-layer-contrast, 1));
|
|
31
|
+
box-shadow: var(--k-depth-layer-shadow, none);
|
|
32
|
+
transition:
|
|
33
|
+
filter 360ms ease,
|
|
34
|
+
opacity 360ms ease,
|
|
35
|
+
box-shadow 420ms ease;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.konitif-depth-layer[data-active='true'] {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
filter: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (prefers-reduced-motion: reduce) {
|
|
44
|
+
.konitif-depth-layer {
|
|
45
|
+
transform: none;
|
|
46
|
+
transition-duration: 1ms;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let active = true;
|
|
3
|
+
export let perspective = 1200;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="konitif-depth-stack"
|
|
8
|
+
data-konitif-depth-stack
|
|
9
|
+
data-konitif-depth-active={active}
|
|
10
|
+
style={`--k-depth-perspective: ${perspective}px;`}
|
|
11
|
+
>
|
|
12
|
+
<slot />
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.konitif-depth-stack {
|
|
17
|
+
position: relative;
|
|
18
|
+
transform-style: preserve-3d;
|
|
19
|
+
perspective: var(--k-depth-perspective);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.konitif-depth-stack[data-konitif-depth-active='false'] {
|
|
23
|
+
perspective: none;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[data-workbench-theme='konitif'],
|
|
2
|
+
[data-theme='konitif-dark'],
|
|
3
|
+
[data-theme='konitif-light'] {
|
|
4
|
+
--k-depth-ambient-blur: 1.8px;
|
|
5
|
+
--k-depth-background-blur: 1.1px;
|
|
6
|
+
--k-depth-workspace-blur: 0.36px;
|
|
7
|
+
--k-depth-panel-blur: 0.12px;
|
|
8
|
+
--k-depth-active-blur: 0px;
|
|
9
|
+
--k-depth-overlay-blur: 0px;
|
|
10
|
+
|
|
11
|
+
--k-depth-ambient-opacity: 0.64;
|
|
12
|
+
--k-depth-background-opacity: 0.74;
|
|
13
|
+
--k-depth-workspace-opacity: 0.92;
|
|
14
|
+
--k-depth-panel-opacity: 0.98;
|
|
15
|
+
--k-depth-active-opacity: 1;
|
|
16
|
+
--k-depth-overlay-opacity: 1;
|
|
17
|
+
|
|
18
|
+
--k-depth-ambient-contrast: 0.88;
|
|
19
|
+
--k-depth-background-contrast: 0.92;
|
|
20
|
+
--k-depth-workspace-contrast: 0.98;
|
|
21
|
+
--k-depth-panel-contrast: 1;
|
|
22
|
+
--k-depth-active-contrast: 1.04;
|
|
23
|
+
--k-depth-overlay-contrast: 1.02;
|
|
24
|
+
|
|
25
|
+
--k-depth-ambient-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.08);
|
|
26
|
+
--k-depth-background-shadow: 0 0.75rem 2.4rem rgba(0, 0, 0, 0.12);
|
|
27
|
+
--k-depth-workspace-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.16);
|
|
28
|
+
--k-depth-panel-shadow: 0 1.2rem 3.8rem rgba(0, 0, 0, 0.2);
|
|
29
|
+
--k-depth-active-shadow: 0 1.4rem 4.8rem rgba(0, 0, 0, 0.28);
|
|
30
|
+
--k-depth-overlay-shadow: 0 1.8rem 5.8rem rgba(0, 0, 0, 0.34);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-theme='konitif-light'] {
|
|
34
|
+
--k-depth-ambient-shadow: 0 0.5rem 2rem rgba(45, 65, 95, 0.05);
|
|
35
|
+
--k-depth-background-shadow: 0 0.75rem 2.4rem rgba(45, 65, 95, 0.08);
|
|
36
|
+
--k-depth-workspace-shadow: 0 1rem 3rem rgba(45, 65, 95, 0.1);
|
|
37
|
+
--k-depth-panel-shadow: 0 1.2rem 3.8rem rgba(45, 65, 95, 0.13);
|
|
38
|
+
--k-depth-active-shadow: 0 1.4rem 4.8rem rgba(45, 65, 95, 0.17);
|
|
39
|
+
--k-depth-overlay-shadow: 0 1.8rem 5.8rem rgba(45, 65, 95, 0.2);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.konitif-depth-layer[data-depth='ambient'] {
|
|
43
|
+
--k-depth-layer-blur: var(--k-depth-ambient-blur);
|
|
44
|
+
--k-depth-layer-opacity: var(--k-depth-ambient-opacity);
|
|
45
|
+
--k-depth-layer-contrast: var(--k-depth-ambient-contrast);
|
|
46
|
+
--k-depth-layer-shadow: var(--k-depth-ambient-shadow);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.konitif-depth-layer[data-depth='background'] {
|
|
50
|
+
--k-depth-layer-blur: var(--k-depth-background-blur);
|
|
51
|
+
--k-depth-layer-opacity: var(--k-depth-background-opacity);
|
|
52
|
+
--k-depth-layer-contrast: var(--k-depth-background-contrast);
|
|
53
|
+
--k-depth-layer-shadow: var(--k-depth-background-shadow);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.konitif-depth-layer[data-depth='workspace'] {
|
|
57
|
+
--k-depth-layer-blur: var(--k-depth-workspace-blur);
|
|
58
|
+
--k-depth-layer-opacity: var(--k-depth-workspace-opacity);
|
|
59
|
+
--k-depth-layer-contrast: var(--k-depth-workspace-contrast);
|
|
60
|
+
--k-depth-layer-shadow: var(--k-depth-workspace-shadow);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.konitif-depth-layer[data-depth='panel'] {
|
|
64
|
+
--k-depth-layer-blur: var(--k-depth-panel-blur);
|
|
65
|
+
--k-depth-layer-opacity: var(--k-depth-panel-opacity);
|
|
66
|
+
--k-depth-layer-contrast: var(--k-depth-panel-contrast);
|
|
67
|
+
--k-depth-layer-shadow: var(--k-depth-panel-shadow);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.konitif-depth-layer[data-depth='active'] {
|
|
71
|
+
--k-depth-layer-blur: var(--k-depth-active-blur);
|
|
72
|
+
--k-depth-layer-opacity: var(--k-depth-active-opacity);
|
|
73
|
+
--k-depth-layer-contrast: var(--k-depth-active-contrast);
|
|
74
|
+
--k-depth-layer-shadow: var(--k-depth-active-shadow);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.konitif-depth-layer[data-depth='overlay'] {
|
|
78
|
+
--k-depth-layer-blur: var(--k-depth-overlay-blur);
|
|
79
|
+
--k-depth-layer-opacity: var(--k-depth-overlay-opacity);
|
|
80
|
+
--k-depth-layer-contrast: var(--k-depth-overlay-contrast);
|
|
81
|
+
--k-depth-layer-shadow: var(--k-depth-overlay-shadow);
|
|
82
|
+
}
|