@despia-native/kernel 0.0.0-coming-soon.0 → 0.3.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/LICENSE +202 -0
- package/NOTICE +1414 -0
- package/README.md +16 -1
- package/dist/.dsx-build-stamp.json +7 -0
- package/dist/api-cohort.d.ts +27 -0
- package/dist/api-cohort.d.ts.map +1 -0
- package/dist/api-cohort.js +94 -0
- package/dist/api-cohort.js.map +1 -0
- package/dist/api.d.ts +454 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2442 -0
- package/dist/api.js.map +1 -0
- package/dist/app-consts.d.ts +10 -0
- package/dist/app-consts.d.ts.map +1 -0
- package/dist/app-consts.js +39 -0
- package/dist/app-consts.js.map +1 -0
- package/dist/app-update.d.ts +12 -0
- package/dist/app-update.d.ts.map +1 -0
- package/dist/app-update.js +32 -0
- package/dist/app-update.js.map +1 -0
- package/dist/aria.d.ts +152 -0
- package/dist/aria.d.ts.map +1 -0
- package/dist/aria.js +524 -0
- package/dist/aria.js.map +1 -0
- package/dist/audio-core.d.ts +260 -0
- package/dist/audio-core.d.ts.map +1 -0
- package/dist/audio-core.js +1440 -0
- package/dist/audio-core.js.map +1 -0
- package/dist/audio-edit.d.ts +100 -0
- package/dist/audio-edit.d.ts.map +1 -0
- package/dist/audio-edit.js +489 -0
- package/dist/audio-edit.js.map +1 -0
- package/dist/audio-mix.d.ts +84 -0
- package/dist/audio-mix.d.ts.map +1 -0
- package/dist/audio-mix.js +393 -0
- package/dist/audio-mix.js.map +1 -0
- package/dist/auth-proof.d.ts +145 -0
- package/dist/auth-proof.d.ts.map +1 -0
- package/dist/auth-proof.js +644 -0
- package/dist/auth-proof.js.map +1 -0
- package/dist/availability-explain.d.ts +3 -0
- package/dist/availability-explain.d.ts.map +1 -0
- package/dist/availability-explain.js +322 -0
- package/dist/availability-explain.js.map +1 -0
- package/dist/availability.d.ts +246 -0
- package/dist/availability.d.ts.map +1 -0
- package/dist/availability.js +615 -0
- package/dist/availability.js.map +1 -0
- package/dist/background.d.ts +116 -0
- package/dist/background.d.ts.map +1 -0
- package/dist/background.js +235 -0
- package/dist/background.js.map +1 -0
- package/dist/boot-tables-flag.d.ts +2 -0
- package/dist/boot-tables-flag.d.ts.map +1 -0
- package/dist/boot-tables-flag.js +16 -0
- package/dist/boot-tables-flag.js.map +1 -0
- package/dist/boot-tables.d.ts +40 -0
- package/dist/boot-tables.d.ts.map +1 -0
- package/dist/boot-tables.js +102 -0
- package/dist/boot-tables.js.map +1 -0
- package/dist/border-edges.d.ts +5 -0
- package/dist/border-edges.d.ts.map +1 -0
- package/dist/border-edges.js +47 -0
- package/dist/border-edges.js.map +1 -0
- package/dist/bus.d.ts +1203 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +2647 -0
- package/dist/bus.js.map +1 -0
- package/dist/calendar-core.d.ts +143 -0
- package/dist/calendar-core.d.ts.map +1 -0
- package/dist/calendar-core.js +372 -0
- package/dist/calendar-core.js.map +1 -0
- package/dist/call-value.d.ts +16 -0
- package/dist/call-value.d.ts.map +1 -0
- package/dist/call-value.js +54 -0
- package/dist/call-value.js.map +1 -0
- package/dist/camera-core.d.ts +222 -0
- package/dist/camera-core.d.ts.map +1 -0
- package/dist/camera-core.js +980 -0
- package/dist/camera-core.js.map +1 -0
- package/dist/canvas-core.d.ts +404 -0
- package/dist/canvas-core.d.ts.map +1 -0
- package/dist/canvas-core.js +2186 -0
- package/dist/canvas-core.js.map +1 -0
- package/dist/capture-core.d.ts +74 -0
- package/dist/capture-core.d.ts.map +1 -0
- package/dist/capture-core.js +158 -0
- package/dist/capture-core.js.map +1 -0
- package/dist/compile/codegen.d.ts +146 -0
- package/dist/compile/codegen.d.ts.map +1 -0
- package/dist/compile/codegen.js +1949 -0
- package/dist/compile/codegen.js.map +1 -0
- package/dist/compile/jstier.d.ts +44 -0
- package/dist/compile/jstier.d.ts.map +1 -0
- package/dist/compile/jstier.js +181 -0
- package/dist/compile/jstier.js.map +1 -0
- package/dist/compile/tier-door.d.ts +41 -0
- package/dist/compile/tier-door.d.ts.map +1 -0
- package/dist/compile/tier-door.js +167 -0
- package/dist/compile/tier-door.js.map +1 -0
- package/dist/compile/tier-realm.d.ts +49 -0
- package/dist/compile/tier-realm.d.ts.map +1 -0
- package/dist/compile/tier-realm.js +368 -0
- package/dist/compile/tier-realm.js.map +1 -0
- package/dist/compile/tier.d.ts +23 -0
- package/dist/compile/tier.d.ts.map +1 -0
- package/dist/compile/tier.js +157 -0
- package/dist/compile/tier.js.map +1 -0
- package/dist/compose-core.d.ts +86 -0
- package/dist/compose-core.d.ts.map +1 -0
- package/dist/compose-core.js +112 -0
- package/dist/compose-core.js.map +1 -0
- package/dist/config-validate.d.ts +31 -0
- package/dist/config-validate.d.ts.map +1 -0
- package/dist/config-validate.js +147 -0
- package/dist/config-validate.js.map +1 -0
- package/dist/config-values.d.ts +106 -0
- package/dist/config-values.d.ts.map +1 -0
- package/dist/config-values.js +340 -0
- package/dist/config-values.js.map +1 -0
- package/dist/contacts-core.d.ts +127 -0
- package/dist/contacts-core.d.ts.map +1 -0
- package/dist/contacts-core.js +211 -0
- package/dist/contacts-core.js.map +1 -0
- package/dist/content-transition.d.ts +58 -0
- package/dist/content-transition.d.ts.map +1 -0
- package/dist/content-transition.js +94 -0
- package/dist/content-transition.js.map +1 -0
- package/dist/controls-core.d.ts +227 -0
- package/dist/controls-core.d.ts.map +1 -0
- package/dist/controls-core.js +652 -0
- package/dist/controls-core.js.map +1 -0
- package/dist/cookies.d.ts +78 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +265 -0
- package/dist/cookies.js.map +1 -0
- package/dist/corner-shape-core.d.ts +69 -0
- package/dist/corner-shape-core.d.ts.map +1 -0
- package/dist/corner-shape-core.js +261 -0
- package/dist/corner-shape-core.js.map +1 -0
- package/dist/crypto-core.d.ts +57 -0
- package/dist/crypto-core.d.ts.map +1 -0
- package/dist/crypto-core.js +128 -0
- package/dist/crypto-core.js.map +1 -0
- package/dist/dataviz.d.ts +436 -0
- package/dist/dataviz.d.ts.map +1 -0
- package/dist/dataviz.js +956 -0
- package/dist/dataviz.js.map +1 -0
- package/dist/debug.d.ts +293 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +767 -0
- package/dist/debug.js.map +1 -0
- package/dist/device-ownership.d.ts +50 -0
- package/dist/device-ownership.d.ts.map +1 -0
- package/dist/device-ownership.js +105 -0
- package/dist/device-ownership.js.map +1 -0
- package/dist/effects.d.ts +86 -0
- package/dist/effects.d.ts.map +1 -0
- package/dist/effects.js +98 -0
- package/dist/effects.js.map +1 -0
- package/dist/element.d.ts +108 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +63 -0
- package/dist/element.js.map +1 -0
- package/dist/file-watch.d.ts +16 -0
- package/dist/file-watch.d.ts.map +1 -0
- package/dist/file-watch.js +49 -0
- package/dist/file-watch.js.map +1 -0
- package/dist/filepaths.d.ts +72 -0
- package/dist/filepaths.d.ts.map +1 -0
- package/dist/filepaths.js +271 -0
- package/dist/filepaths.js.map +1 -0
- package/dist/film.d.ts +264 -0
- package/dist/film.d.ts.map +1 -0
- package/dist/film.js +313 -0
- package/dist/film.js.map +1 -0
- package/dist/fonts.d.ts +66 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +135 -0
- package/dist/fonts.js.map +1 -0
- package/dist/forms.d.ts +191 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +663 -0
- package/dist/forms.js.map +1 -0
- package/dist/geo.d.ts +289 -0
- package/dist/geo.d.ts.map +1 -0
- package/dist/geo.js +460 -0
- package/dist/geo.js.map +1 -0
- package/dist/handler-announce.d.ts +46 -0
- package/dist/handler-announce.d.ts.map +1 -0
- package/dist/handler-announce.js +96 -0
- package/dist/handler-announce.js.map +1 -0
- package/dist/handoff.d.ts +71 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +250 -0
- package/dist/handoff.js.map +1 -0
- package/dist/identity-durability.d.ts +76 -0
- package/dist/identity-durability.d.ts.map +1 -0
- package/dist/identity-durability.js +150 -0
- package/dist/identity-durability.js.map +1 -0
- package/dist/image-core.d.ts +240 -0
- package/dist/image-core.d.ts.map +1 -0
- package/dist/image-core.js +618 -0
- package/dist/image-core.js.map +1 -0
- package/dist/image-schemes.d.ts +10 -0
- package/dist/image-schemes.d.ts.map +1 -0
- package/dist/image-schemes.js +28 -0
- package/dist/image-schemes.js.map +1 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/dist/ink-core.d.ts +53 -0
- package/dist/ink-core.d.ts.map +1 -0
- package/dist/ink-core.js +119 -0
- package/dist/ink-core.js.map +1 -0
- package/dist/input.d.ts +148 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +358 -0
- package/dist/input.js.map +1 -0
- package/dist/integrity.d.ts +63 -0
- package/dist/integrity.d.ts.map +1 -0
- package/dist/integrity.js +150 -0
- package/dist/integrity.js.map +1 -0
- package/dist/intents.d.ts +95 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +282 -0
- package/dist/intents.js.map +1 -0
- package/dist/interpolate-core.d.ts +37 -0
- package/dist/interpolate-core.d.ts.map +1 -0
- package/dist/interpolate-core.js +443 -0
- package/dist/interpolate-core.js.map +1 -0
- package/dist/jse/color.d.ts +12 -0
- package/dist/jse/color.d.ts.map +1 -0
- package/dist/jse/color.js +196 -0
- package/dist/jse/color.js.map +1 -0
- package/dist/jse/core.d.ts +54 -0
- package/dist/jse/core.d.ts.map +1 -0
- package/dist/jse/core.js +1519 -0
- package/dist/jse/core.js.map +1 -0
- package/dist/jse/dispatch.d.ts +28 -0
- package/dist/jse/dispatch.d.ts.map +1 -0
- package/dist/jse/dispatch.js +116 -0
- package/dist/jse/dispatch.js.map +1 -0
- package/dist/jse/highlight-grammar.d.ts +15 -0
- package/dist/jse/highlight-grammar.d.ts.map +1 -0
- package/dist/jse/highlight-grammar.js +161 -0
- package/dist/jse/highlight-grammar.js.map +1 -0
- package/dist/jse/highlight-grammars.generated.d.ts +2 -0
- package/dist/jse/highlight-grammars.generated.d.ts.map +1 -0
- package/dist/jse/highlight-grammars.generated.js +4 -0
- package/dist/jse/highlight-grammars.generated.js.map +1 -0
- package/dist/jse/highlight.d.ts +37 -0
- package/dist/jse/highlight.d.ts.map +1 -0
- package/dist/jse/highlight.js +323 -0
- package/dist/jse/highlight.js.map +1 -0
- package/dist/jse/jse.d.ts +674 -0
- package/dist/jse/jse.d.ts.map +1 -0
- package/dist/jse/jse.js +5841 -0
- package/dist/jse/jse.js.map +1 -0
- package/dist/jse/pathmatch.d.ts +10 -0
- package/dist/jse/pathmatch.d.ts.map +1 -0
- package/dist/jse/pathmatch.js +73 -0
- package/dist/jse/pathmatch.js.map +1 -0
- package/dist/jse/regex.d.ts +33 -0
- package/dist/jse/regex.d.ts.map +1 -0
- package/dist/jse/regex.js +375 -0
- package/dist/jse/regex.js.map +1 -0
- package/dist/jse/stdlib.d.ts +8 -0
- package/dist/jse/stdlib.d.ts.map +1 -0
- package/dist/jse/stdlib.js +765 -0
- package/dist/jse/stdlib.js.map +1 -0
- package/dist/jse/tokens.d.ts +102 -0
- package/dist/jse/tokens.d.ts.map +1 -0
- package/dist/jse/tokens.js +982 -0
- package/dist/jse/tokens.js.map +1 -0
- package/dist/jse/values.d.ts +206 -0
- package/dist/jse/values.d.ts.map +1 -0
- package/dist/jse/values.js +846 -0
- package/dist/jse/values.js.map +1 -0
- package/dist/keyboard.d.ts +196 -0
- package/dist/keyboard.d.ts.map +1 -0
- package/dist/keyboard.js +186 -0
- package/dist/keyboard.js.map +1 -0
- package/dist/label-choices.d.ts +3 -0
- package/dist/label-choices.d.ts.map +1 -0
- package/dist/label-choices.js +168 -0
- package/dist/label-choices.js.map +1 -0
- package/dist/language.d.ts +33 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +50 -0
- package/dist/language.js.map +1 -0
- package/dist/length-units.d.ts +30 -0
- package/dist/length-units.d.ts.map +1 -0
- package/dist/length-units.js +83 -0
- package/dist/length-units.js.map +1 -0
- package/dist/lightsensor.d.ts +48 -0
- package/dist/lightsensor.d.ts.map +1 -0
- package/dist/lightsensor.js +97 -0
- package/dist/lightsensor.js.map +1 -0
- package/dist/link-refresh.d.ts +27 -0
- package/dist/link-refresh.d.ts.map +1 -0
- package/dist/link-refresh.js +166 -0
- package/dist/link-refresh.js.map +1 -0
- package/dist/link.d.ts +57 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +333 -0
- package/dist/link.js.map +1 -0
- package/dist/linkpreview.d.ts +114 -0
- package/dist/linkpreview.d.ts.map +1 -0
- package/dist/linkpreview.js +439 -0
- package/dist/linkpreview.js.map +1 -0
- package/dist/list-presence.d.ts +32 -0
- package/dist/list-presence.d.ts.map +1 -0
- package/dist/list-presence.js +48 -0
- package/dist/list-presence.js.map +1 -0
- package/dist/live-stream.d.ts +27 -0
- package/dist/live-stream.d.ts.map +1 -0
- package/dist/live-stream.js +274 -0
- package/dist/live-stream.js.map +1 -0
- package/dist/livelogs.d.ts +134 -0
- package/dist/livelogs.d.ts.map +1 -0
- package/dist/livelogs.js +409 -0
- package/dist/livelogs.js.map +1 -0
- package/dist/logs.d.ts +80 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +206 -0
- package/dist/logs.js.map +1 -0
- package/dist/mcp/apps.d.ts +82 -0
- package/dist/mcp/apps.d.ts.map +1 -0
- package/dist/mcp/apps.js +219 -0
- package/dist/mcp/apps.js.map +1 -0
- package/dist/mcp/entities.d.ts +25 -0
- package/dist/mcp/entities.d.ts.map +1 -0
- package/dist/mcp/entities.js +71 -0
- package/dist/mcp/entities.js.map +1 -0
- package/dist/mcp/result.d.ts +73 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +119 -0
- package/dist/mcp/result.js.map +1 -0
- package/dist/mcp/webmcp.d.ts +162 -0
- package/dist/mcp/webmcp.d.ts.map +1 -0
- package/dist/mcp/webmcp.js +214 -0
- package/dist/mcp/webmcp.js.map +1 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +14 -0
- package/dist/mcp.js.map +1 -0
- package/dist/media-core.d.ts +191 -0
- package/dist/media-core.d.ts.map +1 -0
- package/dist/media-core.js +446 -0
- package/dist/media-core.js.map +1 -0
- package/dist/media-timeline-core.d.ts +94 -0
- package/dist/media-timeline-core.d.ts.map +1 -0
- package/dist/media-timeline-core.js +620 -0
- package/dist/media-timeline-core.js.map +1 -0
- package/dist/message.d.ts +42 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +582 -0
- package/dist/message.js.map +1 -0
- package/dist/missing-element.d.ts +29 -0
- package/dist/missing-element.d.ts.map +1 -0
- package/dist/missing-element.js +76 -0
- package/dist/missing-element.js.map +1 -0
- package/dist/motion-core.d.ts +160 -0
- package/dist/motion-core.d.ts.map +1 -0
- package/dist/motion-core.js +752 -0
- package/dist/motion-core.js.map +1 -0
- package/dist/motion-pose.d.ts +65 -0
- package/dist/motion-pose.d.ts.map +1 -0
- package/dist/motion-pose.js +143 -0
- package/dist/motion-pose.js.map +1 -0
- package/dist/motion.d.ts +132 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +260 -0
- package/dist/motion.js.map +1 -0
- package/dist/mount-core.d.ts +203 -0
- package/dist/mount-core.d.ts.map +1 -0
- package/dist/mount-core.js +437 -0
- package/dist/mount-core.js.map +1 -0
- package/dist/net-core.d.ts +110 -0
- package/dist/net-core.d.ts.map +1 -0
- package/dist/net-core.js +225 -0
- package/dist/net-core.js.map +1 -0
- package/dist/notify.d.ts +399 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +964 -0
- package/dist/notify.js.map +1 -0
- package/dist/orientation-binding.d.ts +39 -0
- package/dist/orientation-binding.d.ts.map +1 -0
- package/dist/orientation-binding.js +64 -0
- package/dist/orientation-binding.js.map +1 -0
- package/dist/orientation.d.ts +55 -0
- package/dist/orientation.d.ts.map +1 -0
- package/dist/orientation.js +89 -0
- package/dist/orientation.js.map +1 -0
- package/dist/ota.d.ts +52 -0
- package/dist/ota.d.ts.map +1 -0
- package/dist/ota.js +122 -0
- package/dist/ota.js.map +1 -0
- package/dist/passkeys.d.ts +91 -0
- package/dist/passkeys.d.ts.map +1 -0
- package/dist/passkeys.js +307 -0
- package/dist/passkeys.js.map +1 -0
- package/dist/payment.d.ts +85 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +270 -0
- package/dist/payment.js.map +1 -0
- package/dist/pending-presenter.d.ts +31 -0
- package/dist/pending-presenter.d.ts.map +1 -0
- package/dist/pending-presenter.js +119 -0
- package/dist/pending-presenter.js.map +1 -0
- package/dist/permission-core.d.ts +59 -0
- package/dist/permission-core.d.ts.map +1 -0
- package/dist/permission-core.js +102 -0
- package/dist/permission-core.js.map +1 -0
- package/dist/persist.d.ts +169 -0
- package/dist/persist.d.ts.map +1 -0
- package/dist/persist.js +361 -0
- package/dist/persist.js.map +1 -0
- package/dist/phase-plan.d.ts +114 -0
- package/dist/phase-plan.d.ts.map +1 -0
- package/dist/phase-plan.js +837 -0
- package/dist/phase-plan.js.map +1 -0
- package/dist/playback-core.d.ts +64 -0
- package/dist/playback-core.d.ts.map +1 -0
- package/dist/playback-core.js +176 -0
- package/dist/playback-core.js.map +1 -0
- package/dist/player-sources.d.ts +12 -0
- package/dist/player-sources.d.ts.map +1 -0
- package/dist/player-sources.js +44 -0
- package/dist/player-sources.js.map +1 -0
- package/dist/proxy-denylist.d.ts +11 -0
- package/dist/proxy-denylist.d.ts.map +1 -0
- package/dist/proxy-denylist.js +44 -0
- package/dist/proxy-denylist.js.map +1 -0
- package/dist/public-config.d.ts +20 -0
- package/dist/public-config.d.ts.map +1 -0
- package/dist/public-config.js +109 -0
- package/dist/public-config.js.map +1 -0
- package/dist/qoe-core.d.ts +72 -0
- package/dist/qoe-core.d.ts.map +1 -0
- package/dist/qoe-core.js +113 -0
- package/dist/qoe-core.js.map +1 -0
- package/dist/reactive-request.d.ts +80 -0
- package/dist/reactive-request.d.ts.map +1 -0
- package/dist/reactive-request.js +192 -0
- package/dist/reactive-request.js.map +1 -0
- package/dist/read-cache.d.ts +129 -0
- package/dist/read-cache.d.ts.map +1 -0
- package/dist/read-cache.js +566 -0
- package/dist/read-cache.js.map +1 -0
- package/dist/recorder-core.d.ts +57 -0
- package/dist/recorder-core.d.ts.map +1 -0
- package/dist/recorder-core.js +136 -0
- package/dist/recorder-core.js.map +1 -0
- package/dist/ref.d.ts +41 -0
- package/dist/ref.d.ts.map +1 -0
- package/dist/ref.js +98 -0
- package/dist/ref.js.map +1 -0
- package/dist/refusal.d.ts +82 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +218 -0
- package/dist/refusal.js.map +1 -0
- package/dist/region-insets.d.ts +61 -0
- package/dist/region-insets.d.ts.map +1 -0
- package/dist/region-insets.js +67 -0
- package/dist/region-insets.js.map +1 -0
- package/dist/rive-core.d.ts +323 -0
- package/dist/rive-core.d.ts.map +1 -0
- package/dist/rive-core.js +677 -0
- package/dist/rive-core.js.map +1 -0
- package/dist/runner.d.ts +595 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +4094 -0
- package/dist/runner.js.map +1 -0
- package/dist/scene/a11y.d.ts +11 -0
- package/dist/scene/a11y.d.ts.map +1 -0
- package/dist/scene/a11y.js +67 -0
- package/dist/scene/a11y.js.map +1 -0
- package/dist/scene/anim.d.ts +149 -0
- package/dist/scene/anim.d.ts.map +1 -0
- package/dist/scene/anim.js +396 -0
- package/dist/scene/anim.js.map +1 -0
- package/dist/scene/bind.d.ts +33 -0
- package/dist/scene/bind.d.ts.map +1 -0
- package/dist/scene/bind.js +66 -0
- package/dist/scene/bind.js.map +1 -0
- package/dist/scene/collide.d.ts +56 -0
- package/dist/scene/collide.d.ts.map +1 -0
- package/dist/scene/collide.js +146 -0
- package/dist/scene/collide.js.map +1 -0
- package/dist/scene/frame.d.ts +22 -0
- package/dist/scene/frame.d.ts.map +1 -0
- package/dist/scene/frame.js +57 -0
- package/dist/scene/frame.js.map +1 -0
- package/dist/scene/gltf.d.ts +79 -0
- package/dist/scene/gltf.d.ts.map +1 -0
- package/dist/scene/gltf.js +409 -0
- package/dist/scene/gltf.js.map +1 -0
- package/dist/scene/ir.d.ts +293 -0
- package/dist/scene/ir.d.ts.map +1 -0
- package/dist/scene/ir.js +692 -0
- package/dist/scene/ir.js.map +1 -0
- package/dist/scene/math.d.ts +50 -0
- package/dist/scene/math.d.ts.map +1 -0
- package/dist/scene/math.js +180 -0
- package/dist/scene/math.js.map +1 -0
- package/dist/scene/orbit.d.ts +19 -0
- package/dist/scene/orbit.d.ts.map +1 -0
- package/dist/scene/orbit.js +60 -0
- package/dist/scene/orbit.js.map +1 -0
- package/dist/scene/physics.d.ts +228 -0
- package/dist/scene/physics.d.ts.map +1 -0
- package/dist/scene/physics.js +1500 -0
- package/dist/scene/physics.js.map +1 -0
- package/dist/scene/registry.d.ts +85 -0
- package/dist/scene/registry.d.ts.map +1 -0
- package/dist/scene/registry.js +75 -0
- package/dist/scene/registry.js.map +1 -0
- package/dist/scene/skin.d.ts +82 -0
- package/dist/scene/skin.d.ts.map +1 -0
- package/dist/scene/skin.js +351 -0
- package/dist/scene/skin.js.map +1 -0
- package/dist/scene/sprite.d.ts +36 -0
- package/dist/scene/sprite.d.ts.map +1 -0
- package/dist/scene/sprite.js +107 -0
- package/dist/scene/sprite.js.map +1 -0
- package/dist/scene/viewer.d.ts +96 -0
- package/dist/scene/viewer.d.ts.map +1 -0
- package/dist/scene/viewer.js +235 -0
- package/dist/scene/viewer.js.map +1 -0
- package/dist/scoped-slots.d.ts +9 -0
- package/dist/scoped-slots.d.ts.map +1 -0
- package/dist/scoped-slots.js +42 -0
- package/dist/scoped-slots.js.map +1 -0
- package/dist/screen.d.ts +109 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +309 -0
- package/dist/screen.js.map +1 -0
- package/dist/scroll.d.ts +525 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +1226 -0
- package/dist/scroll.js.map +1 -0
- package/dist/settings-plane.d.ts +58 -0
- package/dist/settings-plane.d.ts.map +1 -0
- package/dist/settings-plane.js +86 -0
- package/dist/settings-plane.js.map +1 -0
- package/dist/share-inbox.d.ts +56 -0
- package/dist/share-inbox.d.ts.map +1 -0
- package/dist/share-inbox.js +114 -0
- package/dist/share-inbox.js.map +1 -0
- package/dist/shared-transition.d.ts +152 -0
- package/dist/shared-transition.d.ts.map +1 -0
- package/dist/shared-transition.js +257 -0
- package/dist/shared-transition.js.map +1 -0
- package/dist/sheet-content-padding.d.ts +24 -0
- package/dist/sheet-content-padding.d.ts.map +1 -0
- package/dist/sheet-content-padding.js +32 -0
- package/dist/sheet-content-padding.js.map +1 -0
- package/dist/shot-devices.d.ts +36 -0
- package/dist/shot-devices.d.ts.map +1 -0
- package/dist/shot-devices.js +90 -0
- package/dist/shot-devices.js.map +1 -0
- package/dist/shot-guards.d.ts +100 -0
- package/dist/shot-guards.d.ts.map +1 -0
- package/dist/shot-guards.js +260 -0
- package/dist/shot-guards.js.map +1 -0
- package/dist/shot-scope.d.ts +140 -0
- package/dist/shot-scope.d.ts.map +1 -0
- package/dist/shot-scope.js +302 -0
- package/dist/shot-scope.js.map +1 -0
- package/dist/slot-partition.d.ts +9 -0
- package/dist/slot-partition.d.ts.map +1 -0
- package/dist/slot-partition.js +38 -0
- package/dist/slot-partition.js.map +1 -0
- package/dist/snackbar.d.ts +165 -0
- package/dist/snackbar.d.ts.map +1 -0
- package/dist/snackbar.js +220 -0
- package/dist/snackbar.js.map +1 -0
- package/dist/socket.d.ts +96 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +370 -0
- package/dist/socket.js.map +1 -0
- package/dist/spotlight.d.ts +77 -0
- package/dist/spotlight.d.ts.map +1 -0
- package/dist/spotlight.js +174 -0
- package/dist/spotlight.js.map +1 -0
- package/dist/state-primitive.d.ts +37 -0
- package/dist/state-primitive.d.ts.map +1 -0
- package/dist/state-primitive.js +91 -0
- package/dist/state-primitive.js.map +1 -0
- package/dist/store-query.d.ts +25 -0
- package/dist/store-query.d.ts.map +1 -0
- package/dist/store-query.js +88 -0
- package/dist/store-query.js.map +1 -0
- package/dist/store-value.d.ts +48 -0
- package/dist/store-value.d.ts.map +1 -0
- package/dist/store-value.js +264 -0
- package/dist/store-value.js.map +1 -0
- package/dist/store-versioning.d.ts +70 -0
- package/dist/store-versioning.d.ts.map +1 -0
- package/dist/store-versioning.js +188 -0
- package/dist/store-versioning.js.map +1 -0
- package/dist/store.d.ts +282 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +1144 -0
- package/dist/store.js.map +1 -0
- package/dist/strings.d.ts +141 -0
- package/dist/strings.d.ts.map +1 -0
- package/dist/strings.js +581 -0
- package/dist/strings.js.map +1 -0
- package/dist/telemetry.d.ts +95 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +255 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/transform-core.d.ts +228 -0
- package/dist/transform-core.d.ts.map +1 -0
- package/dist/transform-core.js +921 -0
- package/dist/transform-core.js.map +1 -0
- package/dist/transition-core.d.ts +58 -0
- package/dist/transition-core.d.ts.map +1 -0
- package/dist/transition-core.js +352 -0
- package/dist/transition-core.js.map +1 -0
- package/dist/trim-trailing.d.ts +3 -0
- package/dist/trim-trailing.d.ts.map +1 -0
- package/dist/trim-trailing.js +14 -0
- package/dist/trim-trailing.js.map +1 -0
- package/dist/upload.d.ts +51 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +68 -0
- package/dist/upload.js.map +1 -0
- package/dist/vendor-face.d.ts +44 -0
- package/dist/vendor-face.d.ts.map +1 -0
- package/dist/vendor-face.js +80 -0
- package/dist/vendor-face.js.map +1 -0
- package/dist/vendor-session.d.ts +166 -0
- package/dist/vendor-session.d.ts.map +1 -0
- package/dist/vendor-session.js +423 -0
- package/dist/vendor-session.js.map +1 -0
- package/dist/vendor-surface.d.ts +290 -0
- package/dist/vendor-surface.d.ts.map +1 -0
- package/dist/vendor-surface.js +439 -0
- package/dist/vendor-surface.js.map +1 -0
- package/dist/version-rules.generated.d.ts +17 -0
- package/dist/version-rules.generated.d.ts.map +1 -0
- package/dist/version-rules.generated.js +99 -0
- package/dist/version-rules.generated.js.map +1 -0
- package/dist/view-transition-core.d.ts +99 -0
- package/dist/view-transition-core.d.ts.map +1 -0
- package/dist/view-transition-core.js +127 -0
- package/dist/view-transition-core.js.map +1 -0
- package/dist/view-transition-door.d.ts +26 -0
- package/dist/view-transition-door.d.ts.map +1 -0
- package/dist/view-transition-door.js +88 -0
- package/dist/view-transition-door.js.map +1 -0
- package/dist/window-identity.d.ts +3 -0
- package/dist/window-identity.d.ts.map +1 -0
- package/dist/window-identity.js +27 -0
- package/dist/window-identity.js.map +1 -0
- package/package.json +141 -2
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
//
|
|
2
|
+
// values.ts - the JSE value model. TS twin of Engine/JSE.swift / Jse.kt (same names,
|
|
3
|
+
// same arguments, same behaviors) — see the NUMBER MODEL / NULL MODEL contract there.
|
|
4
|
+
//
|
|
5
|
+
// Every runtime ships ONE coercion table; the conformance corpus
|
|
6
|
+
// (OpenSource/Conformance/jse) is the referee. Values are `unknown`; every number the
|
|
7
|
+
// evaluator produces is a JS number (double). Plain objects are dicts, arrays are lists.
|
|
8
|
+
//
|
|
9
|
+
import { PROXY_DENYLIST } from "../proxy-denylist.js";
|
|
10
|
+
import { elementHost } from "../element.js";
|
|
11
|
+
/** Foundation's NSNull, as the JSE scope sentinel: a bound-but-null lambda param /
|
|
12
|
+
* const / destructured key is stored as NSNull — observable: it shadows outer names and
|
|
13
|
+
* it does not number-coerce. It is FALSY, as null is (the truthiness law below). Its `toString` is Foundation's description for
|
|
14
|
+
* a DEBUG line; the value plane's coercion is `string`, which answers "" for it exactly as
|
|
15
|
+
* it does for null, so nothing renders a description into a hole. */
|
|
16
|
+
/** THE ARRAY WRITE CEILING, one law for both writers (logic parity JSE-VS-JS #18): the store's
|
|
17
|
+
* state path writer (store.ts STATE_PATH_LIMITS) and a block's or an action's local (jse.ts
|
|
18
|
+
* setInLocal). An indexed write past the end grows the array with null in the gap, unless the
|
|
19
|
+
* index is past `maxArrayIndex` or the write would add more than `maxArrayGrowth` elements; then
|
|
20
|
+
* it writes nothing. Twins: JSE.swift DsxStatePathPolicy, Kotlin State.kt StatePathPolicy. */
|
|
21
|
+
export const ARRAY_WRITE_LIMITS = Object.freeze({ maxArrayIndex: 9_999, maxArrayGrowth: 1_024 });
|
|
22
|
+
export const NSNull = {
|
|
23
|
+
__nsnull: true,
|
|
24
|
+
toString() { return "<null>"; },
|
|
25
|
+
};
|
|
26
|
+
export function isNSNull(v) {
|
|
27
|
+
return v === NSNull;
|
|
28
|
+
}
|
|
29
|
+
/** A value as a MODULE receives it: the absent/null sentinel is JSON's null at every depth, not only at the top.
|
|
30
|
+
* `{ files: { icon: null } }` read from author state reached a web module as `{ icon: { __nsnull: true } }`, which the
|
|
31
|
+
* module posted and the service refused.
|
|
32
|
+
* Both spellings are the sentinel: the identity object, and its plain copy after a JSON round trip of author state.
|
|
33
|
+
* Copy on write: a value with no sentinel inside is returned as is. Depth-bounded like every walk of author values. */
|
|
34
|
+
export function plainNulls(v, depth = 0) {
|
|
35
|
+
if (v === NSNull)
|
|
36
|
+
return null;
|
|
37
|
+
if (typeof v !== "object" || v === null || depth > 32)
|
|
38
|
+
return v;
|
|
39
|
+
if (Array.isArray(v)) {
|
|
40
|
+
let out = null;
|
|
41
|
+
for (let i = 0; i < v.length; i++) {
|
|
42
|
+
const p = plainNulls(v[i], depth + 1);
|
|
43
|
+
if (p !== v[i]) {
|
|
44
|
+
out ??= v.slice();
|
|
45
|
+
out[i] = p;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out ?? v;
|
|
49
|
+
}
|
|
50
|
+
if (Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null)
|
|
51
|
+
return v;
|
|
52
|
+
const keys = Object.keys(v);
|
|
53
|
+
if (keys.length === 1 && keys[0] === "__nsnull" && v.__nsnull === true)
|
|
54
|
+
return null;
|
|
55
|
+
let out = null;
|
|
56
|
+
for (const k of keys) {
|
|
57
|
+
const was = v[k];
|
|
58
|
+
const p = plainNulls(was, depth + 1);
|
|
59
|
+
if (p !== was) {
|
|
60
|
+
out ??= { ...v };
|
|
61
|
+
out[k] = p;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return out ?? v;
|
|
65
|
+
}
|
|
66
|
+
export function isDict(v) {
|
|
67
|
+
return typeof v === "object" && v !== null && !Array.isArray(v) && v !== NSNull && !isLambda(v);
|
|
68
|
+
}
|
|
69
|
+
export function isLambda(v) {
|
|
70
|
+
return typeof v === "object" && v !== null && v.__lambda === true;
|
|
71
|
+
}
|
|
72
|
+
/** Swift `.whitespaces` (space separators + tab — NO newlines): the trim used by
|
|
73
|
+
* JSE.eval, the `trim` builtins and `required`. Distinct from `.trim()` on blocks. */
|
|
74
|
+
export function isWhitespaceOnly(c) {
|
|
75
|
+
if (c === "\t")
|
|
76
|
+
return true;
|
|
77
|
+
// Unicode Zs (space separator) — the JS regex class matches Character.SPACE_SEPARATOR
|
|
78
|
+
return /^\p{Zs}$/u.test(c);
|
|
79
|
+
}
|
|
80
|
+
/** THE BRACE FORM OF AN EXPRESSION IS THE EXPRESSION ("every
|
|
81
|
+
* attribute takes {{ }}"). An expression attribute written `visible-if="{{ dsx.variable.on }}"`
|
|
82
|
+
* means `dsx.variable.on`: when the WHOLE trimmed text is one `{{ … }}` hole, the hole's content
|
|
83
|
+
* is the expression. `{{ … }}` is never valid JavaScript (an object literal cannot hold a bare
|
|
84
|
+
* object), so no expression that meant something else before changes meaning. A text with two
|
|
85
|
+
* holes (`{{ a }} and {{ b }}`) is not one hole and is left alone. Braces inside string literals
|
|
86
|
+
* do not count. Twins: Jse.kt `JSE.unwrapBraceExpression`, JSE.swift `JSE.unwrapBraceExpression`;
|
|
87
|
+
* corpus jse/core-005.json `brace-form-*`. */
|
|
88
|
+
export function unwrapBraceExpression(e) {
|
|
89
|
+
if (e.length < 4 || e.charCodeAt(0) !== 123 || e.charCodeAt(1) !== 123)
|
|
90
|
+
return e;
|
|
91
|
+
if (e.charCodeAt(e.length - 1) !== 125 || e.charCodeAt(e.length - 2) !== 125)
|
|
92
|
+
return e;
|
|
93
|
+
let depth = 0;
|
|
94
|
+
let quote = "";
|
|
95
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
96
|
+
const c = e[i];
|
|
97
|
+
if (quote !== "") {
|
|
98
|
+
if (c === "\\") {
|
|
99
|
+
i += 1;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (c === quote)
|
|
103
|
+
quote = "";
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (c === "'" || c === '"' || c === "`") {
|
|
107
|
+
quote = c;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (c === "{")
|
|
111
|
+
depth += 1;
|
|
112
|
+
else if (c === "}") {
|
|
113
|
+
depth -= 1;
|
|
114
|
+
// the outer brace closed before the last character: not one hole
|
|
115
|
+
if (depth === 0 && i !== e.length - 1)
|
|
116
|
+
return e;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (depth !== 0)
|
|
120
|
+
return e;
|
|
121
|
+
// the inner pair must close at the second-to-last character too, or `{{a}{b}}` would pass
|
|
122
|
+
let d = 0;
|
|
123
|
+
quote = "";
|
|
124
|
+
for (let i = 1; i < e.length - 1; i += 1) {
|
|
125
|
+
const c = e[i];
|
|
126
|
+
if (quote !== "") {
|
|
127
|
+
if (c === "\\") {
|
|
128
|
+
i += 1;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (c === quote)
|
|
132
|
+
quote = "";
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (c === "'" || c === '"' || c === "`") {
|
|
136
|
+
quote = c;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (c === "{")
|
|
140
|
+
d += 1;
|
|
141
|
+
else if (c === "}") {
|
|
142
|
+
d -= 1;
|
|
143
|
+
if (d === 0 && i !== e.length - 2)
|
|
144
|
+
return e;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return trimWhitespaceOnly(e.substring(2, e.length - 2));
|
|
148
|
+
}
|
|
149
|
+
export function trimWhitespaceOnly(s) {
|
|
150
|
+
let start = 0;
|
|
151
|
+
let end = s.length;
|
|
152
|
+
while (start < end && isWhitespaceOnly(s[start]))
|
|
153
|
+
start += 1;
|
|
154
|
+
while (end > start && isWhitespaceOnly(s[end - 1]))
|
|
155
|
+
end -= 1;
|
|
156
|
+
return s.substring(start, end);
|
|
157
|
+
}
|
|
158
|
+
/** Swift `String.count` counts extended grapheme clusters. Intl.Segmenter is the web's
|
|
159
|
+
* grapheme segmenter — same seam note as the JVM BreakIterator twin. */
|
|
160
|
+
const segmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(undefined, { granularity: "grapheme" }) : null;
|
|
161
|
+
export function graphemes(s) {
|
|
162
|
+
if (s.length === 0)
|
|
163
|
+
return [];
|
|
164
|
+
if (segmenter) {
|
|
165
|
+
const out = [];
|
|
166
|
+
for (const seg of segmenter.segment(s))
|
|
167
|
+
out.push(seg.segment);
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
return Array.from(s); // code-point fallback (no Segmenter host)
|
|
171
|
+
}
|
|
172
|
+
export function charCount(s) {
|
|
173
|
+
// fast path: no surrogates / combining marks → length is the grapheme count
|
|
174
|
+
let simple = true;
|
|
175
|
+
for (let i = 0; i < s.length; i++) {
|
|
176
|
+
if (s.charCodeAt(i) >= 0x0300) {
|
|
177
|
+
simple = false;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (simple)
|
|
182
|
+
return s.length;
|
|
183
|
+
return graphemes(s).length;
|
|
184
|
+
}
|
|
185
|
+
/** Swift `Double(String)` grammar (the `number()` string coercion): full-string parse,
|
|
186
|
+
* no whitespace tolerance, no "1f"/"1d" suffixes, "inf"/"infinity"/"nan"
|
|
187
|
+
* case-insensitive, bare hex ("0x1F") accepted. Partial numbers ("12px") are null. */
|
|
188
|
+
export function swiftDouble(s) {
|
|
189
|
+
if (s.length === 0)
|
|
190
|
+
return null;
|
|
191
|
+
if (/\s/.test(s[0]) || /\s/.test(s[s.length - 1]))
|
|
192
|
+
return null;
|
|
193
|
+
const neg = s.startsWith("-");
|
|
194
|
+
const body = s.startsWith("+") || neg ? s.substring(1) : s;
|
|
195
|
+
if (body.length === 0)
|
|
196
|
+
return null;
|
|
197
|
+
const lower = body.toLowerCase();
|
|
198
|
+
if (lower === "inf" || lower === "infinity")
|
|
199
|
+
return neg ? -Infinity : Infinity;
|
|
200
|
+
if (lower === "nan")
|
|
201
|
+
return NaN;
|
|
202
|
+
if (lower.startsWith("0x")) {
|
|
203
|
+
// hex — integer mantissa or hex-float with binary exponent (Swift grammar)
|
|
204
|
+
if (/^0x[0-9a-f]+$/.test(lower)) {
|
|
205
|
+
const v = parseInt(lower, 16);
|
|
206
|
+
return neg ? -v : v;
|
|
207
|
+
}
|
|
208
|
+
if (/^0x[0-9a-f]*(\.[0-9a-f]*)?p[+-]?[0-9]+$/.test(lower)) {
|
|
209
|
+
const m = /^0x([0-9a-f]*)(?:\.([0-9a-f]*))?p([+-]?[0-9]+)$/.exec(lower);
|
|
210
|
+
const intPart = m[1] ?? "";
|
|
211
|
+
const fracPart = m[2] ?? "";
|
|
212
|
+
if (intPart.length === 0 && fracPart.length === 0)
|
|
213
|
+
return null;
|
|
214
|
+
let mant = 0;
|
|
215
|
+
for (const c of intPart)
|
|
216
|
+
mant = mant * 16 + parseInt(c, 16);
|
|
217
|
+
let scale = 1 / 16;
|
|
218
|
+
for (const c of fracPart) {
|
|
219
|
+
mant += parseInt(c, 16) * scale;
|
|
220
|
+
scale /= 16;
|
|
221
|
+
}
|
|
222
|
+
const v = mant * Math.pow(2, parseInt(m[3], 10));
|
|
223
|
+
return neg ? -v : v;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
const last = body[body.length - 1].toLowerCase();
|
|
228
|
+
if (last === "f" || last === "d")
|
|
229
|
+
return null; // Java/CSS suffix tolerance Swift rejects
|
|
230
|
+
// Swift Double(String) decimal grammar: digits [. digits] [e[+-]digits] — reject the
|
|
231
|
+
// JS-only laxness (binary/octal literals, "1_000", empty → 0).
|
|
232
|
+
if (!/^(\d+(?:\.\d*)?|\.\d+)(e[+-]?\d+)?$/i.test(body))
|
|
233
|
+
return null;
|
|
234
|
+
const v = Number(body);
|
|
235
|
+
if (Number.isNaN(v))
|
|
236
|
+
return null;
|
|
237
|
+
return neg ? -v : v;
|
|
238
|
+
}
|
|
239
|
+
export function number(v) {
|
|
240
|
+
if (typeof v === "number")
|
|
241
|
+
return v;
|
|
242
|
+
if (typeof v === "boolean")
|
|
243
|
+
return v ? 1 : 0;
|
|
244
|
+
if (typeof v === "string")
|
|
245
|
+
return swiftDouble(v);
|
|
246
|
+
if (isDict(v)) {
|
|
247
|
+
const d = v["__date"];
|
|
248
|
+
return typeof d === "number" ? d : null; // JS Date coerces to its ms
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
// wired by core.ts (JSECore.stringCoerce) — breaks the import cycle values ⇄ globals
|
|
253
|
+
let stringCoerceHook = null;
|
|
254
|
+
export function setStringCoerce(fn) {
|
|
255
|
+
stringCoerceHook = fn;
|
|
256
|
+
}
|
|
257
|
+
export function string(v) {
|
|
258
|
+
if (isDict(v) && stringCoerceHook) {
|
|
259
|
+
const c = stringCoerceHook(v); // Date→ISO, URL→href, params→query
|
|
260
|
+
if (c !== null)
|
|
261
|
+
return c;
|
|
262
|
+
}
|
|
263
|
+
if (typeof v === "string")
|
|
264
|
+
return v;
|
|
265
|
+
// A BOOLEAN PRINTS AS JAVASCRIPT PRINTS IT (`'' + true === 'true'`), on all three lanes
|
|
266
|
+
// (corpus jse/core-001.json, the bool-* rows). The "1"/"0" spelling was iOS's NSNumber
|
|
267
|
+
// bridge leaking into the language; an author reads JavaScript and gets JavaScript.
|
|
268
|
+
if (typeof v === "boolean")
|
|
269
|
+
return v ? "true" : "false";
|
|
270
|
+
if (typeof v === "number") {
|
|
271
|
+
// ONE SPELLING FOR A NON FINITE NUMBER, the JavaScript one (Appendix E item 10). The
|
|
272
|
+
// three kernels printed two: `nan`/`inf`/`-inf` here and on Kotlin (Swift's
|
|
273
|
+
// `"\(Double.nan)"`), `NaN`/`Infinity`/`-Infinity` on iOS. Both spellings coerce back to
|
|
274
|
+
// the same double, so `==` hid the split and only a character walk saw it. The JS
|
|
275
|
+
// spelling wins because an author reads it in every other JavaScript they know, and it
|
|
276
|
+
// is what `numberFrom` already accepts case insensitively, so the round trip holds.
|
|
277
|
+
if (Number.isNaN(v))
|
|
278
|
+
return "NaN";
|
|
279
|
+
if (v === Infinity)
|
|
280
|
+
return "Infinity";
|
|
281
|
+
if (v === -Infinity)
|
|
282
|
+
return "-Infinity";
|
|
283
|
+
// JAVASCRIPT'S NUMBER TO STRING, AT EVERY MAGNITUDE (logic parity B4 to B6). The exotic
|
|
284
|
+
// range used to be "descriptive, not contractual", and it was three descriptions: this
|
|
285
|
+
// lane saturated at 9e18, Kotlin at Long.MAX_VALUE, iOS printed the exact binary integer.
|
|
286
|
+
// One spelling now, the one an author reads everywhere else: `1e+21`, `1e-7`. Twins:
|
|
287
|
+
// JSE.swift / Jse.kt `jsNumberString`.
|
|
288
|
+
return String(v);
|
|
289
|
+
}
|
|
290
|
+
// AN ARRAY PRINTS AS ITS JOIN (`[1, 2] + ''` is `1,2`), each element as it prints alone, so a
|
|
291
|
+
// null element is empty rather than the sentinel's description; an object element is
|
|
292
|
+
// `[object Object]`. The natives printed their own debug descriptions (`[1.0, 2.0]`, `[:]`).
|
|
293
|
+
if (Array.isArray(v))
|
|
294
|
+
return v.map((e) => (isDict(e) ? "[object Object]" : string(e))).join(",");
|
|
295
|
+
if (v === null || v === undefined)
|
|
296
|
+
return "";
|
|
297
|
+
// THE SCOPE SENTINEL HAS NO TEXT, exactly as null has none. It is an internal marker for
|
|
298
|
+
// "bound, and null", and the descriptive fallback below spelled its toString, so a corpus
|
|
299
|
+
// value that is null rendered the four characters `<null>` in a hole where iOS rendered
|
|
300
|
+
// nothing (JSE.swift `case is NSNull`, the pixel parity program's `NSNull interpolates
|
|
301
|
+
// empty`). Twins: JSE.swift `string`, Jse.kt `JSE.string`.
|
|
302
|
+
if (isNSNull(v))
|
|
303
|
+
return "";
|
|
304
|
+
// AN OBJECT WITH NO PROTOTYPE PRINTS AS EVERY OTHER OBJECT DOES, `[object Object]` (logic parity B2, the
|
|
305
|
+
// array rule above). `String` of it throws in JavaScript, which escaped a `{{ }}` hole and a `'' + x` as a raw
|
|
306
|
+
// TypeError; the call value a document holds is one (Conformance/held-calls/document-stop.json). Twins:
|
|
307
|
+
// Jse.kt and JSE.swift `string` (`DSXCall`).
|
|
308
|
+
if (typeof v === "object" && Object.getPrototypeOf(v) === null)
|
|
309
|
+
return "[object Object]";
|
|
310
|
+
return String(v); // lambdas, descriptive fallback
|
|
311
|
+
}
|
|
312
|
+
export function truthy(v) {
|
|
313
|
+
if (typeof v === "boolean")
|
|
314
|
+
return v;
|
|
315
|
+
if (typeof v === "string")
|
|
316
|
+
return v.length > 0; // "0" and "false" are TRUE
|
|
317
|
+
if (typeof v === "number")
|
|
318
|
+
return v !== 0; // NaN != 0 → NaN is truthy
|
|
319
|
+
// THE SENTINEL IS NULL FOR A TRUTH VALUE. A bound-but-null name (a lambda param, a literal's
|
|
320
|
+
// null field, a const) is stored as NSNull, and reading it truthy made `rows.filter(r => r.on)`
|
|
321
|
+
// keep a row whose `on` is null: the served first frame painted what the device dropped
|
|
322
|
+
// (JSE.swift has answered falsy since 1066c5c53). null, undefined, 0, '' and false are the
|
|
323
|
+
// falsy five on every lane (Conformance/jse/core-002.json, the `falsy-` rows).
|
|
324
|
+
if (v === null || v === undefined || v === NSNull)
|
|
325
|
+
return false;
|
|
326
|
+
return true; // arrays, dicts, lambdas
|
|
327
|
+
}
|
|
328
|
+
/** Coerce any stored collection to a list for the collection functions / array verbs. */
|
|
329
|
+
export function asArray(v) {
|
|
330
|
+
return Array.isArray(v) ? v : [];
|
|
331
|
+
}
|
|
332
|
+
/** Coerce to ROW form — non-dict / NSNull elements drop, real rows survive. */
|
|
333
|
+
export function asRows(v) {
|
|
334
|
+
if (!Array.isArray(v))
|
|
335
|
+
return [];
|
|
336
|
+
return v.filter((e) => isDict(e));
|
|
337
|
+
}
|
|
338
|
+
/** A stable, deep key for `<watch>` equality - changes iff the value meaningfully
|
|
339
|
+
* changes (dict keys sorted so ordering never churns).
|
|
340
|
+
*
|
|
341
|
+
* CYCLE-SAFE, and it has to be. This is the JS plane's structural identity function:
|
|
342
|
+
* every store write runs it, and `jseEquals` delegates to it for dicts and arrays. A
|
|
343
|
+
* self-referencing value therefore did not merely render wrong, it overflowed the stack
|
|
344
|
+
* on the write that introduced it and took the surface with it - the exact failure the
|
|
345
|
+
* component depth floor exists to prevent, one layer lower and louder. Native data
|
|
346
|
+
* cannot express the shape (Swift dictionaries and arrays are value types), so this is a
|
|
347
|
+
* JS-plane guard rather than a cross-renderer law.
|
|
348
|
+
*
|
|
349
|
+
* A node already on the current PATH keys as a cycle marker and stops. `seen` is unwound
|
|
350
|
+
* after each branch, so a value shared by two siblings still expands in both - the key
|
|
351
|
+
* for any acyclic input is byte-identical to what it always was.
|
|
352
|
+
*
|
|
353
|
+
* STACK-SAFE, and it also has to be. The walk is driven by the DATA, so its depth is the
|
|
354
|
+
* data's depth, and the data's depth is whatever a surface happens to nest to: a
|
|
355
|
+
* self-recursive component hands this function one value per expansion level, and each
|
|
356
|
+
* level is a row item view whose key read runs a proxy trap, so a frame here is far
|
|
357
|
+
* heavier than a frame in a plain object walk. A recursive walk therefore lived or died
|
|
358
|
+
* on how much host stack the runtime happened to give the thread: the same corrupt-data
|
|
359
|
+
* case that returns a bounded key on a roomy main thread threw "Maximum call stack size
|
|
360
|
+
* exceeded" on a smaller one, which is a property of the machine and not of the value.
|
|
361
|
+
* The walk is an explicit stack of frames instead, so the host stack stays flat however
|
|
362
|
+
* deep the value goes and the answer is the same everywhere. `seen` keeps its meaning: it
|
|
363
|
+
* is the set of nodes on the current path, added when a frame opens and dropped when it
|
|
364
|
+
* closes, so the byte-for-byte output is unchanged. */
|
|
365
|
+
export function watchKey(v, seen) {
|
|
366
|
+
if (v === null || v === undefined || v === NSNull)
|
|
367
|
+
return "∅";
|
|
368
|
+
if (typeof v === "string")
|
|
369
|
+
return "s\u0001" + v;
|
|
370
|
+
if (typeof v === "boolean")
|
|
371
|
+
return v ? "b1" : "b0";
|
|
372
|
+
if (typeof v === "number")
|
|
373
|
+
return "n\u0001" + string(v);
|
|
374
|
+
const path = seen ?? new Set();
|
|
375
|
+
// One open node, as [node, sorted dict keys or null for an array, how far along it is,
|
|
376
|
+
// how many children it has written]. Null keys is also which bracket closes it, and the
|
|
377
|
+
// count is what puts the separator BETWEEN children, exactly where `join` put it.
|
|
378
|
+
const frames = [];
|
|
379
|
+
let out = "";
|
|
380
|
+
let value = v;
|
|
381
|
+
let prefix = "";
|
|
382
|
+
for (;;) {
|
|
383
|
+
let leaf = null;
|
|
384
|
+
if (value === null || value === undefined || value === NSNull)
|
|
385
|
+
leaf = "∅";
|
|
386
|
+
else if (typeof value === "string")
|
|
387
|
+
leaf = "s" + value;
|
|
388
|
+
else if (typeof value === "boolean")
|
|
389
|
+
leaf = value ? "b1" : "b0";
|
|
390
|
+
else if (typeof value === "number")
|
|
391
|
+
leaf = "n" + string(value);
|
|
392
|
+
else if (!Array.isArray(value) && !isDict(value))
|
|
393
|
+
leaf = "x" + String(value);
|
|
394
|
+
else if (path.has(value))
|
|
395
|
+
leaf = "↺";
|
|
396
|
+
if (leaf !== null)
|
|
397
|
+
out += prefix + leaf;
|
|
398
|
+
else {
|
|
399
|
+
const node = value;
|
|
400
|
+
path.add(node);
|
|
401
|
+
const keys = Array.isArray(node) ? null : Object.keys(node).sort();
|
|
402
|
+
out += prefix + (keys === null ? "[" : "{");
|
|
403
|
+
frames.push([node, keys, 0, 0]);
|
|
404
|
+
}
|
|
405
|
+
// The next value comes from the innermost open node; a node with nothing left closes
|
|
406
|
+
// and hands the question to the one above it, which is where the recursion returned.
|
|
407
|
+
for (;;) {
|
|
408
|
+
const frame = frames[frames.length - 1];
|
|
409
|
+
if (frame === undefined)
|
|
410
|
+
return out;
|
|
411
|
+
const [node, keys] = frame;
|
|
412
|
+
const at = frame[2];
|
|
413
|
+
if (at >= (keys === null ? node.length : keys.length)) {
|
|
414
|
+
path.delete(node);
|
|
415
|
+
frames.pop();
|
|
416
|
+
out += keys === null ? "]" : "}";
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
frame[2] = at + 1;
|
|
420
|
+
if (frame[3] > 0)
|
|
421
|
+
out += "";
|
|
422
|
+
frame[3] += 1;
|
|
423
|
+
if (keys === null) {
|
|
424
|
+
// A hole stays a hole: `map` never called the walker for one and `join` wrote it
|
|
425
|
+
// as an empty slot, which is the separator above and nothing else. An array index
|
|
426
|
+
// is never inherited, so `in` reads own slots here.
|
|
427
|
+
if (!(at in node))
|
|
428
|
+
continue;
|
|
429
|
+
value = node[at];
|
|
430
|
+
prefix = "";
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
const key = keys[at];
|
|
434
|
+
value = node[key];
|
|
435
|
+
prefix = `${key}=`;
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
export function jseEquals(a, b) {
|
|
442
|
+
// The scope sentinel reads as null here: a bound-but-null lambda param / const /
|
|
443
|
+
// destructured key is stored as NSNull, and `x == null` is the guard every author
|
|
444
|
+
// writes. Without this the sentinel fell through to string coercion ("<null>" != "")
|
|
445
|
+
// and the guard was silently false. Null equals only null — includes/indexOf/switch/
|
|
446
|
+
// Map/Set all ride this function, so they inherit the law.
|
|
447
|
+
if (a === NSNull || a === undefined)
|
|
448
|
+
a = null;
|
|
449
|
+
if (b === NSNull || b === undefined)
|
|
450
|
+
b = null;
|
|
451
|
+
if (a === null || b === null)
|
|
452
|
+
return a === b;
|
|
453
|
+
const x = number(a);
|
|
454
|
+
const y = number(b);
|
|
455
|
+
if (x !== null && y !== null)
|
|
456
|
+
return x === y; // NaN != NaN, -0 == 0 (Swift semantics)
|
|
457
|
+
// Structural equality for plain dicts/arrays — deep, key-order-insensitive.
|
|
458
|
+
// String-coercible value objects (Date→ISO, URL→href, …) keep coerced-string equality.
|
|
459
|
+
const structural = (v) => {
|
|
460
|
+
if (isDict(v))
|
|
461
|
+
return stringCoerceHook === null || stringCoerceHook(v) === null;
|
|
462
|
+
return Array.isArray(v);
|
|
463
|
+
};
|
|
464
|
+
if (structural(a) || structural(b))
|
|
465
|
+
return watchKey(a) === watchKey(b);
|
|
466
|
+
return string(a) === string(b);
|
|
467
|
+
}
|
|
468
|
+
/** The value kind `===` compares before the value (proposals/strict-equality.md, Decision 1):
|
|
469
|
+
* 0 null (null, undefined, the scope sentinel: one value in JSE), 1 boolean, 2 number,
|
|
470
|
+
* 3 string, 4 array, 5 plain dict, 6 value object (a dict with a string coercion: Date,
|
|
471
|
+
* URL, …), 7 function, 8 anything else. Swift `JSE.strictKind` and Kotlin `strictKind` are
|
|
472
|
+
* the twins. */
|
|
473
|
+
export function strictKind(v) {
|
|
474
|
+
if (v === null || v === undefined || v === NSNull)
|
|
475
|
+
return 0;
|
|
476
|
+
if (typeof v === "boolean")
|
|
477
|
+
return 1;
|
|
478
|
+
if (typeof v === "number")
|
|
479
|
+
return 2;
|
|
480
|
+
if (typeof v === "string")
|
|
481
|
+
return 3;
|
|
482
|
+
if (Array.isArray(v))
|
|
483
|
+
return 4;
|
|
484
|
+
if (isLambda(v))
|
|
485
|
+
return 7;
|
|
486
|
+
if (isDict(v))
|
|
487
|
+
return stringCoerceHook !== null && stringCoerceHook(v) !== null ? 6 : 5;
|
|
488
|
+
return 8;
|
|
489
|
+
}
|
|
490
|
+
/** `===` / `!==`: the kind first, then the value, with no coercion (corpus core-001
|
|
491
|
+
* `strict-eq-*`). `==` stays `jseEquals`, and so do switch, includes, indexOf, Map and Set. */
|
|
492
|
+
export function jseStrictEquals(a, b) {
|
|
493
|
+
const k = strictKind(a);
|
|
494
|
+
if (k !== strictKind(b))
|
|
495
|
+
return false;
|
|
496
|
+
switch (k) {
|
|
497
|
+
case 0: return true;
|
|
498
|
+
case 1:
|
|
499
|
+
case 2:
|
|
500
|
+
case 3: return a === b; // IEEE for numbers: NaN !== NaN, -0 === 0
|
|
501
|
+
case 4:
|
|
502
|
+
case 5: return watchKey(a) === watchKey(b); // kind-tagged leaves: [1] !== ['1']
|
|
503
|
+
case 7: return false; // no portable identity (a Swift lambda is a value)
|
|
504
|
+
default: return string(a) === string(b);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
export function compare(a, b, o) {
|
|
508
|
+
// Both operands strings → JS lexicographic ordering; anything else numeric (?? 0).
|
|
509
|
+
if (typeof a === "string" && typeof b === "string") {
|
|
510
|
+
switch (o) {
|
|
511
|
+
case "<": return a < b;
|
|
512
|
+
case "<=": return a <= b;
|
|
513
|
+
case ">": return a > b;
|
|
514
|
+
default: return a >= b;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const x = number(a) ?? 0;
|
|
518
|
+
const y = number(b) ?? 0;
|
|
519
|
+
switch (o) {
|
|
520
|
+
case "<": return x < y;
|
|
521
|
+
case "<=": return x <= y;
|
|
522
|
+
case ">": return x > y;
|
|
523
|
+
default: return x >= y;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/** JavaScript's StringToNumber for what `swiftDouble` (the JSE literal grammar) does not read:
|
|
527
|
+
* surrounding whitespace and line terminators, the empty or blank string (0), and the `0b`,
|
|
528
|
+
* `0o` and `0x` prefixes. Null when the text is not a number (logic parity, JSE-VS-JS item 2;
|
|
529
|
+
* corpus jse/number-coercion-001.json). Twins: Jse.kt / JSE.swift `jsStringNumber`. */
|
|
530
|
+
export function jsStringNumber(s) {
|
|
531
|
+
const t = s.trim(); // trim() strips exactly the \s set, U+FEFF included, in linear time
|
|
532
|
+
if (t.length === 0)
|
|
533
|
+
return 0;
|
|
534
|
+
const direct = swiftDouble(t);
|
|
535
|
+
if (direct !== null)
|
|
536
|
+
return /^[+-]?0x/i.test(t) && /^[+-]/.test(t) ? null : direct;
|
|
537
|
+
const m = /^0([box])([0-9a-f]+)$/i.exec(t);
|
|
538
|
+
if (m === null)
|
|
539
|
+
return null;
|
|
540
|
+
const radix = { b: 2, o: 8, x: 16 }[m[1].toLowerCase()];
|
|
541
|
+
const digits = m[2].toLowerCase();
|
|
542
|
+
let out = 0;
|
|
543
|
+
for (const c of digits) {
|
|
544
|
+
const d = parseInt(c, 16);
|
|
545
|
+
if (d >= radix)
|
|
546
|
+
return null;
|
|
547
|
+
out = out * radix + d;
|
|
548
|
+
}
|
|
549
|
+
return out;
|
|
550
|
+
}
|
|
551
|
+
/** ToNumber as Number(), unary plus and the arithmetic operators other than `+` read it: the
|
|
552
|
+
* JSE reading first, then a string's JavaScript reading, an array through its text, null as 0. */
|
|
553
|
+
export function numberJS(v) {
|
|
554
|
+
// A text reads through StringToNumber alone, so a signed hex text is NaN as in JavaScript
|
|
555
|
+
// (`Number('-0x10')`; the Swift literal grammar read it as -16; logic parity sweep 5).
|
|
556
|
+
if (typeof v === "string")
|
|
557
|
+
return jsStringNumber(v);
|
|
558
|
+
const n = number(v);
|
|
559
|
+
if (n !== null)
|
|
560
|
+
return n;
|
|
561
|
+
if (Array.isArray(v))
|
|
562
|
+
return jsStringNumber(string(v));
|
|
563
|
+
if (v === null || v === NSNull)
|
|
564
|
+
return 0;
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
export function arith(a, b, o) {
|
|
568
|
+
if (o === "+") {
|
|
569
|
+
// JavaScript's +: a string on either side concatenates, and only two non-strings add
|
|
570
|
+
// (corpus jse/plus-concat-001.json; '2' + '5' answered 7 under
|
|
571
|
+
// the retired law "numeric strings add"). null + 1 stays "1" (null has no text, kept).
|
|
572
|
+
if (typeof a !== "string" && typeof b !== "string") {
|
|
573
|
+
const x = number(a);
|
|
574
|
+
const y = number(b);
|
|
575
|
+
if (x !== null && y !== null)
|
|
576
|
+
return x + y;
|
|
577
|
+
}
|
|
578
|
+
return string(a) + string(b); // string concat
|
|
579
|
+
}
|
|
580
|
+
// A value with no number is NaN, as in JavaScript (corpus jse/number-text-nan-001.json; it
|
|
581
|
+
// was 0). The written laws hold: null is 0 (numberJS), and division by zero is 0 below.
|
|
582
|
+
const x = numberJS(a) ?? NaN;
|
|
583
|
+
const y = numberJS(b) ?? NaN;
|
|
584
|
+
switch (o) {
|
|
585
|
+
case "-": return x - y;
|
|
586
|
+
case "*": return x * y;
|
|
587
|
+
case "/": return y === 0 ? 0 : x / y; // DIVISION BY ZERO YIELDS 0 — the JSE law
|
|
588
|
+
case "%": return y === 0 ? 0 : x % y; // JS % (sign of dividend); %0 → 0 like /0
|
|
589
|
+
default: return 0;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/** The ONE missing value (`??` / `?.` nullish test): null, undefined, and the
|
|
593
|
+
* present-null scope sentinel all count — JSE does not split them. */
|
|
594
|
+
export function isMissing(v) {
|
|
595
|
+
return v === null || v === undefined || v === NSNull;
|
|
596
|
+
}
|
|
597
|
+
/** JS ToInt32 — trunc, wrap mod 2^32 into the signed range. NaN/±inf → 0. */
|
|
598
|
+
export function toInt32(v) {
|
|
599
|
+
let n = number(v) ?? 0;
|
|
600
|
+
if (!Number.isFinite(n))
|
|
601
|
+
return 0;
|
|
602
|
+
n = Math.trunc(n) % 4294967296;
|
|
603
|
+
if (n >= 2147483648)
|
|
604
|
+
n -= 4294967296;
|
|
605
|
+
else if (n < -2147483648)
|
|
606
|
+
n += 4294967296;
|
|
607
|
+
return n;
|
|
608
|
+
}
|
|
609
|
+
/** JS ToUint32 — trunc, wrap mod 2^32 into [0, 2^32). NaN/±inf → 0. */
|
|
610
|
+
export function toUint32(v) {
|
|
611
|
+
let n = number(v) ?? 0;
|
|
612
|
+
if (!Number.isFinite(n))
|
|
613
|
+
return 0;
|
|
614
|
+
n = Math.trunc(n) % 4294967296;
|
|
615
|
+
if (n < 0)
|
|
616
|
+
n += 4294967296;
|
|
617
|
+
return n;
|
|
618
|
+
}
|
|
619
|
+
/** Bitwise / shift operators — JS semantics: Int32 operands (Uint32 for `>>>`),
|
|
620
|
+
* shift counts masked to 5 bits, results back as numbers. */
|
|
621
|
+
export function bitOp(a, b, o) {
|
|
622
|
+
const s = toUint32(b) & 31;
|
|
623
|
+
switch (o) {
|
|
624
|
+
case "&": return toInt32(a) & toInt32(b);
|
|
625
|
+
case "|": return toInt32(a) | toInt32(b);
|
|
626
|
+
case "^": return toInt32(a) ^ toInt32(b);
|
|
627
|
+
case "<<": return (toInt32(a) << s) | 0;
|
|
628
|
+
case ">>": return toInt32(a) >> s;
|
|
629
|
+
case ">>>": return toUint32(a) >>> s;
|
|
630
|
+
default: return 0;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
/** JS `~` — bitwise NOT over ToInt32 (−int32 − 1, the twins' spelling). */
|
|
634
|
+
export function bitNot(v) {
|
|
635
|
+
return -toInt32(v) - 1;
|
|
636
|
+
}
|
|
637
|
+
/** JS `**` — operands number-coerced with `?? 0`, exactly like `*` (the arith table). */
|
|
638
|
+
export function powOp(a, b) {
|
|
639
|
+
// ToNumber as the other arithmetic operators read it (a padded or hex text is its number,
|
|
640
|
+
// a value with no number is NaN; corpus jse/number-text-nan-001.json).
|
|
641
|
+
return Math.pow(numberJS(a) ?? NaN, numberJS(b) ?? NaN);
|
|
642
|
+
}
|
|
643
|
+
/** JS `typeof` — with one deliberate divergence: null and undefined both report
|
|
644
|
+
* "undefined" (JSE does not split them). Arrays and dicts are "object". */
|
|
645
|
+
export function typeofString(v) {
|
|
646
|
+
if (v === null || v === undefined || v === NSNull)
|
|
647
|
+
return "undefined";
|
|
648
|
+
if (typeof v === "string")
|
|
649
|
+
return "string";
|
|
650
|
+
if (typeof v === "boolean")
|
|
651
|
+
return "boolean";
|
|
652
|
+
if (typeof v === "number")
|
|
653
|
+
return "number";
|
|
654
|
+
if (isLambda(v))
|
|
655
|
+
return "function";
|
|
656
|
+
return "object";
|
|
657
|
+
}
|
|
658
|
+
/** Double → integer without trapping on NaN / ±inf / out-of-range (author-controllable).
|
|
659
|
+
* NaN → 0; ±Infinity SATURATES to ±9.0e18 (so `substring(0, Infinity)` / `toSpliced`
|
|
660
|
+
* clamp toward "the end", never toward index 0). */
|
|
661
|
+
export function safeInt(d) {
|
|
662
|
+
if (Number.isNaN(d))
|
|
663
|
+
return 0;
|
|
664
|
+
return Math.trunc(Math.min(Math.max(d, -9.0e18), 9.0e18));
|
|
665
|
+
}
|
|
666
|
+
/** Swift `Double.rounded()` — .toNearestOrAwayFromZero, without the floor(x+0.5) bug. */
|
|
667
|
+
export function roundedAwayFromZero(x) {
|
|
668
|
+
if (Number.isNaN(x) || !Number.isFinite(x))
|
|
669
|
+
return x;
|
|
670
|
+
const a = Math.abs(x);
|
|
671
|
+
const f = Math.floor(a);
|
|
672
|
+
const r = a - f >= 0.5 ? f + 1 : f;
|
|
673
|
+
return x < 0 ? -r : r;
|
|
674
|
+
}
|
|
675
|
+
/** Swift `Swift.min` / `Swift.max` exactly (positional NaN, unlike Math.min). */
|
|
676
|
+
export function swiftMin(a, b) { return b < a ? b : a; }
|
|
677
|
+
export function swiftMax(a, b) { return b >= a ? b : a; }
|
|
678
|
+
/** Foundation `.capitalized`: each letter-run starts uppercase, the rest lowercased. */
|
|
679
|
+
export function capitalizedSwift(s) {
|
|
680
|
+
let out = "";
|
|
681
|
+
let prevLetter = false;
|
|
682
|
+
for (const ch of s) {
|
|
683
|
+
const isLetter = /\p{L}/u.test(ch);
|
|
684
|
+
out += isLetter && !prevLetter ? ch.toUpperCase() : isLetter ? ch.toLowerCase() : ch;
|
|
685
|
+
prevLetter = isLetter;
|
|
686
|
+
}
|
|
687
|
+
return out;
|
|
688
|
+
}
|
|
689
|
+
/** JS `base[idx]`: numeric index into an array (bounds-checked), string key into a dict.
|
|
690
|
+
* A string key equal to a name on `PROXY_DENYLIST` refuses exactly like `member()`
|
|
691
|
+
* (K19): `base["constructor"]` reaches the same host prototype `base.constructor` does,
|
|
692
|
+
* a literal key and a computed one alike, so the bracket door reads the same denylist
|
|
693
|
+
* through the same reporter rather than trusting the dot door to catch every author. */
|
|
694
|
+
export function index(base, idx) {
|
|
695
|
+
// A dict answers its own KEY, a numeric-looking one included (`{ '3': c }['3']` and `[3]`
|
|
696
|
+
// are the key '3', as in JS); only a non-dict takes the numeric path (jse/dict-key-index-001).
|
|
697
|
+
const n = isDict(base) ? null : number(idx);
|
|
698
|
+
if (n !== null) {
|
|
699
|
+
const i = safeInt(n);
|
|
700
|
+
const arr = asArray(base);
|
|
701
|
+
return i >= 0 && i < arr.length ? arr[i] : null;
|
|
702
|
+
}
|
|
703
|
+
const key = string(idx);
|
|
704
|
+
if (PROXY_DENYLIST.has(key)) {
|
|
705
|
+
try {
|
|
706
|
+
memberDeniedFn?.(key);
|
|
707
|
+
}
|
|
708
|
+
catch { /* the reporter never blocks the evaluator */ }
|
|
709
|
+
return null;
|
|
710
|
+
}
|
|
711
|
+
return ownProperty(base, key);
|
|
712
|
+
}
|
|
713
|
+
// ── the MEMBER GUARD seam (K19, the reference evaluator's own member access) ───────────
|
|
714
|
+
//
|
|
715
|
+
// `member()` on a plain JS object is `(base as Dict)[m]`, which walks the JS prototype
|
|
716
|
+
// chain the language itself gives every object: `({}).constructor`, `({}).__proto__`,
|
|
717
|
+
// `({}).toString` and `({}).valueOf` all answer a real host value here, because `isDict`
|
|
718
|
+
// only asks `typeof === "object"` and says nothing about OWN versus INHERITED. The JS
|
|
719
|
+
// tier's proxy plane already refuses these names (proxy-denylist.ts, PROXY_DENYLIST) so a
|
|
720
|
+
// callable proxy cannot dispatch through `String(...)` or a devtools inspect; this door is
|
|
721
|
+
// the evaluator's OWN postfix `.` and index into any value, and it read the same six names
|
|
722
|
+
// from the same host prototype with no guard of its own
|
|
723
|
+
// finding J3). It does not escalate to code execution (`({}).constructor.constructor` is
|
|
724
|
+
// undefined, because `isDict` requires `typeof === "object"` and a function fails that),
|
|
725
|
+
// but a value is still not authored data, and an authored expression that walks it reads
|
|
726
|
+
// the host, not the app. Refuse it with the SAME list the proxy plane freezes, so there is
|
|
727
|
+
// ONE denylist across both doors rather than a second one drifting beside it.
|
|
728
|
+
//
|
|
729
|
+
// JSE-PROTO: A DENYLIST WAS NEVER THE PROPERTY, and it hid eight more names. PROXY_DENYLIST
|
|
730
|
+
// is frozen at the six names the JS RUNTIME probes on any object, which is exactly right for
|
|
731
|
+
// a proxy `get` trap and is NOT the set a plain object inherits: `hasOwnProperty`,
|
|
732
|
+
// `isPrototypeOf`, `propertyIsEnumerable`, `toLocaleString`, `__defineGetter__`,
|
|
733
|
+
// `__defineSetter__`, `__lookupGetter__` and `__lookupSetter__` are all inherited from
|
|
734
|
+
// `Object.prototype` too, and every one of them answered a real host function here through
|
|
735
|
+
// every spelling of member access (128 leaks over a 224 input sweep, jse-member-fence.test.ts).
|
|
736
|
+
// Two of them are capabilities rather than disclosures: `__defineGetter__` and
|
|
737
|
+
// `__defineSetter__` install an accessor on whatever object an author can name.
|
|
738
|
+
//
|
|
739
|
+
// So the guard is a STRUCTURAL property and not a list: a dict answers its OWN keys and
|
|
740
|
+
// nothing it inherits. That is what the Swift and Kotlin lanes already are, structurally,
|
|
741
|
+
// because a `[String: Any]` and a `Map` have no prototype to walk, and this makes the
|
|
742
|
+
// reference evaluator the same shape rather than a list chasing them. The denylist stays in
|
|
743
|
+
// front of it, because those six names carry the K9 refusal ENVELOPE the corpus pins (an
|
|
744
|
+
// authored `.constructor` is worth reporting, not silently reading as absent) and because
|
|
745
|
+
// they must refuse on ANY base, dict or not. Every other inherited name simply reads as what
|
|
746
|
+
// it is to an authored expression: absent.
|
|
747
|
+
//
|
|
748
|
+
// A denied name reports through this seam rather than a direct import of jse.ts: values.ts
|
|
749
|
+
// sits under jse.ts in the module graph (a direct edge back would close the cycle, exactly
|
|
750
|
+
// the reason the ACTIVE LOCALE seam below exists), so jse.ts installs the reporter at
|
|
751
|
+
// module init and this file never composes a refusal of its own.
|
|
752
|
+
let memberDeniedFn = null;
|
|
753
|
+
/** Install the member-denial reporter (jse.ts owns it: it composes and logs the K9
|
|
754
|
+
* refusal envelope against the evaluation currently open on the calling store). */
|
|
755
|
+
export function setMemberDeniedReporter(fn) { memberDeniedFn = fn; }
|
|
756
|
+
/** THE ONE DICT READ every member door funnels through: a dict answers its OWN key or null,
|
|
757
|
+
* and never a name it inherits from `Object.prototype`. `hasOwnProperty` is called off the
|
|
758
|
+
* prototype rather than off `base`, because `base` is author-shaped data whose own
|
|
759
|
+
* `hasOwnProperty` key would otherwise decide the guard. */
|
|
760
|
+
export function ownProperty(base, key) {
|
|
761
|
+
if (!isDict(base))
|
|
762
|
+
return null;
|
|
763
|
+
if (!Object.prototype.hasOwnProperty.call(base, key)) {
|
|
764
|
+
// AN ELEMENT HANDLE IS NOT DATA (kernel element.ts, THE HOST SEAM): its members are live reads of a
|
|
765
|
+
// mounted element, so a member it does not own as a key is asked of its host face. Only a miss pays the
|
|
766
|
+
// symbol read, and every value that is not a handle answers null exactly as before.
|
|
767
|
+
const host = elementHost(base);
|
|
768
|
+
return host === null ? null : host.get(key) ?? null;
|
|
769
|
+
}
|
|
770
|
+
return base[key] ?? null;
|
|
771
|
+
}
|
|
772
|
+
/** THE ONE DICT WRITE, the twin of `ownProperty` and the same law from the other side: a key
|
|
773
|
+
* an AUTHOR chose is written as data on the dict itself, never through `[[Set]]`. Plain
|
|
774
|
+
* `d[k] = v` with `k` of `"__proto__"` invokes `Object.prototype`'s legacy setter and
|
|
775
|
+
* REPLACES that dict's prototype instead of writing a key, so the value handed on carries a
|
|
776
|
+
* row of author data as its prototype and the key the author asked for is simply gone. The
|
|
777
|
+
* COMPILED executor was already right here by accident of JS semantics (a computed key in an
|
|
778
|
+
* object literal, and object spread, both define data properties), and the interpreter was
|
|
779
|
+
* not, which made the two executors disagree about the same expression. */
|
|
780
|
+
export function setOwn(target, key, value) {
|
|
781
|
+
Object.defineProperty(target, key, { value, enumerable: true, configurable: true, writable: true });
|
|
782
|
+
}
|
|
783
|
+
/** JS `base.member` (postfix): `.length` on an array/string, else an object key. A name on
|
|
784
|
+
* `PROXY_DENYLIST` refuses on ANY base, dict or not: the guard is about the NAME reaching a
|
|
785
|
+
* host prototype, not about which value happened to carry it. */
|
|
786
|
+
export function member(base, m) {
|
|
787
|
+
if (PROXY_DENYLIST.has(m)) {
|
|
788
|
+
try {
|
|
789
|
+
memberDeniedFn?.(m);
|
|
790
|
+
}
|
|
791
|
+
catch { /* the reporter never blocks the evaluator */ }
|
|
792
|
+
return null;
|
|
793
|
+
}
|
|
794
|
+
if (m === "length") {
|
|
795
|
+
if (typeof base === "string")
|
|
796
|
+
return charCount(base);
|
|
797
|
+
if (Array.isArray(base))
|
|
798
|
+
return base.length;
|
|
799
|
+
}
|
|
800
|
+
if (Array.isArray(base) && (m === "index" || m === "input" || m === "groups")) {
|
|
801
|
+
const facts = MATCH_FACTS.get(base);
|
|
802
|
+
return facts === undefined ? null : facts[m];
|
|
803
|
+
}
|
|
804
|
+
return ownProperty(base, m);
|
|
805
|
+
}
|
|
806
|
+
/** A MATCH ARRAY'S FACTS (corpus jse/regex-match-facts-001.json; logic parity)
|
|
807
|
+
* the array `s.match(re)` (no g), `re.exec(s)` and each `matchAll` element
|
|
808
|
+
* answer carries JavaScript's `index` (UTF-16 units), `input` and `groups` (the named groups,
|
|
809
|
+
* an unmatched one null; null when the pattern names none). They ride on THAT array value
|
|
810
|
+
* only, as JavaScript's own-properties do: a copy is a plain array and JSON writes the
|
|
811
|
+
* elements. Twins: Jse.kt `JseMatchList`, JSELibrary.swift `JSEMatchFacts`. */
|
|
812
|
+
const MATCH_FACTS = new WeakMap();
|
|
813
|
+
export function matchArray(m) {
|
|
814
|
+
const out = Array.from(m, (x) => x ?? NSNull);
|
|
815
|
+
let groups = NSNull;
|
|
816
|
+
if (m.groups !== undefined) {
|
|
817
|
+
const g = {};
|
|
818
|
+
for (const [k, v] of Object.entries(m.groups))
|
|
819
|
+
setOwn(g, k, v ?? NSNull);
|
|
820
|
+
groups = g;
|
|
821
|
+
}
|
|
822
|
+
MATCH_FACTS.set(out, { index: m.index, input: m.input, groups });
|
|
823
|
+
return out;
|
|
824
|
+
}
|
|
825
|
+
// ── the ACTIVE LOCALE seam (the `setStringCoerce` pattern, and for the same reason) ────
|
|
826
|
+
//
|
|
827
|
+
// `Intl.NumberFormat()` with no tag formats in the DEVICE locale, so a computed
|
|
828
|
+
// formatting a coin price ignored the in-app language switch every string on the same
|
|
829
|
+
// screen obeyed. The fix is one default, but core.ts cannot import strings.ts: the graph
|
|
830
|
+
// runs strings → store → … → jse → core, and a direct edge back closes the cycle (measured
|
|
831
|
+
// — 22 test files died with "Cannot access 'JSESeams' before initialization"). So the tag
|
|
832
|
+
// arrives through this leaf, exactly as string coercion does: strings.ts installs it at
|
|
833
|
+
// module init, and a consumer that never loads it keeps the platform default.
|
|
834
|
+
let activeLocaleFn = null;
|
|
835
|
+
/** Install the app's locale reader (strings.ts owns the ladder). */
|
|
836
|
+
export function setActiveLocale(fn) { activeLocaleFn = fn; }
|
|
837
|
+
/** The app's active locale tag, or "" when nothing has installed a reader. */
|
|
838
|
+
export function activeLocaleTag() {
|
|
839
|
+
try {
|
|
840
|
+
return activeLocaleFn === null ? "" : activeLocaleFn();
|
|
841
|
+
}
|
|
842
|
+
catch {
|
|
843
|
+
return "";
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
//# sourceMappingURL=values.js.map
|