@g9tm/lynxcontrols-media 0.0.0-stage → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,24 @@
1
- # Temporary Holding Version
1
+ # @g9tm/lynxcontrols-media
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Photos, voice notes and files: placeholders, grids, a full-screen viewer, a cropper and a drop target. Opt-in.
4
+
5
+ ```tsx
6
+ import { G9DropZone, G9Lightbox, G9MediaGrid } from '@g9tm/lynxcontrols-media';
7
+
8
+ <G9MediaGrid items={photos} width={300} onOpen={setOpen} />
9
+ <G9Lightbox open={open >= 0} items={photos} index={Math.max(0, open)} onIndexChange={setOpen} onClose={() => setOpen(-1)} />
10
+ <G9DropZone label="Add photos" hint="PNG or JPEG" accept="image/*" onFiles={attach} />
11
+ ```
12
+
13
+ | Component | What it is |
14
+ | --- | --- |
15
+ | **`G9BlurhashView`** | The blurhash of a photo until the photo decodes. It is drawn as a tiny BMP that the image scales with bilinear filtering: the soft blur a blurhash is meant to be, cheaper than SVG cells. |
16
+ | **`G9MediaGrid`** | One to four tiles (and «+k» on the fourth) in a post or a message; a tap opens the photo. |
17
+ | **`G9Lightbox`** | The photos full screen on black on Lynx's native `<viewpager>` (one photo per swipe), with the position and a close button. It opens in the host's popups layer above the tab bar, the system back closes it, and automation sees it as covering the page. |
18
+ | **`G9ImageCropper`** | Drag to place a photo in a frame (round for an avatar), − zoom + to scale (a pinch where the host reports it); reports the crop in image pixels. |
19
+ | **`G9VoicePlayer`** | A voice note: play / pause, the waveform with the played part filled, the time. |
20
+ | **`G9DropZone`** | A tappable area that opens the system chooser on a phone. Around content it is the target of files dropped on the window (a host that emits `g9:drag` / `g9:drop`), with a dashed cover while they are dragged over. Without the optional `files` capability (`G9FilePicker`) it shows disabled. |
21
+
22
+ Model (pure, tested): `decodeBlurhash`, `blurhashAverage`, `blurhashBmp`, `blurhashSvg`, `mediaGridLayout`,
23
+ `cropRect`, `clampCrop`, `coverScale`, `waveformBars`, `formatDuration`, `acceptsFile`, `pickCategory`; `g9PickFiles` runs the
24
+ chooser with the accept rules.
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/react/index.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/animation.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@lynx-js/types/types/common/csstype.d.ts","../../../node_modules/@lynx-js/types/types/main-thread/animation.d.ts","../../../node_modules/@lynx-js/types/types/main-thread/element.d.ts","../../../node_modules/@lynx-js/types/types/common/events.d.ts","../../../node_modules/@lynx-js/types/types/common/system-info.d.ts","../../../node_modules/@lynx-js/types/types/common/performance.d.ts","../../../node_modules/@lynx-js/types/types/main-thread/lynx.d.ts","../../../node_modules/@lynx-js/types/types/main-thread/events.d.ts","../../../node_modules/@lynx-js/types/types/main-thread/index.d.ts","../../../node_modules/@lynx-js/types/types/common/lynx.d.ts","../../../node_modules/@lynx-js/types/types/common/global.d.ts","../../../node_modules/@lynx-js/types/types/common/props.d.ts","../../../node_modules/@lynx-js/types/types/common/element/component.d.ts","../../../node_modules/@lynx-js/types/types/common/element/filter-image.d.ts","../../../node_modules/@lynx-js/types/types/common/element/image.d.ts","../../../node_modules/@lynx-js/types/types/common/element/common.d.ts","../../../node_modules/@lynx-js/types/types/common/element/inline-image.d.ts","../../../node_modules/@lynx-js/types/types/common/element/list.d.ts","../../../node_modules/@lynx-js/types/types/common/element/list-item.d.ts","../../../node_modules/@lynx-js/types/types/common/element/page.d.ts","../../../node_modules/@lynx-js/types/types/common/element/scroll-view.d.ts","../../../node_modules/@lynx-js/types/types/common/element/text.d.ts","../../../node_modules/@lynx-js/types/types/common/element/view.d.ts","../../../node_modules/@lynx-js/types/types/common/element/input.d.ts","../../../node_modules/@lynx-js/types/types/common/element/textarea.d.ts","../../../node_modules/@lynx-js/types/types/common/element/title-bar-view.d.ts","../../../node_modules/@lynx-js/types/types/common/element/svg.d.ts","../../../node_modules/@lynx-js/types/types/common/element/refresh.d.ts","../../../node_modules/@lynx-js/types/types/common/element/scroll-coordinator.d.ts","../../../node_modules/@lynx-js/types/types/common/element/viewpager.d.ts","../../../node_modules/@lynx-js/types/types/common/element/blur-view.d.ts","../../../node_modules/@lynx-js/types/types/common/element/webview.d.ts","../../../node_modules/@lynx-js/types/types/common/element/markdown.d.ts","../../../node_modules/@lynx-js/types/types/common/element/video.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/lynx-performance-entry.d.ts","../../../node_modules/@lynx-js/types/types/common/element/frame.d.ts","../../../node_modules/@lynx-js/types/types/common/element/overlay.d.ts","../../../node_modules/@lynx-js/types/types/common/element/element.d.ts","../../../node_modules/@lynx-js/types/types/common/element/methods.d.ts","../../../node_modules/@lynx-js/types/types/common/element/attributes.d.ts","../../../node_modules/@lynx-js/types/types/common/element/index.d.ts","../../../node_modules/@lynx-js/types/types/common/console.d.ts","../../../node_modules/@lynx-js/types/types/common/index.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/event.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/nodes-ref.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/app.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/performance.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/fetch.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/lynx.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/native-modules.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/text-encoder-decoder.d.ts","../../../node_modules/@lynx-js/types/types/background-thread/index.d.ts","../../../node_modules/@lynx-js/types/types/index.d.ts","../../../node_modules/@types/react/jsx-runtime.d.ts","../../../node_modules/@lynx-js/react/runtime/jsx-runtime/index.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/runtime-marker.d.ts","../../../node_modules/preact/src/jsx.d.ts","../../../node_modules/preact/src/dom.d.ts","../../../node_modules/preact/src/index.d.ts","../../../node_modules/preact/hooks/src/index.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/hooks/react.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/runwithforce.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/lynx.d.ts","../../../node_modules/preact/compat/src/suspense.d.ts","../../../node_modules/preact/compat/src/index.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/children.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/element.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/portalspending.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/portals.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/lynx/suspense.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/hooks/uselynxglobaleventlistener.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/globalprops.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/initdata.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/lynx-data-processors.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/background-function/run-on-background.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/snapshot/worklet/call/runonmainthread.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/worklet-runtime/api/animation/effect.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/worklet-runtime/api/animation/animation.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/worklet-runtime/api/element.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/worklet-runtime/bindings/types.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/main-thread-ref.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/core/main-thread-object.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/lynx-api.d.ts","../../../node_modules/@lynx-js/react/runtime/lib/index.d.ts","../../../node_modules/@lynx-js/react/types/react.docs.d.ts","../../../node_modules/@lynx-js/react/types/react.d.ts","../../foundation/dist/collections.d.ts","../../foundation/dist/culture/bidi.d.ts","../../foundation/dist/culture/digits.d.ts","../../foundation/dist/culture/culture.d.ts","../../foundation/dist/culture/calendar.d.ts","../../foundation/dist/culture/coordinates.d.ts","../../foundation/dist/culture/date-format.d.ts","../../foundation/dist/culture/duration.d.ts","../../foundation/dist/culture/natural-date.d.ts","../../foundation/dist/culture/numbers.d.ts","../../foundation/dist/culture/strings.d.ts","../../foundation/dist/culture/relative-time.d.ts","../../foundation/dist/culture/text.d.ts","../../foundation/dist/culture/index.d.ts","../../foundation/dist/enums/index.d.ts","../../foundation/dist/errors.d.ts","../../foundation/dist/exec/diagnostics.d.ts","../../foundation/dist/services/abort.d.ts","../../foundation/dist/exec/options.d.ts","../../foundation/dist/services/clock.d.ts","../../foundation/dist/exec/trace.d.ts","../../foundation/dist/exec/safe-executor.d.ts","../../foundation/dist/exec/index.d.ts","../../foundation/dist/icons/generated/glyph-svg.d.ts","../../foundation/dist/icons/glyph.d.ts","../../foundation/dist/icons/icon.d.ts","../../foundation/dist/icons/glyph-slots.d.ts","../../foundation/dist/icons/icon-fonts.d.ts","../../foundation/dist/icons/packs.d.ts","../../foundation/dist/icons/svg.d.ts","../../foundation/dist/icons/index.d.ts","../../foundation/dist/layout/index.d.ts","../../foundation/dist/route/address.d.ts","../../foundation/dist/route/catalogue.d.ts","../../foundation/dist/route/journey.d.ts","../../foundation/dist/route/sink.d.ts","../../foundation/dist/route/resolve.d.ts","../../foundation/dist/route/view.d.ts","../../foundation/dist/route/index.d.ts","../../foundation/dist/services/feedback.d.ts","../../foundation/dist/services/preferences.d.ts","../../foundation/dist/services/contracts.d.ts","../../foundation/dist/services/keys.d.ts","../../foundation/dist/services/motion.d.ts","../../foundation/dist/services/index.d.ts","../../foundation/dist/tokens/generated/palettes.d.ts","../../foundation/dist/theme/aliases.d.ts","../../foundation/dist/tokens/shape.d.ts","../../foundation/dist/theme/color.d.ts","../../foundation/dist/theme/theme.d.ts","../../foundation/dist/theme/brand.d.ts","../../foundation/dist/theme/appearance.d.ts","../../foundation/dist/theme/contrast.d.ts","../../foundation/dist/theme/control-colors.d.ts","../../foundation/dist/theme/css-color.d.ts","../../foundation/dist/theme/design.d.ts","../../foundation/dist/theme/oklch.d.ts","../../foundation/dist/theme/recipe.d.ts","../../foundation/dist/tokens/generated/metrics.d.ts","../../foundation/dist/tokens/layout-metrics.d.ts","../../foundation/dist/tokens/css-vars.d.ts","../../foundation/dist/tokens/derived.d.ts","../../foundation/dist/theme/variants.d.ts","../../foundation/dist/theme/index.d.ts","../../foundation/dist/tokens/index.d.ts","../../foundation/dist/index.d.ts","../../controls/dist/anchor/registry.d.ts","../../controls/dist/anchor/hooks.d.ts","../../controls/dist/base/control.d.ts","../../controls/dist/base/corner-badge.d.ts","../../controls/dist/base/disposer.d.ts","../../controls/dist/base/press.d.ts","../../controls/dist/base/pressable.d.ts","../../controls/dist/display/shimmer.d.ts","../../controls/dist/sheet/options.d.ts","../../controls/dist/guide/settings.d.ts","../../controls/dist/popup/types.d.ts","../../controls/dist/provider/settings.d.ts","../../controls/dist/icon/icon.d.ts","../../controls/dist/base/selection-item.d.ts","../../controls/dist/base/timers.d.ts","../../controls/dist/base/tone.d.ts","../../controls/dist/base/use-controllable-state.d.ts","../../controls/dist/base/use-stable-callback.d.ts","../../controls/dist/base/index.d.ts","../../controls/dist/icon/slot.d.ts","../../controls/dist/icon/swatch.d.ts","../../controls/dist/icon/index.d.ts","../../controls/dist/provider/contexts.d.ts","../../controls/dist/provider/activity.d.ts","../../controls/dist/provider/hooks.d.ts","../../controls/dist/provider/keep-alive.d.ts","../../controls/dist/provider/provider.d.ts","../../controls/dist/provider/index.d.ts","../src/model.ts","../src/drop-zone.tsx","../../controls/dist/button/visuals.d.ts","../../controls/dist/button/button.d.ts","../../controls/dist/button/header-action-button.d.ts","../../controls/dist/button/icon-button.d.ts","../../controls/dist/button/nav-card.d.ts","../../controls/dist/button/safe.d.ts","../../controls/dist/button/safe-tap.d.ts","../../controls/dist/button/vertical-icon-text-button.d.ts","../../controls/dist/button/index.d.ts","../../controls/dist/host/layers.d.ts","../../controls/dist/host/back.d.ts","../../controls/dist/host/readiness.d.ts","../../controls/dist/host/registry.d.ts","../../controls/dist/host/hooks.d.ts","../../controls/dist/host/host.d.ts","../../controls/dist/host/keyboard.d.ts","../../controls/dist/host/page-loading-overlay.d.ts","../../controls/dist/host/index.d.ts","../../controls/dist/popover/position.d.ts","../../controls/dist/popover/popover.d.ts","../../controls/dist/popover/index.d.ts","../../controls/dist/toggle/checkbox.d.ts","../../controls/dist/toggle/checkbox-math.d.ts","../../controls/dist/toggle/chip-group.d.ts","../../controls/dist/toggle/choice.d.ts","../../controls/dist/toggle/switch.d.ts","../../controls/dist/toggle/index.d.ts","../src/media.tsx","../src/index.ts"],"fileIdsList":[[41,96,97,129],[102,103,108,114],[41,103],[41,102,103,108,114],[41,123],[99,102,104,106,108,109,110,112,113,126],[41,114,115,116,117,118,119,124,125],[104,105],[102,108],[41,96,129],[41,96,102,111,129],[102],[120],[122],[121],[41,96,98,128,129],[41,104,126,127],[42,86,87,88],[53],[42,78,87,88,89,90,92,93,94],[42,86,87,88,90,91],[86,88],[42,86],[49,78],[43],[44],[51,55],[47],[41,51,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,79,80],[47,51,55,78],[47,51,55],[56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,79,80,81,82,83],[58,59],[47,51,55,59],[47,61,64],[46],[48,52,53,95],[44,47,48,49,51,53,54,55,84,85],[44,47],[52,86,95],[45,86],[46,47,55],[45,46,50,51],[49,86],[38,39,40],[41],[100,102,103,107],[100,101],[96,129,196],[96,129,195],[96,129,196,197],[129],[198,199,200,201,202,209,210,211,212,213],[129,198,201],[195,208],[129,195,198,208,226],[129,195,198,208],[226,227,228,229,230,231,232,233],[195],[41,195,227,229],[129,195,198],[195,204],[235],[129,195,235,236,237,238],[41,129,195,235,236,237,238],[235,236,237,238,239,240,241,242],[195,196,235,236,237],[41,129,195,207],[208,215,216],[129,195,208],[129,195],[244,245],[41,96,129,196,198,208,244],[196],[129,218],[41,195,196,207],[195,207,218],[207,218,219,220,221,222],[129,195,207],[129,195,204,205,206],[129,195,203,208],[41,195,198],[129,195,198,209],[41,129,195,198,208,211],[247,248,249,250,251],[41,129,198],[133],[132],[132,133,134],[131,132,133,134,135,136,137,138,139,140,141,142],[134],[140],[146,148,150,151],[147],[140,146,147,148,149,150],[146,149],[155],[154],[153,154,155,156,157,158,159],[130,143,144,145,152,160,161,168,174,193,194],[145],[145,162],[162,163,164,165,166,167],[163],[162,163,165],[162],[145,147,149,165,169,170],[147,149,169,170,171,172,173],[175],[175,177,179,180],[175,178,179],[178,179],[178],[177,179],[176,178,179,180,181,182,183,184,185,186,187,192],[175,178],[144,175,178,191],[175,188,189],[175,190],[175,177,188,189,190,191],[98,129,174,214,217,223,224],[98,224,225,253],[98,129,195,214,223,224,234,243,246,252],[98,195]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6fdd3074ba01fc8aff89a11055a33516aff7a42a3599fc0e7dce64047a5e3fd","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"035312d4945d13efa134ae482f6dc56a1a9346f7ac3be7ccbad5741058ce87f3","affectsGlobalScope":true,"impliedFormat":1},{"version":"07b03f752ae52a7130e06c5a8399d3a0dde07a1a634f8430b80cd6236c56b5c8","impliedFormat":1},{"version":"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","impliedFormat":1},{"version":"acbac4ca6cd4b2b459debc4a274535775cb6278a8315be383fafa623ab78f18e","impliedFormat":1},{"version":"e421d0b097c78304a2597c1f33da586630e1dc665ae381c0c36e5ebc4aaf4566","impliedFormat":1},{"version":"adf624c89a0d509a789f3c0bf522969d2c47033dbeb50920b37cd89be475a65e","impliedFormat":1},{"version":"f4664d05efc95a0fb8ee228d391e5271a1c8fc9bc3452c7bd760f9ca18b5a837","impliedFormat":1},{"version":"b32b532dcbe0a91d71fd94cb780e94bdfdce10be21608d914c29fb4b8939b24a","impliedFormat":1},{"version":"eb2b64881998b562a4fe9330e55aa2466cd3a41a1a57e93feac6555218cec06f","impliedFormat":1},{"version":"6db1694d205177322d792d924335b046b80607445a45c0d2de1fcffd190b48c0","impliedFormat":1},{"version":"d5465281e0aaffe267f46382c5f014740dc16e7fd8e1c57a0b0ddf8a2eab9be4","impliedFormat":1},{"version":"f7e5c3960dd9df65d83408b9be446f7119fa1db1dd8266dd343349d90c3bf2ce","impliedFormat":1},{"version":"09c6491ed74af89a4155feafedecaf77780f5751c66d4b65b18d30fc0e053a75","impliedFormat":1},{"version":"188b01044640e5ef65f6edf0dd6e6454f02dd19f4ead66b9e03ebe26cc7298ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d34d6de13412a24e8d9252040d972edce68b4db8d8a64a3f7fd63ca1fda3a67f","impliedFormat":1},{"version":"5bf51107315834a209b08395b141e262b7d143d14f6b4e4d403d8e020cef7e32","impliedFormat":1},{"version":"db0dcbe48d5cb38315083b412c8ab6995b0d42dc73b286833e296827feb0e5b4","impliedFormat":1},{"version":"b3e4a49a3ba19463662e7b821544948b953d2f6708370d42406bda558084000c","impliedFormat":1},{"version":"7c5e49b3d96da389b07d4ae3705c9f33a03dadcd04e6c0e76edece6d636f4ce7","impliedFormat":1},{"version":"24e9add3c802e7c9431b2c99edbbda02c1899901fd955dfb2e9ee3e9cdc93c4c","impliedFormat":1},{"version":"cd6611fd8cd9d40de1bdec02a3c5027c968c4aaf7639ee88ee48b2c41edeaddc","impliedFormat":1},{"version":"32d1e153cac16ca3a3f5f6b68fae76cddcda509950fa00d038c465776359db0c","impliedFormat":1},{"version":"0d85d0fa55dd433acf924675d7e976c025c8521c91a76079844cd15e52855ccf","impliedFormat":1},{"version":"89da6ea3ee9735e712691227b0e5ee74381779f9ad8b0f4fb7ced0247b16735a","impliedFormat":1},{"version":"77fbe475cb649a3598aa8f932ab5f6fe011444d94b52d329078c1f6d63c5d3bd","impliedFormat":1},{"version":"7618f7fdf0abf7f712cefe766ac1ab7fcd1f8e753c513e57d3ada9ada3a57257","impliedFormat":1},{"version":"db0441149b37984c225e945a112713d07616b34552d64f814c5cbf8e8c95f165","impliedFormat":1},{"version":"51f5a8fa3de5f13b21ba2604b4de8f0aae3d97acadab981d536a282ea26257af","impliedFormat":1},{"version":"0e323630cbfda771430e2720f6a2f02f257becd8fb9722aa975ae773fb572210","impliedFormat":1},{"version":"56dbc770513baae28f7cfbadeba5078bb13a37a13132a5292e98a8b103312b98","impliedFormat":1},{"version":"84ff906032fe12e816bfb7441cee6726243e5a7316c4f2d6b0a6c149f1a91a16","impliedFormat":1},{"version":"446e9432c63958893f65b4f7eea86fb5b506c2e0e7dd971a1f75e361b333a3db","impliedFormat":1},{"version":"dcbbe1fb0f2c0efc12e29db8bbccb5b82513384d01d7a55342065cb0611da272","impliedFormat":1},{"version":"af209189a194cf5ad1f7b22dd680b52843fec2e30f1283be20b2977872fd4424","impliedFormat":1},{"version":"18e37ffc10db360e66b0af639e55bcc66496830994734f64a97c6751458f7f3a","impliedFormat":1},{"version":"14137199a98201c616a7ee925bfaa9809b659dfbec733f86fa5dc5348a897de6","impliedFormat":1},{"version":"f64cd565aca17df45f4666473da75e4ce51a2610e2ed1c31198e9f9325747a24","impliedFormat":1},{"version":"e415a17ab6a413d6be640457231e045541405eab1f0f370c7dd1e5567aa25999","impliedFormat":1},{"version":"8c03a41d6dc701b6648db83d71a92dc27147d7677ab5d70f32675e7e37b3795a","impliedFormat":1},{"version":"e27b62f2410bb10697800d1c09ae2c48db46cd1eca18ffdd35022b1802bfd6d5","impliedFormat":1},{"version":"2ec0bfa713f313f8b2dc2bf64c5962433722ea7b413f69428106a65584656dc9","impliedFormat":1},{"version":"b2d74af681f440a07e714ae9a33e3ea49c79870b9674058114c0404d2aa2f190","impliedFormat":1},{"version":"24f31e43eb3505e5d2946315e7b8ee8b426dfbe92c3031e435a4eb2d9dd8d69f","affectsGlobalScope":true,"impliedFormat":1},{"version":"5b6a59d1e98f908badf07f243deb42ebd926b4e3d33ec00a5f50cbb8d0464488","impliedFormat":1},{"version":"c669ee7ba01fa6a60b17c3535f96b65fa82dfd2a475a8760364f2f3952f9bcbd","impliedFormat":1},{"version":"a8b121f6a75d603075e62793ff0c109112e882dd6ca2b70bdccbd8d8f753429b","impliedFormat":1},{"version":"f378d7ed5e3ecbe382ade55127a9c98e826c76f786e06effad6fde91a7023d55","impliedFormat":1},{"version":"4e3e9539df72b3bfcc56fa13140070020dac72f1eff39237b11253482cb99847","impliedFormat":1},{"version":"5a47b3a2bbe2c9b015fe356462afe0abe391c592fffbe277126e2415e0811967","impliedFormat":1},{"version":"b1248e5931d2a49c697203e69449c58dacd3d19f12d76bf11d816600a0cf423b","impliedFormat":1},{"version":"0b02aebd8c41453aefd3b1f33b9b9862a57770f8b21e916ecc5b35c0bedcc52b","impliedFormat":1},{"version":"e52840670587e82e129c9bfc6a2f42d9c2f2e1fd6ce176fea998383a8c941ea5","impliedFormat":1},{"version":"31ca1ee726f5d7c7709913b98be76fc40fdfaaca6ad7fafc222108981e11227c","impliedFormat":1},{"version":"556db73da59f5162cdf5c7ea1bc3b063b6ccb758078ef6517ad6f6e4ae7b199a","impliedFormat":1},{"version":"0a2c8ef08611f5a5f711c7b10ba70d10dc1c6af0c9dba8168cbbf34911b74188","impliedFormat":1},{"version":"1d6ef45145a9939a43062fe18188d4f7bdfdf4547978e1f6b7c9089fe53e81e5","impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"509a86836776d5c821901abc16a2d21de674d2c8943ceb8d018049bf324bc56c","impliedFormat":99},{"version":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedFormat":99},{"version":"8a2ef120c4da7aab664148ed8d283aa0b98df4d5f15c570d830c8998ef05718b","impliedFormat":1},{"version":"4433d18f82991634feae5150a68f9b30f5b05b55416af8ff9f7251fb29431ed5","impliedFormat":1},{"version":"cc5d0b221824b7d8597e8a2bbdad2383af877eb564eaca392992049839e88c9e","impliedFormat":1},{"version":"21898d939444825cee1232af435330610b09171bea22a2f892cf2058d764b63d","impliedFormat":1},{"version":"2baebea93983e898000858daeeeb2ac29938891b6b8db72ebce294837fc9499f","impliedFormat":99},{"version":"d9d320cf31f6d63659484f6c9ca4db4ae673daefa65118dd8589838925ff1397","impliedFormat":99},{"version":"027cf2216d065a97bf5a8ea126b3ea2734fab6cfe32adaff81ab4e94a1b51bbe","impliedFormat":99},{"version":"f6e6313fad233c5141220f7d25eae120cdd6e5079fbe0aba56821a1e99d05df8","impliedFormat":1},{"version":"9534c35b4577c193e499178deb47419fdadddd5e53af5ec8cb88218848013f65","impliedFormat":1},{"version":"97f43a6558157a3abae4e32256cc74ba34f69ab30473008ffa13011bf0932986","impliedFormat":99},{"version":"45b8adde5735e97329752dd5598b7ecd85202f221a1d0e8aa90137ce5810f21c","impliedFormat":99},{"version":"dfe6945467765f8e7843442a9dfbcf6b5526b6465b07b4c75a54a750329b5f17","impliedFormat":99},{"version":"7f9f6c9fe0e48c401d855d849e28112ffe2425569eca01b08b8c6112b8200695","impliedFormat":99},{"version":"68fcdc663627d12d336b420b19b3e54258844d0cbca0879f711c22aafd853352","impliedFormat":99},{"version":"d3dd47deefa1cc5dd6f1b866132506ec8dfd678ae0ddaa44de188505df14fcc4","impliedFormat":99},{"version":"a5946bc88dac85da2afacdfa3471ff3bc2bbda7c0e34efde184cf17e6bceb6bc","impliedFormat":99},{"version":"75b68165b9bcc07579562f182d327e83583b89b91d62e76b86f4001feee699ba","impliedFormat":99},{"version":"a9d1030f6773d29b383f49e2c647a7e6e464906e1de97a6bc33d2528d957c4d7","impliedFormat":99},{"version":"37b997d60987b68ce8117da783442b4602c8a85d47680823d469fdc90d29e3b8","impliedFormat":99},{"version":"600850ecc310012e3b1a562629d97a1d78662ae8c477357513dd2e6aa704079b","impliedFormat":99},{"version":"335226d599a9382c9bea07d37e23bf998c1022c0f67e4d6d2b69633de6ac118f","impliedFormat":99},{"version":"ae430fd9bac320e71c3fe9299d90dcf67555d9a4f97ecaa35947b430ba8648ea","impliedFormat":99},{"version":"9061ff14146280f47d740b344ddd641c16df526ecaa868c348852277a9fb8686","impliedFormat":99},{"version":"49ee4555c2fafa01119cccc62436baad88ed937ff55d6a655e764ada6b0721e3","impliedFormat":99},{"version":"e059fb9064bc023bc06945ddda6b00e711c18e8657c82514b51c1c1b828642e9","impliedFormat":99},{"version":"f01b3b376946defc432893dcbbbc79472076b6a55a316b0a461a1b38d09e961c","impliedFormat":99},{"version":"da74d8af20172cfee988a2daf92c560f3fdc816fb9c0537f2cc37ef27b1552a8","impliedFormat":99},{"version":"feed66ae8815d1981ad575482766fb9a82385e75cce35ae2f13be58e50c4349f","impliedFormat":99},{"version":"21305b3c41b1e29c0f0d8f43fe227bca82493f6e4c6407a3363c6f729f1c04ba","affectsGlobalScope":true,"impliedFormat":99},{"version":"20c1041fbd4f1537686af4b707872b87c90a22201f8979e5def4554d28b46a5b","impliedFormat":99},"d533d1fe3018752aa47ee74ae5dbdca34377441b891176ad99bd33366a64372f","577287aa28cdd2976297531706a5baea4ba5171512f500731d3feba37057d851","44b82e4f46178400732ea809a906f7ffb9dd38efab331ca23e7ca4586bf903ef","d3dcff003bac57338c3e60be409d0ff167ec1ff513539a5534c7679332dbc992","16d64c89cec74fa23e8cee7c72acc7549f117dcf7845051870c40366c7522d09","706c787ed201e67534e550d765eecfb18a8c39f46e04fcec600d0bb9d1bb6231","11f9f682c02d51de68eed569f8de1e91c56df296a78f3a6c520b93d52aac2308","28b43630d8d29a300e1e5b0f5efb04c8f994d372fff1b653ce8bb70d4e011e1a","08521f5befe6ec3f1c3a881651321f875ca6fc79db15a6130283d409f5d47d1b","b06c48902c3d127098839c1a6500f41d3e21b2f07f277ba7de23ec730df7275d","946d8fa2088c22a4cbc85875ec7c700c93cf53d7b52057fe4e6730fd613c7925","a7a0e658ca429cfb5268d4bf2e2e6e9fe871ffd06b6588d65424ba4eba35338f","2dbadaab8fa70d9d874b29e23e808b0978fd2dbaf34e3caf8303508e2b88c603","54b8f865e3bea736798e54bc95b49435f472599aea762bd17bb02a18b198c7d1","5e621ae454f5ff6bfea91a558b93eb3dee64eac6f66ad8d6739a4a7c396a42f7","ccd708c3fff99b4ec315e14315dce6b9e85f4c96d10131e9fd219edb6efbdb26","abc924fce33b86b9f8588de3a5be04c609fafa6cb1dc42629b3e9e3e18f7d018","f919e3a8b2d274b631ee4fee0c50eba1d3f39ceaccba04dff915e9f61e9f153c","3ae17ae844491c7326d070c3e70a94a9239394e7a1e84eb203eb1d57470e752e","d1b2970d348eb9f89ef0f0c6730d27e9331067a28f21c8bd667ba1138d5d3e93","b2c4833e6308888c3947953770b3343deaf4276c803bb36148991a3fb90b4f6a","41b7c8204ea79a93e380a228f5c744e9c9a80183133ac62633a4c76e3fdbd7db","d0a441df587b0632c16a813117f110574d903ddd0bc4d28599cc82ff8af7c094","b24ac81f4fcff56ed9827736abcf2f92ea5f86e16d66eb2ee3ccfa0bb8143bc9","068309ff581d08c276c4a772ddf3ab9c8090e591fc9917fdc6cdffc12c95a5bf","5c1d368a451520260ebb6c06121201f18abf86d80540290df6e424d372c5d0ed","bb3ccaacf5c19a7170939b7f735c6a94537fd95ad16b4247a6ad572b23183e74","2c8b86d9d29c4ea62762c3815ffe4fdb0c5dbc0dd096b9703236010f4a17c255","7ec540fd5fb0761576c417b27ea61ec08123412487b020942c893510dce970db","f858a10d167e011155bfe5a3532f599e677bced6727c07366f380c02010650d4","465f5d53f09ac1978002bc264b8a4c0aea749c79dd2bd1917dffe57fddcb9543","cf4ef9c41637cb6995fee096890a0e6113141bcce82cc7d5754c281f03ad889e","40f34f36aba872decb7540030db33dc84f1a53d4778fd8c8ad840d68f2023f3a","10347593c1b262343845f577673e5956217a8a571c859d83e2de50a54729541f","e0a192de84052b553230c5f649307dfb49df6dce54fdc538de15078d895f5f66","228e7d711e429183ddf7fc8c331d00540557ade296fb8132d5bfc48d5c933f89","e8906c76ded4f87db27adfe3e8f9e1a729be51a6a0c2c458f31662c6278b1925","49bca6d49d9c5a525146bba60a48e448e1eabe79be789a7b5238ac10a2f620b3","08fe86bcae8e02f769d215958438d6858dc19aeed2a61c7d7327f052b0db25fc","cd3a9799c8e0996b4d31d5235a8ae105b79a7fa31ba8f660ca35b043048ef757","ee4e73f46ce2f6517e82434bd9fc63c8b6b2179d37d74525899f124a76d06669","773c827d0235c76288ab0092202c357730c5b21314241831b7dd88ef6017818e","ced97526e899f0222df6d805e008cd5bc63fee326838a9002919453f9a2a8c9b","216aa3f63d62f13b158445ff6a3bea8ccfd110f2bf219d607175518c9cc5b29d","be77edbe4d276441584b1c7b297bd8596c78913c22c590dc136d987b82a3976c","faa64d270fa523f80fd31bc7340ee7f6a21632c2ea0cea6535bf5a34bcc6adf7","931d70c96033881193232b90c39210c6cd14865f28b339843c56b5688e7fd10d","0a995ec8876b2bdf48ad2a95dbd7c38d37d2b77940cd39d6f68947e1c383d940","29e6e980f179ac2981d68954462dfd4a4545f73c021f6a4c8a5f442c0e16e56c","67fe56b931e013e9980dec2a605908d44484c7bbd81d2ee9912872c11bc76515","d4924e2b191fee9b43aaeef651c87a7084281d425a30a9a8cf50de8f92b64f6d","8fc678b640b298b07d4f52a5a4f0b3a57e07e45da7a0ad25f1ffde53a152d3be","a59554ba3751ea9ad27f6948f1c71ef57f1e28bb526a53eacb0dfa76bc1df452","ea5a5d5873c239b97d846fb8c78437e08ffd731924764f746c0ebcb7731d7648","da401323d4c96e3f5b8fa8b7ecd200d47a9e340b09cefbea553d2b2b5a345e60","ead4a7fd25e5e2b756a5e71546bd8eae855c7b0ecbffd891f7fb0b6f7d80c0c1","eaea9f8e5b90d87160a885c2afc4afcd2434e149ae5a5368d4b61eed66a6a597","cc44cf86b3ddb7d61f7de3fd32116089decb662a8b6421013bd4a8ee9a079881","ab7ed47f18899e74299db14911a028a0aaf1acae17f870a64ead7d91953d40b3","298f8d2584216932ea238927177ef343d0b8da735eb40a5ba96b1f92e3675e33","c8082c78975419ed5a9f7daa655643425cdd98fee91bb82fd92d25f908c78465","24a588d942a36d853d18dfe63711e9b180ea0448b956dadce7833f4d6455f0c8","c263cc53a55cc822c360481e94d0fe999acebf92f01f2ca84225a168a182657f","11aba4fbd2d4539d8440169f219974378731ad1e65d4656bd9d8a579b79241e6","b2792748a96701780faae92a11922b38e9e37d54b31df3df70acd32fd586c508","56cac1d8d4be53381e236d675f43c1b2342161ca45d31dfaaf340b0612d14bc5","121adbf7463954a594a796c4914376017a201d6c7bb40cb33b6b6e2f7f3c1bb8","1dd2073db39016abc797e46c711630cd39c497c28063e3a75993940c72eb9792","ad4f365726b33c965a6cf7e20ee8a7984866e08632a6c37b13bbe4d08c6e0a03","1492a06643311a66d01dc0c15259c0dbe7c4d336e7a85cb7ece67085afd2e84f","47ace7a5fa09cb19907ed7cb83a867b05ecff3e10bb229888e24f82b2c03b869","65f72380cb90b44b22370dfb07890bdd557d2e211ffb023363d8c87621c2535a","42278f72f154d26b400dcce641e8ed2227fb0102bff628f831bae44018ec4313","c1e64c51dadfcea7b7995040c64b5ac7e8f954f2a4adf4eb92e7a462ba5275e8","0cf0840523da6e63c4d0d096f3a1220da866a39314acc8d624551d4580d5567e","15e170fc85990c9cbdc7d3799b9490183b2d15202f1ccd0794abe5afb6f351eb","2f166c686866f475aee63ff5f7cf42413169d34e60c03fc5c761b2281ea49df0","40eef65c285d2b03f5c07d8455c675ecac1b90330cffd6d97f7008811ff8dd22","4f257d6caa2adab87c7532a456be55604cbd3861d81f38458812eedd84555e04","a270eff1cca84fc69223b8f4ce8db3cb4b4abf0dad0d054f7b3bcfb99ba9a343","665236eec0c0da8d3f7cdba8f01f98233425d8c065058e513b33385e417a56d2","1e771191631caaa4b5d3429c51e23c23c2f609ea1e99f4183e913c5e7fd2311b","50e8918146f4e8a9240bf867a07cf8aa0deb21fee8d4507e74ff62c8c6af42e9","666640b08e3ce76b6a8c76ce1f9f5b986923d3c76663b7fa4bc36e3af734ec46","6454e0780201a5e155d56f4fd4609a3a626d49e2c0300a2a74bf3f65e8c7fb92","8b157145ca9be70e446f1885f4418babbc9f991704b419106d59584a1670810b","ee57677277db2c2c2b43ff9a860a1a77a47e904170fa856bc3b717d741da0955","312cb6345dc8601ec30c58fbf3a3bed42bffe091ebefe7e9d07179c99245fcc3","1298eb4957af19f5d5c283d38f872953085ee4464decb1cfef669411af42c9be","bba3388b8d3c079e0f4dde365643b0a1108ecc91d4d66aca2ebbfc5beffc649e","dc3b234cbc8f5e9d6c7bdcdbef9ef0a0b83a867075751f04471c5ae9fb4e8167","b822c4e98f5d014a3e64e6c4f50cf2d09491e7eb21621114a62ee5eb9e3ec44b","039290b509ce3199d69cff5591430f2e218da1d80ddaff23c58fd193a23c7c89","2ea0ad0652a48d8f881bddef97866b2f6df74e8b628bcf22bc8cb2c8ebf46fa2",{"version":"8bd0323cfff14bbfa50d7e502d01054a78ec8d4fa0fd9d4d1534f0cdcc7e64c6","signature":"3691185ad183a58955dc0754c575f028c5a2c95f855164ba94ab2082cdda816f"},{"version":"85d2cdb54eada37a44479538bed362b215773554df3a9e09ed817d9062417389","signature":"a0c8d94c7d7c7dba9e461104222662e9ff3bfd0630e8ba609d072d4b7a9d6475"},"ae6bf3e7fb36353315f1556fd23d00750f6a21bbc326ff00c1f1ae641375b138","46af33d573233017f5cc8af7081b8cae11b09112d1dd8ba84ae8fb52bdff3fa7","4715928125944c4c5f19d73e14b6104e192b7de6f8d1d2d16ccb5c5412716d8d","1c1fcc68382a99b15b35e193b89da169b9c3861ec4630765f62ed6ac9b9754ea","7ffdf2881f33b7f3600540883081ba83b9e50e0ce9a36417393ae3d8137d027a","09a66153ea0f485d886a8cb3fa99c6d4854d12780acde17d8798039949d5b468","12b36faab2cca51d73cf516f5b1d623d1b9aa65199112b6678db5af1c2c3c8f5","a4372188a04177bcacc9675a498e5b7db0cf1780db7a7bc54fc342e19fb31d91","bcc85da2796bd50bfcd5242d6ad8550774fcddaa0488ba1955fb9a763eda7457","11a7d49d00dc02610fba5f792bb98a4830da21cd279e42b86b8c10387b7a9e70","e4a0dec5576f1f3a0efa482480eb53db258ae24f505a938a880fcfd11c402657","18c56c5a13d01291c50fbae2658bd5f7a2f94984071a4cf1c302869287002470","695bd1e37d5ea63f1a62d1364c98a134af3b5f4856d9a4411ad5758ddc541517","69219e61a9cac62094baa9f26079a19099cb3c84d23101af6ccf358f24a8ae1b","42e872b330a6ab5b7ff1897cef8d8c7bf04d953e524679624d3f41addec2f154","a0f0c22f7b7afd4173cbe844a19ea1adc7956f5fdbde6767c3e20a1e7dbc10dd","482923ec0d1e3817f9fbc00435690b10761fdbc95c8034b43d9b3a0622b820f0","2d79e80c6c0ab98c01dd7526c570c2197384005624bb707cc2f2835df783aedd","c20549364ff7591fe3ed1f3475d86729a22dc6b771680ce9eb2140f3d1260d59","336765e929e6b74f54beedf004efb99bd9f502dfffa05d5131170d6c1ca602dd","90d335db4c18e23adc3a888e6485b55059d1275b051d7ac3bce0527070960f1d","ddd478067db3e594afc28f3824c3ee74dc124dd22c9f6fc94b4f145c490fed30","18118332cf60dfe061ef415b4bdf7189ed18d66ef897e4e4fcbe7024beb0e5b5","4b55851f1b1b241b458042c96a7f700e9065598241f25b0c8d7836b6ce4e3112","c62cb0764f2ed89876d81a79343776c1c10e2e4dc8d4235f6ed0a9873c1891ed","ea50f63a80ae70cb585b62cd5e80e43a9a90c5ae75a16cae6da357d4033e4aa1","80d84fe00782eba2fefee733d00053091eb995a331cdb6d93a642860603ca3f2",{"version":"154125ba9aedbd0f6b3932accc7284c87e74ee1e191e4cabe2ed92b97385ea21","signature":"847bac3c228f1ef1d05fb5d1c83a2c31e52a577459ca4da2b03b54958219f50e"},{"version":"29269e6110b21fe9b279c4e9b1d0db11218f0450e305bd380e962d973ecf70cf","signature":"f7c0c4e14291ed678d015411e158604152a6e7e203c77c97a76203085c572d89"}],"root":[224,225,253,254],"options":{"composite":true,"declaration":true,"declarationDir":"./","declarationMap":true,"emitDeclarationOnly":true,"exactOptionalPropertyTypes":true,"jsx":4,"jsxImportSource":"@lynx-js/react","module":99,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":6,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[98,1],[115,2],[104,3],[116,4],[124,5],[127,6],[126,7],[106,8],[109,9],[110,10],[112,11],[113,12],[121,13],[120,14],[122,15],[123,14],[129,16],[128,17],[89,18],[91,19],[95,20],[92,21],[93,22],[88,23],[90,24],[44,25],[83,26],[74,27],[59,28],[56,27],[81,29],[57,27],[79,30],[58,31],[84,32],[60,33],[67,31],[62,27],[61,34],[76,31],[82,35],[80,31],[63,27],[71,31],[72,31],[64,34],[70,31],[65,34],[68,31],[69,27],[77,31],[66,27],[73,31],[75,31],[47,36],[54,37],[86,38],[55,39],[96,40],[45,36],[46,41],[51,42],[52,43],[50,44],[41,45],[97,46],[108,47],[107,12],[103,12],[101,12],[102,48],[100,12],[197,49],[196,50],[198,51],[199,52],[214,53],[202,54],[209,55],[227,56],[228,57],[229,57],[234,58],[230,57],[232,59],[231,60],[233,61],[226,59],[203,52],[205,62],[236,63],[239,64],[240,65],[243,66],[241,59],[235,52],[242,52],[237,59],[238,67],[208,68],[217,69],[215,70],[216,71],[246,72],[245,73],[244,74],[206,70],[219,75],[218,76],[220,77],[223,78],[221,52],[222,79],[207,80],[204,81],[247,82],[249,83],[250,84],[252,85],[251,86],[134,87],[135,88],[133,88],[136,89],[143,90],[138,91],[139,88],[141,92],[140,87],[142,88],[152,93],[148,94],[151,95],[150,96],[156,97],[157,97],[155,98],[160,99],[159,98],[195,100],[162,101],[163,102],[168,103],[164,104],[166,105],[165,106],[171,107],[174,108],[176,109],[181,110],[180,111],[178,101],[182,109],[183,112],[184,113],[185,114],[193,115],[186,113],[187,110],[179,116],[192,117],[190,118],[191,119],[194,120],[225,121],[254,122],[253,123],[224,124]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
@@ -0,0 +1,46 @@
1
+ import './media.css';
2
+ import type { G9FilePicker, G9FileRef } from '@g9tm/lynxcontrols-foundation/services';
3
+ import { type ReactNode } from '@lynx-js/react';
4
+ /** Options of {@link g9PickFiles}. */
5
+ export interface G9PickOptions {
6
+ /** The web's `accept` list: `image/*,.pdf`, `video/*`. */
7
+ readonly accept?: string;
8
+ readonly multiple?: boolean;
9
+ /** Opens the camera for one photo instead of the chooser. */
10
+ readonly capture?: 'user' | 'environment';
11
+ }
12
+ /**
13
+ * Opens the chooser (or the camera) and resolves the files that match `accept` (`[]` when cancelled or without a
14
+ * picker); the ones that do not match are released back to the host.
15
+ */
16
+ export declare function g9PickFiles(files: G9FilePicker | undefined, options?: G9PickOptions): Promise<readonly G9FileRef[]>;
17
+ /** The host's drag-and-drop events (`g9:drag` `{ active }`, `g9:drop` `{ files }`), delivered to the top zone. */
18
+ export declare function g9DropZoneEvent(name: 'g9:drag' | 'g9:drop', detail: {
19
+ readonly active?: boolean;
20
+ readonly files?: readonly G9FileRef[];
21
+ }): void;
22
+ /** Props of {@link G9DropZone}. */
23
+ export interface G9DropZoneProps {
24
+ readonly id?: string;
25
+ readonly accept?: string;
26
+ /** Default true. */
27
+ readonly multiple?: boolean;
28
+ readonly disabled?: boolean;
29
+ /** The area's and the cover's text. */
30
+ readonly label: string;
31
+ /** A second line in the area. */
32
+ readonly hint?: string;
33
+ readonly onFiles: (files: readonly G9FileRef[]) => void;
34
+ /** Wrapped content opens the chooser on a tap too. */
35
+ readonly tapToPick?: boolean;
36
+ readonly className?: string;
37
+ /** With children: they are the drop target (a chat thread); without: a tappable area. */
38
+ readonly children?: ReactNode;
39
+ }
40
+ /**
41
+ * Two uses: `<G9DropZone label onFiles />` is a tappable area that opens the chooser (the way in on a phone);
42
+ * `<G9DropZone label onFiles>{thread}</G9DropZone>` makes the content the target of files dropped on the window, with a
43
+ * dashed cover while they are dragged over. Without a `files` service the area shows disabled.
44
+ */
45
+ export declare function G9DropZone(props: G9DropZoneProps): ReactNode;
46
+ //# sourceMappingURL=drop-zone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drop-zone.d.ts","sourceRoot":"","sources":["../src/drop-zone.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,gBAAgB,CAAC;AAG7E,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,YAAY,GAAG,SAAS,EAC/B,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAc/B;AAYD,kHAAkH;AAClH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,MAAM,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GAC3E,IAAI,CAQN;AAqBD,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,KAAK,IAAI,CAAC;IACxD,sDAAsD;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CA2E5D"}
@@ -0,0 +1,114 @@
1
+ import "./media.css";
2
+ import { g9IdProps } from "@g9tm/lynxcontrols/base";
3
+ import { G9Art } from "@g9tm/lynxcontrols/icon";
4
+ import { useG9Core } from "@g9tm/lynxcontrols/provider";
5
+ import { useEffect, useRef, useState } from "@lynx-js/react";
6
+ import { acceptsFile, pickCategory } from "./model.jsx";
7
+ async function g9PickFiles(files, options = {}) {
8
+ if (!files) return [];
9
+ try {
10
+ var _options_multiple;
11
+ var _files_release;
12
+ if (options.capture) {
13
+ const shot = files.camera ? await files.camera({
14
+ mode: 'photo',
15
+ facing: options.capture
16
+ }) : null;
17
+ return shot ? [
18
+ shot
19
+ ] : [];
20
+ }
21
+ const picked = await files.pick({
22
+ accept: pickCategory(options.accept),
23
+ multiple: null != (_options_multiple = options.multiple) ? _options_multiple : false
24
+ });
25
+ const matching = picked.filter((file)=>acceptsFile(file, options.accept));
26
+ for (const file of picked)if (!matching.includes(file)) null == (_files_release = files.release) || _files_release.call(files, file.id);
27
+ return options.multiple ? matching : matching.slice(0, 1);
28
+ } catch {
29
+ return [];
30
+ }
31
+ }
32
+ const zones = [];
33
+ let listening = false;
34
+ const topZone = ()=>[
35
+ ...zones
36
+ ].reverse().find((z)=>z.enabled());
37
+ function g9DropZoneEvent(name, detail) {
38
+ const zone = topZone();
39
+ if (!zone) return;
40
+ if ('g9:drag' === name) zone.setActive(Boolean(detail.active));
41
+ else {
42
+ zone.setActive(false);
43
+ if (Array.isArray(detail.files)) zone.deliver(detail.files);
44
+ }
45
+ }
46
+ function listen() {
47
+ if (listening) return;
48
+ listening = true;
49
+ try {
50
+ const emitter = lynx.getJSModule('GlobalEventEmitter');
51
+ emitter.addListener('g9:drag', (d)=>g9DropZoneEvent('g9:drag', null != d ? d : {}));
52
+ emitter.addListener('g9:drop', (d)=>g9DropZoneEvent('g9:drop', null != d ? d : {}));
53
+ } catch {}
54
+ }
55
+ const UPLOAD = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15.5 L12 4.5"/><path d="M7.5 9 L12 4.5 L16.5 9"/><path d="M4.5 15 L4.5 18 Q4.5 19.5 6 19.5 L18 19.5 Q19.5 19.5 19.5 18 L19.5 15"/></svg>';
56
+ function G9DropZone(props) {
57
+ const files = useG9Core().services.files;
58
+ const [active, setActive] = useState(false);
59
+ const [busy, setBusy] = useState(false);
60
+ const latest = useRef(props);
61
+ latest.current = props;
62
+ useEffect(()=>{
63
+ listen();
64
+ const zone = {
65
+ enabled: ()=>!latest.current.disabled,
66
+ setActive,
67
+ deliver: (dropped)=>{
68
+ const matching = dropped.filter((file)=>acceptsFile(file, latest.current.accept));
69
+ if (matching.length) latest.current.onFiles(false === latest.current.multiple ? matching.slice(0, 1) : matching);
70
+ }
71
+ };
72
+ zones.push(zone);
73
+ return ()=>{
74
+ const i = zones.indexOf(zone);
75
+ if (i >= 0) zones.splice(i, 1);
76
+ };
77
+ }, []);
78
+ const disabled = true === props.disabled || !files;
79
+ const choose = async ()=>{
80
+ if (disabled || busy) return;
81
+ setBusy(true);
82
+ try {
83
+ const picked = await g9PickFiles(files, {
84
+ ...props.accept ? {
85
+ accept: props.accept
86
+ } : {},
87
+ multiple: false !== props.multiple
88
+ });
89
+ if (picked.length) props.onFiles(picked);
90
+ } finally{
91
+ setBusy(false);
92
+ }
93
+ };
94
+ const badge = <view className="g9-drop__badge">
95
+ <G9Art svg={UPLOAD} height={22} color="#FFFFFF"/>
96
+ </view>;
97
+ if (void 0 === props.children || null === props.children || false === props.children) return <view className={`g9-drop${active ? ' g9-drop--active' : ''}${disabled ? ' g9-drop--disabled' : ''}${props.className ? ` ${props.className}` : ''}`} {...g9IdProps(props.id)} accessibility-element={true} accessibility-traits="button" accessibility-label={props.hint ? `${props.label}. ${props.hint}` : props.label} bindtap={()=>void choose()}>
98
+ {badge}
99
+ <text className="g9-drop__label">{props.label}</text>
100
+ {props.hint ? <text className="g9-drop__hint">{props.hint}</text> : null}
101
+ </view>;
102
+ return <view className={`g9-drop-wrap${props.className ? ` ${props.className}` : ''}`} {...g9IdProps(props.id)} {...props.tapToPick ? {
103
+ bindtap: ()=>void choose()
104
+ } : {}}>
105
+ {props.children}
106
+ {active && !props.disabled ? <view className="g9-drop__cover">
107
+ <view className="g9-drop__card">
108
+ {badge}
109
+ <text className="g9-drop__label">{props.label}</text>
110
+ </view>
111
+ </view> : null}
112
+ </view>;
113
+ }
114
+ export { G9DropZone, g9DropZoneEvent, g9PickFiles };
@@ -0,0 +1,4 @@
1
+ export { G9DropZone, type G9DropZoneProps, type G9PickOptions, g9DropZoneEvent, g9PickFiles } from './drop-zone.js';
2
+ export { G9BlurhashView, type G9BlurhashViewProps, G9ImageCropper, type G9ImageCropperProps, G9Lightbox, type G9LightboxProps, G9MediaGrid, type G9MediaGridProps, type G9MediaItem, G9VoicePlayer, type G9VoicePlayerProps, } from './media.js';
3
+ export * from './model.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,cAAc,EACd,KAAK,mBAAmB,EACxB,UAAU,EACV,KAAK,eAAe,EACpB,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,SAAS,CAAC;AACjB,cAAc,SAAS,CAAC"}
package/dist/index.jsx ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./model.jsx";
2
+ export { G9DropZone, g9DropZoneEvent, g9PickFiles } from "./drop-zone.jsx";
3
+ export { G9BlurhashView, G9ImageCropper, G9Lightbox, G9MediaGrid, G9VoicePlayer } from "./media.jsx";
package/dist/media.css ADDED
@@ -0,0 +1,256 @@
1
+ .g9-blurhash {
2
+ position: relative;
3
+ overflow: hidden;
4
+ }
5
+
6
+ .g9-blurhash__svg {
7
+ position: absolute;
8
+ top: 0;
9
+ left: 0;
10
+ }
11
+
12
+ .g9-blurhash__img {
13
+ opacity: 0;
14
+ transition: opacity .22s ease-out;
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ }
19
+
20
+ .g9-blurhash__img--on {
21
+ opacity: 1;
22
+ }
23
+
24
+ .g9-media-grid {
25
+ background-color: var(--g9-surface-container);
26
+ position: relative;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .g9-media-grid__tile {
31
+ position: absolute;
32
+ overflow: hidden;
33
+ }
34
+
35
+ .g9-media-grid__img {
36
+ width: 100%;
37
+ height: 100%;
38
+ }
39
+
40
+ .g9-media-grid__more {
41
+ background-color: #00000073;
42
+ justify-content: center;
43
+ align-items: center;
44
+ display: flex;
45
+ position: absolute;
46
+ top: 0;
47
+ bottom: 0;
48
+ left: 0;
49
+ right: 0;
50
+ }
51
+
52
+ .g9-media-grid__more-text {
53
+ color: #fff;
54
+ font-size: 24px;
55
+ font-weight: 800;
56
+ }
57
+
58
+ .g9-lightbox {
59
+ background-color: #000;
60
+ flex-direction: column;
61
+ animation-name: g9-lightbox-in;
62
+ animation-duration: .18s;
63
+ animation-fill-mode: both;
64
+ display: flex;
65
+ position: fixed;
66
+ top: 0;
67
+ bottom: 0;
68
+ left: 0;
69
+ right: 0;
70
+ }
71
+
72
+ @keyframes g9-lightbox-in {
73
+ from {
74
+ opacity: 0;
75
+ }
76
+
77
+ to {
78
+ opacity: 1;
79
+ }
80
+ }
81
+
82
+ .g9-lightbox__pager {
83
+ flex: 1;
84
+ width: 100%;
85
+ }
86
+
87
+ .g9-lightbox__page {
88
+ justify-content: center;
89
+ align-items: center;
90
+ height: 100%;
91
+ display: flex;
92
+ }
93
+
94
+ .g9-lightbox__img {
95
+ width: 100%;
96
+ height: 100%;
97
+ }
98
+
99
+ .g9-lightbox__bar {
100
+ flex-direction: row;
101
+ justify-content: space-between;
102
+ align-items: center;
103
+ padding-left: 12px;
104
+ padding-right: 12px;
105
+ display: flex;
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ right: 0;
110
+ }
111
+
112
+ .g9-lightbox__count {
113
+ color: #fff;
114
+ font-size: 14px;
115
+ font-weight: 700;
116
+ }
117
+
118
+ .g9-lightbox__actions {
119
+ flex-direction: row;
120
+ display: flex;
121
+ }
122
+
123
+ .g9-cropper {
124
+ flex-direction: column;
125
+ align-items: center;
126
+ row-gap: 12px;
127
+ display: flex;
128
+ }
129
+
130
+ .g9-cropper__frame {
131
+ background-color: #000;
132
+ position: relative;
133
+ overflow: hidden;
134
+ }
135
+
136
+ .g9-cropper__grid {
137
+ border: 1px solid #fff9;
138
+ position: absolute;
139
+ top: 0;
140
+ bottom: 0;
141
+ left: 0;
142
+ right: 0;
143
+ }
144
+
145
+ .g9-voice {
146
+ align-items: center;
147
+ column-gap: 10px;
148
+ display: flex;
149
+ }
150
+
151
+ .g9-voice__wave {
152
+ flex-direction: row;
153
+ align-items: center;
154
+ column-gap: 2px;
155
+ height: 32px;
156
+ display: flex;
157
+ }
158
+
159
+ .g9-voice__bar {
160
+ background-color: var(--g9-outline);
161
+ border-radius: 1px;
162
+ width: 2px;
163
+ }
164
+
165
+ .g9-voice__bar--played {
166
+ background-color: var(--g9-primary);
167
+ }
168
+
169
+ .g9-voice__time {
170
+ color: var(--g9-text-secondary);
171
+ font-size: 12px;
172
+ }
173
+
174
+ .g9-drop {
175
+ border-style: dashed;
176
+ border-width: 1.5px;
177
+ border-color: var(--g9-primary-border);
178
+ background-color: var(--g9-primary-container);
179
+ border-radius: 16px;
180
+ flex-direction: column;
181
+ justify-content: center;
182
+ align-items: center;
183
+ padding: 24px 16px;
184
+ display: flex;
185
+ }
186
+
187
+ .g9-drop:active {
188
+ opacity: .8;
189
+ }
190
+
191
+ .g9-drop--active {
192
+ border-color: var(--g9-primary);
193
+ }
194
+
195
+ .g9-drop--disabled {
196
+ opacity: .5;
197
+ }
198
+
199
+ .g9-drop__badge {
200
+ background-color: var(--g9-primary);
201
+ border-radius: 24px;
202
+ justify-content: center;
203
+ align-items: center;
204
+ width: 48px;
205
+ height: 48px;
206
+ display: flex;
207
+ }
208
+
209
+ .g9-drop__label {
210
+ color: var(--g9-text-primary);
211
+ text-align: center;
212
+ margin-top: 12px;
213
+ font-size: 14px;
214
+ font-weight: 600;
215
+ }
216
+
217
+ .g9-drop__hint {
218
+ color: var(--g9-text-tertiary);
219
+ text-align: center;
220
+ margin-top: 4px;
221
+ font-size: 12px;
222
+ }
223
+
224
+ .g9-drop-wrap {
225
+ flex-direction: column;
226
+ display: flex;
227
+ position: relative;
228
+ }
229
+
230
+ .g9-drop__cover {
231
+ border-style: dashed;
232
+ border-width: 2px;
233
+ border-color: var(--g9-primary);
234
+ background-color: var(--g9-scrim-light);
235
+ border-radius: 16px;
236
+ justify-content: center;
237
+ align-items: center;
238
+ display: flex;
239
+ position: absolute;
240
+ top: 0;
241
+ bottom: 0;
242
+ left: 0;
243
+ right: 0;
244
+ }
245
+
246
+ .g9-drop__card {
247
+ background-color: var(--g9-surface);
248
+ border-radius: 16px;
249
+ flex-direction: column;
250
+ align-items: center;
251
+ padding: 20px 24px;
252
+ display: flex;
253
+ }
254
+
255
+
256
+ /*# sourceMappingURL=media.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://./src/media.css"],"names":[],"mappings":"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","sourcesContent":["/* Media controls. One class per selector; motion is opacity/transform only. */\n.g9-blurhash {\n position: relative;\n overflow: hidden;\n}\n\n.g9-blurhash__svg {\n position: absolute;\n left: 0px;\n top: 0px;\n}\n\n.g9-blurhash__img {\n position: absolute;\n left: 0px;\n top: 0px;\n opacity: 0;\n transition: opacity 220ms ease-out;\n}\n\n.g9-blurhash__img--on {\n opacity: 1;\n}\n\n.g9-media-grid {\n position: relative;\n overflow: hidden;\n background-color: var(--g9-surface-container);\n}\n\n.g9-media-grid__tile {\n position: absolute;\n overflow: hidden;\n}\n\n.g9-media-grid__img {\n width: 100%;\n height: 100%;\n}\n\n.g9-media-grid__more {\n position: absolute;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(0, 0, 0, 0.45);\n}\n\n.g9-media-grid__more-text {\n font-size: 24px;\n font-weight: 800;\n color: #ffffff;\n}\n\n.g9-lightbox {\n position: fixed;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n display: flex;\n flex-direction: column;\n background-color: #000000;\n animation-name: g9-lightbox-in;\n animation-duration: 180ms;\n animation-fill-mode: both;\n}\n\n@keyframes g9-lightbox-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.g9-lightbox__pager {\n flex: 1;\n width: 100%;\n}\n\n.g9-lightbox__page {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n\n.g9-lightbox__img {\n width: 100%;\n height: 100%;\n}\n\n.g9-lightbox__bar {\n position: absolute;\n left: 0px;\n right: 0px;\n top: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-left: 12px;\n padding-right: 12px;\n}\n\n.g9-lightbox__count {\n font-size: 14px;\n font-weight: 700;\n color: #ffffff;\n}\n\n.g9-lightbox__actions {\n display: flex;\n flex-direction: row;\n}\n\n.g9-cropper {\n display: flex;\n flex-direction: column;\n align-items: center;\n row-gap: 12px;\n}\n\n.g9-cropper__frame {\n position: relative;\n overflow: hidden;\n background-color: #000000;\n}\n\n.g9-cropper__grid {\n position: absolute;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n border-width: 1px;\n border-style: solid;\n border-color: rgba(255, 255, 255, 0.6);\n}\n\n.g9-voice {\n display: flex;\n align-items: center;\n column-gap: 10px;\n}\n\n.g9-voice__wave {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 2px;\n height: 32px;\n}\n\n.g9-voice__bar {\n width: 2px;\n border-radius: 1px;\n background-color: var(--g9-outline);\n}\n\n.g9-voice__bar--played {\n background-color: var(--g9-primary);\n}\n\n.g9-voice__time {\n font-size: 12px;\n color: var(--g9-text-secondary);\n}\n\n/* G9DropZone */\n.g9-drop {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 24px 16px;\n border-radius: 16px;\n border-width: 1.5px;\n border-style: dashed;\n border-color: var(--g9-primary-border);\n background-color: var(--g9-primary-container);\n}\n\n.g9-drop:active {\n opacity: 0.8;\n}\n\n.g9-drop--active {\n border-color: var(--g9-primary);\n}\n\n.g9-drop--disabled {\n opacity: 0.5;\n}\n\n.g9-drop__badge {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border-radius: 24px;\n background-color: var(--g9-primary);\n}\n\n.g9-drop__label {\n margin-top: 12px;\n font-size: 14px;\n font-weight: 600;\n color: var(--g9-text-primary);\n text-align: center;\n}\n\n.g9-drop__hint {\n margin-top: 4px;\n font-size: 12px;\n color: var(--g9-text-tertiary);\n text-align: center;\n}\n\n.g9-drop-wrap {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.g9-drop__cover {\n position: absolute;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 16px;\n border-width: 2px;\n border-style: dashed;\n border-color: var(--g9-primary);\n background-color: var(--g9-scrim-light);\n}\n\n.g9-drop__card {\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 20px 24px;\n border-radius: 16px;\n background-color: var(--g9-surface);\n}\n"],"sourceRoot":""}
@@ -0,0 +1,88 @@
1
+ import './media.css';
2
+ import { type ReactNode } from '@lynx-js/react';
3
+ import { cropRect, type G9CropState, type G9Size } from './model.js';
4
+ /** Props of {@link G9BlurhashView}. */
5
+ export interface G9BlurhashViewProps {
6
+ readonly hash: string;
7
+ /** The photo drawn over the placeholder (it fades in when loaded). */
8
+ readonly src?: string | null;
9
+ readonly width: number | string;
10
+ readonly height: number | string;
11
+ readonly radius?: number;
12
+ readonly mode?: 'aspectFill' | 'aspectFit';
13
+ readonly className?: string;
14
+ readonly id?: string;
15
+ }
16
+ /** A blurhash placeholder under a photo that fades in on load (one SVG built per hash). */
17
+ export declare const G9BlurhashView: import("react").NamedExoticComponent<G9BlurhashViewProps>;
18
+ /** One photo of a grid or lightbox. */
19
+ export interface G9MediaItem {
20
+ readonly id: string;
21
+ readonly src: string;
22
+ readonly blurhash?: string;
23
+ /** Spoken description. */
24
+ readonly alt?: string;
25
+ }
26
+ /** Props of {@link G9MediaGrid}. */
27
+ export interface G9MediaGridProps {
28
+ readonly id?: string;
29
+ readonly items: readonly G9MediaItem[];
30
+ readonly width: number;
31
+ readonly height?: number;
32
+ readonly radius?: number;
33
+ readonly gap?: number;
34
+ readonly onOpen?: (index: number) => void;
35
+ }
36
+ /** 1–4 tiles (and «+k» on the fourth) in a chat or feed post; a tap opens the photo. */
37
+ export declare function G9MediaGrid(props: G9MediaGridProps): ReactNode;
38
+ /** Props of {@link G9Lightbox}. */
39
+ export interface G9LightboxProps {
40
+ readonly id?: string;
41
+ readonly open: boolean;
42
+ readonly items: readonly G9MediaItem[];
43
+ readonly index: number;
44
+ readonly onIndexChange?: (index: number) => void;
45
+ readonly onClose: () => void;
46
+ readonly closeLabel?: string;
47
+ /** Actions in the top bar (share, save). */
48
+ readonly actions?: ReactNode;
49
+ }
50
+ /**
51
+ * The photos full screen on black: swipe between them (Lynx's native `<viewpager>`, snapping), the position «۲ / ۵»,
52
+ * a close button; fades in with opacity only. It opens in the host's popups layer (above the tab bar and the page),
53
+ * the system back closes it, and automation sees it as covering the page.
54
+ */
55
+ export declare function G9Lightbox(props: G9LightboxProps): ReactNode;
56
+ /** Props of {@link G9ImageCropper}. */
57
+ export interface G9ImageCropperProps {
58
+ readonly id?: string;
59
+ readonly src: string;
60
+ readonly image: G9Size;
61
+ readonly frame: G9Size;
62
+ /** A round mask (avatars). */
63
+ readonly round?: boolean;
64
+ readonly maxZoom?: number;
65
+ readonly onChange?: (crop: ReturnType<typeof cropRect>, state: G9CropState) => void;
66
+ }
67
+ /** Drag to place, − zoom + to scale (a pinch where the host reports it); the crop rectangle in image pixels comes out. */
68
+ export declare function G9ImageCropper(props: G9ImageCropperProps): ReactNode;
69
+ /** Props of {@link G9VoicePlayer}. */
70
+ export interface G9VoicePlayerProps {
71
+ readonly id?: string;
72
+ /** Seconds. */
73
+ readonly duration: number;
74
+ /** Seconds played. */
75
+ readonly position: number;
76
+ readonly playing: boolean;
77
+ readonly onToggle: () => void;
78
+ /** Seek to a fraction 0..1 (a tap on the waveform). */
79
+ readonly onSeek?: (fraction: number) => void;
80
+ readonly samples?: readonly number[];
81
+ readonly bars?: number;
82
+ readonly mine?: boolean;
83
+ readonly playLabel?: string;
84
+ readonly pauseLabel?: string;
85
+ }
86
+ /** A voice note: play/pause, the waveform filling as it plays, the time left. The app owns the audio. */
87
+ export declare const G9VoicePlayer: import("react").NamedExoticComponent<G9VoicePlayerProps>;
88
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.tsx"],"names":[],"mappings":"AAGA,OAAO,aAAa,CAAC;AAQrB,OAAO,EAAQ,KAAK,SAAS,EAA6B,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAKL,QAAQ,EAER,KAAK,WAAW,EAChB,KAAK,MAAM,EAIZ,MAAM,SAAS,CAAC;AAEjB,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,2FAA2F;AAC3F,eAAO,MAAM,cAAc,2DA2BzB,CAAC;AAEH,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAID,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CA+C9D;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAS5D;AAuDD,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACrF;AAED,0HAA0H;AAC1H,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CA8DpE;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,yGAAyG;AACzG,eAAO,MAAM,aAAa,0DA+CxB,CAAC"}
package/dist/media.jsx ADDED
@@ -0,0 +1,223 @@
1
+ import "./media.css";
2
+ import { g9IdProps } from "@g9tm/lynxcontrols/base";
3
+ import { G9IconButton } from "@g9tm/lynxcontrols/button";
4
+ import { useG9Back, useG9LayerItem } from "@g9tm/lynxcontrols/host";
5
+ import { G9OverlayRoot, useG9OpenOverlay } from "@g9tm/lynxcontrols/popover";
6
+ import { useG9Culture, useG9Direction, useG9SafeInsets } from "@g9tm/lynxcontrols/provider";
7
+ import { G9Stepper } from "@g9tm/lynxcontrols/toggle";
8
+ import { formatNumber, g9Haptic, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
9
+ import { memo, useMemo, useRef, useState } from "@lynx-js/react";
10
+ import { blurhashAverage, blurhashBmp, clampCrop, coverScale, cropRect, formatDuration, isBlurhash, mediaGridLayout, waveformBars } from "./model.jsx";
11
+ const G9BlurhashView = memo(function(props) {
12
+ var _props_radius, _props_mode;
13
+ const placeholder = useMemo(()=>isBlurhash(props.hash) ? blurhashBmp(props.hash) : '', [
14
+ props.hash
15
+ ]);
16
+ const [loaded, setLoaded] = useState(false);
17
+ const size = {
18
+ width: 'number' == typeof props.width ? `${props.width}px` : props.width,
19
+ height: 'number' == typeof props.height ? `${props.height}px` : props.height
20
+ };
21
+ return <view className={`g9-blurhash${props.className ? ` ${props.className}` : ''}`} {...g9IdProps(props.id)} style={{
22
+ ...size,
23
+ borderRadius: `${null != (_props_radius = props.radius) ? _props_radius : 0}px`,
24
+ backgroundColor: blurhashAverage(props.hash)
25
+ }}>
26
+ {placeholder && !loaded ? <image className="g9-blurhash__svg" src={placeholder} mode="scaleToFill" style={size}/> : null}
27
+ {props.src ? <image className={`g9-blurhash__img${loaded ? ' g9-blurhash__img--on' : ''}`} src={props.src} mode={null != (_props_mode = props.mode) ? _props_mode : 'aspectFill'} style={size} bindload={()=>setLoaded(true)}/> : null}
28
+ </view>;
29
+ });
30
+ const px = (v)=>`${Math.round(100 * v) / 100}px`;
31
+ function G9MediaGrid(props) {
32
+ var _props_height, _props_gap, _props_radius;
33
+ const culture = useG9Culture();
34
+ const rtl = 'rtl' === useG9Direction();
35
+ const tiles = mediaGridLayout(props.items.length);
36
+ const h = null != (_props_height = props.height) ? _props_height : 1 === props.items.length ? 0.75 * props.width : 0.66 * props.width;
37
+ const gap = null != (_props_gap = props.gap) ? _props_gap : 2;
38
+ const more = props.items.length - tiles.length;
39
+ return <view className="g9-media-grid" {...g9IdProps(props.id)} style={{
40
+ width: `${props.width}px`,
41
+ height: `${h}px`,
42
+ borderRadius: `${null != (_props_radius = props.radius) ? _props_radius : 12}px`
43
+ }}>
44
+ {tiles.map((t, i)=>{
45
+ var _it_alt;
46
+ const it = props.items[i];
47
+ const x = rtl ? Math.round((1 - t.x - t.w) * 1e6) / 1e6 : t.x;
48
+ return <view key={it.id} className="g9-media-grid__tile" style={{
49
+ left: px(x * props.width + (x > 0 ? gap / 2 : 0)),
50
+ top: px(t.y * h + (t.y > 0 ? gap / 2 : 0)),
51
+ width: px(t.w * props.width - (t.w < 1 ? gap / 2 : 0)),
52
+ height: px(t.h * h - (t.h < 1 ? gap / 2 : 0))
53
+ }} {...props.onOpen ? {
54
+ bindtap: ()=>{
55
+ var _props_onOpen;
56
+ return null == (_props_onOpen = props.onOpen) ? void 0 : _props_onOpen.call(props, i);
57
+ }
58
+ } : {}} accessibility-element={true} accessibility-traits="image" accessibility-label={null != (_it_alt = it.alt) ? _it_alt : ''}>
59
+ {it.blurhash ? <G9BlurhashView hash={it.blurhash} src={it.src} width="100%" height="100%"/> : <image className="g9-media-grid__img" src={it.src} mode="aspectFill"/>}
60
+ {i === tiles.length - 1 && more > 0 ? <view className="g9-media-grid__more">
61
+ <text className="g9-media-grid__more-text">{`+${formatNumber(more, {
62
+ numberingSystem: culture.numberingSystem
63
+ })}`}</text>
64
+ </view> : null}
65
+ </view>;
66
+ })}
67
+ </view>;
68
+ }
69
+ function G9Lightbox(props) {
70
+ const key = useMemo(()=>`g9-lightbox-${++lightboxSeq}`, []);
71
+ const [width, setWidth] = useState(0);
72
+ const close = props.onClose;
73
+ useG9Back(()=>(close(), true), {
74
+ enabled: props.open,
75
+ layer: 'popups'
76
+ });
77
+ useG9OpenOverlay(key, 'lightbox', props.open, close);
78
+ const element = props.open ? <LightboxView key={key} {...props} width={width} onWidth={setWidth}/> : null;
79
+ useG9LayerItem('popups', key, element, {
80
+ enabled: props.open
81
+ });
82
+ return null;
83
+ }
84
+ let lightboxSeq = 0;
85
+ function LightboxView(props) {
86
+ var _props_closeLabel;
87
+ const culture = useG9Culture();
88
+ const insets = useG9SafeInsets();
89
+ const n = (v)=>formatNumber(v, {
90
+ numberingSystem: culture.numberingSystem
91
+ });
92
+ const { width } = props;
93
+ return <G9OverlayRoot id={props.id} label={`${n(props.index + 1)} / ${n(props.items.length)}`} attrs={{
94
+ className: 'g9-lightbox',
95
+ bindlayoutchange: (e)=>props.onWidth(Math.round(e.detail.width))
96
+ }}>
97
+ <viewpager className="g9-lightbox__pager" initial-select-index={props.index} bindchange={(e)=>{
98
+ var _props_onIndexChange;
99
+ if (e.detail.index !== props.index) null == (_props_onIndexChange = props.onIndexChange) || _props_onIndexChange.call(props, e.detail.index);
100
+ }}>
101
+ {props.items.map((it)=>{
102
+ var _it_alt;
103
+ return <viewpager-item key={it.id} className="g9-lightbox__page" style={width ? {
104
+ width: `${width}px`
105
+ } : {}}>
106
+ <image className="g9-lightbox__img" src={it.src} mode="aspectFit" accessibility-element={true} accessibility-label={null != (_it_alt = it.alt) ? _it_alt : ''}/>
107
+ </viewpager-item>;
108
+ })}
109
+ </viewpager>
110
+ <view className="g9-lightbox__bar" style={{
111
+ paddingTop: `${insets.top + 8}px`
112
+ }}>
113
+ <G9IconButton {...props.id ? {
114
+ id: `${props.id}.Close`
115
+ } : {}} icon="close" baseBackgroundColor="rgba(255,255,255,0.14)" textColor="#FFFFFF" accessibilityText={null != (_props_closeLabel = props.closeLabel) ? _props_closeLabel : 'Close'} onPress={props.onClose}/>
116
+ <text className="g9-lightbox__count">{`${n(props.index + 1)} / ${n(props.items.length)}`}</text>
117
+ <view className="g9-lightbox__actions">{props.actions}</view>
118
+ </view>
119
+ </G9OverlayRoot>;
120
+ }
121
+ function G9ImageCropper(props) {
122
+ var _props_maxZoom;
123
+ const [state, setState] = useState({
124
+ zoom: 1,
125
+ x: 0,
126
+ y: 0
127
+ });
128
+ const drag = useRef(null);
129
+ const apply = (next)=>{
130
+ var _props_maxZoom;
131
+ var _props_onChange;
132
+ const c = clampCrop(next, props.image, props.frame, null != (_props_maxZoom = props.maxZoom) ? _props_maxZoom : 5);
133
+ setState(c);
134
+ null == (_props_onChange = props.onChange) || _props_onChange.call(props, cropRect(c, props.image, props.frame), c);
135
+ };
136
+ const s = coverScale(props.image, props.frame) * state.zoom;
137
+ const w = props.image.width * s;
138
+ const h = props.image.height * s;
139
+ return <view className="g9-cropper" {...g9IdProps(props.id)}>
140
+ <view className="g9-cropper__frame" style={{
141
+ width: `${props.frame.width}px`,
142
+ height: `${props.frame.height}px`,
143
+ borderRadius: props.round ? `${Math.min(props.frame.width, props.frame.height) / 2}px` : '12px'
144
+ }} bindtouchstart={(e)=>{
145
+ var _ref, _ref1, _ref2, _ref3;
146
+ var _e_touches, _e_detail, _e_detail1;
147
+ const t = null == (_e_touches = e.touches) ? void 0 : _e_touches[0];
148
+ drag.current = {
149
+ x: null != (_ref = null != (_ref1 = null == t ? void 0 : t.clientX) ? _ref1 : null == (_e_detail = e.detail) ? void 0 : _e_detail.x) ? _ref : 0,
150
+ y: null != (_ref2 = null != (_ref3 = null == t ? void 0 : t.clientY) ? _ref3 : null == (_e_detail1 = e.detail) ? void 0 : _e_detail1.y) ? _ref2 : 0,
151
+ from: state
152
+ };
153
+ }} bindtouchmove={(e)=>{
154
+ var _e_touches;
155
+ const t = null == (_e_touches = e.touches) ? void 0 : _e_touches[0];
156
+ const d = drag.current;
157
+ if (!t || !d) return;
158
+ apply({
159
+ zoom: d.from.zoom,
160
+ x: d.from.x + (t.clientX - d.x),
161
+ y: d.from.y + (t.clientY - d.y)
162
+ });
163
+ }} bindtouchend={()=>{
164
+ drag.current = null;
165
+ }}>
166
+ <image src={props.src} mode="scaleToFill" style={{
167
+ width: `${w}px`,
168
+ height: `${h}px`,
169
+ transform: `translate(${(props.frame.width - w) / 2 + state.x}px, ${(props.frame.height - h) / 2 + state.y}px)`
170
+ }}/>
171
+ <view className="g9-cropper__grid"/>
172
+ </view>
173
+ <G9Stepper {...props.id ? {
174
+ id: `${props.id}.Zoom`
175
+ } : {}} value={Math.round(10 * state.zoom)} min={10} max={Math.round((null != (_props_maxZoom = props.maxZoom) ? _props_maxZoom : 5) * 10)} step={2} format={(v)=>`${(v / 10).toFixed(1)}×`} onChange={(v)=>{
176
+ g9Haptic('tick');
177
+ apply({
178
+ ...state,
179
+ zoom: v / 10
180
+ });
181
+ }}/>
182
+ </view>;
183
+ }
184
+ const G9VoicePlayer = memo(function(props) {
185
+ var _props_bars, _props_pauseLabel, _props_playLabel;
186
+ const rtl = 'rtl' === useG9Direction();
187
+ const culture = useG9Culture();
188
+ const count = null != (_props_bars = props.bars) ? _props_bars : 32;
189
+ const heights = useMemo(()=>{
190
+ var _props_samples;
191
+ return waveformBars(null != (_props_samples = props.samples) ? _props_samples : [], count);
192
+ }, [
193
+ props.samples,
194
+ count
195
+ ]);
196
+ const played = props.duration > 0 ? Math.min(1, props.position / props.duration) : 0;
197
+ const width = 4 * count;
198
+ return <view className="g9-voice" {...g9IdProps(props.id)} style={{
199
+ flexDirection: rtl ? 'row-reverse' : 'row',
200
+ direction: 'ltr'
201
+ }}>
202
+ <G9IconButton {...props.id ? {
203
+ id: `${props.id}.Toggle`
204
+ } : {}} emoji={props.playing ? '⏸' : '▶'} variant={props.mine ? 'primary' : 'tonal'} isCircular accessibilityText={props.playing ? null != (_props_pauseLabel = props.pauseLabel) ? _props_pauseLabel : 'Pause' : null != (_props_playLabel = props.playLabel) ? _props_playLabel : 'Play'} onPress={props.onToggle}/>
205
+ <view className="g9-voice__wave" style={{
206
+ width: `${width}px`
207
+ }} {...props.onSeek ? {
208
+ bindtap: (e)=>{
209
+ var _ref;
210
+ var _e_detail, _props_onSeek;
211
+ return null == (_props_onSeek = props.onSeek) ? void 0 : _props_onSeek.call(props, Math.max(0, Math.min(1, (null != (_ref = null == (_e_detail = e.detail) ? void 0 : _e_detail.x) ? _ref : 0) / width)));
212
+ }
213
+ } : {}}>
214
+ {heights.map((v, i)=><view key={i} className={`g9-voice__bar${i / count < played ? ' g9-voice__bar--played' : ''}`} style={{
215
+ height: `${Math.round(28 * v)}px`
216
+ }}/>)}
217
+ </view>
218
+ <text className="g9-voice__time">
219
+ {toNativeDigits(formatDuration(props.playing || props.position > 0 ? props.duration - props.position : props.duration), culture.numberingSystem)}
220
+ </text>
221
+ </view>;
222
+ });
223
+ export { G9BlurhashView, G9ImageCropper, G9Lightbox, G9MediaGrid, G9VoicePlayer };
@@ -0,0 +1,62 @@
1
+ /** True when `hash` is a well-formed blurhash. */
2
+ export declare function isBlurhash(hash: string): boolean;
3
+ /** Decodes a blurhash to `width × height` RGB pixels (row-major, 3 bytes each). */
4
+ export declare function decodeBlurhash(hash: string, width: number, height: number, punch?: number): Uint8ClampedArray;
5
+ /** The average colour of a blurhash (its DC component), `#RRGGBB` — a solid placeholder for free. */
6
+ export declare function blurhashAverage(hash: string): string;
7
+ /**
8
+ * A blurhash as a tiny SVG of `cols × rows` cells (no canvas on Lynx). The cells blend at this size because the SVG is
9
+ * scaled up smoothly; 8×6 is 48 rects, built once per hash.
10
+ */
11
+ export declare function blurhashSvg(hash: string, cols?: number, rows?: number): string;
12
+ /**
13
+ * The blurhash as a tiny 24-bit BMP data URI (`cols` × `rows` pixels, ~200 bytes): an `<image>` scales it up with
14
+ * bilinear filtering, which is the soft blur a blurhash is meant to look like (the SVG of flat cells shows the grid).
15
+ */
16
+ export declare function blurhashBmp(hash: string, cols?: number, rows?: number): string;
17
+ /** A size. */
18
+ export interface G9Size {
19
+ readonly width: number;
20
+ readonly height: number;
21
+ }
22
+ /** A cropper's state: zoom (1 = the image covers the frame) and the image's offset from centred, in frame pixels. */
23
+ export interface G9CropState {
24
+ readonly zoom: number;
25
+ readonly x: number;
26
+ readonly y: number;
27
+ }
28
+ /** The scale at which `image` just covers `frame`. */
29
+ export declare const coverScale: (image: G9Size, frame: G9Size) => number;
30
+ /** Keeps the image covering the frame: zoom ≥ 1 (≤ max) and the offset within the overflow. */
31
+ export declare function clampCrop(state: G9CropState, image: G9Size, frame: G9Size, maxZoom?: number): G9CropState;
32
+ /** The crop in image pixels for a state (what a server or the native side cuts out). */
33
+ export declare function cropRect(state: G9CropState, image: G9Size, frame: G9Size): {
34
+ readonly x: number;
35
+ readonly y: number;
36
+ readonly width: number;
37
+ readonly height: number;
38
+ };
39
+ /** One tile of a media grid, in fractions of the grid's width and height. */
40
+ export interface G9GridTile {
41
+ readonly x: number;
42
+ readonly y: number;
43
+ readonly w: number;
44
+ readonly h: number;
45
+ }
46
+ /**
47
+ * The tiles for `n` photos (chat and feed style): one fills; two side by side; three = one large + two stacked;
48
+ * four = 2×2; more = 2×2 with «+k» on the last tile.
49
+ */
50
+ export declare function mediaGridLayout(n: number): G9GridTile[];
51
+ /** A waveform's samples (any count, 0..1 or raw amplitudes) reduced to `bars` heights in 0..1. */
52
+ export declare function waveformBars(samples: readonly number[], bars: number): number[];
53
+ /** `75` → «1:15». */
54
+ export declare const formatDuration: (seconds: number) => string;
55
+ /** Whether a file matches an `accept` list (`image/*,.pdf`): the web's rule, on file handles (G9Hub `accepts`). */
56
+ export declare function acceptsFile(file: {
57
+ readonly name?: string;
58
+ readonly mime?: string;
59
+ }, accept?: string): boolean;
60
+ /** The host chooser's category for an `accept` list (hosts filter by category; {@link acceptsFile} filters exactly). */
61
+ export declare function pickCategory(accept?: string): 'image' | 'video' | 'media' | 'audio' | 'any';
62
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AA2BA,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhD;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,iBAAiB,CAuCxG;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,IAAI,SAAI,GAAG,MAAM,CAWpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,IAAI,SAAI,GAAG,MAAM,CAkCpE;AAED,cAAc;AACd,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,qHAAqH;AACrH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sDAAsD;AACtD,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MACQ,CAAC;AAEnE,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,WAAW,CAMpG;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAS7F;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAoBvD;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAY/E;AAED,qBAAqB;AACrB,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,MAGhD,CAAC;AAEF,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAe9G;AAED,wHAAwH;AACxH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAqB3F"}
package/dist/model.jsx ADDED
@@ -0,0 +1,265 @@
1
+ import { bytesToBase64 } from "@g9tm/lynxcontrols-foundation";
2
+ const DIGITS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~';
3
+ function decode83(s) {
4
+ let v = 0;
5
+ for (const ch of s){
6
+ const i = DIGITS.indexOf(ch);
7
+ if (i < 0) throw new Error(`blurhash: bad character ${ch}`);
8
+ v = 83 * v + i;
9
+ }
10
+ return v;
11
+ }
12
+ const sRGBToLinear = (v)=>{
13
+ const x = v / 255;
14
+ return x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
15
+ };
16
+ const linearTosRGB = (v)=>{
17
+ const x = Math.max(0, Math.min(1, v));
18
+ return Math.round((x <= 0.0031308 ? 12.92 * x : 1.055 * x ** (1 / 2.4) - 0.055) * 255);
19
+ };
20
+ const signPow = (v, e)=>Math.sign(v) * Math.abs(v) ** e;
21
+ function isBlurhash(hash) {
22
+ if (!hash || hash.length < 6) return false;
23
+ try {
24
+ const size = decode83(hash.charAt(0));
25
+ const nx = size % 9 + 1;
26
+ const ny = Math.floor(size / 9) + 1;
27
+ return hash.length === 4 + 2 * nx * ny;
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ function decodeBlurhash(hash, width, height, punch = 1) {
33
+ if (!isBlurhash(hash)) throw new Error('blurhash: invalid');
34
+ const size = decode83(hash.charAt(0));
35
+ const nx = size % 9 + 1;
36
+ const ny = Math.floor(size / 9) + 1;
37
+ const maxValue = (decode83(hash.charAt(1)) + 1) / 166 * punch;
38
+ const colors = [];
39
+ for(let i = 0; i < nx * ny; i++)if (0 === i) {
40
+ const v = decode83(hash.substring(2, 6));
41
+ colors.push([
42
+ sRGBToLinear(v >> 16),
43
+ sRGBToLinear(v >> 8 & 255),
44
+ sRGBToLinear(255 & v)
45
+ ]);
46
+ } else {
47
+ const v = decode83(hash.substring(4 + 2 * i, 6 + 2 * i));
48
+ const q = (x)=>signPow((x - 9) / 9, 2) * maxValue;
49
+ colors.push([
50
+ q(Math.floor(v / 361)),
51
+ q(Math.floor(v / 19) % 19),
52
+ q(v % 19)
53
+ ]);
54
+ }
55
+ const out = new Uint8ClampedArray(width * height * 3);
56
+ for(let y = 0; y < height; y++)for(let x = 0; x < width; x++){
57
+ let r = 0;
58
+ let g = 0;
59
+ let b = 0;
60
+ for(let j = 0; j < ny; j++)for(let i = 0; i < nx; i++){
61
+ const basis = Math.cos(Math.PI * x * i / width) * Math.cos(Math.PI * y * j / height);
62
+ const c = colors[i + j * nx];
63
+ r += c[0] * basis;
64
+ g += c[1] * basis;
65
+ b += c[2] * basis;
66
+ }
67
+ const o = (y * width + x) * 3;
68
+ out[o] = linearTosRGB(r);
69
+ out[o + 1] = linearTosRGB(g);
70
+ out[o + 2] = linearTosRGB(b);
71
+ }
72
+ return out;
73
+ }
74
+ function blurhashAverage(hash) {
75
+ if (!isBlurhash(hash)) return '#888888';
76
+ const v = decode83(hash.substring(2, 6));
77
+ return `#${v.toString(16).padStart(6, '0').toUpperCase()}`;
78
+ }
79
+ function blurhashSvg(hash, cols = 8, rows = 6) {
80
+ const px = decodeBlurhash(hash, cols, rows);
81
+ let rects = '';
82
+ for(let y = 0; y < rows; y++)for(let x = 0; x < cols; x++){
83
+ const o = (y * cols + x) * 3;
84
+ const hex = `#${[
85
+ px[o],
86
+ px[o + 1],
87
+ px[o + 2]
88
+ ].map((v)=>(null != v ? v : 0).toString(16).padStart(2, '0')).join('')}`;
89
+ rects += `<rect x="${x}" y="${y}" width="1.02" height="1.02" fill="${hex}"/>`;
90
+ }
91
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${cols} ${rows}" preserveAspectRatio="none">${rects}</svg>`;
92
+ }
93
+ function blurhashBmp(hash, cols = 8, rows = 6) {
94
+ const px = decodeBlurhash(hash, cols, rows);
95
+ const stride = 3 * cols + 3 & -4;
96
+ const size = 54 + stride * rows;
97
+ const b = new Uint8Array(size);
98
+ const u16 = (o, v)=>{
99
+ b[o] = 255 & v;
100
+ b[o + 1] = v >> 8 & 255;
101
+ };
102
+ const u32 = (o, v)=>{
103
+ u16(o, 0xffff & v);
104
+ u16(o + 2, v >>> 16 & 0xffff);
105
+ };
106
+ b[0] = 0x42;
107
+ b[1] = 0x4d;
108
+ u32(2, size);
109
+ u32(10, 54);
110
+ u32(14, 40);
111
+ u32(18, cols);
112
+ u32(22, rows);
113
+ u16(26, 1);
114
+ u16(28, 24);
115
+ u32(34, stride * rows);
116
+ for(let y = 0; y < rows; y++){
117
+ const row = 54 + (rows - 1 - y) * stride;
118
+ for(let x = 0; x < cols; x++){
119
+ var _px_, _px_1, _px_o;
120
+ const o = (y * cols + x) * 3;
121
+ b[row + 3 * x] = null != (_px_ = px[o + 2]) ? _px_ : 0;
122
+ b[row + 3 * x + 1] = null != (_px_1 = px[o + 1]) ? _px_1 : 0;
123
+ b[row + 3 * x + 2] = null != (_px_o = px[o]) ? _px_o : 0;
124
+ }
125
+ }
126
+ return `data:image/bmp;base64,${bytesToBase64(b)}`;
127
+ }
128
+ const coverScale = (image, frame)=>Math.max(frame.width / image.width, frame.height / image.height);
129
+ function clampCrop(state, image, frame, maxZoom = 5) {
130
+ const zoom = Math.max(1, Math.min(maxZoom, state.zoom));
131
+ const s = coverScale(image, frame) * zoom;
132
+ const ox = Math.max(0, (image.width * s - frame.width) / 2);
133
+ const oy = Math.max(0, (image.height * s - frame.height) / 2);
134
+ return {
135
+ zoom,
136
+ x: Math.max(-ox, Math.min(ox, state.x)),
137
+ y: Math.max(-oy, Math.min(oy, state.y))
138
+ };
139
+ }
140
+ function cropRect(state, image, frame) {
141
+ const c = clampCrop(state, image, frame);
142
+ const s = coverScale(image, frame) * c.zoom;
143
+ const width = frame.width / s;
144
+ const height = frame.height / s;
145
+ const x = image.width / 2 - width / 2 - c.x / s;
146
+ const y = image.height / 2 - height / 2 - c.y / s;
147
+ const r = (v)=>Math.round(100 * v) / 100;
148
+ return {
149
+ x: r(Math.max(0, x)),
150
+ y: r(Math.max(0, y)),
151
+ width: r(width),
152
+ height: r(height)
153
+ };
154
+ }
155
+ function mediaGridLayout(n) {
156
+ if (n <= 0) return [];
157
+ if (1 === n) return [
158
+ {
159
+ x: 0,
160
+ y: 0,
161
+ w: 1,
162
+ h: 1
163
+ }
164
+ ];
165
+ if (2 === n) return [
166
+ {
167
+ x: 0,
168
+ y: 0,
169
+ w: 0.5,
170
+ h: 1
171
+ },
172
+ {
173
+ x: 0.5,
174
+ y: 0,
175
+ w: 0.5,
176
+ h: 1
177
+ }
178
+ ];
179
+ if (3 === n) return [
180
+ {
181
+ x: 0,
182
+ y: 0,
183
+ w: 0.66,
184
+ h: 1
185
+ },
186
+ {
187
+ x: 0.66,
188
+ y: 0,
189
+ w: 0.34,
190
+ h: 0.5
191
+ },
192
+ {
193
+ x: 0.66,
194
+ y: 0.5,
195
+ w: 0.34,
196
+ h: 0.5
197
+ }
198
+ ];
199
+ return [
200
+ {
201
+ x: 0,
202
+ y: 0,
203
+ w: 0.5,
204
+ h: 0.5
205
+ },
206
+ {
207
+ x: 0.5,
208
+ y: 0,
209
+ w: 0.5,
210
+ h: 0.5
211
+ },
212
+ {
213
+ x: 0,
214
+ y: 0.5,
215
+ w: 0.5,
216
+ h: 0.5
217
+ },
218
+ {
219
+ x: 0.5,
220
+ y: 0.5,
221
+ w: 0.5,
222
+ h: 0.5
223
+ }
224
+ ];
225
+ }
226
+ function waveformBars(samples, bars) {
227
+ if (!samples.length || bars <= 0) return Array.from({
228
+ length: Math.max(0, bars)
229
+ }, ()=>0.15);
230
+ const peak = Math.max(...samples.map(Math.abs)) || 1;
231
+ const out = [];
232
+ for(let i = 0; i < bars; i++){
233
+ var _samples_k;
234
+ const a = Math.floor(i * samples.length / bars);
235
+ const b = Math.max(a + 1, Math.floor((i + 1) * samples.length / bars));
236
+ let m = 0;
237
+ for(let k = a; k < b; k++)m = Math.max(m, Math.abs(null != (_samples_k = samples[k]) ? _samples_k : 0));
238
+ out.push(Math.max(0.12, m / peak));
239
+ }
240
+ return out;
241
+ }
242
+ const formatDuration = (seconds)=>{
243
+ const s = Math.max(0, Math.round(seconds));
244
+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;
245
+ };
246
+ function acceptsFile(file, accept) {
247
+ var _file_name, _file_mime;
248
+ if (!accept) return true;
249
+ const rules = accept.split(',').map((rule)=>rule.trim().toLowerCase()).filter(Boolean);
250
+ const name = (null != (_file_name = file.name) ? _file_name : '').toLowerCase();
251
+ const type = (null != (_file_mime = file.mime) ? _file_mime : '').toLowerCase();
252
+ return rules.some((rule)=>rule.startsWith('.') ? name.endsWith(rule) : rule.endsWith('/*') ? type.startsWith(rule.slice(0, -1)) : type === rule);
253
+ }
254
+ function pickCategory(accept) {
255
+ if (!accept) return 'any';
256
+ const rules = accept.split(',').map((rule)=>rule.trim().toLowerCase()).filter(Boolean);
257
+ const kinds = new Set(rules.map((rule)=>rule.startsWith('image/') ? 'image' : rule.startsWith('video/') ? 'video' : rule.startsWith('audio/') ? 'audio' : 'other'));
258
+ if (kinds.has('other')) return 'any';
259
+ if (1 === kinds.size) return [
260
+ ...kinds
261
+ ][0];
262
+ if (2 === kinds.size && kinds.has('image') && kinds.has('video')) return 'media';
263
+ return 'any';
264
+ }
265
+ export { acceptsFile, blurhashAverage, blurhashBmp, blurhashSvg, clampCrop, coverScale, cropRect, decodeBlurhash, formatDuration, isBlurhash, mediaGridLayout, pickCategory, waveformBars };
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@g9tm/lynxcontrols-media",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.1.0",
4
+ "description": "Media controls for G9LynxControls: blurhash decode, crop math, G9BlurhashView, G9MediaGrid, G9Lightbox, G9ImageCropper and G9VoicePlayer.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "source": "./src/index.ts",
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.jsx"
15
+ },
16
+ "./model": {
17
+ "source": "./src/model.ts",
18
+ "types": "./dist/model.d.ts",
19
+ "default": "./dist/model.jsx"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md"
25
+ ],
26
+ "scripts": {
27
+ "build": "rslib build"
28
+ },
29
+ "dependencies": {
30
+ "@g9tm/lynxcontrols-foundation": "2.1.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@g9tm/lynxcontrols": "2.1.0",
34
+ "@lynx-js/react": ">=0.129.3 <0.130.0"
35
+ }
36
+ }