@kubohiroya/turbowarp-aframe 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +6 -1
- package/README.md +6 -1
- package/dist/turbowarp-aframe.js +8122 -61
- package/docs/architecture.ja.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/editor-schema-ci-fix-20261018.ja.md +25 -0
- package/docs/editor-schema-ci-fix-20261018.json +88 -0
- package/docs/editor-schema-publication.ja.md +13 -0
- package/docs/editor-schema-publication.json +100 -0
- package/docs/editor-schema-verification.json +50 -0
- package/docs/editor-schema.ja.md +23 -0
- package/docs/index.html +55 -1
- package/docs/source-editor.ja.md +13 -0
- package/docs/stage-2-publication.ja.md +34 -0
- package/docs/stage-2-publication.json +67 -0
- package/lib-editor/schemas/block-editor-template-compat.schema.json +48 -0
- package/lib-editor/src/editor-schema.d.ts +44 -0
- package/lib-editor/src/editor-schema.js +100 -0
- package/lib-editor/src/template-validation.d.ts +10 -0
- package/lib-editor/src/template-validation.js +69 -0
- package/package.json +20 -5
- package/schemas/block-editor-template-compat.schema.json +48 -0
- package/src/editor-schema.ts +111 -0
- package/src/extension.ts +18 -77
- package/src/runtime-capability.ts +17 -0
- package/src/source-editors.ts +30 -0
- package/src/template-validation.ts +79 -0
- package/schemas/extension-manifest.schema.json +0 -49
- package/src/extension-manifest.ts +0 -149
package/README.ja.md
CHANGED
|
@@ -34,6 +34,9 @@ unsandboxed 拡張はページ DOM を操作できます。信頼できる生成
|
|
|
34
34
|
interface AFrameRuntimeCapabilityV2 {
|
|
35
35
|
readonly version: 2;
|
|
36
36
|
requireVersion(version: number): AFrameRuntimeCapabilityV2;
|
|
37
|
+
createScene(layer: string, mode: string): Promise<void>;
|
|
38
|
+
createNode(type: string, id: string, parent: string): void;
|
|
39
|
+
addClass(className: string, selector: string): void;
|
|
37
40
|
loadTemplate(id: string, source: string): void;
|
|
38
41
|
createFromTemplate(template: string, instance: string, parent: string): void;
|
|
39
42
|
setPosition(selector: string, x: number, y: number, z: number): void;
|
|
@@ -52,6 +55,8 @@ interface AFrameRuntimeCapabilityV2 {
|
|
|
52
55
|
}
|
|
53
56
|
```
|
|
54
57
|
|
|
58
|
+
`createScene`、`createNode`、`addClass`はscene自体を構築します。scene記述をA-Frame nodeへ変換する機能拡張が、blockだけに頼らずこのportを通せるようにするためです。`createFromTemplate`は代用になりません。子のidにinstance idを前置し、`template`と`instance`のdata keyを書き込むため、自分でidを決めている呼び出し側は要求したidを得られません。
|
|
59
|
+
|
|
55
60
|
`setAttribute`と`setData`は、`visible`などのA-Frameコンポーネント属性と`data-<key>`属性を、selectorに一致するすべてのnodeへ書きます。属性を書く必要のある連携機能拡張—たとえばtarget poseとvisibilityを書く`turbowarp-ar`—が、機能拡張の背後でDOMを直接触らずこのportを通り、機能拡張が持つscene stateと矛盾しないようにするために存在します。
|
|
56
61
|
|
|
57
62
|
version 2は、scene操作に加えてVRMアバターを扱います。`loadVrm`は、A-Frameが読み込んだThree.jsの上でthree-vrmを動かし、selectorに最初に一致したnodeへモデルを読み込んで、準備ができると解決します。`setVrmBoneRotation`は、`leftUpperArm`などの正規化されたヒューマノイドのボーンへ、Tポーズからの回転を度のEuler角で設定します。どのVRMでも同じ回転が同じ意味になり、sceneのtickがモデル本来のボーンへ反映します。VRMの準備ができていないnodeは飛ばし、存在しないボーン名は例外になります。`setVrmExpression`は、`happy`、`blink`、`aa`などのプリセットまたはカスタムの表情の重みを、three-vrmと同じく0〜1に丸めて設定し、sceneのtickが反映します。`vrmExpressionNames`はモデルが持つ表情名を返し、存在しない名前は例外になります。
|
|
@@ -76,7 +81,7 @@ TurboWarp では `dist/turbowarp-aframe.js` を unsandboxed custom extension と
|
|
|
76
81
|
package として参照する場合は version を固定します。
|
|
77
82
|
|
|
78
83
|
```bash
|
|
79
|
-
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.
|
|
84
|
+
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.8.0
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
## ブロック概要
|
package/README.md
CHANGED
|
@@ -34,6 +34,9 @@ Composite unsandboxed extensions can use the same scene operations as the blocks
|
|
|
34
34
|
interface AFrameRuntimeCapabilityV2 {
|
|
35
35
|
readonly version: 2;
|
|
36
36
|
requireVersion(version: number): AFrameRuntimeCapabilityV2;
|
|
37
|
+
createScene(layer: string, mode: string): Promise<void>;
|
|
38
|
+
createNode(type: string, id: string, parent: string): void;
|
|
39
|
+
addClass(className: string, selector: string): void;
|
|
37
40
|
loadTemplate(id: string, source: string): void;
|
|
38
41
|
createFromTemplate(template: string, instance: string, parent: string): void;
|
|
39
42
|
setPosition(selector: string, x: number, y: number, z: number): void;
|
|
@@ -52,6 +55,8 @@ interface AFrameRuntimeCapabilityV2 {
|
|
|
52
55
|
}
|
|
53
56
|
```
|
|
54
57
|
|
|
58
|
+
`createScene`, `createNode`, and `addClass` build the scene itself, so an extension that turns a scene description into A-Frame nodes can do it through this port rather than only through blocks. `createFromTemplate` is not a substitute: it prefixes child ids with the instance id and writes `template` and `instance` data keys, so a caller that already owns its ids would not get the ids it asked for.
|
|
59
|
+
|
|
55
60
|
`setAttribute` and `setData` write an A-Frame component attribute such as `visible`, and a `data-<key>` attribute, on every matching node. They exist so that a companion extension which has to write attributes, such as `turbowarp-ar` writing target pose and visibility, goes through this port and keeps the extension's scene state in sync, instead of reaching into the DOM behind its back.
|
|
56
61
|
|
|
57
62
|
Besides the scene operations, version 2 carries VRM avatars. `loadVrm` loads the model onto the first node matching the selector with three-vrm, running on the Three.js that A-Frame loaded, and resolves when it is ready. `setVrmBoneRotation` sets Euler degrees on a normalized humanoid bone such as `leftUpperArm`, relative to the T-pose, so the same rotation means the same thing on every VRM; the scene tick applies it to the model's own bones. Nodes whose VRM is not ready are skipped, and an unknown bone name throws. `setVrmExpression` sets the weight of a preset expression such as `happy`, `blink`, or `aa`, or of a custom one, clamped to 0 through 1 as three-vrm does, and the scene tick applies it; `vrmExpressionNames` lists the names the model has, and an unknown name throws.
|
|
@@ -76,7 +81,7 @@ Load `dist/turbowarp-aframe.js` as an unsandboxed custom extension in TurboWarp.
|
|
|
76
81
|
For package-based reuse, pin the version:
|
|
77
82
|
|
|
78
83
|
```bash
|
|
79
|
-
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.
|
|
84
|
+
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.8.0
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
## Block reference
|