@kubohiroya/turbowarp-structured-data 0.6.3 → 0.7.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 +36 -0
- package/README.md +49 -7
- package/dist/structured-data.js +26 -16
- package/docs/.nojekyll +0 -0
- package/docs/assets/github-mark.svg +1 -0
- package/docs/assets/site.css +847 -0
- package/docs/index.html +577 -21
- package/docs/ja/index.html +549 -0
- package/lib-module/src/bundle-module.d.ts +7 -0
- package/lib-module/src/bundle-module.js +1384 -0
- package/lib-module/src/codecs.d.ts +10 -0
- package/lib-module/src/config.d.ts +25 -0
- package/lib-module/src/core.d.ts +34 -0
- package/lib-module/src/editor-schema.d.ts +2 -0
- package/lib-module/src/extension.d.ts +74 -0
- package/lib-module/src/fixed-input-editors.d.ts +9 -0
- package/lib-module/src/fixed-input-schema.d.ts +3 -0
- package/lib-module/src/runtime-api.d.ts +41 -0
- package/lib-module/src/source-editor.d.ts +8 -0
- package/lib-module/src/structured-provider.d.ts +33 -0
- package/package.json +15 -8
- package/src/bundle-module.ts +23 -0
- package/src/extension.ts +17 -15
- package/src/globals.d.ts +7 -36
- package/src/index.ts +2 -2
- package/src/runtime-api.ts +43 -0
- package/templates/README.ja.md +36 -0
- package/templates/README.md +48 -6
package/templates/README.md
CHANGED
|
@@ -154,6 +154,48 @@ for example `TurboWarp-Asset-Manager`, `TurboWarp-Runtime-Expression`, and
|
|
|
154
154
|
Document schema-aware migrations when an extension ID or opcode changes. Never
|
|
155
155
|
instruct users to replace JavaScript alone when stored identifiers have changed.
|
|
156
156
|
|
|
157
|
+
## Integrated-build module API
|
|
158
|
+
|
|
159
|
+
Building this source also produces a `./bundle-module` ESM entry and declarations
|
|
160
|
+
in `lib-module/`. This entry is separate from the standalone JavaScript file.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import {bundleModuleMetadata, createExtension, type ScratchApi}
|
|
164
|
+
from '@kubohiroya/<package>/bundle-module';
|
|
165
|
+
|
|
166
|
+
export function createMember(memberScratch: ScratchApi) {
|
|
167
|
+
return createExtension(memberScratch);
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Importing the entry does not access global Scratch / window / document or create
|
|
172
|
+
and register an extension. Each explicit createExtension(memberScratch) call
|
|
173
|
+
returns a fresh instance bound to that host, including deferred block execution,
|
|
174
|
+
editor helpers and lifecycle callbacks. The factory does not call
|
|
175
|
+
Scratch.extensions.register; the standalone entry uses the same factory and
|
|
176
|
+
registers exactly once.
|
|
177
|
+
|
|
178
|
+
The frozen bundleModuleMetadata declares formatVersion: 1, the original id and
|
|
179
|
+
unsandboxed requirement. An integrated host validates these before creation and
|
|
180
|
+
owns registration and disposal. Existing IDs, opcodes and saved data stay unchanged.
|
|
181
|
+
|
|
182
|
+
The existing STRUCTURED_DATA_MVP, NAMED_DATA_REGISTRY_MVP and Schema reference startup flags retain their defaults. Creation performs the existing optional editor and named-data initialization against the injected host. Call and await dispose() to release the instance registrations and listeners. Internal callers constructing StructuredDataExtension directly now pass the host first, followed by the existing optional feature arguments.
|
|
183
|
+
|
|
184
|
+
Runtime dependencies (including yaml and their subpaths) remain external imports.
|
|
185
|
+
Only the existing small, pure development-time editor helpers are included, so
|
|
186
|
+
production consumers need no editor package or GUI engine. Public types use the
|
|
187
|
+
same ES2022 libraries as the project tsconfig; generated JavaScript targets ES2020.
|
|
188
|
+
The package retains its existing exports and adds ./bundle-module; no template
|
|
189
|
+
runtime dependency is required.
|
|
190
|
+
|
|
191
|
+
pnpm run build:module builds this entry; pnpm run check:module packs and installs
|
|
192
|
+
the actual package with production dependencies only, checks host isolation,
|
|
193
|
+
standalone parity and public types, and rejects editor-engine dependency leaks.
|
|
194
|
+
The integrated sb3-toolchain build remains a later step in
|
|
195
|
+
[sb3-toolchain #65](https://github.com/kubohiroya/sb3-toolchain/issues/65).
|
|
196
|
+
To roll back, continue loading the existing classic dist artifact without selecting
|
|
197
|
+
this module entry. No runtime flag or saved-data migration is introduced.
|
|
198
|
+
|
|
157
199
|
## Development
|
|
158
200
|
|
|
159
201
|
Use Node.js `<minimum version>` and the pnpm version declared by
|
|
@@ -197,15 +239,15 @@ site and `blockIconURI` remains a `data:image/svg+xml;base64,...` URI.
|
|
|
197
239
|
Third-party components, when present, are listed in
|
|
198
240
|
[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
|
|
199
241
|
|
|
200
|
-
##
|
|
242
|
+
## Fixed-input editor form (S3-4)
|
|
201
243
|
|
|
202
|
-
|
|
244
|
+
When the shared editor's startup flag `blockEditorFixedInputs` and Dialogs are both on in the GUI, the extension registers a fixed form for `forEachAtPath`'s `MAX` input only. Older GUIs, or a GUI with the flag off, get no extra registration. The canonical Schema is `schemas/block-editor-fixed-inputs.schema.json#/$defs/forEachAtPath/properties/MAX`; the codec and registration live in `src/fixed-input-editors.ts`. Saving without changes never rewrites existing raw values, unchanged aliases, or unknown enum values, and connected reporters are never evaluated. Only explicit changes are validated; other arguments, block declarations, and the saved format are unchanged.
|
|
203
245
|
|
|
204
|
-
MAX
|
|
246
|
+
`MAX` is an integer from 1 to 1000. New input also follows the shared finite-number token rule, and partial input is not saved. When the MVP flag is off nothing is registered, and whether `NAME`/`PATH` accept connected reporters (derived from `staticLiteral`) does not change.
|
|
205
247
|
|
|
206
|
-
|
|
248
|
+
Registration is limited to the optional API (`apiVersion: 1`) and is released on `RUNTIME_DISPOSED` or an explicit dispose. Turning the startup flag off and reloading restores the previous behavior. When rolling back the dependency, restore the manifest, lockfile, and actual resolution together. This stage does not include an npm release or dynamic candidates from later stages.
|
|
207
249
|
|
|
208
|
-
Schema
|
|
209
|
-
|
|
250
|
+
The contract the Schema describes is grounded in the actual `getInfo` declarations and the existing pure runtime conversions. The SchemaBundle `retrievalUri` identifies this local document; it does not mean the Schema is served from that URL or that `$ref` is resolved over HTTP. The Schema compiles from the bundled documents only.
|
|
251
|
+
Existing non-empty finite Number aliases for `MAX` (for example `001`, `+1`, or `0x10`) are only projected through `Number` for display; unchanged raw values are not saved again. Blank, non-finite, or unprojectable values are read-only, and no `0` or default is substituted. New input does not accept these aliases and follows NP-finite-new-input-v1.
|
|
210
252
|
|
|
211
253
|
Registration uses the optional editor API available when the extension instance is constructed. Adding or replacing that API later is not followed automatically; reload the GUI and reconstruct the extension instance after changing the startup configuration.
|