@3driseai/3drise-core 1.0.21 → 1.0.22
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/autoAnimate/composer.d.ts +6 -0
- package/dist/autoAnimate/composer.d.ts.map +1 -1
- package/dist/autoAnimate/composer.js +4 -3
- package/dist/autoAnimate/describeScene.js +1 -1
- package/dist/catalog/catalogInfo.d.ts +22 -0
- package/dist/catalog/catalogInfo.d.ts.map +1 -0
- package/dist/catalog/catalogInfo.js +204 -0
- package/dist/catalog/index.d.ts +3 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +2 -0
- package/dist/catalog/objectCatalog.d.ts +33 -0
- package/dist/catalog/objectCatalog.d.ts.map +1 -0
- package/dist/catalog/objectCatalog.js +99 -0
- package/dist/data/allMaterials.js +2 -2
- package/dist/data/environmentDefaults.d.ts +10 -0
- package/dist/data/environmentDefaults.d.ts.map +1 -0
- package/dist/data/environmentDefaults.js +126 -0
- package/dist/data/gridsDefaults.d.ts +2 -0
- package/dist/data/gridsDefaults.d.ts.map +1 -1
- package/dist/data/gridsDefaults.js +57 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +4 -0
- package/dist/data/landDefaults.d.ts +26 -0
- package/dist/data/landDefaults.d.ts.map +1 -0
- package/dist/data/landDefaults.js +76 -0
- package/dist/data/spaceDefaults.d.ts +10 -0
- package/dist/data/spaceDefaults.d.ts.map +1 -0
- package/dist/data/spaceDefaults.js +46 -0
- package/dist/data/textDefaults.d.ts +16 -0
- package/dist/data/textDefaults.d.ts.map +1 -0
- package/dist/data/textDefaults.js +199 -0
- package/dist/environment/oceanConfigs.d.ts +5 -4
- package/dist/environment/oceanConfigs.d.ts.map +1 -1
- package/dist/environment/oceanConfigs.js +2 -2
- package/dist/environment/terrainConfigs.d.ts +78 -0
- package/dist/environment/terrainConfigs.d.ts.map +1 -1
- package/dist/environment/terrainConfigs.js +72 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/properties/registry.d.ts +10 -1
- package/dist/properties/registry.d.ts.map +1 -1
- package/dist/properties/registry.js +60 -9
- package/dist/properties/tables/environmentProperties.d.ts +9 -0
- package/dist/properties/tables/environmentProperties.d.ts.map +1 -0
- package/dist/properties/tables/environmentProperties.js +127 -0
- package/dist/properties/tables/gridProperties.d.ts.map +1 -1
- package/dist/properties/tables/gridProperties.js +117 -93
- package/dist/properties/tables/index.d.ts +4 -0
- package/dist/properties/tables/index.d.ts.map +1 -1
- package/dist/properties/tables/index.js +4 -0
- package/dist/properties/tables/landProperties.d.ts +5 -0
- package/dist/properties/tables/landProperties.d.ts.map +1 -0
- package/dist/properties/tables/landProperties.js +24 -0
- package/dist/properties/tables/optionalProperties.d.ts +1 -2
- package/dist/properties/tables/optionalProperties.d.ts.map +1 -1
- package/dist/properties/tables/optionalProperties.js +21 -0
- package/dist/properties/tables/spaceProperties.d.ts +8 -0
- package/dist/properties/tables/spaceProperties.d.ts.map +1 -0
- package/dist/properties/tables/spaceProperties.js +42 -0
- package/dist/properties/tables/textProperties.d.ts +4 -0
- package/dist/properties/tables/textProperties.d.ts.map +1 -0
- package/dist/properties/tables/textProperties.js +361 -0
- package/dist/properties/types.d.ts +1 -1
- package/dist/properties/types.d.ts.map +1 -1
- package/dist/services/MaterialRegistry.d.ts.map +1 -1
- package/dist/services/MaterialRegistry.js +2 -0
- package/dist/services/SkySystemManager.d.ts +22 -0
- package/dist/services/SkySystemManager.d.ts.map +1 -1
- package/dist/services/SkySystemManager.js +50 -18
- package/dist/services/TextureResolver.d.ts.map +1 -1
- package/dist/services/TextureResolver.js +22 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/shaders/SkyboxMaterial.js +3 -3
- package/dist/shaders/StarsMaterial.d.ts +5 -0
- package/dist/shaders/StarsMaterial.d.ts.map +1 -1
- package/dist/shaders/StarsMaterial.js +59 -57
- package/dist/types/actions.d.ts +6 -5
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/commands.d.ts +61 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +1 -0
- package/dist/types/environment.d.ts +34 -1
- package/dist/types/environment.d.ts.map +1 -1
- package/dist/types/environment.js +15 -0
- package/dist/types/environmentObjects.d.ts +152 -0
- package/dist/types/environmentObjects.d.ts.map +1 -0
- package/dist/types/environmentObjects.js +10 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/landObjects.d.ts +15 -0
- package/dist/types/landObjects.d.ts.map +1 -0
- package/dist/types/landObjects.js +1 -0
- package/dist/types/objectSettings.d.ts +187 -16
- package/dist/types/objectSettings.d.ts.map +1 -1
- package/dist/types/objectsConfigs.d.ts +0 -3
- package/dist/types/objectsConfigs.d.ts.map +1 -1
- package/dist/types/scene3d.d.ts +8 -5
- package/dist/types/scene3d.d.ts.map +1 -1
- package/dist/types/spaceObjects.d.ts +65 -0
- package/dist/types/spaceObjects.d.ts.map +1 -0
- package/dist/types/spaceObjects.js +11 -0
- package/dist/types/textObjects.d.ts +352 -0
- package/dist/types/textObjects.d.ts.map +1 -0
- package/dist/types/textObjects.js +14 -0
- package/dist/types/types.d.ts +3 -6
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/users.d.ts +3 -1
- package/dist/types/users.d.ts.map +1 -1
- package/dist/types/users.js +2 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +4 -0
- package/dist/ui/uiBindings.d.ts +45 -0
- package/dist/ui/uiBindings.d.ts.map +1 -0
- package/dist/ui/uiBindings.js +172 -0
- package/dist/ui/uiKeys.d.ts +14 -0
- package/dist/ui/uiKeys.d.ts.map +1 -0
- package/dist/ui/uiKeys.js +22 -0
- package/dist/ui/uiSanitize.d.ts +18 -0
- package/dist/ui/uiSanitize.d.ts.map +1 -0
- package/dist/ui/uiSanitize.js +251 -0
- package/dist/ui/uiSpec.d.ts +116 -0
- package/dist/ui/uiSpec.d.ts.map +1 -0
- package/dist/ui/uiSpec.js +173 -0
- package/dist/utils/environmentMigration.d.ts +3 -0
- package/dist/utils/environmentMigration.d.ts.map +1 -0
- package/dist/utils/environmentMigration.js +50 -0
- package/dist/utils/generativeAnimatable.d.ts +1 -1
- package/dist/utils/generativeAnimatable.d.ts.map +1 -1
- package/dist/utils/generativeAnimatable.js +12 -0
- package/dist/utils/getAnimatableProperties.d.ts +1 -1
- package/dist/utils/getAnimatableProperties.d.ts.map +1 -1
- package/dist/utils/getAnimatableProperties.js +1 -1
- package/dist/utils/gridMigration.d.ts +3 -0
- package/dist/utils/gridMigration.d.ts.map +1 -0
- package/dist/utils/gridMigration.js +34 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/objectEffects.d.ts +24 -2
- package/dist/utils/objectEffects.d.ts.map +1 -1
- package/dist/utils/objectEffects.js +29 -2
- package/dist/utils/objectMigration.d.ts +9 -0
- package/dist/utils/objectMigration.d.ts.map +1 -0
- package/dist/utils/objectMigration.js +12 -0
- package/dist/utils/skyPhase.d.ts +61 -0
- package/dist/utils/skyPhase.d.ts.map +1 -0
- package/dist/utils/skyPhase.js +93 -0
- package/dist/utils/spaceMigration.d.ts +3 -0
- package/dist/utils/spaceMigration.d.ts.map +1 -0
- package/dist/utils/spaceMigration.js +46 -0
- package/dist/utils/sunUtils.d.ts +26 -1
- package/dist/utils/sunUtils.d.ts.map +1 -1
- package/dist/utils/sunUtils.js +37 -6
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export interface UiLayer {
|
|
2
|
+
id: string;
|
|
3
|
+
/** Stable, code-facing name; unique per project (see uiKeys). */
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
html: string;
|
|
8
|
+
css: string;
|
|
9
|
+
visible: boolean;
|
|
10
|
+
/** Position in the project's list (junction table `layerOrder`). */
|
|
11
|
+
layerOrder?: number;
|
|
12
|
+
}
|
|
13
|
+
export type UiRefKind = 'action' | 'sequence' | 'clip';
|
|
14
|
+
/** `ui` addresses an element of the same layer by CSS id: `ui.toggle:#menu`. */
|
|
15
|
+
export type UiCommandKind = UiRefKind | 'ui';
|
|
16
|
+
/** Attributes that run commands. */
|
|
17
|
+
export declare const UI_TRIGGER_ATTRS: {
|
|
18
|
+
readonly click: "data-click";
|
|
19
|
+
readonly hoverIn: "data-hover-in";
|
|
20
|
+
readonly hoverOut: "data-hover-out";
|
|
21
|
+
};
|
|
22
|
+
export type UiTrigger = keyof typeof UI_TRIGGER_ATTRS;
|
|
23
|
+
export declare const UI_ATTR: {
|
|
24
|
+
readonly bind: "data-bind";
|
|
25
|
+
readonly state: "data-state";
|
|
26
|
+
readonly showWhen: "data-show-when";
|
|
27
|
+
readonly anchor: "data-anchor";
|
|
28
|
+
readonly anchorOcclude: "data-anchor-occlude";
|
|
29
|
+
readonly anchorOffset: "data-anchor-offset";
|
|
30
|
+
readonly set: "data-set";
|
|
31
|
+
readonly setValue: "data-set-value";
|
|
32
|
+
readonly click: "data-click";
|
|
33
|
+
readonly hoverIn: "data-hover-in";
|
|
34
|
+
readonly hoverOut: "data-hover-out";
|
|
35
|
+
};
|
|
36
|
+
/** Verbs per command kind. `toggle` for sequences and clips alternates forward / backward. */
|
|
37
|
+
export declare const UI_VERBS: Record<UiCommandKind, readonly string[]>;
|
|
38
|
+
export interface UiCommand {
|
|
39
|
+
kind: UiCommandKind;
|
|
40
|
+
verb: string;
|
|
41
|
+
ref: string;
|
|
42
|
+
}
|
|
43
|
+
/** A condition on scene state: `action:key`, `!sequence:key`, `ui:#panel`. */
|
|
44
|
+
export interface UiCondition {
|
|
45
|
+
negate: boolean;
|
|
46
|
+
kind: UiCommandKind;
|
|
47
|
+
ref: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UiBind {
|
|
50
|
+
kind: 'sequence' | 'clip';
|
|
51
|
+
ref: string;
|
|
52
|
+
}
|
|
53
|
+
export interface UiAnchor {
|
|
54
|
+
/** Object ref (id or name). */
|
|
55
|
+
object: string;
|
|
56
|
+
/** Name of a node inside a model. */
|
|
57
|
+
node?: string;
|
|
58
|
+
}
|
|
59
|
+
/** What `data-set` writes to: an object (or a node of a model), or one of the environment elements. */
|
|
60
|
+
export declare const UI_SET_ENVIRONMENT: readonly ["camera", "sky", "clouds", "ocean", "terrain"];
|
|
61
|
+
export interface UiSetTarget {
|
|
62
|
+
/** `camera` / `sky` / `clouds` / `ocean` / `terrain`, or an object ref (key, id or name). */
|
|
63
|
+
target: string;
|
|
64
|
+
/** Name of a node inside a model. */
|
|
65
|
+
node?: string;
|
|
66
|
+
/** Settings path, the same ones clip tracks use: `materialSettings.opacity`, `meshSettings.position.y`, `config.intensity`. */
|
|
67
|
+
path: string;
|
|
68
|
+
}
|
|
69
|
+
/** `engine:materialSettings.opacity`, `engine/Door_L:meshSettings.rotation.y`, `sky:elevation`. */
|
|
70
|
+
export declare function parseSetTarget(value: string | null | undefined): {
|
|
71
|
+
set?: UiSetTarget;
|
|
72
|
+
error?: string;
|
|
73
|
+
};
|
|
74
|
+
/** The value of `data-set-value`: a number, true/false, a JSON array (`[1,0,0]`), or a string (`#ff0000`). */
|
|
75
|
+
export declare function parseSetValue(value: string | null | undefined): number | boolean | string | number[] | undefined;
|
|
76
|
+
/** `action.toggle:open-door sequence.play:intro` */
|
|
77
|
+
export declare function parseCommands(value: string | null | undefined): {
|
|
78
|
+
commands: UiCommand[];
|
|
79
|
+
errors: string[];
|
|
80
|
+
};
|
|
81
|
+
/** `action:open-door !sequence:intro ui:#menu` — all must hold. */
|
|
82
|
+
export declare function parseConditions(value: string | null | undefined): {
|
|
83
|
+
conditions: UiCondition[];
|
|
84
|
+
errors: string[];
|
|
85
|
+
};
|
|
86
|
+
/** `sequence:intro` or `clip:spin` (for <input type="range">). */
|
|
87
|
+
export declare function parseBind(value: string | null | undefined): {
|
|
88
|
+
bind?: UiBind;
|
|
89
|
+
error?: string;
|
|
90
|
+
};
|
|
91
|
+
/** `object:engine` or `object:engine/Door_L` (the node name is everything after the first slash). */
|
|
92
|
+
export declare function parseAnchor(value: string | null | undefined): {
|
|
93
|
+
anchor?: UiAnchor;
|
|
94
|
+
error?: string;
|
|
95
|
+
};
|
|
96
|
+
/** `12 -8` (px, from the projected point). */
|
|
97
|
+
export declare function parseOffset(value: string | null | undefined): [number, number] | null;
|
|
98
|
+
export declare const UI_CLASS_PREFIX = "rise-";
|
|
99
|
+
export interface UiClassInfo {
|
|
100
|
+
name: string;
|
|
101
|
+
/** What it is for — shown in the agent docs. */
|
|
102
|
+
use: string;
|
|
103
|
+
/** Elements the validator expects it on (warns when a control has none of the generic classes). */
|
|
104
|
+
for?: string;
|
|
105
|
+
}
|
|
106
|
+
export declare const UI_CLASSES: readonly UiClassInfo[];
|
|
107
|
+
export interface UiVariableInfo {
|
|
108
|
+
name: string;
|
|
109
|
+
default: string;
|
|
110
|
+
use: string;
|
|
111
|
+
}
|
|
112
|
+
/** Set on the page (or the host element) to restyle every layer at once. */
|
|
113
|
+
export declare const UI_VARIABLES: readonly UiVariableInfo[];
|
|
114
|
+
/** Class of the host element each layer is rendered in (target it from the page to override variables). */
|
|
115
|
+
export declare const UI_HOST_CLASS = "rise-ui-layer";
|
|
116
|
+
//# sourceMappingURL=uiSpec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiSpec.d.ts","sourceRoot":"","sources":["../../src/ui/uiSpec.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAA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IACxB,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,EAAE,SAAS,WAAW,EAc5C,CAAC;AAEF,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AAE9E,4EAA4E;AAC5E,eAAO,MAAM,YAAY,EAAE,SAAS,cAAc,EAWjD,CAAC;AAEF,2GAA2G;AAC3G,eAAO,MAAM,aAAa,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// UI layers — the spec (types, vocabulary, attribute grammar)
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// A UI layer is HTML + CSS written by the AI agent (or by hand) that controls the
|
|
6
|
+
// scene through data attributes. The viewer's binder turns the attributes into calls
|
|
7
|
+
// on the project's SceneHandle (actions, clips, sequences). This file is the single
|
|
8
|
+
// source of the vocabulary: the binder, the validator, the agent docs and the base
|
|
9
|
+
// stylesheet all read it, so they cannot drift apart.
|
|
10
|
+
//
|
|
11
|
+
// <button class="rise-button" data-click="action.toggle:open-door">Open</button>
|
|
12
|
+
//
|
|
13
|
+
// Refs are an item's key, then its id, then its exact name (same as SceneHandle).
|
|
14
|
+
// Commands are separated by spaces, so a ref used in an attribute cannot contain one:
|
|
15
|
+
// address things by key.
|
|
16
|
+
//
|
|
17
|
+
/** Attributes that run commands. */
|
|
18
|
+
export const UI_TRIGGER_ATTRS = {
|
|
19
|
+
click: 'data-click',
|
|
20
|
+
hoverIn: 'data-hover-in',
|
|
21
|
+
hoverOut: 'data-hover-out',
|
|
22
|
+
};
|
|
23
|
+
export const UI_ATTR = {
|
|
24
|
+
...UI_TRIGGER_ATTRS,
|
|
25
|
+
bind: 'data-bind',
|
|
26
|
+
state: 'data-state',
|
|
27
|
+
showWhen: 'data-show-when',
|
|
28
|
+
anchor: 'data-anchor',
|
|
29
|
+
anchorOcclude: 'data-anchor-occlude',
|
|
30
|
+
anchorOffset: 'data-anchor-offset',
|
|
31
|
+
set: 'data-set',
|
|
32
|
+
setValue: 'data-set-value',
|
|
33
|
+
};
|
|
34
|
+
/** Verbs per command kind. `toggle` for sequences and clips alternates forward / backward. */
|
|
35
|
+
export const UI_VERBS = {
|
|
36
|
+
action: ['apply', 'revert', 'toggle'],
|
|
37
|
+
sequence: ['play', 'reverse', 'pause', 'resume', 'stop', 'toggle'],
|
|
38
|
+
clip: ['play', 'reverse', 'pause', 'resume', 'stop', 'toggle'],
|
|
39
|
+
ui: ['show', 'hide', 'toggle'],
|
|
40
|
+
};
|
|
41
|
+
/** What `data-set` writes to: an object (or a node of a model), or one of the environment elements. */
|
|
42
|
+
export const UI_SET_ENVIRONMENT = ['camera', 'sky', 'clouds', 'ocean', 'terrain'];
|
|
43
|
+
/** `engine:materialSettings.opacity`, `engine/Door_L:meshSettings.rotation.y`, `sky:elevation`. */
|
|
44
|
+
export function parseSetTarget(value) {
|
|
45
|
+
// One target per attribute, so (unlike the command lists) names may contain spaces.
|
|
46
|
+
const m = /^([^:/]+?)(?:\/([^:]+?))?:([A-Za-z_][\w.]*)$/.exec((value ?? '').trim());
|
|
47
|
+
return m
|
|
48
|
+
? { set: { target: m[1].trim(), node: m[2]?.trim(), path: m[3] } }
|
|
49
|
+
: { error: `"${value ?? ''}" is not target:path (e.g. engine:materialSettings.opacity or sky:elevation).` };
|
|
50
|
+
}
|
|
51
|
+
/** The value of `data-set-value`: a number, true/false, a JSON array (`[1,0,0]`), or a string (`#ff0000`). */
|
|
52
|
+
export function parseSetValue(value) {
|
|
53
|
+
if (value == null)
|
|
54
|
+
return undefined;
|
|
55
|
+
const t = value.trim();
|
|
56
|
+
if (t === 'true')
|
|
57
|
+
return true;
|
|
58
|
+
if (t === 'false')
|
|
59
|
+
return false;
|
|
60
|
+
if (/^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(t))
|
|
61
|
+
return Number(t);
|
|
62
|
+
if (t.startsWith('[')) {
|
|
63
|
+
try {
|
|
64
|
+
const a = JSON.parse(t);
|
|
65
|
+
if (Array.isArray(a) && a.every(n => typeof n === 'number'))
|
|
66
|
+
return a;
|
|
67
|
+
}
|
|
68
|
+
catch { /* fall through */ }
|
|
69
|
+
}
|
|
70
|
+
return t;
|
|
71
|
+
}
|
|
72
|
+
const KINDS = ['action', 'sequence', 'clip', 'ui'];
|
|
73
|
+
const isKind = (k) => KINDS.includes(k);
|
|
74
|
+
const tokens = (value) => (value ?? '').split(/\s+/).filter(Boolean);
|
|
75
|
+
/** `action.toggle:open-door sequence.play:intro` */
|
|
76
|
+
export function parseCommands(value) {
|
|
77
|
+
const commands = [];
|
|
78
|
+
const errors = [];
|
|
79
|
+
for (const token of tokens(value)) {
|
|
80
|
+
const m = /^([a-z]+)\.([a-z]+):(.+)$/.exec(token);
|
|
81
|
+
if (!m) {
|
|
82
|
+
errors.push(`"${token}" is not kind.verb:ref (e.g. action.toggle:open-door).`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const [, kind, verb, ref] = m;
|
|
86
|
+
if (!isKind(kind)) {
|
|
87
|
+
errors.push(`"${token}": unknown kind "${kind}". Use ${KINDS.join(', ')}.`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (!UI_VERBS[kind].includes(verb)) {
|
|
91
|
+
errors.push(`"${token}": ${kind} has no verb "${verb}". Use ${UI_VERBS[kind].join(', ')}.`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (kind === 'ui' && !/^#[A-Za-z][\w-]*$/.test(ref)) {
|
|
95
|
+
errors.push(`"${token}": ui commands address an element id in this layer, like ui.toggle:#menu.`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
commands.push({ kind, verb, ref });
|
|
99
|
+
}
|
|
100
|
+
return { commands, errors };
|
|
101
|
+
}
|
|
102
|
+
/** `action:open-door !sequence:intro ui:#menu` — all must hold. */
|
|
103
|
+
export function parseConditions(value) {
|
|
104
|
+
const conditions = [];
|
|
105
|
+
const errors = [];
|
|
106
|
+
for (const raw of tokens(value)) {
|
|
107
|
+
const negate = raw.startsWith('!');
|
|
108
|
+
const token = negate ? raw.slice(1) : raw;
|
|
109
|
+
const m = /^([a-z]+):(.+)$/.exec(token);
|
|
110
|
+
if (!m || !isKind(m[1])) {
|
|
111
|
+
errors.push(`"${raw}" is not [!]kind:ref (e.g. action:open-door).`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (m[1] === 'ui' && !/^#[A-Za-z][\w-]*$/.test(m[2])) {
|
|
115
|
+
errors.push(`"${raw}": ui conditions address an element id in this layer, like ui:#menu.`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
conditions.push({ negate, kind: m[1], ref: m[2] });
|
|
119
|
+
}
|
|
120
|
+
return { conditions, errors };
|
|
121
|
+
}
|
|
122
|
+
/** `sequence:intro` or `clip:spin` (for <input type="range">). */
|
|
123
|
+
export function parseBind(value) {
|
|
124
|
+
const m = /^(sequence|clip):(.+)$/.exec((value ?? '').trim());
|
|
125
|
+
return m ? { bind: { kind: m[1], ref: m[2] } } : { error: `"${value ?? ''}" is not sequence:ref or clip:ref.` };
|
|
126
|
+
}
|
|
127
|
+
/** `object:engine` or `object:engine/Door_L` (the node name is everything after the first slash). */
|
|
128
|
+
export function parseAnchor(value) {
|
|
129
|
+
const m = /^object:([^/]+)(?:\/(.+))?$/.exec((value ?? '').trim());
|
|
130
|
+
return m ? { anchor: { object: m[1], node: m[2] } } : { error: `"${value ?? ''}" is not object:ref or object:ref/NodeName.` };
|
|
131
|
+
}
|
|
132
|
+
/** `12 -8` (px, from the projected point). */
|
|
133
|
+
export function parseOffset(value) {
|
|
134
|
+
const p = tokens(value).map(Number);
|
|
135
|
+
return p.length === 2 && p.every(Number.isFinite) ? [p[0], p[1]] : null;
|
|
136
|
+
}
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Generic classes + variables (the base stylesheet in the viewer implements them)
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
//
|
|
141
|
+
// The prefix is `rise-`, not `3drise-`: a CSS class cannot start with a digit
|
|
142
|
+
// without escaping (`.3drise-button` is invalid; it has to be `.\33 drise-button`).
|
|
143
|
+
export const UI_CLASS_PREFIX = 'rise-';
|
|
144
|
+
export const UI_CLASSES = [
|
|
145
|
+
{ name: 'rise-panel', use: 'A container grouping controls (a bar, a drawer, a side panel).' },
|
|
146
|
+
{ name: 'rise-button', use: 'A button. Pressed / active state: [data-on="true"] when it has data-state.', for: 'button' },
|
|
147
|
+
{ name: 'rise-toggle', use: 'A button showing an on/off state (use with data-state).', for: 'button' },
|
|
148
|
+
{ name: 'rise-slider', use: 'A range input (<input type="range">), often with data-bind.', for: 'input[type=range]' },
|
|
149
|
+
{ name: 'rise-input', use: 'A text or number input.', for: 'input' },
|
|
150
|
+
{ name: 'rise-menu', use: 'A list of choices (a column of rise-menu-item).' },
|
|
151
|
+
{ name: 'rise-menu-item', use: 'One choice in a rise-menu. Selected: [data-on="true"].' },
|
|
152
|
+
{ name: 'rise-card', use: 'An info card.' },
|
|
153
|
+
{ name: 'rise-card-title', use: 'The card heading.' },
|
|
154
|
+
{ name: 'rise-card-body', use: 'The card text.' },
|
|
155
|
+
{ name: 'rise-card-image', use: 'An <img> in a card.' },
|
|
156
|
+
{ name: 'rise-hotspot', use: 'A marker anchored to an object or model part (data-anchor).' },
|
|
157
|
+
{ name: 'rise-label', use: 'A small text label.' },
|
|
158
|
+
];
|
|
159
|
+
/** Set on the page (or the host element) to restyle every layer at once. */
|
|
160
|
+
export const UI_VARIABLES = [
|
|
161
|
+
{ name: '--rise-accent', default: '#6ea8ff', use: 'Accent colour: active states, slider thumb, hotspot.' },
|
|
162
|
+
{ name: '--rise-accent-text', default: '#0b1220', use: 'Text on the accent colour.' },
|
|
163
|
+
{ name: '--rise-bg', default: 'rgba(18, 22, 32, 0.72)', use: 'Control and card background.' },
|
|
164
|
+
{ name: '--rise-text', default: '#f2f5fa', use: 'Text colour.' },
|
|
165
|
+
{ name: '--rise-muted', default: 'rgba(242, 245, 250, 0.65)', use: 'Secondary text.' },
|
|
166
|
+
{ name: '--rise-border', default: 'rgba(255, 255, 255, 0.16)', use: 'Border colour.' },
|
|
167
|
+
{ name: '--rise-radius', default: '10px', use: 'Corner radius.' },
|
|
168
|
+
{ name: '--rise-gap', default: '8px', use: 'Spacing between grouped controls.' },
|
|
169
|
+
{ name: '--rise-font', default: 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif', use: 'Font family (system fonts only).' },
|
|
170
|
+
{ name: '--rise-blur', default: '12px', use: 'Backdrop blur of panels and cards.' },
|
|
171
|
+
];
|
|
172
|
+
/** Class of the host element each layer is rendered in (target it from the page to override variables). */
|
|
173
|
+
export const UI_HOST_CLASS = 'rise-ui-layer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environmentMigration.d.ts","sourceRoot":"","sources":["../../src/utils/environmentMigration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAgB9D,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,qBAAqB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAkCnF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Environment objects — load-time migration of the legacy rain
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// Rain used to sit outside the environment family, with its own animation domain:
|
|
6
|
+
// its keyframes in `animations.rain`, its pointer bindings in `mouseMove.rain`.
|
|
7
|
+
// It is a family member now, driven through `animations.environment` /
|
|
8
|
+
// `mouseMove.environment` like every other environment object, so a saved rain's
|
|
9
|
+
// tracks move over (appended to anything already there). The never-rendered
|
|
10
|
+
// `splash` knob is dropped.
|
|
11
|
+
//
|
|
12
|
+
// Pure and idempotent: returns the same object when there is nothing to migrate.
|
|
13
|
+
//
|
|
14
|
+
export function migrateEnvironmentObject(obj) {
|
|
15
|
+
if (!obj || obj.type !== 'environment')
|
|
16
|
+
return obj;
|
|
17
|
+
const config = obj.config;
|
|
18
|
+
if (!config || config.type !== 'rain')
|
|
19
|
+
return obj;
|
|
20
|
+
const animations = obj.animations;
|
|
21
|
+
const mouseMove = obj.mouseMove;
|
|
22
|
+
const hasAnim = !!animations && 'rain' in animations;
|
|
23
|
+
const hasMouse = !!mouseMove && typeof mouseMove === 'object' && 'rain' in mouseMove;
|
|
24
|
+
if (!('splash' in config) && !hasAnim && !hasMouse)
|
|
25
|
+
return obj;
|
|
26
|
+
const next = { ...obj };
|
|
27
|
+
if ('splash' in config) {
|
|
28
|
+
const { splash: _splash, ...rest } = config;
|
|
29
|
+
next.config = rest;
|
|
30
|
+
}
|
|
31
|
+
if (hasAnim) {
|
|
32
|
+
const { rain, ...others } = animations;
|
|
33
|
+
const env = others.environment ?? {};
|
|
34
|
+
next.animations = {
|
|
35
|
+
...others,
|
|
36
|
+
environment: { ...rain, ...env, animations: [...(env.animations ?? []), ...(rain?.animations ?? [])] },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (hasMouse) {
|
|
40
|
+
const { rain, ...others } = mouseMove;
|
|
41
|
+
const env = others.environment;
|
|
42
|
+
next.mouseMove = {
|
|
43
|
+
...others,
|
|
44
|
+
environment: env
|
|
45
|
+
? { ...env, enabled: env.enabled || !!rain?.enabled, properties: [...(env.properties ?? []), ...(rain?.properties ?? [])] }
|
|
46
|
+
: rain,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return next;
|
|
50
|
+
}
|
|
@@ -2,7 +2,7 @@ export interface AnimatableConfigProperty {
|
|
|
2
2
|
value: string;
|
|
3
3
|
label: string;
|
|
4
4
|
}
|
|
5
|
-
export type GenerativeFamily = 'particles' | 'lights' | 'effects' | 'grids';
|
|
5
|
+
export type GenerativeFamily = 'particles' | 'lights' | 'effects' | 'grids' | 'environment' | 'space' | 'land' | 'text';
|
|
6
6
|
/** The animatable knobs of one generative object, by family and config.type. */
|
|
7
7
|
export declare function getGenerativeAnimatable(family: GenerativeFamily, config: {
|
|
8
8
|
type?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generativeAnimatable.d.ts","sourceRoot":"","sources":["../../src/utils/generativeAnimatable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generativeAnimatable.d.ts","sourceRoot":"","sources":["../../src/utils/generativeAnimatable.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAoBxH,gFAAgF;AAChF,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,GAC7C,wBAAwB,EAAE,CAM5B;AAED,sFAAsF;AACtF,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,GAC7C,OAAO,CAGT"}
|
|
@@ -2,6 +2,10 @@ import { GENERATIVE_PARTICLES_ANIMATABLE } from "../data/particlesDefaults.js";
|
|
|
2
2
|
import { LIGHTS_ANIMATABLE } from "../data/lightsDefaults.js";
|
|
3
3
|
import { EFFECTS_ANIMATABLE } from "../data/effectsDefaults.js";
|
|
4
4
|
import { GRIDS_ANIMATABLE } from "../data/gridsDefaults.js";
|
|
5
|
+
import { ENVIRONMENT_OBJECTS_ANIMATABLE } from "../data/environmentDefaults.js";
|
|
6
|
+
import { SPACE_OBJECTS_ANIMATABLE } from "../data/spaceDefaults.js";
|
|
7
|
+
import { LAND_OBJECTS_ANIMATABLE } from "../data/landDefaults.js";
|
|
8
|
+
import { TEXT_OBJECTS_ANIMATABLE } from "../data/textDefaults.js";
|
|
5
9
|
// Partial: grids list only the types converted to the config pattern so far (effects list all).
|
|
6
10
|
const FAMILIES = {
|
|
7
11
|
particles: GENERATIVE_PARTICLES_ANIMATABLE,
|
|
@@ -10,6 +14,14 @@ const FAMILIES = {
|
|
|
10
14
|
lights: LIGHTS_ANIMATABLE,
|
|
11
15
|
effects: EFFECTS_ANIMATABLE,
|
|
12
16
|
grids: GRIDS_ANIMATABLE,
|
|
17
|
+
// Weather objects (type 'environment'): snow… The legacy rain is not in this table.
|
|
18
|
+
environment: ENVIRONMENT_OBJECTS_ANIMATABLE,
|
|
19
|
+
// Celestial bodies and backdrops (type 'space'): stars, earth, solarSystem, shootingStars.
|
|
20
|
+
space: SPACE_OBJECTS_ANIMATABLE,
|
|
21
|
+
// Placeable patches of terrain (type 'land'): mountains, hills, dunes, canyon.
|
|
22
|
+
land: LAND_OBJECTS_ANIMATABLE,
|
|
23
|
+
// Animated text looks (type 'text', config.type set): handwriting, neonTube, fourierSketch. The legacy bitmap / 3D text is not in this table.
|
|
24
|
+
text: TEXT_OBJECTS_ANIMATABLE,
|
|
13
25
|
};
|
|
14
26
|
/** The animatable knobs of one generative object, by family and config.type. */
|
|
15
27
|
export function getGenerativeAnimatable(family, config) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MouseMoveInteraction, MouseMoveInteractions, ObjectAnimations } from "../types/objectSettings";
|
|
2
2
|
import type { PropertyKind } from "../properties/types";
|
|
3
|
-
export type AnimatableDomain = 'transform' | 'material' | 'edges' | 'light' | 'clouds' | 'rain' | 'particles' | 'effect' | 'grid';
|
|
3
|
+
export type AnimatableDomain = 'transform' | 'material' | 'edges' | 'light' | 'clouds' | 'rain' | 'particles' | 'effect' | 'grid' | 'environment' | 'space' | 'land' | 'text' | 'sky' | 'ocean' | 'terrain';
|
|
4
4
|
export interface AnimatableProperty {
|
|
5
5
|
value: string;
|
|
6
6
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAnimatableProperties.d.ts","sourceRoot":"","sources":["../../src/utils/getAnimatableProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE7G,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,qBAAqB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"getAnimatableProperties.d.ts","sourceRoot":"","sources":["../../src/utils/getAnimatableProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE7G,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,qBAAqB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5M,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC1C,CAAC;IACF,MAAM,CAAC,EAAE,CAAC;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,qBAAqB,GAAG,oBAAoB,CAAC;CAC5D;AAmBD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD;AAUD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,EAAE,CAMlH;AAKD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAUhH"}
|
|
@@ -41,7 +41,7 @@ export function getAnimatableProperties(settings, domain) {
|
|
|
41
41
|
.map(toAnimatable);
|
|
42
42
|
}
|
|
43
43
|
/** Domain priority when a name exists in more than one (edges before material: an edges key shadows the mesh's). */
|
|
44
|
-
const DETECT_ORDER = ['edges', 'light', 'effect', 'grid', 'particles', 'clouds', 'rain', 'material'];
|
|
44
|
+
const DETECT_ORDER = ['edges', 'light', 'effect', 'grid', 'environment', 'space', 'land', 'text', 'particles', 'clouds', 'rain', 'sky', 'ocean', 'terrain', 'material'];
|
|
45
45
|
/**
|
|
46
46
|
* Detect which domain a property name belongs to, for a given target. Used by
|
|
47
47
|
* the runtime + UI to migrate flat MouseMove arrays into the new per-domain
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridMigration.d.ts","sourceRoot":"","sources":["../../src/utils/gridMigration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAoB9D,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAgB5E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Euler, Quaternion } from 'three';
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Grids — load-time migration of the legacy surface knobs
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// Every grid now lies flat in its own frame (the plane on local XZ, facing +Y);
|
|
7
|
+
// standing it up is the parent object's rotation, and pointer behaviour is a
|
|
8
|
+
// Pointer-tab binding. Older grids carried two knobs for that:
|
|
9
|
+
// flat: false the plane stood upright on local XY. Kept as it looked by
|
|
10
|
+
// turning the object +90° about its own X axis, so the now-flat
|
|
11
|
+
// plane ends up exactly where the upright one was.
|
|
12
|
+
// followMouse the ripple focus tracked the cursor. Dropped: the focus stays
|
|
13
|
+
// at the grid's centre.
|
|
14
|
+
// Both keys are removed. Pure and idempotent: returns the same object when there
|
|
15
|
+
// is nothing to migrate, so it can run on every load without marking anything dirty.
|
|
16
|
+
//
|
|
17
|
+
const UPRIGHT = new Quaternion().setFromEuler(new Euler(Math.PI / 2, 0, 0));
|
|
18
|
+
export function migrateGridObject(obj) {
|
|
19
|
+
if (!obj || obj.type !== 'grid')
|
|
20
|
+
return obj;
|
|
21
|
+
const config = obj.config;
|
|
22
|
+
if (!config || (!('flat' in config) && !('followMouse' in config)))
|
|
23
|
+
return obj;
|
|
24
|
+
const { flat, followMouse: _followMouse, ...rest } = config;
|
|
25
|
+
const next = { ...obj, config: rest };
|
|
26
|
+
if (flat === false) {
|
|
27
|
+
const mesh = obj.meshSettings ?? {};
|
|
28
|
+
const r = Array.isArray(mesh.rotation) ? mesh.rotation : [0, 0, 0];
|
|
29
|
+
const q = new Quaternion().setFromEuler(new Euler(r[0] ?? 0, r[1] ?? 0, r[2] ?? 0)).multiply(UPRIGHT);
|
|
30
|
+
const e = new Euler().setFromQuaternion(q);
|
|
31
|
+
next.meshSettings = { ...mesh, rotation: [e.x, e.y, e.z] };
|
|
32
|
+
}
|
|
33
|
+
return next;
|
|
34
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './meshUtils';
|
|
|
16
16
|
export * from './pathUtils';
|
|
17
17
|
export * from './positionsCreatorUtils';
|
|
18
18
|
export * from './sunUtils';
|
|
19
|
+
export * from './skyPhase';
|
|
19
20
|
export * from './utils';
|
|
20
21
|
export * from './edgeUtils';
|
|
21
22
|
export * from './surfaceUtils';
|
|
@@ -33,6 +34,10 @@ export * from './handleEdgesMouseMove';
|
|
|
33
34
|
export * from './handleLightMouseMove';
|
|
34
35
|
export * from './sceneQuery';
|
|
35
36
|
export * from './shootingStarHelpers';
|
|
37
|
+
export * from './spaceMigration';
|
|
38
|
+
export * from './gridMigration';
|
|
39
|
+
export * from './environmentMigration';
|
|
40
|
+
export * from './objectMigration';
|
|
36
41
|
export * from './environmentUtils';
|
|
37
42
|
export * from './MaterialCompiler';
|
|
38
43
|
export * from './nodeOverrides';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAA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AAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './meshUtils.js';
|
|
|
16
16
|
export * from './pathUtils.js';
|
|
17
17
|
export * from './positionsCreatorUtils.js';
|
|
18
18
|
export * from './sunUtils.js';
|
|
19
|
+
export * from './skyPhase.js';
|
|
19
20
|
export * from './utils.js';
|
|
20
21
|
export * from './edgeUtils.js';
|
|
21
22
|
export * from './surfaceUtils.js';
|
|
@@ -33,6 +34,10 @@ export * from './handleEdgesMouseMove.js';
|
|
|
33
34
|
export * from './handleLightMouseMove.js';
|
|
34
35
|
export * from './sceneQuery.js';
|
|
35
36
|
export * from './shootingStarHelpers.js';
|
|
37
|
+
export * from './spaceMigration.js';
|
|
38
|
+
export * from './gridMigration.js';
|
|
39
|
+
export * from './environmentMigration.js';
|
|
40
|
+
export * from './objectMigration.js';
|
|
36
41
|
export * from './environmentUtils.js';
|
|
37
42
|
export * from './MaterialCompiler.js';
|
|
38
43
|
export * from './nodeOverrides.js';
|
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import type { ObjectEffect } from '../types/objectSettings';
|
|
2
|
-
/**
|
|
1
|
+
import type { EffectSpread, EffectSteps, ObjectEffect, ObjectEffectClip } from '../types/objectSettings';
|
|
2
|
+
/**
|
|
3
|
+
* Visual effects layer GLSL onto three's standard materials, so they take only objects drawn with
|
|
4
|
+
* them: meshes, models and the legacy 2d / 3d text. Every other scene object (particles, grids, text
|
|
5
|
+
* looks, lights, weather, space, generative effects…) takes physical (transform) effects only, for now —
|
|
6
|
+
* they move the object's group, whatever draws inside it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function objectTakesVisualEffects(o: {
|
|
9
|
+
type?: string;
|
|
10
|
+
config?: unknown;
|
|
11
|
+
} | null | undefined): boolean;
|
|
12
|
+
/** A group's stagger when its clip sets none (see EffectSpread). */
|
|
13
|
+
export declare const DEFAULT_EFFECT_SPREAD: Required<EffectSpread>;
|
|
14
|
+
/** An object's effect clip (`effects`), or an empty one. The stored value itself — identity stays stable. */
|
|
15
|
+
export declare function objectEffectClipOf(settings: {
|
|
16
|
+
effects?: unknown;
|
|
17
|
+
} | null | undefined): ObjectEffectClip;
|
|
18
|
+
/** The object's Base effects (well-formed entries only). */
|
|
3
19
|
export declare function objectEffectsOf(settings: {
|
|
4
20
|
effects?: unknown;
|
|
5
21
|
} | null | undefined): ObjectEffect[];
|
|
22
|
+
/** The steps of an effect clip as the effects controller takes them, or null when it has none. */
|
|
23
|
+
export declare function objectEffectStepsOf(clip: ObjectEffectClip | null | undefined): EffectSteps | null;
|
|
24
|
+
/** The object with its effect clip changed (Base effects normalised, the rest kept). */
|
|
25
|
+
export declare function withObjectEffectClip<T extends {
|
|
26
|
+
effects?: unknown;
|
|
27
|
+
}>(settings: T, patch: Partial<ObjectEffectClip>): T;
|
|
6
28
|
//# sourceMappingURL=objectEffects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectEffects.d.ts","sourceRoot":"","sources":["../../src/utils/objectEffects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"objectEffects.d.ts","sourceRoot":"","sources":["../../src/utils/objectEffects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGzG;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG3G;AAED,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAAiD,CAAC;AAI3G,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB,CAGvG;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,CAGlG;AAED,kGAAkG;AAClG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAEjG;AAED,wFAAwF;AACxF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAEtH"}
|
|
@@ -1,5 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import { isTextObjectConfig } from '../data/textDefaults.js';
|
|
2
|
+
/**
|
|
3
|
+
* Visual effects layer GLSL onto three's standard materials, so they take only objects drawn with
|
|
4
|
+
* them: meshes, models and the legacy 2d / 3d text. Every other scene object (particles, grids, text
|
|
5
|
+
* looks, lights, weather, space, generative effects…) takes physical (transform) effects only, for now —
|
|
6
|
+
* they move the object's group, whatever draws inside it.
|
|
7
|
+
*/
|
|
8
|
+
export function objectTakesVisualEffects(o) {
|
|
9
|
+
// a group never draws an effect itself: its visual effects go to each child that takes them
|
|
10
|
+
return o?.type === 'mesh' || o?.type === 'model' || o?.type === 'group' || (o?.type === 'text' && !isTextObjectConfig(o.config));
|
|
11
|
+
}
|
|
12
|
+
/** A group's stagger when its clip sets none (see EffectSpread). */
|
|
13
|
+
export const DEFAULT_EFFECT_SPREAD = { order: 'tree', total: 0.6, out: 'reverse' };
|
|
14
|
+
const EMPTY = Object.freeze({ effects: [] });
|
|
15
|
+
/** An object's effect clip (`effects`), or an empty one. The stored value itself — identity stays stable. */
|
|
16
|
+
export function objectEffectClipOf(settings) {
|
|
17
|
+
const c = settings?.effects;
|
|
18
|
+
return c && typeof c === 'object' && !Array.isArray(c) ? c : EMPTY;
|
|
19
|
+
}
|
|
20
|
+
/** The object's Base effects (well-formed entries only). */
|
|
2
21
|
export function objectEffectsOf(settings) {
|
|
3
|
-
const list = settings
|
|
22
|
+
const list = objectEffectClipOf(settings).effects;
|
|
4
23
|
return Array.isArray(list) ? list.filter((e) => e && typeof e.operation === 'string' && typeof e.id === 'string') : [];
|
|
5
24
|
}
|
|
25
|
+
/** The steps of an effect clip as the effects controller takes them, or null when it has none. */
|
|
26
|
+
export function objectEffectStepsOf(clip) {
|
|
27
|
+
return clip?.steps?.length ? { steps: clip.steps, loop: clip.loop, yoyo: clip.yoyo } : null;
|
|
28
|
+
}
|
|
29
|
+
/** The object with its effect clip changed (Base effects normalised, the rest kept). */
|
|
30
|
+
export function withObjectEffectClip(settings, patch) {
|
|
31
|
+
return { ...settings, effects: { ...objectEffectClipOf(settings), effects: objectEffectsOf(settings), ...patch } };
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CreatedObjectSettings } from '../types/scene3d';
|
|
2
|
+
/**
|
|
3
|
+
* Every load-time migration of saved scene objects, in one pass. Each step is
|
|
4
|
+
* pure, idempotent and returns the same object when there is nothing to change,
|
|
5
|
+
* so this runs on every load (objectsSlice, the viewer ProjectLoader). A family
|
|
6
|
+
* whose saved shape changes adds its step here.
|
|
7
|
+
*/
|
|
8
|
+
export declare function migrateObject<T extends CreatedObjectSettings>(obj: T): T;
|
|
9
|
+
//# sourceMappingURL=objectMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectMigration.d.ts","sourceRoot":"","sources":["../../src/utils/objectMigration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAK9D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,qBAAqB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAExE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { migrateSpaceObject } from './spaceMigration.js';
|
|
2
|
+
import { migrateGridObject } from './gridMigration.js';
|
|
3
|
+
import { migrateEnvironmentObject } from './environmentMigration.js';
|
|
4
|
+
/**
|
|
5
|
+
* Every load-time migration of saved scene objects, in one pass. Each step is
|
|
6
|
+
* pure, idempotent and returns the same object when there is nothing to change,
|
|
7
|
+
* so this runs on every load (objectsSlice, the viewer ProjectLoader). A family
|
|
8
|
+
* whose saved shape changes adds its step here.
|
|
9
|
+
*/
|
|
10
|
+
export function migrateObject(obj) {
|
|
11
|
+
return migrateEnvironmentObject(migrateGridObject(migrateSpaceObject(obj)));
|
|
12
|
+
}
|