@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,191 @@
|
|
|
1
|
+
/** The raster formats `manipulate` can be asked to write. */
|
|
2
|
+
export declare const MEDIA_FORMATS: readonly string[];
|
|
3
|
+
/** The resize fits. Deliberately three: the fourth spelling everyone invents ("inside",
|
|
4
|
+
* "outside", "scale-down") is `contain` with a clamp the caller can do itself. */
|
|
5
|
+
export declare const MEDIA_RESIZE_FITS: readonly string[];
|
|
6
|
+
/** The pixel budget for one manipulation step, and the one number in this file that is a
|
|
7
|
+
* POLICY rather than arithmetic. It bounds what a caller may ASK FOR - a 20000x20000
|
|
8
|
+
* render is refused before anything is allocated - and deliberately does NOT bound what
|
|
9
|
+
* the camera produced: a 48 MP ProRAW photo is over the budget the moment it is opened,
|
|
10
|
+
* and a framework that refused to rotate it would be refusing the device's own output.
|
|
11
|
+
* So the check is on GROWTH: a step is `too_large` only when it pushes past the budget
|
|
12
|
+
* AND makes the image bigger than it already was. Shrinking a huge photo always works,
|
|
13
|
+
* and `mediaDecodeHint` is what keeps it from ever being resident whole. */
|
|
14
|
+
export declare const MEDIA_MAX_PIXELS = 40000000;
|
|
15
|
+
/** The ceiling on one multi-pick. A picker that hands back 400 assets has handed back an
|
|
16
|
+
* out-of-memory bug; the system pickers cap far lower in practice, and a caller who wants
|
|
17
|
+
* more should page. 0 from the caller means "the system's own maximum". */
|
|
18
|
+
export declare const MEDIA_PICK_MAX = 64;
|
|
19
|
+
export interface MediaBox {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
export interface MediaRect {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
29
|
+
/** One resolved step of an op chain: what the image measures after it, and - for the ops
|
|
30
|
+
* that select a region (crop, and the centre-crop half of `cover`) - the exact rect, in
|
|
31
|
+
* the coordinate space of the image AS IT WAS WHEN THE STEP RAN. */
|
|
32
|
+
export interface MediaStep {
|
|
33
|
+
op: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
rect?: MediaRect;
|
|
37
|
+
}
|
|
38
|
+
export type MediaOpsResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
steps: MediaStep[];
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
error: "invalid_ops" | "too_large";
|
|
46
|
+
at: number;
|
|
47
|
+
};
|
|
48
|
+
/** Fold an author's format spelling; null is `unsupported_format`. An omitted format means
|
|
49
|
+
* "keep whatever the source was", which the facet answers, so it folds to null too - the
|
|
50
|
+
* caller distinguishes the two by whether it passed anything. */
|
|
51
|
+
export declare function foldMediaFormat(name: string | null | undefined): string | null;
|
|
52
|
+
/** Clamp a quality argument into 0...1, reading a value above 1 as a percent because
|
|
53
|
+
* everyone confuses the two exactly once. Identical semantics to the capture fold. */
|
|
54
|
+
export declare function mediaQuality(value: unknown, fallback?: number): number;
|
|
55
|
+
/** What each renderer can actually ENCODE. `true` is unconditional, `"device"` means the
|
|
56
|
+
* hardware decides at runtime (HEIC on an older iPhone, HEIC below Android 30) and the
|
|
57
|
+
* facet must ask, `false` means never. A format that cannot be written falls back to
|
|
58
|
+
* jpeg - lossy but universal - and the resolve says so rather than lying about the file
|
|
59
|
+
* it produced. */
|
|
60
|
+
export declare const MEDIA_FORMAT_SUPPORT: Readonly<Record<string, Readonly<Record<string, boolean | "device">>>>;
|
|
61
|
+
/** png is lossless, so a quality argument against it is meaningless and is dropped rather
|
|
62
|
+
* than silently changing nothing - a caller reading the resolve sees the truth. */
|
|
63
|
+
export declare function mediaFormatLossless(format: string): boolean;
|
|
64
|
+
export type MediaFormatPlan = {
|
|
65
|
+
ok: true;
|
|
66
|
+
format: string;
|
|
67
|
+
requested: string;
|
|
68
|
+
fellBack: boolean;
|
|
69
|
+
lossless: boolean;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
error: "unsupported_format";
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Resolve the format a facet will actually write.
|
|
76
|
+
*
|
|
77
|
+
* `deviceCanEncode` answers the `"device"` rows: the facet asks its platform once (does
|
|
78
|
+
* this iPhone encode HEIC? is this API level 30?) and passes the answer in. An unknown
|
|
79
|
+
* platform is treated as the web row, which is the conservative one.
|
|
80
|
+
*/
|
|
81
|
+
export declare function mediaFormatPlan(requested: string | null | undefined, platform: string, deviceCanEncode?: boolean, fallback?: string): MediaFormatPlan;
|
|
82
|
+
/**
|
|
83
|
+
* The eight EXIF orientation values, as the transform that turns STORED pixels into what
|
|
84
|
+
* the photographer saw. `rotate` is clockwise degrees; `mirrored` is a horizontal flip
|
|
85
|
+
* applied BEFORE the rotation. `swaps` says whether the two axes trade places, which is
|
|
86
|
+
* the whole reason a portrait photo reports 4032x3024.
|
|
87
|
+
*
|
|
88
|
+
* This table is the fix for the classic bug: one platform's decoder applies the tag and
|
|
89
|
+
* another hands back raw pixels, so the same crop rect selects a different region. The
|
|
90
|
+
* law that makes them agree is not "everyone applies the tag" - it is that the tag is
|
|
91
|
+
* applied FIRST and the op chain then runs against normalised pixels on every renderer.
|
|
92
|
+
*/
|
|
93
|
+
export declare const EXIF_TRANSFORMS: Readonly<Record<number, {
|
|
94
|
+
rotate: 0 | 90 | 180 | 270;
|
|
95
|
+
mirrored: boolean;
|
|
96
|
+
swaps: boolean;
|
|
97
|
+
}>>;
|
|
98
|
+
export interface MediaOrientation {
|
|
99
|
+
orientation: number;
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
rotate: 0 | 90 | 180 | 270;
|
|
103
|
+
mirrored: boolean;
|
|
104
|
+
swaps: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Normalise stored dimensions by an EXIF orientation tag. An absent, zero or out-of-range
|
|
108
|
+
* tag is orientation 1 (the identity) rather than a refusal: a file with no EXIF block is
|
|
109
|
+
* ordinary, not broken.
|
|
110
|
+
*/
|
|
111
|
+
export declare function exifNormalise(width: unknown, height: unknown, orientation: unknown): MediaOrientation;
|
|
112
|
+
/**
|
|
113
|
+
* Run an op list over a source box and report the geometry at every step.
|
|
114
|
+
*
|
|
115
|
+
* The ops are applied IN ORDER, which is the contract: `[crop, resize]` and
|
|
116
|
+
* `[resize, crop]` are different pictures and both must be exact. The budget is checked
|
|
117
|
+
* after each step, so a chain that would blow up in the middle is refused before the
|
|
118
|
+
* facet allocates anything.
|
|
119
|
+
*/
|
|
120
|
+
export declare function resolveMediaOps(source: MediaBox, ops: unknown, maxPixels?: number): MediaOpsResult;
|
|
121
|
+
export interface MediaDecodeHint {
|
|
122
|
+
/** The power-of-two subsampling factor. 1 means "decode whole". Android passes it
|
|
123
|
+
* straight to BitmapFactory.Options.inSampleSize; iOS and the web use `width`/`height`
|
|
124
|
+
* as the downsample target (kCGImageSourceThumbnailMaxPixelSize / createImageBitmap). */
|
|
125
|
+
sampleSize: number;
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The largest the source needs to be decoded at for this chain to be exact.
|
|
131
|
+
*
|
|
132
|
+
* A 12 MP photo resized to 400 px wide never needs 12 MP in memory: decoding at
|
|
133
|
+
* sampleSize 8 gives 500x375, which still has more pixels than the output asks for, and
|
|
134
|
+
* costs 0.2 MB instead of 48 MB. Decode at the size you need, never full then downscale -
|
|
135
|
+
* this is the arithmetic behind that sentence, and it is shared so the three facets cannot
|
|
136
|
+
* differ about when the phone is allowed to die.
|
|
137
|
+
*
|
|
138
|
+
* The factor is taken at the FIRST resize, relative to the box that reaches it: a crop
|
|
139
|
+
* before the resize means the resize sees fewer pixels, so MORE of the source is needed
|
|
140
|
+
* per output pixel, and the hint gets conservatively larger. A chain with no resize needs
|
|
141
|
+
* the source whole - unless the source alone breaks the budget, in which case the hint
|
|
142
|
+
* subsamples until it fits, because refusing to open a photo the camera produced is not an
|
|
143
|
+
* option a framework has.
|
|
144
|
+
*/
|
|
145
|
+
export declare function mediaDecodeHint(source: MediaBox, ops: unknown, maxPixels?: number): MediaDecodeHint;
|
|
146
|
+
export declare const MEDIA_PICK_TYPES: readonly string[];
|
|
147
|
+
/** Subtype -> its kind: a system-picker filter inside the kind (media/pick.json `subtypes`). */
|
|
148
|
+
export declare const MEDIA_PICK_SUBTYPES: Readonly<Record<string, string>>;
|
|
149
|
+
export declare const MEDIA_PICK_SOURCES: readonly string[];
|
|
150
|
+
export interface MediaPickPlan {
|
|
151
|
+
type: string;
|
|
152
|
+
/** A system-picker filter inside `type` (media/pick.json `subtypes`), or null. */
|
|
153
|
+
subtype: string | null;
|
|
154
|
+
source: string;
|
|
155
|
+
limit: number;
|
|
156
|
+
multiple: boolean;
|
|
157
|
+
ordered: boolean;
|
|
158
|
+
/** `true` when the plan can run on the PERMISSION-FREE system picker. This is the whole
|
|
159
|
+
* privacy posture in one boolean: library picks never ask, camera picks do. */
|
|
160
|
+
permissionFree: boolean;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Fold pick arguments into the plan a facet executes.
|
|
164
|
+
*
|
|
165
|
+
* The rules exist because every one of them is a shape a caller gets wrong:
|
|
166
|
+
* - `multiple: false` pins the limit to 1 whatever `limit` says;
|
|
167
|
+
* - a `limit` above 1 IMPLIES multiple, because passing one without the other is what a
|
|
168
|
+
* caller means and refusing it teaches nothing;
|
|
169
|
+
* - `limit: 0` means "the system's own maximum", which is not the same as one;
|
|
170
|
+
* - the camera returns one shot per presentation, so `source: "camera"` is always limit 1;
|
|
171
|
+
* - `ordered` is only meaningful for a multi-pick and is folded off otherwise, so a facet
|
|
172
|
+
* never has to decide what an ordered single selection means.
|
|
173
|
+
*/
|
|
174
|
+
export declare function mediaPickPlan(args: {
|
|
175
|
+
type?: unknown;
|
|
176
|
+
multiple?: unknown;
|
|
177
|
+
limit?: unknown;
|
|
178
|
+
source?: unknown;
|
|
179
|
+
ordered?: unknown;
|
|
180
|
+
} | null | undefined): {
|
|
181
|
+
ok: true;
|
|
182
|
+
plan: MediaPickPlan;
|
|
183
|
+
} | {
|
|
184
|
+
ok: false;
|
|
185
|
+
error: "unsupported_format" | "invalid_source";
|
|
186
|
+
};
|
|
187
|
+
/** The MIME filter a facet hands its picker. `any` is an empty list, which every picker
|
|
188
|
+
* reads as "no filter" - a list of every type it might see would be wrong the first time
|
|
189
|
+
* a new codec shipped. */
|
|
190
|
+
export declare function mediaPickMimeTypes(type: string): string[];
|
|
191
|
+
//# sourceMappingURL=media-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-core.d.ts","sourceRoot":"","sources":["../src/media-core.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
//
|
|
2
|
+
// media-core.ts - the shared `media` module core: the pick plan, EXIF orientation
|
|
3
|
+
// normalisation, the manipulate op-chain resolver, the decode hint that keeps a 12 MP
|
|
4
|
+
// photo from ever being allocated whole, and the format/quality fold with its
|
|
5
|
+
// per-platform support table. The law is the corpus, OpenSource/Conformance/media/
|
|
6
|
+
// (parity/F04-media.md); the Kotlin twin is :core MediaCore.kt and the Swift twin is
|
|
7
|
+
// Engine/Swift/MediaCore.swift.
|
|
8
|
+
//
|
|
9
|
+
// WHY THESE PARTS AND NOT THE PIXELS. Opening a picker, decoding a JPEG and running a
|
|
10
|
+
// CIFilter chain are entirely platform work (PHPickerViewController, PickVisualMedia,
|
|
11
|
+
// <input type=file>; Core Image, Bitmap, OffscreenCanvas) and belong in the facets. What
|
|
12
|
+
// cannot live there is the ARITHMETIC AND THE ORDER:
|
|
13
|
+
//
|
|
14
|
+
// * crop-then-resize is not resize-then-crop, and an avatar that comes out 401 px on one
|
|
15
|
+
// platform and 400 on another is a bug the author cannot fix from markup;
|
|
16
|
+
// * a phone photo carries its rotation in EXIF, so a crop rect computed against the
|
|
17
|
+
// stored pixels lands somewhere else than the one the user drew on screen - the
|
|
18
|
+
// "sideways on one platform" bug, which is an ORDERING law, not a decoder setting;
|
|
19
|
+
// * the decode hint is the difference between an error and an OOM kill: decode at the
|
|
20
|
+
// size you need, never full then downscale.
|
|
21
|
+
//
|
|
22
|
+
// Everything here is pure arithmetic over plain values. No I/O, no platform types.
|
|
23
|
+
//
|
|
24
|
+
/** The raster formats `manipulate` can be asked to write. */
|
|
25
|
+
export const MEDIA_FORMATS = ["jpeg", "png", "webp", "heic"];
|
|
26
|
+
/** The resize fits. Deliberately three: the fourth spelling everyone invents ("inside",
|
|
27
|
+
* "outside", "scale-down") is `contain` with a clamp the caller can do itself. */
|
|
28
|
+
export const MEDIA_RESIZE_FITS = ["contain", "cover", "fill"];
|
|
29
|
+
/** The pixel budget for one manipulation step, and the one number in this file that is a
|
|
30
|
+
* POLICY rather than arithmetic. It bounds what a caller may ASK FOR - a 20000x20000
|
|
31
|
+
* render is refused before anything is allocated - and deliberately does NOT bound what
|
|
32
|
+
* the camera produced: a 48 MP ProRAW photo is over the budget the moment it is opened,
|
|
33
|
+
* and a framework that refused to rotate it would be refusing the device's own output.
|
|
34
|
+
* So the check is on GROWTH: a step is `too_large` only when it pushes past the budget
|
|
35
|
+
* AND makes the image bigger than it already was. Shrinking a huge photo always works,
|
|
36
|
+
* and `mediaDecodeHint` is what keeps it from ever being resident whole. */
|
|
37
|
+
export const MEDIA_MAX_PIXELS = 40_000_000;
|
|
38
|
+
/** The ceiling on one multi-pick. A picker that hands back 400 assets has handed back an
|
|
39
|
+
* out-of-memory bug; the system pickers cap far lower in practice, and a caller who wants
|
|
40
|
+
* more should page. 0 from the caller means "the system's own maximum". */
|
|
41
|
+
export const MEDIA_PICK_MAX = 64;
|
|
42
|
+
// ── small numeric helpers ────────────────────────────────────────────────────────────────
|
|
43
|
+
/** Round half away from zero, then floor at one pixel. Every dimension in this file goes
|
|
44
|
+
* through it so three renderers cannot disagree about 400.5. */
|
|
45
|
+
function px(value) {
|
|
46
|
+
const rounded = value < 0 ? -Math.round(-value) : Math.round(value);
|
|
47
|
+
return Math.max(1, rounded);
|
|
48
|
+
}
|
|
49
|
+
function finite(value) {
|
|
50
|
+
if (value === null || value === undefined || value === "")
|
|
51
|
+
return null;
|
|
52
|
+
const raw = typeof value === "number" ? value : Number(value);
|
|
53
|
+
return Number.isFinite(raw) ? raw : null;
|
|
54
|
+
}
|
|
55
|
+
function positive(value) {
|
|
56
|
+
const raw = finite(value);
|
|
57
|
+
return raw !== null && raw > 0 ? raw : null;
|
|
58
|
+
}
|
|
59
|
+
// ── the format / quality fold ────────────────────────────────────────────────────────────
|
|
60
|
+
/** Fold an author's format spelling; null is `unsupported_format`. An omitted format means
|
|
61
|
+
* "keep whatever the source was", which the facet answers, so it folds to null too - the
|
|
62
|
+
* caller distinguishes the two by whether it passed anything. */
|
|
63
|
+
export function foldMediaFormat(name) {
|
|
64
|
+
const key = String(name ?? "").trim().toLowerCase().replace(/^\./, "");
|
|
65
|
+
if (key === "")
|
|
66
|
+
return null;
|
|
67
|
+
if (key === "jpg")
|
|
68
|
+
return "jpeg";
|
|
69
|
+
if (key === "heif")
|
|
70
|
+
return "heic";
|
|
71
|
+
return MEDIA_FORMATS.includes(key) ? key : null;
|
|
72
|
+
}
|
|
73
|
+
/** Clamp a quality argument into 0...1, reading a value above 1 as a percent because
|
|
74
|
+
* everyone confuses the two exactly once. Identical semantics to the capture fold. */
|
|
75
|
+
export function mediaQuality(value, fallback = 0.9) {
|
|
76
|
+
if (value === undefined || value === null || value === "")
|
|
77
|
+
return fallback;
|
|
78
|
+
const raw = typeof value === "number" ? value : Number(value);
|
|
79
|
+
if (!Number.isFinite(raw))
|
|
80
|
+
return fallback;
|
|
81
|
+
const unit = raw > 1 && raw <= 100 ? raw / 100 : raw;
|
|
82
|
+
return Math.min(Math.max(unit, 0), 1);
|
|
83
|
+
}
|
|
84
|
+
/** What each renderer can actually ENCODE. `true` is unconditional, `"device"` means the
|
|
85
|
+
* hardware decides at runtime (HEIC on an older iPhone, HEIC below Android 30) and the
|
|
86
|
+
* facet must ask, `false` means never. A format that cannot be written falls back to
|
|
87
|
+
* jpeg - lossy but universal - and the resolve says so rather than lying about the file
|
|
88
|
+
* it produced. */
|
|
89
|
+
export const MEDIA_FORMAT_SUPPORT = {
|
|
90
|
+
ios: { jpeg: true, png: true, webp: false, heic: "device" },
|
|
91
|
+
android: { jpeg: true, png: true, webp: true, heic: "device" },
|
|
92
|
+
web: { jpeg: true, png: true, webp: true, heic: false },
|
|
93
|
+
};
|
|
94
|
+
/** png is lossless, so a quality argument against it is meaningless and is dropped rather
|
|
95
|
+
* than silently changing nothing - a caller reading the resolve sees the truth. */
|
|
96
|
+
export function mediaFormatLossless(format) {
|
|
97
|
+
return format === "png";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolve the format a facet will actually write.
|
|
101
|
+
*
|
|
102
|
+
* `deviceCanEncode` answers the `"device"` rows: the facet asks its platform once (does
|
|
103
|
+
* this iPhone encode HEIC? is this API level 30?) and passes the answer in. An unknown
|
|
104
|
+
* platform is treated as the web row, which is the conservative one.
|
|
105
|
+
*/
|
|
106
|
+
export function mediaFormatPlan(requested, platform, deviceCanEncode = false, fallback = "jpeg") {
|
|
107
|
+
const format = foldMediaFormat(requested);
|
|
108
|
+
if (format === null)
|
|
109
|
+
return { ok: false, error: "unsupported_format" };
|
|
110
|
+
const table = MEDIA_FORMAT_SUPPORT[platform] ?? MEDIA_FORMAT_SUPPORT["web"];
|
|
111
|
+
const support = table[format];
|
|
112
|
+
const writable = support === true || (support === "device" && deviceCanEncode);
|
|
113
|
+
if (writable) {
|
|
114
|
+
return { ok: true, format, requested: format, fellBack: false, lossless: mediaFormatLossless(format) };
|
|
115
|
+
}
|
|
116
|
+
return { ok: true, format: fallback, requested: format, fellBack: true, lossless: mediaFormatLossless(fallback) };
|
|
117
|
+
}
|
|
118
|
+
// ── EXIF orientation ─────────────────────────────────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* The eight EXIF orientation values, as the transform that turns STORED pixels into what
|
|
121
|
+
* the photographer saw. `rotate` is clockwise degrees; `mirrored` is a horizontal flip
|
|
122
|
+
* applied BEFORE the rotation. `swaps` says whether the two axes trade places, which is
|
|
123
|
+
* the whole reason a portrait photo reports 4032x3024.
|
|
124
|
+
*
|
|
125
|
+
* This table is the fix for the classic bug: one platform's decoder applies the tag and
|
|
126
|
+
* another hands back raw pixels, so the same crop rect selects a different region. The
|
|
127
|
+
* law that makes them agree is not "everyone applies the tag" - it is that the tag is
|
|
128
|
+
* applied FIRST and the op chain then runs against normalised pixels on every renderer.
|
|
129
|
+
*/
|
|
130
|
+
export const EXIF_TRANSFORMS = {
|
|
131
|
+
1: { rotate: 0, mirrored: false, swaps: false },
|
|
132
|
+
2: { rotate: 0, mirrored: true, swaps: false },
|
|
133
|
+
3: { rotate: 180, mirrored: false, swaps: false },
|
|
134
|
+
4: { rotate: 180, mirrored: true, swaps: false },
|
|
135
|
+
5: { rotate: 90, mirrored: true, swaps: true },
|
|
136
|
+
6: { rotate: 90, mirrored: false, swaps: true },
|
|
137
|
+
7: { rotate: 270, mirrored: true, swaps: true },
|
|
138
|
+
8: { rotate: 270, mirrored: false, swaps: true },
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Normalise stored dimensions by an EXIF orientation tag. An absent, zero or out-of-range
|
|
142
|
+
* tag is orientation 1 (the identity) rather than a refusal: a file with no EXIF block is
|
|
143
|
+
* ordinary, not broken.
|
|
144
|
+
*/
|
|
145
|
+
export function exifNormalise(width, height, orientation) {
|
|
146
|
+
const w = positive(width) ?? 1;
|
|
147
|
+
const h = positive(height) ?? 1;
|
|
148
|
+
const raw = finite(orientation);
|
|
149
|
+
const tag = raw !== null && Number.isInteger(raw) && raw >= 1 && raw <= 8 ? raw : 1;
|
|
150
|
+
const t = EXIF_TRANSFORMS[tag];
|
|
151
|
+
return {
|
|
152
|
+
orientation: tag,
|
|
153
|
+
width: t.swaps ? px(h) : px(w),
|
|
154
|
+
height: t.swaps ? px(w) : px(h),
|
|
155
|
+
rotate: t.rotate,
|
|
156
|
+
mirrored: t.mirrored,
|
|
157
|
+
swaps: t.swaps,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// ── the op chain ─────────────────────────────────────────────────────────────────────────
|
|
161
|
+
function opName(op) {
|
|
162
|
+
if (typeof op !== "object" || op === null || Array.isArray(op))
|
|
163
|
+
return null;
|
|
164
|
+
const keys = Object.keys(op).filter((k) => !k.startsWith("_"));
|
|
165
|
+
// Exactly one verb per entry. Two keys is an ambiguity about ORDER, and order is the one
|
|
166
|
+
// thing this resolver exists to make unambiguous.
|
|
167
|
+
if (keys.length !== 1)
|
|
168
|
+
return null;
|
|
169
|
+
return keys[0];
|
|
170
|
+
}
|
|
171
|
+
function resizeStep(box, spec) {
|
|
172
|
+
if (typeof spec !== "object" || spec === null)
|
|
173
|
+
return null;
|
|
174
|
+
const s = spec;
|
|
175
|
+
const tw = positive(s["width"]);
|
|
176
|
+
const th = positive(s["height"]);
|
|
177
|
+
if (tw === null && th === null)
|
|
178
|
+
return null;
|
|
179
|
+
const fitRaw = String(s["fit"] ?? "contain").trim().toLowerCase();
|
|
180
|
+
if (!MEDIA_RESIZE_FITS.includes(fitRaw))
|
|
181
|
+
return null;
|
|
182
|
+
// One dimension given: the aspect ratio decides the other, whatever `fit` says. There is
|
|
183
|
+
// no box to fit inside, so `cover` and `contain` cannot differ.
|
|
184
|
+
if (tw === null)
|
|
185
|
+
return { width: px(box.width * (th / box.height)), height: px(th) };
|
|
186
|
+
if (th === null)
|
|
187
|
+
return { width: px(tw), height: px(box.height * (tw / box.width)) };
|
|
188
|
+
if (fitRaw === "fill")
|
|
189
|
+
return { width: px(tw), height: px(th) };
|
|
190
|
+
const scale = fitRaw === "cover"
|
|
191
|
+
? Math.max(tw / box.width, th / box.height)
|
|
192
|
+
: Math.min(tw / box.width, th / box.height);
|
|
193
|
+
const scaledW = px(box.width * scale);
|
|
194
|
+
const scaledH = px(box.height * scale);
|
|
195
|
+
if (fitRaw === "contain")
|
|
196
|
+
return { width: scaledW, height: scaledH };
|
|
197
|
+
// cover: fill the box, then take the CENTRE of the overflow. Floor the offsets so a one
|
|
198
|
+
// pixel remainder always lands on the bottom/right, identically on three renderers.
|
|
199
|
+
const outW = Math.min(px(tw), scaledW);
|
|
200
|
+
const outH = Math.min(px(th), scaledH);
|
|
201
|
+
return {
|
|
202
|
+
width: outW,
|
|
203
|
+
height: outH,
|
|
204
|
+
rect: { x: Math.floor((scaledW - outW) / 2), y: Math.floor((scaledH - outH) / 2), width: outW, height: outH },
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function cropStep(box, spec) {
|
|
208
|
+
if (typeof spec !== "object" || spec === null)
|
|
209
|
+
return null;
|
|
210
|
+
const s = spec;
|
|
211
|
+
const w = positive(s["width"]);
|
|
212
|
+
const h = positive(s["height"]);
|
|
213
|
+
if (w === null || h === null)
|
|
214
|
+
return null;
|
|
215
|
+
const x = finite(s["x"]) ?? 0;
|
|
216
|
+
const y = finite(s["y"]) ?? 0;
|
|
217
|
+
// A crop that hangs off the edge is INTERSECTED with the image, not refused: the caller
|
|
218
|
+
// drew a rect on a screen, and a two pixel overhang from a rounding difference must not
|
|
219
|
+
// lose the whole operation. A crop with no overlap at all IS refused - it selects
|
|
220
|
+
// nothing, and silently handing back a 1x1 image is the worse answer.
|
|
221
|
+
const x0 = Math.min(Math.max(Math.round(x), 0), box.width);
|
|
222
|
+
const y0 = Math.min(Math.max(Math.round(y), 0), box.height);
|
|
223
|
+
const x1 = Math.min(Math.max(Math.round(x + w), 0), box.width);
|
|
224
|
+
const y1 = Math.min(Math.max(Math.round(y + h), 0), box.height);
|
|
225
|
+
const cw = x1 - x0;
|
|
226
|
+
const ch = y1 - y0;
|
|
227
|
+
if (cw < 1 || ch < 1)
|
|
228
|
+
return null;
|
|
229
|
+
return { width: cw, height: ch, rect: { x: x0, y: y0, width: cw, height: ch } };
|
|
230
|
+
}
|
|
231
|
+
function rotateStep(box, spec) {
|
|
232
|
+
const deg = finite(spec);
|
|
233
|
+
if (deg === null)
|
|
234
|
+
return null;
|
|
235
|
+
const normal = ((Math.round(deg) % 360) + 360) % 360;
|
|
236
|
+
// Only right angles. An arbitrary angle changes the canvas shape and needs a fill colour
|
|
237
|
+
// and a resampling policy; refusing is honest, and `manipulate` is not an editor.
|
|
238
|
+
if (normal % 90 !== 0)
|
|
239
|
+
return null;
|
|
240
|
+
return normal === 90 || normal === 270
|
|
241
|
+
? { width: box.height, height: box.width }
|
|
242
|
+
: { width: box.width, height: box.height };
|
|
243
|
+
}
|
|
244
|
+
function flipStep(box, spec) {
|
|
245
|
+
const word = String(spec ?? "").trim().toLowerCase();
|
|
246
|
+
const known = word === "h" || word === "v" || word === "horizontal" || word === "vertical";
|
|
247
|
+
return known ? { width: box.width, height: box.height } : null;
|
|
248
|
+
}
|
|
249
|
+
function blurStep(box, spec) {
|
|
250
|
+
const radius = finite(spec);
|
|
251
|
+
if (radius === null || radius < 0 || radius > 100)
|
|
252
|
+
return null;
|
|
253
|
+
return { width: box.width, height: box.height };
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Run an op list over a source box and report the geometry at every step.
|
|
257
|
+
*
|
|
258
|
+
* The ops are applied IN ORDER, which is the contract: `[crop, resize]` and
|
|
259
|
+
* `[resize, crop]` are different pictures and both must be exact. The budget is checked
|
|
260
|
+
* after each step, so a chain that would blow up in the middle is refused before the
|
|
261
|
+
* facet allocates anything.
|
|
262
|
+
*/
|
|
263
|
+
export function resolveMediaOps(source, ops, maxPixels = MEDIA_MAX_PIXELS) {
|
|
264
|
+
const sw = positive(source?.width);
|
|
265
|
+
const sh = positive(source?.height);
|
|
266
|
+
if (sw === null || sh === null)
|
|
267
|
+
return { ok: false, error: "invalid_ops", at: -1 };
|
|
268
|
+
const list = ops === undefined || ops === null ? [] : ops;
|
|
269
|
+
if (!Array.isArray(list))
|
|
270
|
+
return { ok: false, error: "invalid_ops", at: -1 };
|
|
271
|
+
let box = { width: px(sw), height: px(sh) };
|
|
272
|
+
const steps = [];
|
|
273
|
+
for (let i = 0; i < list.length; i++) {
|
|
274
|
+
const name = opName(list[i]);
|
|
275
|
+
if (name === null)
|
|
276
|
+
return { ok: false, error: "invalid_ops", at: i };
|
|
277
|
+
const spec = list[i][name];
|
|
278
|
+
let next;
|
|
279
|
+
switch (name) {
|
|
280
|
+
case "resize":
|
|
281
|
+
next = resizeStep(box, spec);
|
|
282
|
+
break;
|
|
283
|
+
case "crop":
|
|
284
|
+
next = cropStep(box, spec);
|
|
285
|
+
break;
|
|
286
|
+
case "rotate":
|
|
287
|
+
next = rotateStep(box, spec);
|
|
288
|
+
break;
|
|
289
|
+
case "flip":
|
|
290
|
+
next = flipStep(box, spec);
|
|
291
|
+
break;
|
|
292
|
+
case "blur":
|
|
293
|
+
next = blurStep(box, spec);
|
|
294
|
+
break;
|
|
295
|
+
default: next = null;
|
|
296
|
+
}
|
|
297
|
+
if (next === null)
|
|
298
|
+
return { ok: false, error: "invalid_ops", at: i };
|
|
299
|
+
const after = next.width * next.height;
|
|
300
|
+
if (after > maxPixels && after > box.width * box.height) {
|
|
301
|
+
return { ok: false, error: "too_large", at: i };
|
|
302
|
+
}
|
|
303
|
+
box = { width: next.width, height: next.height };
|
|
304
|
+
steps.push(next.rect === undefined
|
|
305
|
+
? { op: name, width: box.width, height: box.height }
|
|
306
|
+
: { op: name, width: box.width, height: box.height, rect: next.rect });
|
|
307
|
+
}
|
|
308
|
+
return { ok: true, width: box.width, height: box.height, steps };
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* The largest the source needs to be decoded at for this chain to be exact.
|
|
312
|
+
*
|
|
313
|
+
* A 12 MP photo resized to 400 px wide never needs 12 MP in memory: decoding at
|
|
314
|
+
* sampleSize 8 gives 500x375, which still has more pixels than the output asks for, and
|
|
315
|
+
* costs 0.2 MB instead of 48 MB. Decode at the size you need, never full then downscale -
|
|
316
|
+
* this is the arithmetic behind that sentence, and it is shared so the three facets cannot
|
|
317
|
+
* differ about when the phone is allowed to die.
|
|
318
|
+
*
|
|
319
|
+
* The factor is taken at the FIRST resize, relative to the box that reaches it: a crop
|
|
320
|
+
* before the resize means the resize sees fewer pixels, so MORE of the source is needed
|
|
321
|
+
* per output pixel, and the hint gets conservatively larger. A chain with no resize needs
|
|
322
|
+
* the source whole - unless the source alone breaks the budget, in which case the hint
|
|
323
|
+
* subsamples until it fits, because refusing to open a photo the camera produced is not an
|
|
324
|
+
* option a framework has.
|
|
325
|
+
*/
|
|
326
|
+
export function mediaDecodeHint(source, ops, maxPixels = MEDIA_MAX_PIXELS) {
|
|
327
|
+
const sw = px(positive(source?.width) ?? 1);
|
|
328
|
+
const sh = px(positive(source?.height) ?? 1);
|
|
329
|
+
const list = Array.isArray(ops) ? ops : [];
|
|
330
|
+
let box = { width: sw, height: sh };
|
|
331
|
+
let needed = 1;
|
|
332
|
+
for (const op of list) {
|
|
333
|
+
const name = opName(op);
|
|
334
|
+
if (name === null)
|
|
335
|
+
break;
|
|
336
|
+
const spec = op[name];
|
|
337
|
+
if (name === "resize") {
|
|
338
|
+
const step = resizeStep(box, spec);
|
|
339
|
+
if (step === null)
|
|
340
|
+
break;
|
|
341
|
+
// `cover` crops after scaling, so the SCALED box is what the decode must reach.
|
|
342
|
+
const scaledW = step.rect === undefined ? step.width : Math.max(step.width, step.rect.width);
|
|
343
|
+
const scaledH = step.rect === undefined ? step.height : Math.max(step.height, step.rect.height);
|
|
344
|
+
needed = Math.max(scaledW / box.width, scaledH / box.height);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
const step = name === "crop" ? cropStep(box, spec)
|
|
348
|
+
: name === "rotate" ? rotateStep(box, spec)
|
|
349
|
+
: name === "flip" ? flipStep(box, spec)
|
|
350
|
+
: name === "blur" ? blurStep(box, spec)
|
|
351
|
+
: null;
|
|
352
|
+
if (step === null)
|
|
353
|
+
break;
|
|
354
|
+
box = { width: step.width, height: step.height };
|
|
355
|
+
}
|
|
356
|
+
let sampleSize = 1;
|
|
357
|
+
if (needed < 1) {
|
|
358
|
+
const wantW = Math.ceil(sw * needed);
|
|
359
|
+
const wantH = Math.ceil(sh * needed);
|
|
360
|
+
while (sampleSize < 32
|
|
361
|
+
&& Math.floor(sw / (sampleSize * 2)) >= wantW
|
|
362
|
+
&& Math.floor(sh / (sampleSize * 2)) >= wantH) {
|
|
363
|
+
sampleSize *= 2;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// Whatever the chain asked for, never hand back a decode that breaks the budget.
|
|
367
|
+
while (sampleSize < 32
|
|
368
|
+
&& Math.ceil(sw / sampleSize) * Math.ceil(sh / sampleSize) > maxPixels) {
|
|
369
|
+
sampleSize *= 2;
|
|
370
|
+
}
|
|
371
|
+
return { sampleSize, width: Math.ceil(sw / sampleSize), height: Math.ceil(sh / sampleSize) };
|
|
372
|
+
}
|
|
373
|
+
// ── the pick plan ────────────────────────────────────────────────────────────────────────
|
|
374
|
+
export const MEDIA_PICK_TYPES = ["image", "video", "any"];
|
|
375
|
+
/** Subtype -> its kind: a system-picker filter inside the kind (media/pick.json `subtypes`). */
|
|
376
|
+
export const MEDIA_PICK_SUBTYPES = Object.freeze({
|
|
377
|
+
live: "image", screenshot: "image", panorama: "image", burst: "image", portrait: "image",
|
|
378
|
+
slomo: "video", timelapse: "video", cinematic: "video", spatial: "any",
|
|
379
|
+
});
|
|
380
|
+
export const MEDIA_PICK_SOURCES = ["library", "camera"];
|
|
381
|
+
/**
|
|
382
|
+
* Fold pick arguments into the plan a facet executes.
|
|
383
|
+
*
|
|
384
|
+
* The rules exist because every one of them is a shape a caller gets wrong:
|
|
385
|
+
* - `multiple: false` pins the limit to 1 whatever `limit` says;
|
|
386
|
+
* - a `limit` above 1 IMPLIES multiple, because passing one without the other is what a
|
|
387
|
+
* caller means and refusing it teaches nothing;
|
|
388
|
+
* - `limit: 0` means "the system's own maximum", which is not the same as one;
|
|
389
|
+
* - the camera returns one shot per presentation, so `source: "camera"` is always limit 1;
|
|
390
|
+
* - `ordered` is only meaningful for a multi-pick and is folded off otherwise, so a facet
|
|
391
|
+
* never has to decide what an ordered single selection means.
|
|
392
|
+
*/
|
|
393
|
+
export function mediaPickPlan(args) {
|
|
394
|
+
const a = args ?? {};
|
|
395
|
+
const typeRaw = String(a.type ?? "any").trim().toLowerCase();
|
|
396
|
+
const word = typeRaw === "" ? "any" : (typeRaw === "photo" ? "image" : typeRaw);
|
|
397
|
+
const kind = Object.prototype.hasOwnProperty.call(MEDIA_PICK_SUBTYPES, word) ? MEDIA_PICK_SUBTYPES[word] : word;
|
|
398
|
+
if (!MEDIA_PICK_TYPES.includes(kind))
|
|
399
|
+
return { ok: false, error: "unsupported_format" };
|
|
400
|
+
const type = kind;
|
|
401
|
+
const sourceRaw = String(a.source ?? "library").trim().toLowerCase();
|
|
402
|
+
const source = sourceRaw === "" ? "library" : sourceRaw;
|
|
403
|
+
if (!MEDIA_PICK_SOURCES.includes(source))
|
|
404
|
+
return { ok: false, error: "invalid_source" };
|
|
405
|
+
const askedLimit = finite(a.limit);
|
|
406
|
+
// An explicit `multiple: false` always wins: a caller who wrote it means it. A limit
|
|
407
|
+
// above one with no `multiple` at all IMPLIES it, because that is what the caller means
|
|
408
|
+
// and refusing the shorthand teaches nothing.
|
|
409
|
+
const impliedMultiple = a.multiple === undefined && askedLimit !== null && askedLimit > 1;
|
|
410
|
+
let multiple = a.multiple === true || impliedMultiple;
|
|
411
|
+
let limit;
|
|
412
|
+
if (!multiple) {
|
|
413
|
+
limit = 1;
|
|
414
|
+
}
|
|
415
|
+
else if (askedLimit === null || askedLimit <= 0) {
|
|
416
|
+
limit = 0;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
limit = Math.min(Math.floor(askedLimit), MEDIA_PICK_MAX);
|
|
420
|
+
if (limit === 1)
|
|
421
|
+
multiple = false;
|
|
422
|
+
}
|
|
423
|
+
if (source === "camera") {
|
|
424
|
+
multiple = false;
|
|
425
|
+
limit = 1;
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
ok: true,
|
|
429
|
+
plan: {
|
|
430
|
+
type, subtype: source === "camera" || word === kind ? null : word, source, limit, multiple,
|
|
431
|
+
ordered: multiple && a.ordered === true,
|
|
432
|
+
permissionFree: source === "library",
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/** The MIME filter a facet hands its picker. `any` is an empty list, which every picker
|
|
437
|
+
* reads as "no filter" - a list of every type it might see would be wrong the first time
|
|
438
|
+
* a new codec shipped. */
|
|
439
|
+
export function mediaPickMimeTypes(type) {
|
|
440
|
+
if (type === "image")
|
|
441
|
+
return ["image/*"];
|
|
442
|
+
if (type === "video")
|
|
443
|
+
return ["video/*"];
|
|
444
|
+
return [];
|
|
445
|
+
}
|
|
446
|
+
//# sourceMappingURL=media-core.js.map
|