@zephyr3d/editor 0.3.5 → 0.3.7
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/assets/{index-DlnbO59X.js → index-ySiLtSxz.js} +2 -2
- package/dist/assistant/zephyr-types-index.json +14215 -7892
- package/dist/index.html +1 -1
- package/dist/modules/zephyr3d_backend-webgl.js.map +1 -1
- package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
- package/dist/modules/zephyr3d_base.js +152 -152
- package/dist/modules/zephyr3d_base.js.map +1 -1
- package/dist/modules/zephyr3d_imgui.js.map +1 -1
- package/dist/modules/zephyr3d_loaders.js +6 -6
- package/dist/modules/zephyr3d_loaders.js.map +1 -1
- package/dist/modules/zephyr3d_scene.js +2538 -348
- package/dist/modules/zephyr3d_scene.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgl/dist/index.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/index.js.map +1 -1
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js +152 -152
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js.map +1 -1
- package/dist/vendor/zephyr3d/imgui/dist/index.d.ts +7 -0
- package/dist/vendor/zephyr3d/imgui/dist/index.js.map +1 -1
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js +6 -6
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animation.js +87 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/animation.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animationcontroller.js +503 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/animationcontroller.js.map +1 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +782 -156
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animationtimeline.js +974 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/animationtimeline.js.map +1 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js +320 -0
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js.map +1 -0
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js +130 -125
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js +64 -63
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/index.d.ts +1270 -9
- package/dist/vendor/zephyr3d/scene/dist/index.js +3 -1
- package/dist/vendor/zephyr3d/scene/dist/index.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lit.js +7 -3
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lit.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.js +1 -0
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/animation.js +4 -3
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/node.js +3 -2
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/node.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\r\n * The WebGL/WebGL2 device backend for zephyr3d project\r\n *\r\n * @module backend-webgl\r\n * @packageDocumentation\r\n */\r\nimport { backend1, backend2 } from './device_webgl';\r\n\r\n/**\r\n * The WebGL1 backend\r\n * @public\r\n */\r\nexport const backendWebGL1 = backend1;\r\n\r\n/**\r\n * The WebGL2 backend\r\n * @public\r\n */\r\nexport const backendWebGL2 = backend2;\r\n"],"names":["backendWebGL1","backend1","backendWebGL2","backend2"],"mappings":";;AAQA;;;IAIaA,MAAAA,aAAAA,GAAgBC;AAE7B;;;IAIaC,MAAAA,aAAAA,GAAgBC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\r\n * The WebGPU device backend for zephyr3d project\r\n *\r\n * @module backend-webgpu\r\n * @packageDocumentation\r\n */\r\nimport { WebGPUDevice } from './device';\r\nimport type { DeviceBackend, DeviceEventMap } from '@zephyr3d/device';\r\nimport type { Nullable } from '@zephyr3d/base';\r\nimport { makeObservable } from '@zephyr3d/base';\r\n\r\nlet webGPUStatus: Nullable<Promise<boolean>> = null;\r\n\r\n/**\r\n * The WebGPU backend\r\n * @public\r\n */\r\nexport const backendWebGPU: DeviceBackend = {\r\n typeName() {\r\n return 'webgpu';\r\n },\r\n async supported() {\r\n if (!webGPUStatus) {\r\n webGPUStatus = new Promise<boolean>(async (resolve) => {\r\n let status = true;\r\n try {\r\n if (!('gpu' in navigator)) {\r\n status = false;\r\n }\r\n const adapter = await navigator.gpu.requestAdapter();\r\n if (!adapter) {\r\n status = false;\r\n } else {\r\n const device = await adapter.requestDevice();\r\n if (!device) {\r\n status = false;\r\n } else if (typeof device.destroy === 'function') {\r\n device.destroy();\r\n }\r\n status = true;\r\n }\r\n } catch {\r\n status = false;\r\n }\r\n resolve(status);\r\n });\r\n }\r\n return webGPUStatus;\r\n },\r\n async createDevice(cvs, options?) {\r\n try {\r\n const factory = makeObservable(WebGPUDevice)<DeviceEventMap>();\r\n const device = new factory(this, cvs, options);\r\n await device.initContext();\r\n device.setViewport(null);\r\n device.setScissor(null);\r\n return device;\r\n } catch (err) {\r\n console.error(err);\r\n return null;\r\n }\r\n }\r\n};\r\n"],"names":["webGPUStatus","backendWebGPU","typeName","supported","Promise","resolve","status","navigator","adapter","gpu","requestAdapter","device","requestDevice","destroy","createDevice","cvs","options","factory","makeObservable","WebGPUDevice","initContext","setViewport","setScissor","err","console","error"],"mappings":";;;AAWA,IAAIA,YAA2C,GAAA,IAAA;AAE/C;;;UAIaC,aAA+B,GAAA;AAC1CC,IAAAA,QAAAA,CAAAA,GAAAA;QACE,OAAO,QAAA;AACT,KAAA;IACA,MAAMC,SAAAA,CAAAA,GAAAA;AACJ,QAAA,IAAI,CAACH,YAAc,EAAA;YACjBA,YAAe,GAAA,IAAII,QAAiB,OAAOC,OAAAA,GAAAA;AACzC,gBAAA,IAAIC,MAAS,GAAA,IAAA;gBACb,IAAI;AACF,oBAAA,IAAI,EAAE,KAASC,IAAAA,SAAQ,CAAI,EAAA;wBACzBD,MAAS,GAAA,KAAA;AACX;AACA,oBAAA,MAAME,OAAU,GAAA,MAAMD,SAAUE,CAAAA,GAAG,CAACC,cAAc,EAAA;AAClD,oBAAA,IAAI,CAACF,OAAS,EAAA;wBACZF,MAAS,GAAA,KAAA;qBACJ,MAAA;wBACL,MAAMK,MAAAA,GAAS,MAAMH,OAAAA,CAAQI,aAAa,EAAA;AAC1C,wBAAA,IAAI,CAACD,MAAQ,EAAA;4BACXL,MAAS,GAAA,KAAA;AACX,yBAAA,MAAO,IAAI,OAAOK,MAAOE,CAAAA,OAAO,KAAK,UAAY,EAAA;AAC/CF,4BAAAA,MAAAA,CAAOE,OAAO,EAAA;AAChB;wBACAP,MAAS,GAAA,IAAA;AACX;AACF,iBAAA,CAAE,OAAM;oBACNA,MAAS,GAAA,KAAA;AACX;gBACAD,OAAQC,CAAAA,MAAAA,CAAAA;AACV,aAAA,CAAA;AACF;QACA,OAAON,YAAAA;AACT,KAAA;IACA,MAAMc,YAAAA,CAAAA,CAAaC,GAAG,EAAEC,OAAQ,EAAA;QAC9B,IAAI;AACF,YAAA,MAAMC,UAAUC,cAAeC,CAAAA,YAAAA,CAAAA,EAAAA;AAC/B,YAAA,MAAMR,MAAS,GAAA,IAAIM,OAAQ,CAAA,IAAI,EAAEF,GAAKC,EAAAA,OAAAA,CAAAA;AACtC,YAAA,MAAML,OAAOS,WAAW,EAAA;AACxBT,YAAAA,MAAAA,CAAOU,WAAW,CAAC,IAAA,CAAA;AACnBV,YAAAA,MAAAA,CAAOW,UAAU,CAAC,IAAA,CAAA;YAClB,OAAOX,MAAAA;AACT,SAAA,CAAE,OAAOY,GAAK,EAAA;AACZC,YAAAA,OAAAA,CAAQC,KAAK,CAACF,GAAAA,CAAAA;YACd,OAAO,IAAA;AACT;AACF;AACF;;;;"}
|
|
@@ -41,35 +41,35 @@ const mimeTypes = {
|
|
|
41
41
|
'.zprefab': 'application/vnd.zephyr3d.prefab+json',
|
|
42
42
|
'.zabc': 'application/vnd.zephyr3d.alembic-cache+json'
|
|
43
43
|
};
|
|
44
|
-
/**
|
|
45
|
-
* Path utilities.
|
|
46
|
-
*
|
|
47
|
-
* Provides POSIX-like path manipulation helpers (pure string operations),
|
|
48
|
-
* including normalization, joining, dirname/basename/extname extraction,
|
|
49
|
-
* absolute-path detection, and relative path computation.
|
|
50
|
-
*
|
|
51
|
-
* Notes:
|
|
52
|
-
* - Uses "/" as the separator (web/URL or POSIX-like paths).
|
|
53
|
-
* - All methods are pure and do not touch a real filesystem.
|
|
54
|
-
* - `normalize` collapses ".", "..", and redundant slashes.
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
44
|
+
/**
|
|
45
|
+
* Path utilities.
|
|
46
|
+
*
|
|
47
|
+
* Provides POSIX-like path manipulation helpers (pure string operations),
|
|
48
|
+
* including normalization, joining, dirname/basename/extname extraction,
|
|
49
|
+
* absolute-path detection, and relative path computation.
|
|
50
|
+
*
|
|
51
|
+
* Notes:
|
|
52
|
+
* - Uses "/" as the separator (web/URL or POSIX-like paths).
|
|
53
|
+
* - All methods are pure and do not touch a real filesystem.
|
|
54
|
+
* - `normalize` collapses ".", "..", and redundant slashes.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
57
|
*/ class PathUtils {
|
|
58
|
-
/**
|
|
59
|
-
* Normalizes a path by collapsing redundant slashes, removing "." segments,
|
|
60
|
-
* and resolving ".." segments.
|
|
61
|
-
*
|
|
62
|
-
* Rules:
|
|
63
|
-
* - Multiple consecutive "/" are collapsed into a single "/".
|
|
64
|
-
* - "." segments are removed.
|
|
65
|
-
* - ".." removes the previous segment (no-op at root).
|
|
66
|
-
* - The result always starts with "/" (absolute form).
|
|
67
|
-
*
|
|
68
|
-
* Example:
|
|
69
|
-
* - normalize('/a//b/./c/../d') -\> '/a/b/d'
|
|
70
|
-
*
|
|
71
|
-
* @param path - Input path (relative or absolute).
|
|
72
|
-
* @returns The normalized absolute path (always starting with "/").
|
|
58
|
+
/**
|
|
59
|
+
* Normalizes a path by collapsing redundant slashes, removing "." segments,
|
|
60
|
+
* and resolving ".." segments.
|
|
61
|
+
*
|
|
62
|
+
* Rules:
|
|
63
|
+
* - Multiple consecutive "/" are collapsed into a single "/".
|
|
64
|
+
* - "." segments are removed.
|
|
65
|
+
* - ".." removes the previous segment (no-op at root).
|
|
66
|
+
* - The result always starts with "/" (absolute form).
|
|
67
|
+
*
|
|
68
|
+
* Example:
|
|
69
|
+
* - normalize('/a//b/./c/../d') -\> '/a/b/d'
|
|
70
|
+
*
|
|
71
|
+
* @param path - Input path (relative or absolute).
|
|
72
|
+
* @returns The normalized absolute path (always starting with "/").
|
|
73
73
|
*/ static normalize(path) {
|
|
74
74
|
const parts = path.split('/').filter((p)=>p && p !== '.');
|
|
75
75
|
const result = [];
|
|
@@ -82,55 +82,55 @@ const mimeTypes = {
|
|
|
82
82
|
}
|
|
83
83
|
return '/' + result.join('/');
|
|
84
84
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Joins multiple path segments and normalizes the result.
|
|
87
|
-
*
|
|
88
|
-
* Behavior:
|
|
89
|
-
* - Concatenates segments with "/" and then runs `normalize`.
|
|
90
|
-
* - The returned path is always absolute.
|
|
91
|
-
*
|
|
92
|
-
* Example:
|
|
93
|
-
* - join('/a', 'b', '../c') -\> '/a/c'
|
|
94
|
-
*
|
|
95
|
-
* @param paths - Path segments in order.
|
|
96
|
-
* @returns Normalized absolute path.
|
|
85
|
+
/**
|
|
86
|
+
* Joins multiple path segments and normalizes the result.
|
|
87
|
+
*
|
|
88
|
+
* Behavior:
|
|
89
|
+
* - Concatenates segments with "/" and then runs `normalize`.
|
|
90
|
+
* - The returned path is always absolute.
|
|
91
|
+
*
|
|
92
|
+
* Example:
|
|
93
|
+
* - join('/a', 'b', '../c') -\> '/a/c'
|
|
94
|
+
*
|
|
95
|
+
* @param paths - Path segments in order.
|
|
96
|
+
* @returns Normalized absolute path.
|
|
97
97
|
*/ static join(...paths) {
|
|
98
98
|
return this.normalize(paths.join('/'));
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Returns the directory name (parent directory) of a path.
|
|
102
|
-
*
|
|
103
|
-
* Behavior:
|
|
104
|
-
* - Applies `normalize` first.
|
|
105
|
-
* - If the path is root "/" or has no parent, returns "/".
|
|
106
|
-
*
|
|
107
|
-
* Examples:
|
|
108
|
-
* - dirname('/a/b/c') -\> '/a/b'
|
|
109
|
-
* - dirname('/a') -\> '/'
|
|
110
|
-
* - dirname('/') -\> '/'
|
|
111
|
-
*
|
|
112
|
-
* @param path - Input path.
|
|
113
|
-
* @returns Directory path of the input.
|
|
100
|
+
/**
|
|
101
|
+
* Returns the directory name (parent directory) of a path.
|
|
102
|
+
*
|
|
103
|
+
* Behavior:
|
|
104
|
+
* - Applies `normalize` first.
|
|
105
|
+
* - If the path is root "/" or has no parent, returns "/".
|
|
106
|
+
*
|
|
107
|
+
* Examples:
|
|
108
|
+
* - dirname('/a/b/c') -\> '/a/b'
|
|
109
|
+
* - dirname('/a') -\> '/'
|
|
110
|
+
* - dirname('/') -\> '/'
|
|
111
|
+
*
|
|
112
|
+
* @param path - Input path.
|
|
113
|
+
* @returns Directory path of the input.
|
|
114
114
|
*/ static dirname(path) {
|
|
115
115
|
const normalized = this.normalize(path);
|
|
116
116
|
const lastSlash = normalized.lastIndexOf('/');
|
|
117
117
|
return lastSlash <= 0 ? '/' : normalized.slice(0, lastSlash);
|
|
118
118
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Returns the last portion of a path (file name).
|
|
121
|
-
*
|
|
122
|
-
* Behavior:
|
|
123
|
-
* - Applies `normalize` first.
|
|
124
|
-
* - If `ext` is provided and the name ends with it, the extension is stripped.
|
|
125
|
-
*
|
|
126
|
-
* Examples:
|
|
127
|
-
* - basename('/a/b/c.txt') -\> 'c.txt'
|
|
128
|
-
* - basename('/a/b/c.txt', '.txt') -\> 'c'
|
|
129
|
-
* - basename('/') -\> ''
|
|
130
|
-
*
|
|
131
|
-
* @param path - Input path.
|
|
132
|
-
* @param ext - Optional extension to strip (exact suffix match).
|
|
133
|
-
* @returns The base name of the path.
|
|
119
|
+
/**
|
|
120
|
+
* Returns the last portion of a path (file name).
|
|
121
|
+
*
|
|
122
|
+
* Behavior:
|
|
123
|
+
* - Applies `normalize` first.
|
|
124
|
+
* - If `ext` is provided and the name ends with it, the extension is stripped.
|
|
125
|
+
*
|
|
126
|
+
* Examples:
|
|
127
|
+
* - basename('/a/b/c.txt') -\> 'c.txt'
|
|
128
|
+
* - basename('/a/b/c.txt', '.txt') -\> 'c'
|
|
129
|
+
* - basename('/') -\> ''
|
|
130
|
+
*
|
|
131
|
+
* @param path - Input path.
|
|
132
|
+
* @param ext - Optional extension to strip (exact suffix match).
|
|
133
|
+
* @returns The base name of the path.
|
|
134
134
|
*/ static basename(path, ext) {
|
|
135
135
|
const normalized = this.normalize(path);
|
|
136
136
|
const lastSlash = normalized.lastIndexOf('/');
|
|
@@ -140,44 +140,44 @@ const mimeTypes = {
|
|
|
140
140
|
}
|
|
141
141
|
return name;
|
|
142
142
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Returns the extension of the path, including the leading dot.
|
|
145
|
-
*
|
|
146
|
-
* Behavior:
|
|
147
|
-
* - Based on the result of `basename`.
|
|
148
|
-
* - If there is no dot, returns an empty string.
|
|
149
|
-
*
|
|
150
|
-
* Examples:
|
|
151
|
-
* - extname('/a/b/c.txt') -\> '.txt'
|
|
152
|
-
* - extname('/a/b/c') -\> ''
|
|
153
|
-
*
|
|
154
|
-
* @param path - Input path.
|
|
155
|
-
* @returns The extension (e.g., ".txt") or an empty string if none.
|
|
143
|
+
/**
|
|
144
|
+
* Returns the extension of the path, including the leading dot.
|
|
145
|
+
*
|
|
146
|
+
* Behavior:
|
|
147
|
+
* - Based on the result of `basename`.
|
|
148
|
+
* - If there is no dot, returns an empty string.
|
|
149
|
+
*
|
|
150
|
+
* Examples:
|
|
151
|
+
* - extname('/a/b/c.txt') -\> '.txt'
|
|
152
|
+
* - extname('/a/b/c') -\> ''
|
|
153
|
+
*
|
|
154
|
+
* @param path - Input path.
|
|
155
|
+
* @returns The extension (e.g., ".txt") or an empty string if none.
|
|
156
156
|
*/ static extname(path) {
|
|
157
157
|
const basename = this.basename(path);
|
|
158
158
|
const lastDot = basename.lastIndexOf('.');
|
|
159
159
|
return lastDot === -1 ? '' : basename.slice(lastDot);
|
|
160
160
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Sanitizes a file or directory name by replacing or removing invalid characters.
|
|
163
|
-
*
|
|
164
|
-
* Behavior:
|
|
165
|
-
* - Removes or replaces characters that are invalid in common filesystems.
|
|
166
|
-
* - Trims leading/trailing spaces and dots.
|
|
167
|
-
* - Collapses multiple spaces into single spaces.
|
|
168
|
-
* - Replaces reserved names with safe alternatives.
|
|
169
|
-
* - Optionally limits the length of the result.
|
|
170
|
-
*
|
|
171
|
-
* Examples:
|
|
172
|
-
* - sanitizeFilename('my file.txt') -\> 'my file.txt'
|
|
173
|
-
* - sanitizeFilename('file:name*.txt') -\> 'file_name_.txt'
|
|
174
|
-
* - sanitizeFilename(' .hidden ') -\> 'hidden'
|
|
175
|
-
* - sanitizeFilename('CON') -\> '_CON'
|
|
176
|
-
* - sanitizeFilename('a'.repeat(300)) -\> (truncated to maxLength)
|
|
177
|
-
*
|
|
178
|
-
* @param filename - Input filename to sanitize.
|
|
179
|
-
* @param options - Optional configuration.
|
|
180
|
-
* @returns Sanitized filename safe for use across platforms.
|
|
161
|
+
/**
|
|
162
|
+
* Sanitizes a file or directory name by replacing or removing invalid characters.
|
|
163
|
+
*
|
|
164
|
+
* Behavior:
|
|
165
|
+
* - Removes or replaces characters that are invalid in common filesystems.
|
|
166
|
+
* - Trims leading/trailing spaces and dots.
|
|
167
|
+
* - Collapses multiple spaces into single spaces.
|
|
168
|
+
* - Replaces reserved names with safe alternatives.
|
|
169
|
+
* - Optionally limits the length of the result.
|
|
170
|
+
*
|
|
171
|
+
* Examples:
|
|
172
|
+
* - sanitizeFilename('my file.txt') -\> 'my file.txt'
|
|
173
|
+
* - sanitizeFilename('file:name*.txt') -\> 'file_name_.txt'
|
|
174
|
+
* - sanitizeFilename(' .hidden ') -\> 'hidden'
|
|
175
|
+
* - sanitizeFilename('CON') -\> '_CON'
|
|
176
|
+
* - sanitizeFilename('a'.repeat(300)) -\> (truncated to maxLength)
|
|
177
|
+
*
|
|
178
|
+
* @param filename - Input filename to sanitize.
|
|
179
|
+
* @param options - Optional configuration.
|
|
180
|
+
* @returns Sanitized filename safe for use across platforms.
|
|
181
181
|
*/ static sanitizeFilename(filename, options) {
|
|
182
182
|
const { replacement = '_', maxLength = 255, asciiOnly = false } = options ?? {};
|
|
183
183
|
const reserved = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;
|
|
@@ -218,32 +218,32 @@ const mimeTypes = {
|
|
|
218
218
|
}
|
|
219
219
|
return sanitized;
|
|
220
220
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Determines whether the path is absolute.
|
|
223
|
-
*
|
|
224
|
-
* Definition here: absolute paths start with "/".
|
|
225
|
-
*
|
|
226
|
-
* @param path - Input path.
|
|
227
|
-
* @returns True if the path starts with "/", otherwise false.
|
|
221
|
+
/**
|
|
222
|
+
* Determines whether the path is absolute.
|
|
223
|
+
*
|
|
224
|
+
* Definition here: absolute paths start with "/".
|
|
225
|
+
*
|
|
226
|
+
* @param path - Input path.
|
|
227
|
+
* @returns True if the path starts with "/", otherwise false.
|
|
228
228
|
*/ static isAbsolute(path) {
|
|
229
229
|
return path.startsWith('/');
|
|
230
230
|
}
|
|
231
|
-
/**
|
|
232
|
-
* Computes a relative path from one path to another.
|
|
233
|
-
*
|
|
234
|
-
* Behavior:
|
|
235
|
-
* - Both `from` and `to` are normalized first.
|
|
236
|
-
* - The returned path does not start with "/" (relative form).
|
|
237
|
-
* - If both resolve to the same path, returns ".".
|
|
238
|
-
*
|
|
239
|
-
* Examples:
|
|
240
|
-
* - relative('/a/b/c', '/a/d/e') -\> '../../d/e'
|
|
241
|
-
* - relative('/a/b', '/a/b/c') -\> 'c'
|
|
242
|
-
* - relative('/a/b', '/a/b') -\> '.'
|
|
243
|
-
*
|
|
244
|
-
* @param from - Base path to start from.
|
|
245
|
-
* @param to - Target path to reach.
|
|
246
|
-
* @returns Relative path from `from` to `to`.
|
|
231
|
+
/**
|
|
232
|
+
* Computes a relative path from one path to another.
|
|
233
|
+
*
|
|
234
|
+
* Behavior:
|
|
235
|
+
* - Both `from` and `to` are normalized first.
|
|
236
|
+
* - The returned path does not start with "/" (relative form).
|
|
237
|
+
* - If both resolve to the same path, returns ".".
|
|
238
|
+
*
|
|
239
|
+
* Examples:
|
|
240
|
+
* - relative('/a/b/c', '/a/d/e') -\> '../../d/e'
|
|
241
|
+
* - relative('/a/b', '/a/b/c') -\> 'c'
|
|
242
|
+
* - relative('/a/b', '/a/b') -\> '.'
|
|
243
|
+
*
|
|
244
|
+
* @param from - Base path to start from.
|
|
245
|
+
* @param to - Target path to reach.
|
|
246
|
+
* @returns Relative path from `from` to `to`.
|
|
247
247
|
*/ static relative(from, to) {
|
|
248
248
|
const fromParts = this.normalize(from).split('/').filter(Boolean);
|
|
249
249
|
const toParts = this.normalize(to).split('/').filter(Boolean);
|
|
@@ -256,37 +256,37 @@ const mimeTypes = {
|
|
|
256
256
|
return up + down || '.';
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Guesses the MIME type based on a file path or file name.
|
|
261
|
-
*
|
|
262
|
-
* Behavior:
|
|
263
|
-
* - Uses `PathUtils.extname` to extract the extension (case-insensitive).
|
|
264
|
-
* - Falls back to `application/octet-stream` if unknown.
|
|
265
|
-
*
|
|
266
|
-
* Notes:
|
|
267
|
-
* - The mapping is intentionally minimal and web-oriented.
|
|
268
|
-
* - Extend the `mimeTypes` table if you need additional types.
|
|
269
|
-
*
|
|
270
|
-
* Examples:
|
|
271
|
-
* - guessMimeType('image.png') -\> 'image/png'
|
|
272
|
-
* - guessMimeType('/a/b/model.glb') -\> 'model/gltf-binary'
|
|
273
|
-
* - guessMimeType('unknown.ext') -\> 'application/octet-stream'
|
|
274
|
-
*
|
|
275
|
-
* @param path - File path or name used to infer the MIME type.
|
|
276
|
-
* @returns The guessed MIME type string.
|
|
277
|
-
*
|
|
278
|
-
* @public
|
|
259
|
+
/**
|
|
260
|
+
* Guesses the MIME type based on a file path or file name.
|
|
261
|
+
*
|
|
262
|
+
* Behavior:
|
|
263
|
+
* - Uses `PathUtils.extname` to extract the extension (case-insensitive).
|
|
264
|
+
* - Falls back to `application/octet-stream` if unknown.
|
|
265
|
+
*
|
|
266
|
+
* Notes:
|
|
267
|
+
* - The mapping is intentionally minimal and web-oriented.
|
|
268
|
+
* - Extend the `mimeTypes` table if you need additional types.
|
|
269
|
+
*
|
|
270
|
+
* Examples:
|
|
271
|
+
* - guessMimeType('image.png') -\> 'image/png'
|
|
272
|
+
* - guessMimeType('/a/b/model.glb') -\> 'model/gltf-binary'
|
|
273
|
+
* - guessMimeType('unknown.ext') -\> 'application/octet-stream'
|
|
274
|
+
*
|
|
275
|
+
* @param path - File path or name used to infer the MIME type.
|
|
276
|
+
* @returns The guessed MIME type string.
|
|
277
|
+
*
|
|
278
|
+
* @public
|
|
279
279
|
*/ function guessMimeType(path) {
|
|
280
280
|
const ext = PathUtils.extname(path).toLowerCase();
|
|
281
281
|
return mimeTypes[ext] || 'application/octet-stream';
|
|
282
282
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Gets the MIME type based on a file extension.
|
|
285
|
-
*
|
|
286
|
-
* @param ext - File extension (e.g., "png", ".jpg").
|
|
287
|
-
* @returns The corresponding MIME type or 'application/octet-stream' if unknown.
|
|
288
|
-
*
|
|
289
|
-
* @public
|
|
283
|
+
/**
|
|
284
|
+
* Gets the MIME type based on a file extension.
|
|
285
|
+
*
|
|
286
|
+
* @param ext - File extension (e.g., "png", ".jpg").
|
|
287
|
+
* @returns The corresponding MIME type or 'application/octet-stream' if unknown.
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
290
290
|
*/ function mimeTypeOf(ext) {
|
|
291
291
|
ext = ext.toLowerCase();
|
|
292
292
|
if (!ext.startsWith('.')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sources":["../../src/vfs/common.ts"],"sourcesContent":["const mimeTypes: Record<string, string> = {\n '.txt': 'text/plain',\n '.html': 'text/html',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.ts': 'text/x-typescript',\n '.wasm': 'application/wasm',\n '.json': 'application/json',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.webp': 'image/webp',\n '.gif': 'image/gif',\n '.tga': 'image/tga',\n '.ico': 'image/x-icon',\n '.dds': 'image/x-dds',\n '.svg': 'image/svg+xml',\n '.hdr': 'image/vnd.radiance',\n '.exr': 'image/x-exr',\n '.tiff': 'image/tiff',\n '.wav': 'audio/wav',\n '.mp3': 'audio/mpeg',\n '.mp4': 'video/mp4',\n '.zip': 'application/zip',\n '.fbx': 'model/fbx',\n '.obj': 'model/obj',\n '.gltf': 'model/gltf+json',\n '.glb': 'model/gltf-binary',\n '.vrm': 'model/gltf-binary',\n '.vrma': 'model/gltf-binary',\n '.ktx': 'image/ktx',\n '.ktx2': 'image/ktx2',\n '.ttf': 'font/ttf',\n '.otf': 'font/otf',\n // zephyr3d specific\n '.zbpt': 'application/vnd.zephyr3d.blueprint+json',\n '.zmsh': 'application/vnd.zephyr3d.mesh+json',\n '.zmtl': 'application/vnd.zephyr3d.material+json',\n '.zmf': 'application/vnd.zephyr3d.blueprint.mf+json',\n '.zscn': 'application/vnd.zephyr3d.scene+json',\n '.zprefab': 'application/vnd.zephyr3d.prefab+json',\n '.zabc': 'application/vnd.zephyr3d.alembic-cache+json'\n};\n\n/**\n * Path utilities.\n *\n * Provides POSIX-like path manipulation helpers (pure string operations),\n * including normalization, joining, dirname/basename/extname extraction,\n * absolute-path detection, and relative path computation.\n *\n * Notes:\n * - Uses \"/\" as the separator (web/URL or POSIX-like paths).\n * - All methods are pure and do not touch a real filesystem.\n * - `normalize` collapses \".\", \"..\", and redundant slashes.\n *\n * @public\n */\nexport class PathUtils {\n /**\n * Normalizes a path by collapsing redundant slashes, removing \".\" segments,\n * and resolving \"..\" segments.\n *\n * Rules:\n * - Multiple consecutive \"/\" are collapsed into a single \"/\".\n * - \".\" segments are removed.\n * - \"..\" removes the previous segment (no-op at root).\n * - The result always starts with \"/\" (absolute form).\n *\n * Example:\n * - normalize('/a//b/./c/../d') -\\> '/a/b/d'\n *\n * @param path - Input path (relative or absolute).\n * @returns The normalized absolute path (always starting with \"/\").\n */\n static normalize(path: string) {\n const parts = path.split('/').filter((p) => p && p !== '.');\n const result: string[] = [];\n\n for (const part of parts) {\n if (part === '..') {\n result.pop();\n } else {\n result.push(part);\n }\n }\n\n return '/' + result.join('/');\n }\n\n /**\n * Joins multiple path segments and normalizes the result.\n *\n * Behavior:\n * - Concatenates segments with \"/\" and then runs `normalize`.\n * - The returned path is always absolute.\n *\n * Example:\n * - join('/a', 'b', '../c') -\\> '/a/c'\n *\n * @param paths - Path segments in order.\n * @returns Normalized absolute path.\n */\n static join(...paths: string[]) {\n return this.normalize(paths.join('/'));\n }\n\n /**\n * Returns the directory name (parent directory) of a path.\n *\n * Behavior:\n * - Applies `normalize` first.\n * - If the path is root \"/\" or has no parent, returns \"/\".\n *\n * Examples:\n * - dirname('/a/b/c') -\\> '/a/b'\n * - dirname('/a') -\\> '/'\n * - dirname('/') -\\> '/'\n *\n * @param path - Input path.\n * @returns Directory path of the input.\n */\n static dirname(path: string) {\n const normalized = this.normalize(path);\n const lastSlash = normalized.lastIndexOf('/');\n return lastSlash <= 0 ? '/' : normalized.slice(0, lastSlash);\n }\n\n /**\n * Returns the last portion of a path (file name).\n *\n * Behavior:\n * - Applies `normalize` first.\n * - If `ext` is provided and the name ends with it, the extension is stripped.\n *\n * Examples:\n * - basename('/a/b/c.txt') -\\> 'c.txt'\n * - basename('/a/b/c.txt', '.txt') -\\> 'c'\n * - basename('/') -\\> ''\n *\n * @param path - Input path.\n * @param ext - Optional extension to strip (exact suffix match).\n * @returns The base name of the path.\n */\n static basename(path: string, ext?: string) {\n const normalized = this.normalize(path);\n const lastSlash = normalized.lastIndexOf('/');\n let name = normalized.slice(lastSlash + 1);\n\n if (ext && name.endsWith(ext)) {\n name = name.slice(0, -ext.length);\n }\n\n return name;\n }\n\n /**\n * Returns the extension of the path, including the leading dot.\n *\n * Behavior:\n * - Based on the result of `basename`.\n * - If there is no dot, returns an empty string.\n *\n * Examples:\n * - extname('/a/b/c.txt') -\\> '.txt'\n * - extname('/a/b/c') -\\> ''\n *\n * @param path - Input path.\n * @returns The extension (e.g., \".txt\") or an empty string if none.\n */\n static extname(path: string) {\n const basename = this.basename(path);\n const lastDot = basename.lastIndexOf('.');\n return lastDot === -1 ? '' : basename.slice(lastDot);\n }\n\n /**\n * Sanitizes a file or directory name by replacing or removing invalid characters.\n *\n * Behavior:\n * - Removes or replaces characters that are invalid in common filesystems.\n * - Trims leading/trailing spaces and dots.\n * - Collapses multiple spaces into single spaces.\n * - Replaces reserved names with safe alternatives.\n * - Optionally limits the length of the result.\n *\n * Examples:\n * - sanitizeFilename('my file.txt') -\\> 'my file.txt'\n * - sanitizeFilename('file:name*.txt') -\\> 'file_name_.txt'\n * - sanitizeFilename(' .hidden ') -\\> 'hidden'\n * - sanitizeFilename('CON') -\\> '_CON'\n * - sanitizeFilename('a'.repeat(300)) -\\> (truncated to maxLength)\n *\n * @param filename - Input filename to sanitize.\n * @param options - Optional configuration.\n * @returns Sanitized filename safe for use across platforms.\n */\n static sanitizeFilename(\n filename: string,\n options?: { replacement?: string; maxLength?: number; asciiOnly?: boolean }\n ) {\n const { replacement = '_', maxLength = 255, asciiOnly = false } = options ?? {};\n const reserved = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;\n\n // Replace reserved special characters\n let sanitized = filename.replace(/[<>:\"/\\\\|?*]/g, replacement);\n // Replace control characters and optionally non-ASCII\n sanitized = Array.from(sanitized)\n .map((char) => {\n const code = char.charCodeAt(0);\n if (code <= 0x1f || code === 0x7f) {\n return replacement;\n }\n if (asciiOnly && (code < 0x20 || code > 0x7e)) {\n return replacement;\n }\n return char;\n })\n .join('');\n // Normalize whitespace and trim invalid edges\n sanitized = sanitized.replace(/\\s+/g, ' ').replace(/^[\\s.]+|[\\s.]+$/g, '');\n // Empty fallback\n if (!sanitized) {\n sanitized = 'unnamed';\n }\n // Handle reserved names (Windows)\n const baseName = sanitized.split('.')[0];\n if (reserved.test(baseName)) {\n sanitized = replacement + sanitized;\n }\n // Truncate (preserve extension if possible)\n if (sanitized.length > maxLength) {\n const dotIndex = sanitized.lastIndexOf('.');\n if (dotIndex > 0 && sanitized.length - dotIndex <= 10) {\n const ext = sanitized.slice(dotIndex);\n const base = sanitized.slice(0, maxLength - ext.length);\n sanitized = base + ext;\n } else {\n sanitized = sanitized.slice(0, maxLength);\n }\n }\n\n return sanitized;\n }\n /**\n * Determines whether the path is absolute.\n *\n * Definition here: absolute paths start with \"/\".\n *\n * @param path - Input path.\n * @returns True if the path starts with \"/\", otherwise false.\n */\n static isAbsolute(path: string) {\n return path.startsWith('/');\n }\n\n /**\n * Computes a relative path from one path to another.\n *\n * Behavior:\n * - Both `from` and `to` are normalized first.\n * - The returned path does not start with \"/\" (relative form).\n * - If both resolve to the same path, returns \".\".\n *\n * Examples:\n * - relative('/a/b/c', '/a/d/e') -\\> '../../d/e'\n * - relative('/a/b', '/a/b/c') -\\> 'c'\n * - relative('/a/b', '/a/b') -\\> '.'\n *\n * @param from - Base path to start from.\n * @param to - Target path to reach.\n * @returns Relative path from `from` to `to`.\n */\n static relative(from: string, to: string) {\n const fromParts = this.normalize(from).split('/').filter(Boolean);\n const toParts = this.normalize(to).split('/').filter(Boolean);\n\n let i = 0;\n while (i < fromParts.length && i < toParts.length && fromParts[i] === toParts[i]) {\n i++;\n }\n\n const up = '../'.repeat(fromParts.length - i);\n const down = toParts.slice(i).join('/');\n\n return up + down || '.';\n }\n}\n\n/**\n * Guesses the MIME type based on a file path or file name.\n *\n * Behavior:\n * - Uses `PathUtils.extname` to extract the extension (case-insensitive).\n * - Falls back to `application/octet-stream` if unknown.\n *\n * Notes:\n * - The mapping is intentionally minimal and web-oriented.\n * - Extend the `mimeTypes` table if you need additional types.\n *\n * Examples:\n * - guessMimeType('image.png') -\\> 'image/png'\n * - guessMimeType('/a/b/model.glb') -\\> 'model/gltf-binary'\n * - guessMimeType('unknown.ext') -\\> 'application/octet-stream'\n *\n * @param path - File path or name used to infer the MIME type.\n * @returns The guessed MIME type string.\n *\n * @public\n */\nexport function guessMimeType(path: string) {\n const ext = PathUtils.extname(path).toLowerCase();\n return mimeTypes[ext] || 'application/octet-stream';\n}\n\n/**\n * Gets the MIME type based on a file extension.\n *\n * @param ext - File extension (e.g., \"png\", \".jpg\").\n * @returns The corresponding MIME type or 'application/octet-stream' if unknown.\n *\n * @public\n */\nexport function mimeTypeOf(ext: string) {\n ext = ext.toLowerCase();\n if (!ext.startsWith('.')) {\n ext = '.' + ext;\n }\n return mimeTypes[ext] || 'application/octet-stream';\n}\n"],"names":["mimeTypes","PathUtils","normalize","path","parts","split","filter","p","result","part","pop","push","join","paths","dirname","normalized","lastSlash","lastIndexOf","slice","basename","ext","name","endsWith","length","extname","lastDot","sanitizeFilename","filename","options","replacement","maxLength","asciiOnly","reserved","sanitized","replace","Array","from","map","char","code","charCodeAt","baseName","test","dotIndex","base","isAbsolute","startsWith","relative","to","fromParts","Boolean","toParts","i","up","repeat","down","guessMimeType","toLowerCase","mimeTypeOf"],"mappings":"AAAA,MAAMA,SAAoC,GAAA;IACxC,MAAQ,EAAA,YAAA;IACR,OAAS,EAAA,WAAA;IACT,KAAO,EAAA,iBAAA;IACP,MAAQ,EAAA,iBAAA;IACR,KAAO,EAAA,mBAAA;IACP,OAAS,EAAA,kBAAA;IACT,OAAS,EAAA,kBAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,YAAA;IACR,OAAS,EAAA,YAAA;IACT,OAAS,EAAA,YAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,cAAA;IACR,MAAQ,EAAA,aAAA;IACR,MAAQ,EAAA,eAAA;IACR,MAAQ,EAAA,oBAAA;IACR,MAAQ,EAAA,aAAA;IACR,OAAS,EAAA,YAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,YAAA;IACR,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,iBAAA;IACR,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,WAAA;IACR,OAAS,EAAA,iBAAA;IACT,MAAQ,EAAA,mBAAA;IACR,MAAQ,EAAA,mBAAA;IACR,OAAS,EAAA,mBAAA;IACT,MAAQ,EAAA,WAAA;IACR,OAAS,EAAA,YAAA;IACT,MAAQ,EAAA,UAAA;IACR,MAAQ,EAAA,UAAA;;IAER,OAAS,EAAA,yCAAA;IACT,OAAS,EAAA,oCAAA;IACT,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A,IAAIqC,WAAW,EAAA;AACrB,IAAA,IAAI,CAACrC,GAAAA,CAAI0B,UAAU,CAAC,GAAM,CAAA,EAAA;AACxB1B,QAAAA,GAAAA,GAAM,GAAMA,GAAAA,GAAAA;AACd;IACA,OAAOpB,SAAS,CAACoB,GAAAA,CAAI,IAAI,0BAAA;AAC3B;;;;"}
|
|
1
|
+
{"version":3,"file":"common.js","sources":["../../src/vfs/common.ts"],"sourcesContent":["const mimeTypes: Record<string, string> = {\r\n '.txt': 'text/plain',\r\n '.html': 'text/html',\r\n '.js': 'text/javascript',\r\n '.mjs': 'text/javascript',\r\n '.ts': 'text/x-typescript',\r\n '.wasm': 'application/wasm',\r\n '.json': 'application/json',\r\n '.png': 'image/png',\r\n '.jpg': 'image/jpeg',\r\n '.jpeg': 'image/jpeg',\r\n '.webp': 'image/webp',\r\n '.gif': 'image/gif',\r\n '.tga': 'image/tga',\r\n '.ico': 'image/x-icon',\r\n '.dds': 'image/x-dds',\r\n '.svg': 'image/svg+xml',\r\n '.hdr': 'image/vnd.radiance',\r\n '.exr': 'image/x-exr',\r\n '.tiff': 'image/tiff',\r\n '.wav': 'audio/wav',\r\n '.mp3': 'audio/mpeg',\r\n '.mp4': 'video/mp4',\r\n '.zip': 'application/zip',\r\n '.fbx': 'model/fbx',\r\n '.obj': 'model/obj',\r\n '.gltf': 'model/gltf+json',\r\n '.glb': 'model/gltf-binary',\r\n '.vrm': 'model/gltf-binary',\r\n '.vrma': 'model/gltf-binary',\r\n '.ktx': 'image/ktx',\r\n '.ktx2': 'image/ktx2',\r\n '.ttf': 'font/ttf',\r\n '.otf': 'font/otf',\r\n // zephyr3d specific\r\n '.zbpt': 'application/vnd.zephyr3d.blueprint+json',\r\n '.zmsh': 'application/vnd.zephyr3d.mesh+json',\r\n '.zmtl': 'application/vnd.zephyr3d.material+json',\r\n '.zmf': 'application/vnd.zephyr3d.blueprint.mf+json',\r\n '.zscn': 'application/vnd.zephyr3d.scene+json',\r\n '.zprefab': 'application/vnd.zephyr3d.prefab+json',\r\n '.zabc': 'application/vnd.zephyr3d.alembic-cache+json'\r\n};\r\n\r\n/**\r\n * Path utilities.\r\n *\r\n * Provides POSIX-like path manipulation helpers (pure string operations),\r\n * including normalization, joining, dirname/basename/extname extraction,\r\n * absolute-path detection, and relative path computation.\r\n *\r\n * Notes:\r\n * - Uses \"/\" as the separator (web/URL or POSIX-like paths).\r\n * - All methods are pure and do not touch a real filesystem.\r\n * - `normalize` collapses \".\", \"..\", and redundant slashes.\r\n *\r\n * @public\r\n */\r\nexport class PathUtils {\r\n /**\r\n * Normalizes a path by collapsing redundant slashes, removing \".\" segments,\r\n * and resolving \"..\" segments.\r\n *\r\n * Rules:\r\n * - Multiple consecutive \"/\" are collapsed into a single \"/\".\r\n * - \".\" segments are removed.\r\n * - \"..\" removes the previous segment (no-op at root).\r\n * - The result always starts with \"/\" (absolute form).\r\n *\r\n * Example:\r\n * - normalize('/a//b/./c/../d') -\\> '/a/b/d'\r\n *\r\n * @param path - Input path (relative or absolute).\r\n * @returns The normalized absolute path (always starting with \"/\").\r\n */\r\n static normalize(path: string) {\r\n const parts = path.split('/').filter((p) => p && p !== '.');\r\n const result: string[] = [];\r\n\r\n for (const part of parts) {\r\n if (part === '..') {\r\n result.pop();\r\n } else {\r\n result.push(part);\r\n }\r\n }\r\n\r\n return '/' + result.join('/');\r\n }\r\n\r\n /**\r\n * Joins multiple path segments and normalizes the result.\r\n *\r\n * Behavior:\r\n * - Concatenates segments with \"/\" and then runs `normalize`.\r\n * - The returned path is always absolute.\r\n *\r\n * Example:\r\n * - join('/a', 'b', '../c') -\\> '/a/c'\r\n *\r\n * @param paths - Path segments in order.\r\n * @returns Normalized absolute path.\r\n */\r\n static join(...paths: string[]) {\r\n return this.normalize(paths.join('/'));\r\n }\r\n\r\n /**\r\n * Returns the directory name (parent directory) of a path.\r\n *\r\n * Behavior:\r\n * - Applies `normalize` first.\r\n * - If the path is root \"/\" or has no parent, returns \"/\".\r\n *\r\n * Examples:\r\n * - dirname('/a/b/c') -\\> '/a/b'\r\n * - dirname('/a') -\\> '/'\r\n * - dirname('/') -\\> '/'\r\n *\r\n * @param path - Input path.\r\n * @returns Directory path of the input.\r\n */\r\n static dirname(path: string) {\r\n const normalized = this.normalize(path);\r\n const lastSlash = normalized.lastIndexOf('/');\r\n return lastSlash <= 0 ? '/' : normalized.slice(0, lastSlash);\r\n }\r\n\r\n /**\r\n * Returns the last portion of a path (file name).\r\n *\r\n * Behavior:\r\n * - Applies `normalize` first.\r\n * - If `ext` is provided and the name ends with it, the extension is stripped.\r\n *\r\n * Examples:\r\n * - basename('/a/b/c.txt') -\\> 'c.txt'\r\n * - basename('/a/b/c.txt', '.txt') -\\> 'c'\r\n * - basename('/') -\\> ''\r\n *\r\n * @param path - Input path.\r\n * @param ext - Optional extension to strip (exact suffix match).\r\n * @returns The base name of the path.\r\n */\r\n static basename(path: string, ext?: string) {\r\n const normalized = this.normalize(path);\r\n const lastSlash = normalized.lastIndexOf('/');\r\n let name = normalized.slice(lastSlash + 1);\r\n\r\n if (ext && name.endsWith(ext)) {\r\n name = name.slice(0, -ext.length);\r\n }\r\n\r\n return name;\r\n }\r\n\r\n /**\r\n * Returns the extension of the path, including the leading dot.\r\n *\r\n * Behavior:\r\n * - Based on the result of `basename`.\r\n * - If there is no dot, returns an empty string.\r\n *\r\n * Examples:\r\n * - extname('/a/b/c.txt') -\\> '.txt'\r\n * - extname('/a/b/c') -\\> ''\r\n *\r\n * @param path - Input path.\r\n * @returns The extension (e.g., \".txt\") or an empty string if none.\r\n */\r\n static extname(path: string) {\r\n const basename = this.basename(path);\r\n const lastDot = basename.lastIndexOf('.');\r\n return lastDot === -1 ? '' : basename.slice(lastDot);\r\n }\r\n\r\n /**\r\n * Sanitizes a file or directory name by replacing or removing invalid characters.\r\n *\r\n * Behavior:\r\n * - Removes or replaces characters that are invalid in common filesystems.\r\n * - Trims leading/trailing spaces and dots.\r\n * - Collapses multiple spaces into single spaces.\r\n * - Replaces reserved names with safe alternatives.\r\n * - Optionally limits the length of the result.\r\n *\r\n * Examples:\r\n * - sanitizeFilename('my file.txt') -\\> 'my file.txt'\r\n * - sanitizeFilename('file:name*.txt') -\\> 'file_name_.txt'\r\n * - sanitizeFilename(' .hidden ') -\\> 'hidden'\r\n * - sanitizeFilename('CON') -\\> '_CON'\r\n * - sanitizeFilename('a'.repeat(300)) -\\> (truncated to maxLength)\r\n *\r\n * @param filename - Input filename to sanitize.\r\n * @param options - Optional configuration.\r\n * @returns Sanitized filename safe for use across platforms.\r\n */\r\n static sanitizeFilename(\r\n filename: string,\r\n options?: { replacement?: string; maxLength?: number; asciiOnly?: boolean }\r\n ) {\r\n const { replacement = '_', maxLength = 255, asciiOnly = false } = options ?? {};\r\n const reserved = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;\r\n\r\n // Replace reserved special characters\r\n let sanitized = filename.replace(/[<>:\"/\\\\|?*]/g, replacement);\r\n // Replace control characters and optionally non-ASCII\r\n sanitized = Array.from(sanitized)\r\n .map((char) => {\r\n const code = char.charCodeAt(0);\r\n if (code <= 0x1f || code === 0x7f) {\r\n return replacement;\r\n }\r\n if (asciiOnly && (code < 0x20 || code > 0x7e)) {\r\n return replacement;\r\n }\r\n return char;\r\n })\r\n .join('');\r\n // Normalize whitespace and trim invalid edges\r\n sanitized = sanitized.replace(/\\s+/g, ' ').replace(/^[\\s.]+|[\\s.]+$/g, '');\r\n // Empty fallback\r\n if (!sanitized) {\r\n sanitized = 'unnamed';\r\n }\r\n // Handle reserved names (Windows)\r\n const baseName = sanitized.split('.')[0];\r\n if (reserved.test(baseName)) {\r\n sanitized = replacement + sanitized;\r\n }\r\n // Truncate (preserve extension if possible)\r\n if (sanitized.length > maxLength) {\r\n const dotIndex = sanitized.lastIndexOf('.');\r\n if (dotIndex > 0 && sanitized.length - dotIndex <= 10) {\r\n const ext = sanitized.slice(dotIndex);\r\n const base = sanitized.slice(0, maxLength - ext.length);\r\n sanitized = base + ext;\r\n } else {\r\n sanitized = sanitized.slice(0, maxLength);\r\n }\r\n }\r\n\r\n return sanitized;\r\n }\r\n /**\r\n * Determines whether the path is absolute.\r\n *\r\n * Definition here: absolute paths start with \"/\".\r\n *\r\n * @param path - Input path.\r\n * @returns True if the path starts with \"/\", otherwise false.\r\n */\r\n static isAbsolute(path: string) {\r\n return path.startsWith('/');\r\n }\r\n\r\n /**\r\n * Computes a relative path from one path to another.\r\n *\r\n * Behavior:\r\n * - Both `from` and `to` are normalized first.\r\n * - The returned path does not start with \"/\" (relative form).\r\n * - If both resolve to the same path, returns \".\".\r\n *\r\n * Examples:\r\n * - relative('/a/b/c', '/a/d/e') -\\> '../../d/e'\r\n * - relative('/a/b', '/a/b/c') -\\> 'c'\r\n * - relative('/a/b', '/a/b') -\\> '.'\r\n *\r\n * @param from - Base path to start from.\r\n * @param to - Target path to reach.\r\n * @returns Relative path from `from` to `to`.\r\n */\r\n static relative(from: string, to: string) {\r\n const fromParts = this.normalize(from).split('/').filter(Boolean);\r\n const toParts = this.normalize(to).split('/').filter(Boolean);\r\n\r\n let i = 0;\r\n while (i < fromParts.length && i < toParts.length && fromParts[i] === toParts[i]) {\r\n i++;\r\n }\r\n\r\n const up = '../'.repeat(fromParts.length - i);\r\n const down = toParts.slice(i).join('/');\r\n\r\n return up + down || '.';\r\n }\r\n}\r\n\r\n/**\r\n * Guesses the MIME type based on a file path or file name.\r\n *\r\n * Behavior:\r\n * - Uses `PathUtils.extname` to extract the extension (case-insensitive).\r\n * - Falls back to `application/octet-stream` if unknown.\r\n *\r\n * Notes:\r\n * - The mapping is intentionally minimal and web-oriented.\r\n * - Extend the `mimeTypes` table if you need additional types.\r\n *\r\n * Examples:\r\n * - guessMimeType('image.png') -\\> 'image/png'\r\n * - guessMimeType('/a/b/model.glb') -\\> 'model/gltf-binary'\r\n * - guessMimeType('unknown.ext') -\\> 'application/octet-stream'\r\n *\r\n * @param path - File path or name used to infer the MIME type.\r\n * @returns The guessed MIME type string.\r\n *\r\n * @public\r\n */\r\nexport function guessMimeType(path: string) {\r\n const ext = PathUtils.extname(path).toLowerCase();\r\n return mimeTypes[ext] || 'application/octet-stream';\r\n}\r\n\r\n/**\r\n * Gets the MIME type based on a file extension.\r\n *\r\n * @param ext - File extension (e.g., \"png\", \".jpg\").\r\n * @returns The corresponding MIME type or 'application/octet-stream' if unknown.\r\n *\r\n * @public\r\n */\r\nexport function mimeTypeOf(ext: string) {\r\n ext = ext.toLowerCase();\r\n if (!ext.startsWith('.')) {\r\n ext = '.' + ext;\r\n }\r\n return mimeTypes[ext] || 'application/octet-stream';\r\n}\r\n"],"names":["mimeTypes","PathUtils","normalize","path","parts","split","filter","p","result","part","pop","push","join","paths","dirname","normalized","lastSlash","lastIndexOf","slice","basename","ext","name","endsWith","length","extname","lastDot","sanitizeFilename","filename","options","replacement","maxLength","asciiOnly","reserved","sanitized","replace","Array","from","map","char","code","charCodeAt","baseName","test","dotIndex","base","isAbsolute","startsWith","relative","to","fromParts","Boolean","toParts","i","up","repeat","down","guessMimeType","toLowerCase","mimeTypeOf"],"mappings":"AAAA,MAAMA,SAAoC,GAAA;IACxC,MAAQ,EAAA,YAAA;IACR,OAAS,EAAA,WAAA;IACT,KAAO,EAAA,iBAAA;IACP,MAAQ,EAAA,iBAAA;IACR,KAAO,EAAA,mBAAA;IACP,OAAS,EAAA,kBAAA;IACT,OAAS,EAAA,kBAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,YAAA;IACR,OAAS,EAAA,YAAA;IACT,OAAS,EAAA,YAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,cAAA;IACR,MAAQ,EAAA,aAAA;IACR,MAAQ,EAAA,eAAA;IACR,MAAQ,EAAA,oBAAA;IACR,MAAQ,EAAA,aAAA;IACR,OAAS,EAAA,YAAA;IACT,MAAQ,EAAA,WAAA;IACR,MAAQ,EAAA,YAAA;IACR,MAAQ,EAAA,WAAA;IACR,MAAQ,E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ACtB;AACF;AAEA;;;;;;;;;;;;;;;;;;;;IAqBO,SAASC,aAAAA,CAAcrD,IAAY,EAAA;AACxC,IAAA,MAAMiB,GAAMnB,GAAAA,SAAAA,CAAUuB,OAAO,CAACrB,MAAMsD,WAAW,EAAA;IAC/C,OAAOzD,SAAS,CAACoB,GAAAA,CAAI,IAAI,0BAAA;AAC3B;AAEA;;;;;;;IAQO,SAASsC,UAAAA,CAAWtC,GAAW,EAAA;AACpCA,IAAAA,GAAAA,GAAMA,IAAIqC,WAAW,EAAA;AACrB,IAAA,IAAI,CAACrC,GAAAA,CAAI0B,UAAU,CAAC,GAAM,CAAA,EAAA;AACxB1B,QAAAA,GAAAA,GAAM,GAAMA,GAAAA,GAAAA;AACd;IACA,OAAOpB,SAAS,CAACoB,GAAAA,CAAI,IAAI,0BAAA;AAC3B;;;;"}
|
|
@@ -4420,6 +4420,13 @@ declare namespace imgui {
|
|
|
4420
4420
|
export { IM_ARRAYSIZE as ARRAYSIZE, imgui_ASSERT as ASSERT, imgui_AcceptDragDropPayload as AcceptDragDropPayload, type ImAccess as Access, imgui_AlignTextToFramePadding as AlignTextToFramePadding, imgui_ArrowButton as ArrowButton, ImGuiBackendFlags as BackendFlags, imgui_Begin as Begin, imgui_BeginChild as BeginChild, imgui_BeginChildFrame as BeginChildFrame, imgui_BeginCombo as BeginCombo, imgui_BeginDragDropSource as BeginDragDropSource, imgui_BeginDragDropTarget as BeginDragDropTarget, imgui_BeginGroup as BeginGroup, imgui_BeginMainMenuBar as BeginMainMenuBar, imgui_BeginMenu as BeginMenu, imgui_BeginMenuBar as BeginMenuBar, imgui_BeginPopup as BeginPopup, imgui_BeginPopupContextItem as BeginPopupContextItem, imgui_BeginPopupContextVoid as BeginPopupContextVoid, imgui_BeginPopupContextWindow as BeginPopupContextWindow, imgui_BeginPopupModal as BeginPopupModal, imgui_BeginSection as BeginSection, imgui_BeginStatusBar as BeginStatusBar, imgui_BeginTabBar as BeginTabBar, imgui_BeginTabItem as BeginTabItem, imgui_BeginTable as BeginTable, imgui_BeginTooltip as BeginTooltip, imgui_Bullet as Bullet, imgui_BulletText as BulletText, imgui_Button as Button, ImGuiButtonFlags as ButtonFlags, IMGUI_CHECKVERSION as CHECKVERSION, IM_COL32 as COL32, IM_COL32_BLACK as COL32_BLACK, IM_COL32_BLACK_TRANS as COL32_BLACK_TRANS, IM_COL32_WHITE as COL32_WHITE, imgui_CalcItemWidth as CalcItemWidth, imgui_CalcListClipping as CalcListClipping, imgui_CalcTextSize as CalcTextSize, imgui_CaptureKeyboardFromApp as CaptureKeyboardFromApp, imgui_CaptureMouseFromApp as CaptureMouseFromApp, imgui_Checkbox as Checkbox, imgui_CheckboxFlags as CheckboxFlags, imgui_CloseCurrentPopup as CloseCurrentPopup, ImGuiCol as Col, imgui_CollapsingHeader as CollapsingHeader, ImColor as Color, imgui_ColorButton as ColorButton, imgui_ColorConvertFloat4ToU32 as ColorConvertFloat4ToU32, imgui_ColorConvertHSVtoRGB as ColorConvertHSVtoRGB, imgui_ColorConvertRGBtoHSV as ColorConvertRGBtoHSV, imgui_ColorConvertU32ToFloat4 as ColorConvertU32ToFloat4, imgui_ColorEdit3 as ColorEdit3, imgui_ColorEdit4 as ColorEdit4, ImGuiColorEditFlags as ColorEditFlags, imgui_ColorPicker3 as ColorPicker3, imgui_ColorPicker4 as ColorPicker4, imgui_Columns as Columns, imgui_Combo as Combo, ImGuiComboFlags as ComboFlags, type imgui_ComboValueGetter as ComboValueGetter, ImGuiCond as Cond, ImGuiConfigFlags as ConfigFlags, imgui_CreateContext as CreateContext, imgui_CreateFont as CreateFont, type imgui_DOMFontConfig as DOMFontConfig, ImGuiDataType as DataType, imgui_DebugCheckVersionAndDataLayout as DebugCheckVersionAndDataLayout, imgui_DestroyContext as DestroyContext, ImGuiDir as Dir, ImGuiDragDropFlags as DragDropFlags, imgui_DragFloat as DragFloat, imgui_DragFloat2 as DragFloat2, imgui_DragFloat3 as DragFloat3, imgui_DragFloat4 as DragFloat4, imgui_DragFloatRange2 as DragFloatRange2, imgui_DragInt as DragInt, imgui_DragInt2 as DragInt2, imgui_DragInt3 as DragInt3, imgui_DragInt4 as DragInt4, imgui_DragIntRange2 as DragIntRange2, imgui_DragScalar as DragScalar, ImDrawCmd as DrawCmd, ImDrawCornerFlags as DrawCornerFlags, ImDrawData as DrawData, type ImDrawIdx as DrawIdx, ImDrawIdxSize as DrawIdxSize, ImDrawList as DrawList, ImDrawVert as DrawVert, ImDrawVertColOffset as DrawVertColOffset, ImDrawVertPosOffset as DrawVertPosOffset, ImDrawVertSize as DrawVertSize, ImDrawVertUVOffset as DrawVertUVOffset, imgui_Dummy as Dummy, imgui_End as End, imgui_EndChild as EndChild, imgui_EndChildFrame as EndChildFrame, imgui_EndCombo as EndCombo, imgui_EndDragDropSource as EndDragDropSource, imgui_EndDragDropTarget as EndDragDropTarget, imgui_EndFrame as EndFrame, imgui_EndGroup as EndGroup, imgui_EndMainMenuBar as EndMainMenuBar, imgui_EndMenu as EndMenu, imgui_EndMenuBar as EndMenuBar, imgui_EndPopup as EndPopup, imgui_EndSection as EndSection, imgui_EndStatusBar as EndStatusBar, imgui_EndTabBar as EndTabBar, imgui_EndTabItem as EndTabItem, imgui_EndTable as EndTable, imgui_EndTooltip as EndTooltip, imgui_FLT_MAX as FLT_MAX, imgui_FLT_MIN as FLT_MIN, ImGuiFocusedFlags as FocusedFlags, ImFont as Font, ImFontAtlas as FontAtlas, ImFontAtlasFlags as FontAtlasFlags, ImFontConfig as FontConfig, ImFontGlyph as FontGlyph, imgui_Font_toString as Font_toString, imgui_GetActiveId as GetActiveId, imgui_GetActiveIdPreviousFrame as GetActiveIdPreviousFrame, imgui_GetActiveWindow as GetActiveWindow, imgui_GetBackgroundDrawList as GetBackgroundDrawList, imgui_GetClipboardText as GetClipboardText, imgui_GetColorU32 as GetColorU32, imgui_GetColumnIndex as GetColumnIndex, imgui_GetColumnOffset as GetColumnOffset, imgui_GetColumnWidth as GetColumnWidth, imgui_GetColumnsCount as GetColumnsCount, imgui_GetContentRegionAvail as GetContentRegionAvail, imgui_GetContentRegionMax as GetContentRegionMax, imgui_GetCurrentContext as GetCurrentContext, imgui_GetCurrentWindow as GetCurrentWindow, imgui_GetCursorPos as GetCursorPos, imgui_GetCursorPosX as GetCursorPosX, imgui_GetCursorPosY as GetCursorPosY, imgui_GetCursorScreenPos as GetCursorScreenPos, imgui_GetCursorStartPos as GetCursorStartPos, imgui_GetDragDropPayload as GetDragDropPayload, imgui_GetDrawData as GetDrawData, imgui_GetDrawListSharedData as GetDrawListSharedData, imgui_GetFont as GetFont, imgui_GetFontSize as GetFontSize, imgui_GetFontTexUvWhitePixel as GetFontTexUvWhitePixel, imgui_GetForegroundDrawList as GetForegroundDrawList, imgui_GetFrameCount as GetFrameCount, imgui_GetFrameHeight as GetFrameHeight, imgui_GetFrameHeightWithSpacing as GetFrameHeightWithSpacing, imgui_GetHoveredId as GetHoveredId, imgui_GetHoveredIdPreviousFrame as GetHoveredIdPreviousFrame, imgui_GetHoveredRootWindow as GetHoveredRootWindow, imgui_GetHoveredWindow as GetHoveredWindow, imgui_GetID as GetID, imgui_GetIO as GetIO, imgui_GetInputTextId as GetInputTextId, imgui_GetInputTextState as GetInputTextState, imgui_GetItemRectMax as GetItemRectMax, imgui_GetItemRectMin as GetItemRectMin, imgui_GetItemRectSize as GetItemRectSize, imgui_GetKeyIndex as GetKeyIndex, imgui_GetKeyPressedAmount as GetKeyPressedAmount, imgui_GetMouseCursor as GetMouseCursor, imgui_GetMouseDragDelta as GetMouseDragDelta, imgui_GetMousePos as GetMousePos, imgui_GetMousePosOnOpeningCurrentPopup as GetMousePosOnOpeningCurrentPopup, imgui_GetScrollMaxX as GetScrollMaxX, imgui_GetScrollMaxY as GetScrollMaxY, imgui_GetScrollX as GetScrollX, imgui_GetScrollY as GetScrollY, imgui_GetStyle as GetStyle, imgui_GetStyleColorName as GetStyleColorName, imgui_GetStyleColorVec4 as GetStyleColorVec4, imgui_GetTextLineHeight as GetTextLineHeight, imgui_GetTextLineHeightWithSpacing as GetTextLineHeightWithSpacing, imgui_GetTime as GetTime, imgui_GetTreeNodeToLabelSpacing as GetTreeNodeToLabelSpacing, imgui_GetVersion as GetVersion, imgui_GetWindowContentRegionMax as GetWindowContentRegionMax, imgui_GetWindowContentRegionMin as GetWindowContentRegionMin, imgui_GetWindowContentRegionWidth as GetWindowContentRegionWidth, imgui_GetWindowDrawList as GetWindowDrawList, imgui_GetWindowHeight as GetWindowHeight, imgui_GetWindowPos as GetWindowPos, imgui_GetWindowSize as GetWindowSize, imgui_GetWindowWidth as GetWindowWidth, ImGuiHoveredFlags as HoveredFlags, type ImGuiID as ID, imgui_IMGUI_CHECKVERSION as IMGUI_CHECKVERSION, imgui_IMGUI_HAS_TABLE as IMGUI_HAS_TABLE, imgui_IMGUI_PAYLOAD_TYPE_COLOR_3F as IMGUI_PAYLOAD_TYPE_COLOR_3F, imgui_IMGUI_PAYLOAD_TYPE_COLOR_4F as IMGUI_PAYLOAD_TYPE_COLOR_4F, imgui_IMGUI_VERSION as IMGUI_VERSION, imgui_IMGUI_VERSION_NUM as IMGUI_VERSION_NUM, imgui_IM_ARRAYSIZE as IM_ARRAYSIZE, imgui_IM_ASSERT as IM_ASSERT, imgui_IM_COL32 as IM_COL32, imgui_IM_COL32_A_MASK as IM_COL32_A_MASK, imgui_IM_COL32_A_SHIFT as IM_COL32_A_SHIFT, imgui_IM_COL32_BLACK as IM_COL32_BLACK, imgui_IM_COL32_BLACK_TRANS as IM_COL32_BLACK_TRANS, imgui_IM_COL32_B_SHIFT as IM_COL32_B_SHIFT, imgui_IM_COL32_G_SHIFT as IM_COL32_G_SHIFT, imgui_IM_COL32_R_SHIFT as IM_COL32_R_SHIFT, imgui_IM_COL32_WHITE as IM_COL32_WHITE, imgui_IM_DRAWLIST_TEX_LINES_WIDTH_MAX as IM_DRAWLIST_TEX_LINES_WIDTH_MAX, imgui_IM_UNICODE_CODEPOINT_MAX as IM_UNICODE_CODEPOINT_MAX, ImGuiIO as IO, type imgui_ImAccess as ImAccess, imgui_ImColor as ImColor, type imgui_ImDrawCallback as ImDrawCallback, imgui_ImDrawCallback_ResetRenderState as ImDrawCallback_ResetRenderState, imgui_ImDrawChannel as ImDrawChannel, imgui_ImDrawCmd as ImDrawCmd, imgui_ImDrawCmdHeader as ImDrawCmdHeader, imgui_ImDrawCornerFlags as ImDrawCornerFlags, imgui_ImDrawData as ImDrawData, type imgui_ImDrawIdx as ImDrawIdx, imgui_ImDrawIdxSize as ImDrawIdxSize, imgui_ImDrawList as ImDrawList, imgui_ImDrawListFlags as ImDrawListFlags, imgui_ImDrawListSharedData as ImDrawListSharedData, imgui_ImDrawVert as ImDrawVert, imgui_ImDrawVertColOffset as ImDrawVertColOffset, imgui_ImDrawVertPosOffset as ImDrawVertPosOffset, imgui_ImDrawVertSize as ImDrawVertSize, imgui_ImDrawVertUVOffset as ImDrawVertUVOffset, imgui_ImFont as ImFont, imgui_ImFontAtlas as ImFontAtlas, imgui_ImFontAtlasCustomRect as ImFontAtlasCustomRect, imgui_ImFontAtlasFlags as ImFontAtlasFlags, imgui_ImFontConfig as ImFontConfig, imgui_ImFontGlyph as ImFontGlyph, imgui_ImGuiBackendFlags as ImGuiBackendFlags, imgui_ImGuiButtonFlags as ImGuiButtonFlags, imgui_ImGuiCol as ImGuiCol, imgui_ImGuiColorEditFlags as ImGuiColorEditFlags, imgui_ImGuiComboFlags as ImGuiComboFlags, imgui_ImGuiCond as ImGuiCond, imgui_ImGuiConfigFlags as ImGuiConfigFlags, imgui_ImGuiContext as ImGuiContext, imgui_ImGuiDataType as ImGuiDataType, imgui_ImGuiDir as ImGuiDir, imgui_ImGuiDragDropFlags as ImGuiDragDropFlags, imgui_ImGuiFocusedFlags as ImGuiFocusedFlags, imgui_ImGuiHoveredFlags as ImGuiHoveredFlags, type imgui_ImGuiID as ImGuiID, imgui_ImGuiIO as ImGuiIO, type imgui_ImGuiInputTextCallback as ImGuiInputTextCallback, imgui_ImGuiInputTextCallbackData as ImGuiInputTextCallbackData, imgui_ImGuiInputTextDefaultSize as ImGuiInputTextDefaultSize, imgui_ImGuiInputTextFlags as ImGuiInputTextFlags, imgui_ImGuiInputTextState as ImGuiInputTextState, imgui_ImGuiKey as ImGuiKey, imgui_ImGuiKeyModFlags as ImGuiKeyModFlags, imgui_ImGuiListClipper as ImGuiListClipper, imgui_ImGuiMouseButton as ImGuiMouseButton, imgui_ImGuiMouseCursor as ImGuiMouseCursor, imgui_ImGuiNavInput as ImGuiNavInput, type imgui_ImGuiPayload as ImGuiPayload, imgui_ImGuiPopupFlags as ImGuiPopupFlags, imgui_ImGuiSelectableFlags as ImGuiSelectableFlags, type imgui_ImGuiSizeCallback as ImGuiSizeCallback, imgui_ImGuiSizeCallbackData as ImGuiSizeCallbackData, imgui_ImGuiSliderFlags as ImGuiSliderFlags, imgui_ImGuiSortDirection as ImGuiSortDirection, imgui_ImGuiStorage as ImGuiStorage, imgui_ImGuiStyle as ImGuiStyle, imgui_ImGuiStyleVar as ImGuiStyleVar, imgui_ImGuiTabBarFlags as ImGuiTabBarFlags, imgui_ImGuiTabItemFlags as ImGuiTabItemFlags, imgui_ImGuiTableBgTarget as ImGuiTableBgTarget, imgui_ImGuiTableColumnFlags as ImGuiTableColumnFlags, imgui_ImGuiTableColumnSortSpecs as ImGuiTableColumnSortSpecs, imgui_ImGuiTableFlags as ImGuiTableFlags, imgui_ImGuiTableRowFlags as ImGuiTableRowFlags, imgui_ImGuiTableSortSpecs as ImGuiTableSortSpecs, imgui_ImGuiTextBuffer as ImGuiTextBuffer, imgui_ImGuiTextFilter as ImGuiTextFilter, imgui_ImGuiTreeNodeFlags as ImGuiTreeNodeFlags, imgui_ImGuiWindow as ImGuiWindow, imgui_ImGuiWindowFlags as ImGuiWindowFlags, type imgui_ImScalar as ImScalar, imgui_ImStringBuffer as ImStringBuffer, type imgui_ImTextureID as ImTextureID, type imgui_ImTuple2 as ImTuple2, type imgui_ImTuple3 as ImTuple3, type imgui_ImTuple4 as ImTuple4, type imgui_ImU32 as ImU32, imgui_ImVec2 as ImVec2, imgui_ImVec4 as ImVec4, imgui_ImVector as ImVector, imgui_Image as Image, imgui_ImageButton as ImageButton, imgui_Indent as Indent, imgui_InputDouble as InputDouble, imgui_InputFloat as InputFloat, imgui_InputFloat2 as InputFloat2, imgui_InputFloat3 as InputFloat3, imgui_InputFloat4 as InputFloat4, imgui_InputInt as InputInt, imgui_InputInt2 as InputInt2, imgui_InputInt3 as InputInt3, imgui_InputInt4 as InputInt4, imgui_InputScalar as InputScalar, imgui_InputText as InputText, type ImGuiInputTextCallback as InputTextCallback, ImGuiInputTextCallbackData as InputTextCallbackData, ImGuiInputTextDefaultSize as InputTextDefaultSize, ImGuiInputTextFlags as InputTextFlags, imgui_InputTextMultiline as InputTextMultiline, ImGuiInputTextState as InputTextState, imgui_InputTextWithHint as InputTextWithHint, imgui_InvisibleButton as InvisibleButton, imgui_IsAnyItemActive as IsAnyItemActive, imgui_IsAnyItemFocused as IsAnyItemFocused, imgui_IsAnyItemHovered as IsAnyItemHovered, imgui_IsAnyMouseDown as IsAnyMouseDown, imgui_IsItemActivated as IsItemActivated, imgui_IsItemActive as IsItemActive, imgui_IsItemClicked as IsItemClicked, imgui_IsItemDeactivated as IsItemDeactivated, imgui_IsItemDeactivatedAfterEdit as IsItemDeactivatedAfterEdit, imgui_IsItemEdited as IsItemEdited, imgui_IsItemFocused as IsItemFocused, imgui_IsItemHovered as IsItemHovered, imgui_IsItemToggledOpen as IsItemToggledOpen, imgui_IsItemVisible as IsItemVisible, imgui_IsKeyDown as IsKeyDown, imgui_IsKeyPressed as IsKeyPressed, imgui_IsKeyReleased as IsKeyReleased, imgui_IsMouseClicked as IsMouseClicked, imgui_IsMouseDoubleClicked as IsMouseDoubleClicked, imgui_IsMouseDown as IsMouseDown, imgui_IsMouseDragging as IsMouseDragging, imgui_IsMouseHoveringRect as IsMouseHoveringRect, imgui_IsMousePosValid as IsMousePosValid, imgui_IsMouseReleased as IsMouseReleased, imgui_IsPopupOpen as IsPopupOpen, imgui_IsRectVisible as IsRectVisible, imgui_IsWindowAppearing as IsWindowAppearing, imgui_IsWindowCollapsed as IsWindowCollapsed, imgui_IsWindowFocused as IsWindowFocused, imgui_IsWindowHovered as IsWindowHovered, ImGuiKey as Key, ImGuiKeyModFlags as KeyModFlags, imgui_LabelText as LabelText, imgui_ListBox as ListBox, imgui_ListBoxFooter as ListBoxFooter, imgui_ListBoxHeader as ListBoxHeader, type imgui_ListBoxItemGetter as ListBoxItemGetter, ImGuiListClipper as ListClipper, imgui_LoadIniSettingsFromDisk as LoadIniSettingsFromDisk, imgui_LoadIniSettingsFromMemory as LoadIniSettingsFromMemory, imgui_LogButtons as LogButtons, imgui_LogFinish as LogFinish, imgui_LogText as LogText, imgui_LogToClipboard as LogToClipboard, imgui_LogToFile as LogToFile, imgui_LogToTTY as LogToTTY, imgui_MemAlloc as MemAlloc, imgui_MemFree as MemFree, imgui_MenuItem as MenuItem, ImGuiMouseButton as MouseButton, ImGuiMouseCursor as MouseCursor, ImGuiNavInput as NavInput, imgui_NewFrame as NewFrame, imgui_NewLine as NewLine, imgui_NextColumn as NextColumn, imgui_OpenPopup as OpenPopup, imgui_OpenPopupOnItemClick as OpenPopupOnItemClick, type ImGuiPayload as Payload, imgui_PlotHistogram as PlotHistogram, type imgui_PlotHistogramValueGetter as PlotHistogramValueGetter, imgui_PlotLines as PlotLines, type imgui_PlotLinesValueGetter as PlotLinesValueGetter, imgui_PopAllowKeyboardFocus as PopAllowKeyboardFocus, imgui_PopButtonRepeat as PopButtonRepeat, imgui_PopClipRect as PopClipRect, imgui_PopFont as PopFont, imgui_PopID as PopID, imgui_PopItemWidth as PopItemWidth, imgui_PopStyleColor as PopStyleColor, imgui_PopStyleVar as PopStyleVar, imgui_PopTextWrapPos as PopTextWrapPos, ImGuiPopupFlags as PopupFlags, imgui_ProgressBar as ProgressBar, imgui_PushAllowKeyboardFocus as PushAllowKeyboardFocus, imgui_PushButtonRepeat as PushButtonRepeat, imgui_PushClipRect as PushClipRect, imgui_PushFont as PushFont, imgui_PushID as PushID, imgui_PushItemWidth as PushItemWidth, imgui_PushStyleColor as PushStyleColor, imgui_PushStyleVar as PushStyleVar, imgui_PushTextWrapPos as PushTextWrapPos, type imgui_RGB as RGB, type imgui_RGBA as RGBA, imgui_RadioButton as RadioButton, imgui_Render as Render, imgui_ResetMouseDragDelta as ResetMouseDragDelta, imgui_SameLine as SameLine, imgui_SaveIniSettingsToDisk as SaveIniSettingsToDisk, imgui_SaveIniSettingsToMemory as SaveIniSettingsToMemory, type ImScalar as Scalar, imgui_Selectable as Selectable, ImGuiSelectableFlags as SelectableFlags, imgui_Separator as Separator, imgui_SetActiveId as SetActiveId, imgui_SetAllocatorFunctions as SetAllocatorFunctions, imgui_SetClipboardText as SetClipboardText, imgui_SetColorEditOptions as SetColorEditOptions, imgui_SetColumnOffset as SetColumnOffset, imgui_SetColumnWidth as SetColumnWidth, imgui_SetCurrentContext as SetCurrentContext, imgui_SetCursorPos as SetCursorPos, imgui_SetCursorPosX as SetCursorPosX, imgui_SetCursorPosY as SetCursorPosY, imgui_SetCursorScreenPos as SetCursorScreenPos, imgui_SetDragDropPayload as SetDragDropPayload, imgui_SetItemAllowOverlap as SetItemAllowOverlap, imgui_SetItemDefaultFocus as SetItemDefaultFocus, imgui_SetKeyboardFocusHere as SetKeyboardFocusHere, imgui_SetMouseCursor as SetMouseCursor, imgui_SetNextItemOpen as SetNextItemOpen, imgui_SetNextItemWidth as SetNextItemWidth, imgui_SetNextWindowBgAlpha as SetNextWindowBgAlpha, imgui_SetNextWindowCollapsed as SetNextWindowCollapsed, imgui_SetNextWindowContentSize as SetNextWindowContentSize, imgui_SetNextWindowFocus as SetNextWindowFocus, imgui_SetNextWindowPos as SetNextWindowPos, imgui_SetNextWindowSize as SetNextWindowSize, imgui_SetNextWindowSizeConstraints as SetNextWindowSizeConstraints, imgui_SetScrollFromPosX as SetScrollFromPosX, imgui_SetScrollFromPosY as SetScrollFromPosY, imgui_SetScrollHereX as SetScrollHereX, imgui_SetScrollHereY as SetScrollHereY, imgui_SetScrollX as SetScrollX, imgui_SetScrollY as SetScrollY, imgui_SetTabItemClosed as SetTabItemClosed, imgui_SetTooltip as SetTooltip, imgui_SetWindowCollapsed as SetWindowCollapsed, imgui_SetWindowFocus as SetWindowFocus, imgui_SetWindowFontScale as SetWindowFontScale, imgui_SetWindowPos as SetWindowPos, imgui_SetWindowSize as SetWindowSize, imgui_ShowAboutWindow as ShowAboutWindow, imgui_ShowDemoWindow as ShowDemoWindow, imgui_ShowFontSelector as ShowFontSelector, imgui_ShowMetricsWindow as ShowMetricsWindow, imgui_ShowStyleEditor as ShowStyleEditor, imgui_ShowStyleSelector as ShowStyleSelector, imgui_ShowUserGuide as ShowUserGuide, type ImGuiSizeCallback as SizeCallback, ImGuiSizeCallbackData as SizeCallbackData, imgui_SliderAngle as SliderAngle, imgui_SliderAngle3 as SliderAngle3, ImGuiSliderFlags as SliderFlags, imgui_SliderFloat as SliderFloat, imgui_SliderFloat2 as SliderFloat2, imgui_SliderFloat3 as SliderFloat3, imgui_SliderFloat4 as SliderFloat4, imgui_SliderInt as SliderInt, imgui_SliderInt2 as SliderInt2, imgui_SliderInt3 as SliderInt3, imgui_SliderInt4 as SliderInt4, imgui_SliderScalar as SliderScalar, imgui_SmallButton as SmallButton, ImGuiSortDirection as SortDirection, imgui_Spacing as Spacing, ImStringBuffer as StringBuffer, ImGuiStyle as Style, imgui_StyleColorsClassic as StyleColorsClassic, imgui_StyleColorsDark as StyleColorsDark, imgui_StyleColorsLight as StyleColorsLight, ImGuiStyleVar as StyleVar, ImGuiTabBarFlags as TabBarFlags, imgui_TabItemButton as TabItemButton, ImGuiTabItemFlags as TabItemFlags, ImGuiTableBgTarget as TableBgTarget, ImGuiTableColumnFlags as TableColumnFlags, ImGuiTableColumnSortSpecs as TableColumnSortSpecs, ImGuiTableFlags as TableFlags, imgui_TableGetColumnCount as TableGetColumnCount, imgui_TableGetColumnFlags as TableGetColumnFlags, imgui_TableGetColumnIndex as TableGetColumnIndex, imgui_TableGetColumnName as TableGetColumnName, imgui_TableGetRowIndex as TableGetRowIndex, imgui_TableGetSortSpecs as TableGetSortSpecs, imgui_TableHeader as TableHeader, imgui_TableHeadersRow as TableHeadersRow, imgui_TableNextColumn as TableNextColumn, imgui_TableNextRow as TableNextRow, ImGuiTableRowFlags as TableRowFlags, imgui_TableSetBgColor as TableSetBgColor, imgui_TableSetColumnIndex as TableSetColumnIndex, imgui_TableSetupColumn as TableSetupColumn, imgui_TableSetupScrollFreeze as TableSetupScrollFreeze, ImGuiTableSortSpecs as TableSortSpecs, imgui_Text as Text, ImGuiTextBuffer as TextBuffer, imgui_TextColored as TextColored, imgui_TextDisabled as TextDisabled, ImGuiTextFilter as TextFilter, imgui_TextUnformatted as TextUnformatted, imgui_TextWrapped as TextWrapped, type ImTextureID as TextureID, imgui_TreeNode as TreeNode, imgui_TreeNodeEx as TreeNodeEx, ImGuiTreeNodeFlags as TreeNodeFlags, imgui_TreePop as TreePop, imgui_TreePush as TreePush, type ImTuple2 as Tuple2, type ImTuple3 as Tuple3, type ImTuple4 as Tuple4, type ImU32 as U32, IM_UNICODE_CODEPOINT_MAX as UNICODE_CODEPOINT_MAX, imgui_Unindent as Unindent, IMGUI_VERSION as VERSION, IMGUI_VERSION_NUM as VERSION_NUM, imgui_VSliderFloat as VSliderFloat, imgui_VSliderInt as VSliderInt, imgui_VSliderScalar as VSliderScalar, imgui_Value as Value, ImVec2 as Vec2, ImVec4 as Vec4, imgui_Vec4_toRGBA as Vec4_toRGBA, ImVector as Vector, ImGuiWindow as Window, ImGuiWindowFlags as WindowFlags, type imgui_XY as XY, type imgui_XYZ as XYZ, type imgui_XYZW as XYZW, imgui_bind as bind, export_default as default, imgui_isMobile as isMobile, imgui_script_ImFontConfig as script_ImFontConfig, imgui_script_ImFontGlyph as script_ImFontGlyph, ImDrawListFlags as wListFlags };
|
|
4421
4421
|
}
|
|
4422
4422
|
|
|
4423
|
+
/**
|
|
4424
|
+
* Dear ImGui bindings for zephyr3d project
|
|
4425
|
+
*
|
|
4426
|
+
* @module imgui
|
|
4427
|
+
* @packageDocumentation
|
|
4428
|
+
*/
|
|
4429
|
+
|
|
4423
4430
|
/**
|
|
4424
4431
|
* Initialize the ImGUI bindings
|
|
4425
4432
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\r\n * Dear ImGui bindings for zephyr3d project\r\n *\r\n * @module imgui\r\n * @packageDocumentation\r\n */\r\nimport type { AbstractDevice, Font } from '@zephyr3d/device';\r\nimport * as ImGui from './imgui';\r\nimport * as ImGui_Impl from './imgui_impl';\r\n\r\n/**\r\n * The ImGui interface\r\n * @public\r\n */\r\nexport { ImGui };\r\n\r\nlet inFrame = false;\r\n\r\n/**\r\n * Initialize the ImGUI bindings\r\n *\r\n * @param device - The device object\r\n * @param fontFamily - Font family, default to arial\r\n * @param fontSize - Default font size, default to 16\r\n * @param fontSizeGlyph - Default font size for glyph, default to fontSize\r\n * @public\r\n */\r\nexport async function imGuiInit(\r\n device: AbstractDevice,\r\n fontFamily?: string,\r\n fontSize?: number,\r\n fontSizeGlyph?: number\r\n) {\r\n await ImGui.default();\r\n ImGui.CHECKVERSION();\r\n console.info('ImGui.CreateContext() VERSION=', ImGui.VERSION);\r\n\r\n ImGui.CreateContext();\r\n ImGui.StyleColorsDark();\r\n const io: ImGui.IO = ImGui.GetIO();\r\n\r\n io.ConfigWindowsResizeFromEdges = true;\r\n io.ConfigDragClickToInputText = true;\r\n io.BackendFlags |= ImGui.BackendFlags.HasMouseCursors;\r\n fontSize = fontSize || 12;\r\n fontSizeGlyph = fontSizeGlyph || fontSize;\r\n const font = io.Fonts.AddFontDefault();\r\n\r\n font.FontName = fontFamily || `'Segoe UI', Tahoma, Geneva, Verdana, sans-serif`;\r\n font.FontSize = fontSize || 12;\r\n ImGui_Impl.Init(device, fontSizeGlyph ?? (fontSize || 12));\r\n}\r\n\r\n/**\r\n * Whether a frame is currently rendering\r\n * @public\r\n */\r\nexport function imGuiInFrame() {\r\n return inFrame;\r\n}\r\n\r\n/**\r\n * Starts a new frame\r\n * @public\r\n */\r\nexport function imGuiNewFrame() {\r\n if (inFrame) {\r\n throw new Error('imGuiNewFrame() failed: alreay in a frame');\r\n }\r\n inFrame = true;\r\n ImGui_Impl.NewFrame(Date.now());\r\n ImGui.NewFrame();\r\n imGuiWantCaptureKeyboard(false);\r\n}\r\n\r\n/**\r\n * Ends current frame\r\n * @public\r\n */\r\nexport function imGuiEndFrame() {\r\n if (!inFrame) {\r\n throw new Error('imGuiEndFrame() failed: not in a frame');\r\n }\r\n inFrame = false;\r\n ImGui.EndFrame();\r\n ImGui.Render();\r\n ImGui_Impl.RenderDrawData(ImGui.GetDrawData());\r\n}\r\n\r\n/**\r\n * Injects a browser event into the GUI system\r\n * @param ev - The event object\r\n * @param type - Event type, default to ev.type if not specified.\r\n * @returns A boolean value indices if the event was processed by GUI system\r\n * @public\r\n */\r\nexport function imGuiInjectEvent(ev: Event, type?: string) {\r\n type = type ?? ev.type;\r\n if (type === 'pointermove' || type === 'pointerdown' || type === 'pointerup') {\r\n return ImGui_Impl.injectPointerEvent(ev as PointerEvent);\r\n } else if (type === 'keydown' || type === 'keyup' || type === 'keypress') {\r\n return ImGui_Impl.injectKeyEvent(ev as KeyboardEvent);\r\n } else if (type === 'wheel') {\r\n return ImGui_Impl.injectWheelEvent(ev as WheelEvent);\r\n } else {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Set special text glyph font\r\n * @param charCode - char code of glyph\r\n * @param font - Web font\r\n * @public\r\n */\r\nexport function imGuiSetFontGlyph(charCode: number, font: Font) {\r\n ImGui_Impl.addCustomGlyph(charCode, font);\r\n}\r\n\r\n/**\r\n * Calculate text size\r\n * @param text - text to calculated\r\n * @remarks\r\n * The function ensures all glyphs in text been created\r\n *\r\n * @public\r\n */\r\nexport function imGuiCalcTextSize(text: string, out?: ImGui.ImVec2) {\r\n return ImGui_Impl.calcTextSize(text, out);\r\n}\r\n\r\n/**\r\n * Get char code map, for emoji conversion\r\n * @returns char code map\r\n *\r\n * @public\r\n */\r\nexport function imGuiGetCharCodeMap() {\r\n return ImGui_Impl.getCharCodeMap();\r\n}\r\n\r\n/**\r\n * Sets char code map, for emoji conversion\r\n * @param map - Char code map to set\r\n *\r\n * @public\r\n */\r\nexport function imGuiSetCharCodeMap(map: Record<number, string>) {\r\n ImGui_Impl.setCharCodeMap(map);\r\n}\r\n\r\n/**\r\n * Manual set keyboard capture\r\n * @param capture - Whether keyboard should be captured by ImGUI\r\n *\r\n * @public\r\n */\r\nexport function imGuiWantCaptureKeyboard(capture: boolean) {\r\n ImGui_Impl.captureKeyboard(capture);\r\n}\r\n"],"names":["inFrame","imGuiInit","device","fontFamily","fontSize","fontSizeGlyph","ImGui","console","info","io","ConfigWindowsResizeFromEdges","ConfigDragClickToInputText","BackendFlags","HasMouseCursors","font","Fonts","AddFontDefault","FontName","FontSize","ImGui_Impl","imGuiInFrame","imGuiNewFrame","Error","Date","now","imGuiWantCaptureKeyboard","imGuiEndFrame","imGuiInjectEvent","ev","type","imGuiSetFontGlyph","charCode","imGuiCalcTextSize","text","out","imGuiGetCharCodeMap","imGuiSetCharCodeMap","map","capture"],"mappings":";;;;;AAgBA,IAAIA,OAAU,GAAA,KAAA;AAEd;;;;;;;;IASO,eAAeC,SACpBC,CAAAA,MAAsB,EACtBC,UAAmB,EACnBC,QAAiB,EACjBC,aAAsB,EAAA;AAEtB,IAAA,MAAMC,OAAa,EAAA;AACnBA,IAAAA,kBAAkB,EAAA;AAClBC,IAAAA,OAAAA,CAAQC,IAAI,CAAC,gCAAkCF,EAAAA,aAAa,CAAA;AAE5DA,IAAAA,aAAmB,EAAA;AACnBA,IAAAA,eAAqB,EAAA;IACrB,MAAMG,EAAAA,GAAeH,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GFORCE_SCALE = 0.5;
|
|
12
|
-
/**
|
|
13
|
-
* The GLTF/GLB model loader
|
|
14
|
-
* @public
|
|
12
|
+
/**
|
|
13
|
+
* The GLTF/GLB model loader
|
|
14
|
+
* @public
|
|
15
15
|
*/ class GLTFImporter extends AbstractModelImporter {
|
|
16
16
|
/** @internal */ async initDraco3d(gltf) {
|
|
17
17
|
return new Promise((resolve)=>{
|
|
@@ -1839,9 +1839,9 @@ const VRM_DRAGFORCE_SCALE = 0.5;
|
|
|
1839
1839
|
return 'point-list';
|
|
1840
1840
|
case 1:
|
|
1841
1841
|
return 'line-list';
|
|
1842
|
-
/* FIXME:
|
|
1843
|
-
case 2: // GL_LINE_LOOP
|
|
1844
|
-
return PrimitiveType.LineLoop;
|
|
1842
|
+
/* FIXME:
|
|
1843
|
+
case 2: // GL_LINE_LOOP
|
|
1844
|
+
return PrimitiveType.LineLoop;
|
|
1845
1845
|
*/ case 3:
|
|
1846
1846
|
return 'line-strip';
|
|
1847
1847
|
case 4:
|