@atom.io/spa 0.0.9 → 0.0.11

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.
Files changed (149) hide show
  1. package/README.md +30 -10
  2. package/README.mdx +16 -5
  3. package/dist/BrandMarkScene-BeWazldB.js +140 -0
  4. package/dist/BrandMarkScene-BeWazldB.js.map +1 -0
  5. package/dist/astro-application.d.ts +1 -1
  6. package/dist/astro-application.js +1 -1
  7. package/dist/astro-client.d.ts +1 -1
  8. package/dist/astro-client.js +5 -5
  9. package/dist/{astro-context-OdlexHR4.js → astro-context-B9XKrz8c.js} +1 -1
  10. package/dist/{astro-context-OdlexHR4.js.map → astro-context-B9XKrz8c.js.map} +1 -1
  11. package/dist/astro-middleware.js +2 -2
  12. package/dist/{development/astro-request-DRKvDjsO.js → astro-request-C0eYQlmS.js} +2 -2
  13. package/dist/{astro-request-DRKvDjsO.js.map → astro-request-C0eYQlmS.js.map} +1 -1
  14. package/dist/astro-resumability-client.d.ts +1 -1
  15. package/dist/astro-resumability-client.js +1 -1
  16. package/dist/astro-resumability-server.js +1 -1
  17. package/dist/astro-server.js +4 -4
  18. package/dist/{astro-shared-KxK9OUSj.d.ts → astro-shared-C-iO4PVU.d.ts} +2 -2
  19. package/dist/{astro-shared-KxK9OUSj.d.ts.map → astro-shared-C-iO4PVU.d.ts.map} +1 -1
  20. package/dist/{astro-shared-DBwINQav.js → astro-shared-CwBaV3Xu.js} +2 -2
  21. package/dist/{astro-shared-DBwINQav.js.map → astro-shared-CwBaV3Xu.js.map} +1 -1
  22. package/dist/astro.d.ts +2 -2
  23. package/dist/astro.js +1 -1
  24. package/dist/brand-css.d.ts +2 -0
  25. package/dist/brand-model.d.ts +32 -0
  26. package/dist/brand-model.d.ts.map +1 -0
  27. package/dist/brand-model.js +120 -0
  28. package/dist/brand-model.js.map +1 -0
  29. package/dist/brand.css +37 -0
  30. package/dist/brand.d.ts +13 -0
  31. package/dist/brand.d.ts.map +1 -0
  32. package/dist/brand.js +94 -0
  33. package/dist/brand.js.map +1 -0
  34. package/dist/{capabilities-ChgSs6bp.d.ts → capabilities-BNnXgvo5.d.ts} +3 -3
  35. package/dist/{capabilities-ChgSs6bp.d.ts.map → capabilities-BNnXgvo5.d.ts.map} +1 -1
  36. package/dist/client.min.js +1 -1
  37. package/dist/{core-DD2giR6E.js → core-N07x1OaR.js} +1 -1
  38. package/dist/{core-DD2giR6E.js.map → core-N07x1OaR.js.map} +1 -1
  39. package/dist/development/BrandMarkScene-B282kBA3.js +140 -0
  40. package/dist/development/BrandMarkScene-B282kBA3.js.map +1 -0
  41. package/dist/development/astro-application.js +1 -1
  42. package/dist/development/astro-client.js +5 -5
  43. package/dist/development/{astro-context-OdlexHR4.js → astro-context-B9XKrz8c.js} +1 -1
  44. package/dist/development/{astro-context-OdlexHR4.js.map → astro-context-B9XKrz8c.js.map} +1 -1
  45. package/dist/development/astro-middleware.js +2 -2
  46. package/dist/{astro-request-DRKvDjsO.js → development/astro-request-C0eYQlmS.js} +2 -2
  47. package/dist/development/{astro-request-DRKvDjsO.js.map → astro-request-C0eYQlmS.js.map} +1 -1
  48. package/dist/development/astro-resumability-client.js +1 -1
  49. package/dist/development/astro-resumability-server.js +1 -1
  50. package/dist/development/astro-server.js +4 -4
  51. package/dist/development/{astro-shared-DBwINQav.js → astro-shared-CwBaV3Xu.js} +2 -2
  52. package/dist/development/{astro-shared-DBwINQav.js.map → astro-shared-CwBaV3Xu.js.map} +1 -1
  53. package/dist/development/astro.js +1 -1
  54. package/dist/development/brand-model.js +120 -0
  55. package/dist/development/brand-model.js.map +1 -0
  56. package/dist/development/brand.css +37 -0
  57. package/dist/development/brand.js +94 -0
  58. package/dist/development/brand.js.map +1 -0
  59. package/dist/development/{core-DrUd8x25.js → core-D1FWUMMC.js} +1 -1
  60. package/dist/development/{core-DrUd8x25.js.map → core-D1FWUMMC.js.map} +1 -1
  61. package/dist/development/{dom-BRFv7FP_.js → dom-C1cVf5Vm.js} +6 -5
  62. package/dist/development/dom-C1cVf5Vm.js.map +1 -0
  63. package/dist/development/floating.js +1 -1
  64. package/dist/development/floating.js.map +1 -1
  65. package/dist/development/hot.js +3 -3
  66. package/dist/development/hot.js.map +1 -1
  67. package/dist/{identity-oFU5p-Qj.js → development/identity-DWHH6jbd.js} +3 -3
  68. package/dist/development/{identity-DwB8MTM1.js.map → identity-DWHH6jbd.js.map} +1 -1
  69. package/dist/development/index.js +4 -4
  70. package/dist/development/{jsx-runtime-BGDPK50B.js → jsx-runtime-B2XxfA3E.js} +1 -1
  71. package/dist/development/{jsx-runtime-BGDPK50B.js.map → jsx-runtime-B2XxfA3E.js.map} +1 -1
  72. package/dist/development/jsx-runtime.js +1 -1
  73. package/dist/development/konva.js +4 -4
  74. package/dist/development/motion.js +39 -20
  75. package/dist/development/motion.js.map +1 -1
  76. package/dist/development/renderer.js +3 -3
  77. package/dist/{server-renderer-BYFDmqnM.js → development/server-renderer-B-L5tNg7.js} +4 -4
  78. package/dist/development/{server-renderer-u1-c5PGd.js.map → server-renderer-B-L5tNg7.js.map} +1 -1
  79. package/dist/development/server.js +1 -1
  80. package/dist/development/{src-CB7ruwRs.js → src-By4JY4qf.js} +2 -2
  81. package/dist/development/{src-CB7ruwRs.js.map → src-By4JY4qf.js.map} +1 -1
  82. package/dist/development/three-F5D1OnE9.js +527 -0
  83. package/dist/development/three-F5D1OnE9.js.map +1 -0
  84. package/dist/development/three.js +1 -509
  85. package/dist/development/{vite-WUiz1ju6.js → vite-BKxEE-ZO.js} +1 -1
  86. package/dist/development/{vite-WUiz1ju6.js.map → vite-BKxEE-ZO.js.map} +1 -1
  87. package/dist/development/vite.js +1 -1
  88. package/dist/{dom--HZvmgqd.js → dom-BbfEAPpR.js} +6 -5
  89. package/dist/dom-BbfEAPpR.js.map +1 -0
  90. package/dist/floating.d.ts +1 -1
  91. package/dist/floating.js +1 -1
  92. package/dist/floating.js.map +1 -1
  93. package/dist/hot.d.ts +1 -1
  94. package/dist/hot.d.ts.map +1 -1
  95. package/dist/hot.js +1 -1
  96. package/dist/hot.js.map +1 -1
  97. package/dist/{development/identity-DwB8MTM1.js → identity-wPtz6EJM.js} +3 -3
  98. package/dist/{identity-oFU5p-Qj.js.map → identity-wPtz6EJM.js.map} +1 -1
  99. package/dist/{index-DdA39aMv.d.ts → index-2AKIR8up.d.ts} +4 -4
  100. package/dist/{index-DdA39aMv.d.ts.map → index-2AKIR8up.d.ts.map} +1 -1
  101. package/dist/index.d.ts +3 -3
  102. package/dist/index.js +4 -4
  103. package/dist/{jsx-runtime-BGDPK50B.js → jsx-runtime-B2XxfA3E.js} +1 -1
  104. package/dist/{jsx-runtime-BGDPK50B.js.map → jsx-runtime-B2XxfA3E.js.map} +1 -1
  105. package/dist/{jsx-runtime-CCvcEosg.d.ts → jsx-runtime-CjiJSx5m.d.ts} +2 -2
  106. package/dist/{jsx-runtime-CCvcEosg.d.ts.map → jsx-runtime-CjiJSx5m.d.ts.map} +1 -1
  107. package/dist/jsx-runtime.d.ts +1 -1
  108. package/dist/jsx-runtime.js +1 -1
  109. package/dist/konva.d.ts +3 -3
  110. package/dist/konva.js +4 -4
  111. package/dist/motion.d.ts +3 -1
  112. package/dist/motion.d.ts.map +1 -1
  113. package/dist/motion.js +39 -20
  114. package/dist/motion.js.map +1 -1
  115. package/dist/renderer.d.ts +1 -1
  116. package/dist/renderer.js +3 -3
  117. package/dist/{development/server-renderer-u1-c5PGd.js → server-renderer-CjTOgG1b.js} +4 -4
  118. package/dist/{server-renderer-BYFDmqnM.js.map → server-renderer-CjTOgG1b.js.map} +1 -1
  119. package/dist/server.d.ts +1 -1
  120. package/dist/server.js +1 -1
  121. package/dist/size.json +13 -13
  122. package/dist/{src-B2W_TA_X.js → src-BQlLP70K.js} +2 -2
  123. package/dist/{src-B2W_TA_X.js.map → src-BQlLP70K.js.map} +1 -1
  124. package/dist/three-DGOOlFXk.js +527 -0
  125. package/dist/three-DGOOlFXk.js.map +1 -0
  126. package/dist/three.d.ts +24 -3
  127. package/dist/three.d.ts.map +1 -1
  128. package/dist/three.js +1 -509
  129. package/dist/{vite-WUiz1ju6.js → vite-BKxEE-ZO.js} +1 -1
  130. package/dist/{vite-WUiz1ju6.js.map → vite-BKxEE-ZO.js.map} +1 -1
  131. package/dist/vite.js +1 -1
  132. package/package.json +43 -23
  133. package/src/BrandMark.module.css +25 -0
  134. package/src/BrandMark.tsx +106 -0
  135. package/src/BrandMarkScene.module.css +10 -0
  136. package/src/BrandMarkScene.tsx +116 -0
  137. package/src/brand-css.d.ts +2 -0
  138. package/src/brand-model.ts +177 -0
  139. package/src/brand.ts +3 -0
  140. package/src/dom.ts +8 -1
  141. package/src/hot.ts +3 -2
  142. package/src/lasertag.d.ts +1 -0
  143. package/src/motion-layout.ts +55 -26
  144. package/src/motion.ts +3 -0
  145. package/src/three.ts +69 -22
  146. package/dist/development/dom-BRFv7FP_.js.map +0 -1
  147. package/dist/development/three.js.map +0 -1
  148. package/dist/dom--HZvmgqd.js.map +0 -1
  149. package/dist/three.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"core-DD2giR6E.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["import type {\n\tdisposeState,\n\tReadableFamilyToken,\n\tReadableToken,\n\tRegularAtomFamilyToken,\n\tRegularAtomToken,\n\tSetter,\n\tTimelineFamilyToken,\n\tTimelineManageable,\n\tTimelineToken,\n\tTransactionToken,\n\tViewOf,\n\tWritableFamilyToken,\n\tWritableToken,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tclearTimelineInStore,\n\tdisposeFromStore,\n\tfindInStore,\n\tfindTimelineInStore,\n\tgetFromStore,\n\tgetTimelineTransactionAtHead,\n\tIMPLICIT,\n\tsetIntoStore,\n\tsubscribeToState,\n\tsubscribeToTimeline,\n\ttimeTravel,\n\ttimeTravelTransactionGroupInStore,\n\twithdraw,\n} from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type {\n\tExitParticipant,\n\tPresenceCoordinator,\n\tPresenceTarget,\n} from \"./presence.ts\"\n\nexport type Cleanup = () => void\n// A callable interface permits the recursive Children union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Children. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Children\n/** A JSX descriptor for an intrinsic tag, component, or fragment. */\nexport interface SpaElement {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\n/** Renderable content, including nested groups and reactive accessors. */\nexport type Children =\n\t| SpaElement\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Children[]\n\t| Accessor<Children>\nexport interface RootOptions {\n\tcapabilities?: readonly Capability[]\n\tstore?: RootStore\n\tidPrefix?: string\n\tonError?: (error: unknown) => void\n}\ninterface BoundaryOptions extends Omit<RootOptions, `capabilities`> {\n\t_capabilities?: Map<string, Capability>\n}\nexport interface Scope {\n\t_exiting?: boolean\n\t_exits?: Set<ExitParticipant>\n\t_targets?: Set<PresenceTarget>\n\t_root: Root\n\t_parent?: Scope | undefined\n\t_options?: BoundaryOptions | undefined\n\t_setupOrder: number\n\t_cleanups: Set<Cleanup | Scope>\n\t_updates: Cleanup[]\n\t_dead: boolean\n}\nexport interface Root extends Scope {\n\t_onRead?:\n\t\t| ((value: unknown, token: ReadableToken<unknown>, store: RootStore) => void)\n\t\t| undefined\n\t_presence?: PresenceCoordinator\n\t_presenceFactory?: Capability[`presence`]\n\t_capabilities: Map<string, Capability>\n\t_boundaryCapabilities?: Map<Capability, number>\n\t_prepareCapability?: ((capability: Capability) => void) | undefined\n\t_failure?: { error: unknown; report: Root[`error`] } | undefined\n\t_store: RootStore\n\t_prefix: string\n\t_id: number\n\t_queue: Set<Cleanup>\n\t_enqueueCount?: number\n\t_mounts: Cleanup[] | undefined\n\t_commits?: Set<CommitJob>\n\t_flushing?: boolean\n\t_forms?: Set<() => boolean>\n\t_host?: Element\n\tflush: Cleanup\n\terror: (error: unknown) => void\n}\n\ninterface CommitJob {\n\tscope: Scope\n\torder: number\n\trun: Cleanup\n\tloopError: Error | undefined\n}\ninterface CommitGroup {\n\torder: number\n\tchildren: CommitGroup[]\n\tjobs: CommitJob[]\n}\n\nexport let owner: Scope | undefined\ntype Subscribe = (notify: Cleanup) => Cleanup\nlet tracking: ((subscribe: Subscribe) => void) | undefined\nlet serial = 0\nlet setupOrder = 0\n\nfunction scopedErrorHandler(\n\tscope: Scope,\n\terror: unknown,\n): Root[`error`] | undefined {\n\tconst failure = scope._root._failure\n\treturn failure && Object.is(failure.error, error)\n\t\t? failure.report\n\t\t: scope._options?.onError\n}\nfunction throwScopedError(\n\tscope: Scope,\n\terror: unknown,\n\treport = scopedErrorHandler(scope, error),\n): never {\n\tif (report) scope._root._failure = { error, report }\n\tthrow error\n}\nexport function within<T>(scope: Scope, run: () => T): T {\n\tconst previous = owner\n\towner = scope\n\ttry {\n\t\treturn run()\n\t} catch (error) {\n\t\tthrowScopedError(scope, error)\n\t} finally {\n\t\towner = previous\n\t}\n}\nexport function untrack<T>(run: () => T): T {\n\tconst previous = tracking\n\ttracking = undefined\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\ttracking = previous\n\t}\n}\nexport function createScope(parent?: Scope): Scope {\n\tconst child: Scope = {\n\t\t_root: parent?._root as Root,\n\t\t_parent: parent,\n\t\t_options: parent?._options,\n\t\t_setupOrder: setupOrder++,\n\t\t_cleanups: new Set(),\n\t\t_updates: [],\n\t\t_dead: false,\n\t}\n\tparent?._cleanups.add(child)\n\treturn child\n}\nexport function fail(scope: Scope, error: unknown): never {\n\tconst report = scopedErrorHandler(scope, error)\n\ttry {\n\t\tdispose(scope)\n\t} catch (cleanup) {\n\t\tthrowScopedError(scope, new AggregateError([error, cleanup]), report)\n\t}\n\tthrow error\n}\nexport function dispose(scope: Scope): void {\n\tif (scope._dead) return\n\tscope._dead = true\n\tconst errors: unknown[] = []\n\tlet report: Root[`error`] | undefined\n\tconst record = (error: unknown) => {\n\t\terrors.push(error)\n\t\t// Keep the first boundary handler as nested disposal wraps its errors.\n\t\treport ??= scopedErrorHandler(scope, error)\n\t}\n\ttry {\n\t\tscope._root._presence?.forget(scope)\n\t} catch (error) {\n\t\trecord(error)\n\t}\n\tfor (const cleanup of [...scope._cleanups].reverse()) {\n\t\ttry {\n\t\t\ttypeof cleanup === `function` ? cleanup() : dispose(cleanup)\n\t\t} catch (error) {\n\t\t\trecord(error)\n\t\t}\n\t}\n\tscope._parent?._cleanups.delete(scope)\n\tscope._cleanups.clear()\n\tscope._targets?.clear()\n\tscope._updates.length = 0\n\tif (errors.length) throwScopedError(scope, new AggregateError(errors), report)\n}\nexport function invalidate(scope: Scope): void {\n\tfor (const run of scope._updates) enqueue(scope, run)\n\tfor (const child of scope._cleanups)\n\t\tif (typeof child !== `function`) invalidate(child)\n}\nexport function enqueue(scope: Scope, run: Cleanup): void {\n\tif (!isPresent(scope)) return\n\tconst root = scope._root\n\tif (!root._queue.size && !root._flushing)\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\troot.flush()\n\t\t\t} catch (error) {\n\t\t\t\tconst report = scopedErrorHandler(root, error) ?? root.error\n\t\t\t\troot._failure = undefined\n\t\t\t\treport(error)\n\t\t\t}\n\t\t})\n\t// A write can invalidate an observer that is already pending.\n\tif (import.meta.env.DEV) root._enqueueCount = (root._enqueueCount ?? 0) + 1\n\troot._queue.add(run)\n}\n\nfunction runCommits(root: Root, pending: Set<CommitJob>): CommitJob | undefined {\n\tconst top: CommitGroup = { order: root._setupOrder, children: [], jobs: [] }\n\tconst groups = new Map<Scope, CommitGroup>([[root, top]])\n\t// Keep only branches with pending work. Visit siblings in setup order.\n\tconst groupFor = (scope: Scope): CommitGroup => {\n\t\tlet group = groups.get(scope)\n\t\tif (!group) {\n\t\t\tgroup = { order: scope._setupOrder, children: [], jobs: [] }\n\t\t\tgroups.set(scope, group)\n\t\t\tgroupFor(scope._parent!).children.push(group)\n\t\t}\n\t\treturn group\n\t}\n\tfor (const job of [...pending].sort((a, b) => a.order - b.order))\n\t\tgroupFor(job.scope).jobs.push(job)\n\tlet last: CommitJob | undefined\n\tconst visit = (group: CommitGroup) => {\n\t\tfor (const child of group.children.sort((a, b) => a.order - b.order))\n\t\t\tvisit(child)\n\t\tfor (const job of group.jobs) {\n\t\t\tif (pending.delete(job) && isPresent(job.scope)) {\n\t\t\t\tconst enqueueCount = import.meta.env.DEV ? root._enqueueCount : undefined\n\t\t\t\tjob.run()\n\t\t\t\tif (import.meta.env.DEV && root._enqueueCount !== enqueueCount)\n\t\t\t\t\tlast = job\n\t\t\t}\n\t\t}\n\t}\n\tvisit(top)\n\treturn last\n}\n\nfunction capabilityMap(list: readonly Capability[] | undefined) {\n\tconst capabilities = new Map<string, Capability>()\n\tfor (const capability of list ?? []) {\n\t\tif (capabilities.has(capability.namespace))\n\t\t\tthrow new Error(`spa: duplicate capability ${capability.namespace}`)\n\t\tcapabilities.set(capability.namespace, capability)\n\t}\n\treturn capabilities\n}\nfunction registerPresence(\n\troot: Root,\n\tcapability: Capability,\n\tshared = false,\n): void {\n\tconst create = capability.presence\n\tif (!create) return\n\tif (root._presence) {\n\t\tif (!shared || root._presenceFactory !== create)\n\t\t\tthrow new Error(`spa: multiple presence coordinators`)\n\t} else {\n\t\troot._presence = create(root)\n\t\troot._presenceFactory = create\n\t}\n}\nexport function scopeCapabilities(scope: Scope): Map<string, Capability> {\n\treturn scope._options?._capabilities ?? scope._root._capabilities\n}\nexport function reportScopeError(scope: Scope, error: unknown): void {\n\tconst report = scopedErrorHandler(scope, error) ?? scope._root.error\n\ttry {\n\t\tfail(scope._root, error)\n\t} catch (failure) {\n\t\tscope._root._failure = undefined\n\t\treport(failure)\n\t}\n}\n\n/** Override root options for these children while sharing their parent's ownership. */\nexport function RootBoundary(\n\tprops: RootOptions & { children?: Children },\n): Children {\n\tconst scope = owner!\n\tconst { store, idPrefix, onError, capabilities } = props\n\tconst options = { ...scope._options }\n\tif (store !== undefined) options.store = store\n\tif (idPrefix !== undefined) options.idPrefix = idPrefix\n\tif (onError !== undefined) options.onError = onError\n\tif (capabilities !== undefined) {\n\t\toptions._capabilities = capabilityMap(capabilities)\n\t\tconst root = scope._root\n\t\tconst active = (root._boundaryCapabilities ??= new Map())\n\t\tfor (const capability of options._capabilities.values()) {\n\t\t\tregisterPresence(root, capability, true)\n\t\t\tactive.set(capability, (active.get(capability) ?? 0) + 1)\n\t\t\tscope._cleanups.add(() => {\n\t\t\t\tconst remaining = active.get(capability)! - 1\n\t\t\t\tif (remaining) active.set(capability, remaining)\n\t\t\t\telse active.delete(capability)\n\t\t\t})\n\t\t\troot._prepareCapability?.(capability)\n\t\t}\n\t}\n\tscope._options = options\n\treturn () => props.children\n}\n\nexport function createRoot(options: RootOptions = {}, server = false): Root {\n\tconst capabilities = capabilityMap(options.capabilities)\n\tconst root = {\n\t\t_capabilities: capabilities,\n\t\t_store: options.store ?? IMPLICIT.STORE,\n\t\t_prefix: options.idPrefix ?? `w${serial++}`,\n\t\t_id: 0,\n\t\t...createScope(),\n\t\t_queue: new Set(),\n\t\t_mounts: server ? undefined : [],\n\t} as unknown as Root\n\troot._root = root\n\troot.error =\n\t\toptions.onError ??\n\t\t((error) => {\n\t\t\tthrow error\n\t\t})\n\tfor (const capability of capabilities.values())\n\t\tregisterPresence(root, capability)\n\tconst hasWrites = () => root._queue.size || root._mounts!.length\n\tconst hasWork = () => hasWrites() || root._commits?.size\n\tlet flushPendingWrites: Cleanup | undefined\n\troot.flush = () => {\n\t\tconst nested = root._flushing\n\t\tif (!(nested ? hasWrites() : hasWork()) && !root._forms?.size) return\n\t\troot._flushing = true\n\t\ttry {\n\t\t\tif (nested) {\n\t\t\t\t// The outer flush owns commit dispatch. Mount callbacks can drain writes.\n\t\t\t\tflushPendingWrites?.()\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot._failure = undefined\n\t\t\tlet passes = 0\n\t\t\tlet lastCommit: CommitJob | undefined\n\t\t\tconst checkLoop = () => {\n\t\t\t\tif (import.meta.env.DEV && ++passes > 100)\n\t\t\t\t\tthrow lastCommit?.loopError ?? new Error(`spa: update loop`)\n\t\t\t}\n\t\t\tconst runWriteBatch = () => {\n\t\t\t\tconst commits = new Map<Capability, Cleanup | undefined>()\n\t\t\t\tconst prepare = (capability: Capability) => {\n\t\t\t\t\tif (!commits.has(capability))\n\t\t\t\t\t\tcommits.set(capability, capability.beforeUpdate?.(root))\n\t\t\t\t}\n\t\t\t\tconst previous = root._prepareCapability\n\t\t\t\troot._prepareCapability = prepare\n\t\t\t\tlet formsReady = true\n\t\t\t\ttry {\n\t\t\t\t\tfor (const capability of capabilities.values()) prepare(capability)\n\t\t\t\t\tfor (const capability of root._boundaryCapabilities?.keys() ?? [])\n\t\t\t\t\t\tprepare(capability)\n\t\t\t\t\twhile (hasWrites()) {\n\t\t\t\t\t\tcheckLoop()\n\t\t\t\t\t\tfor (const run of [...root._queue])\n\t\t\t\t\t\t\tif (root._queue.delete(run)) run()\n\t\t\t\t\t\tfor (const run of root._mounts!.splice(0)) run()\n\t\t\t\t\t}\n\t\t\t\t\tfor (const restore of root._forms ?? [])\n\t\t\t\t\t\tif (!untrack(restore)) formsReady = false\n\t\t\t\t} finally {\n\t\t\t\t\troot._prepareCapability = previous\n\t\t\t\t\tfor (const commit of commits.values()) commit?.()\n\t\t\t\t}\n\t\t\t\treturn formsReady\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tflushPendingWrites = runWriteBatch\n\t\t\t\tconst formsReady = runWriteBatch()\n\t\t\t\tflushPendingWrites = undefined\n\t\t\t\tif (!hasWrites()) {\n\t\t\t\t\t// Form event completion schedules a flush to restore the controls.\n\t\t\t\t\tif (!formsReady || !root._commits?.size) break\n\t\t\t\t\tcheckLoop()\n\t\t\t\t\tlastCommit = runCommits(root, root._commits) ?? lastCommit\n\t\t\t\t}\n\t\t\t} while (hasWork())\n\t\t\troot._failure = undefined\n\t\t} catch (error) {\n\t\t\tflushPendingWrites = undefined\n\t\t\tfail(root, error)\n\t\t} finally {\n\t\t\tif (!nested) root._flushing = false\n\t\t}\n\t}\n\treturn root\n}\n/** Return the atom.io store selected by the current owner. */\nexport function useStore(): RootStore {\n\treturn owner!._options?.store ?? owner!._root._store\n}\n/** Return atom.io disposal bound to the current root's store. */\nexport function useDisposal(): typeof disposeState {\n\treturn disposeFromStore.bind(null, useStore()) as typeof disposeState\n}\nexport function onCleanup(cleanup: Cleanup): void {\n\towner!._cleanups.add(cleanup)\n}\nexport function onMount(run: Cleanup): void {\n\tconst scope = owner!\n\tscope._root._mounts?.push(() => {\n\t\tif (!scope._dead)\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(run)\n\t\t\t})\n\t})\n}\n/** Observe state during setup and apply changes after the root's writes. */\nexport function onCommit<T>(\n\tread: Accessor<T>,\n\tapply: (value: T, previous: T | undefined) => void | Cleanup,\n): void {\n\tconst scope = owner!\n\tconst root = scope._root\n\tif (!root._mounts) return\n\tconst pending = (root._commits ??= new Set())\n\tlet ran = false\n\tlet next: T\n\tlet previous: T | undefined\n\tlet cleanup: Cleanup | void\n\tconst clear = () => {\n\t\tconst release = cleanup\n\t\tcleanup = undefined\n\t\tif (release) untrack(release)\n\t}\n\tconst job: CommitJob = {\n\t\tscope,\n\t\torder: setupOrder++,\n\t\t// The registration stack identifies the component in a feedback loop.\n\t\tloopError: import.meta.env.DEV\n\t\t\t? new Error(`spa: onCommit update loop`)\n\t\t\t: undefined,\n\t\trun() {\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(() => {\n\t\t\t\t\tclear()\n\t\t\t\t\tif (!isPresent(scope)) return\n\t\t\t\t\tconst old = previous\n\t\t\t\t\tprevious = next\n\t\t\t\t\tran = true\n\t\t\t\t\tcleanup = apply(next, old)\n\t\t\t\t\tif (scope._dead) clear()\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t}\n\tscope._cleanups.add(() => {\n\t\tpending.delete(job)\n\t\tclear()\n\t})\n\tobserve(scope, read, (value) => {\n\t\tnext = value\n\t\tif (!ran || !Object.is(value, previous)) pending.add(job)\n\t\telse pending.delete(job)\n\t})\n}\nexport function useId(): string {\n\tconst root = owner!._root\n\treturn `${owner!._options?.idPrefix ?? root._prefix}-${root._id++}`\n}\n\nexport function observe<T>(\n\tscope: Scope,\n\tread: Accessor<T>,\n\tapply: (value: T) => void,\n): void {\n\tconst subscriptions = new Map<Subscribe, Cleanup>()\n\tconst run = () => {\n\t\tif (!isPresent(scope)) return\n\t\tconst used = new Set<Subscribe>()\n\t\tconst previous = tracking\n\t\ttracking = (subscribe) => {\n\t\t\tused.add(subscribe)\n\t\t\tif (!subscriptions.has(subscribe))\n\t\t\t\tsubscriptions.set(\n\t\t\t\t\tsubscribe,\n\t\t\t\t\tsubscribe(() => {\n\t\t\t\t\t\tenqueue(scope, run)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t}\n\t\tlet value: T\n\t\ttry {\n\t\t\tvalue = within(scope, read)\n\t\t} finally {\n\t\t\ttracking = previous\n\t\t\tfor (const [subscribe, unsubscribe] of subscriptions)\n\t\t\t\tif (!used.has(subscribe)) {\n\t\t\t\t\tunsubscribe()\n\t\t\t\t\tsubscriptions.delete(subscribe)\n\t\t\t\t}\n\t\t}\n\t\twithin(scope, () => {\n\t\t\tuntrack(() => {\n\t\t\t\tapply(value)\n\t\t\t})\n\t\t})\n\t}\n\tscope._updates.push(run)\n\tscope._cleanups.add(() => {\n\t\tscope._root._queue.delete(run)\n\t\tfor (const unsubscribe of subscriptions.values()) unsubscribe()\n\t})\n\trun()\n}\n\n/** Resolve a fixed family key in the current owner's store. */\nexport function resolveStateToken(token: any, key?: Canonical): any {\n\tconst store = useStore()\n\treturn token.type.endsWith(`_family`) ? findInStore(store, token, key!) : token\n}\n\n/** Capture a token for this instance. Change the component key to change its token. */\nexport function useGetter<T, E = never>(\n\ttoken: ReadableToken<T, any, E>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter<T, K extends Canonical, E = never>(\n\tfamily: ReadableFamilyToken<T, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter(token: any, key?: Canonical): Accessor<any> {\n\ttoken = resolveStateToken(token, key)\n\tconst root = owner!._root\n\tconst store = useStore()\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToState(store, token, `spa:${serial++}`, notify)\n\treturn () => {\n\t\tconst value = getFromStore(store, token)\n\t\troot._onRead?.(value, token, store)\n\t\ttracking?.(subscribe)\n\t\treturn value\n\t}\n}\nexport function useSetter<T>(\n\ttoken: WritableToken<T, any, any>,\n): (value: T | Setter<T>) => void\nexport function useSetter<T, K extends Canonical>(\n\tfamily: WritableFamilyToken<T, K, any>,\n\tkey: NoInfer<K>,\n): (value: T | Setter<T>) => void\nexport function useSetter(token: any, key?: Canonical): (value: any) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\treturn (value) => {\n\t\tsetIntoStore(store, token, value)\n\t}\n}\nexport function useTransaction<F extends (...args: any[]) => any>(\n\ttoken: TransactionToken<F>,\n): (...args: Parameters<F>) => ReturnType<F> {\n\treturn actUponStore(useStore(), token, `spa:${serial++}`)\n}\n\nconst refs = new WeakMap<RootStore, Map<string, object>>()\nexport function useRef<E extends Element>(\n\ttoken: RegularAtomToken<E | null>,\n): (element: E | null) => void\nexport function useRef<E extends Element, K extends Canonical>(\n\tfamily: RegularAtomFamilyToken<E | null, K>,\n\tkey: NoInfer<K>,\n): (element: E | null) => void\nexport function useRef<E extends Element>(\n\ttoken: any,\n\tkey?: Canonical,\n): (element: E | null) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\tconst owners = refs.get(store) ?? new Map<string, object>()\n\trefs.set(store, owners)\n\tconst identity = {}\n\tlet held: E | null = null\n\treturn (element) => {\n\t\tif (element) {\n\t\t\theld = element\n\t\t\towners.set(token.key, identity)\n\t\t\tsetIntoStore(store, token, element)\n\t\t} else if (owners.get(token.key) === identity) {\n\t\t\towners.delete(token.key)\n\t\t\tif (getFromStore(store, token) === held) setIntoStore(store, token, null)\n\t\t\theld = null\n\t\t}\n\t}\n}\nexport interface TimelineControls {\n\tgetCursor(): number\n\tgetLength(): number\n\tundo(): void\n\tredo(): void\n\tclear(): void\n\tgetTransaction(): { undo?: Cleanup; redo?: Cleanup }\n}\nexport function useTimeline<M extends TimelineManageable>(\n\ttoken: TimelineToken<M>,\n): TimelineControls\nexport function useTimeline<K extends Canonical, M extends TimelineManageable>(\n\tfamily: TimelineFamilyToken<K, M>,\n\tkey: NoInfer<K>,\n): TimelineControls\nexport function useTimeline(token: any, key?: Canonical): TimelineControls {\n\tconst store = useStore()\n\tconst selected: TimelineToken<any> =\n\t\ttoken.type === `timeline_family`\n\t\t\t? findTimelineInStore(store, token, key!)\n\t\t\t: token\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToTimeline(store, selected, `spa:${serial++}`, notify)\n\tconst read = () => {\n\t\tconst timeline = withdraw(store, selected)\n\t\ttracking?.(subscribe)\n\t\treturn timeline\n\t}\n\treturn {\n\t\tgetCursor: () => read().at,\n\t\tgetLength: () => read().history.length,\n\t\tundo: () => {\n\t\t\ttimeTravel(store, `undo`, selected)\n\t\t},\n\t\tredo: () => {\n\t\t\ttimeTravel(store, `redo`, selected)\n\t\t},\n\t\tclear: () => {\n\t\t\tclearTimelineInStore(store, selected)\n\t\t},\n\t\tgetTransaction: () => {\n\t\t\tconst timeline = read()\n\t\t\tconst controls: ReturnType<TimelineControls[`getTransaction`]> = {}\n\t\t\tfor (const direction of [`undo`, `redo`] as const) {\n\t\t\t\tconst group = getTimelineTransactionAtHead(timeline, direction)\n\t\t\t\tif (group)\n\t\t\t\t\tcontrols[direction] = () => {\n\t\t\t\t\t\ttimeTravelTransactionGroupInStore(store, direction, group)\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn controls\n\t\t},\n\t}\n}\n\nexport function plain(value: Children): string {\n\tif (typeof value === `function`) return plain(value())\n\tif (Array.isArray(value)) return value.map(plain).join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (import.meta.env.DEV && typeof value === `object`)\n\t\tthrow new Error(`spa: text required`)\n\t// oxlint-disable-next-line typescript/no-base-to-string -- Valid text children are primitives here; development rejects malformed object children.\n\treturn String(value)\n}\n\nexport function isPresent(scope: Scope): boolean {\n\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\tif (at._dead || at._exiting) return false\n\treturn true\n}\n"],"mappings":";;AA0HA,IAAW;AAEX,IAAI;AACJ,IAAI,SAAS;AACb,IAAI,aAAa;AAEjB,SAAS,mBACR,OACA,OAC4B;CAC5B,MAAM,UAAU,MAAM,MAAM;CAC5B,OAAO,WAAW,OAAO,GAAG,QAAQ,OAAO,KAAK,IAC7C,QAAQ,SACR,MAAM,UAAU;AACpB;AACA,SAAS,iBACR,OACA,OACA,SAAS,mBAAmB,OAAO,KAAK,GAChC;CACR,IAAI,QAAQ,MAAM,MAAM,WAAW;EAAE;EAAO;CAAO;CACnD,MAAM;AACP;AACA,SAAgB,OAAU,OAAc,KAAiB;CACxD,MAAM,WAAW;CACjB,QAAQ;CACR,IAAI;EACH,OAAO,IAAI;CACZ,SAAS,OAAO;EACf,iBAAiB,OAAO,KAAK;CAC9B,UAAU;EACT,QAAQ;CACT;AACD;AACA,SAAgB,QAAW,KAAiB;CAC3C,MAAM,WAAW;CACjB,WAAW,KAAA;CACX,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,WAAW;CACZ;AACD;AACA,SAAgB,YAAY,QAAuB;CAClD,MAAM,QAAe;EACpB,OAAO,QAAQ;EACf,SAAS;EACT,UAAU,QAAQ;EAClB,aAAa;EACb,2BAAW,IAAI,IAAI;EACnB,UAAU,CAAC;EACX,OAAO;CACR;CACA,QAAQ,UAAU,IAAI,KAAK;CAC3B,OAAO;AACR;AACA,SAAgB,KAAK,OAAc,OAAuB;CACzD,MAAM,SA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,OAAO,KAAK;AACpB;AAEA,SAAgB,UAAU,OAAuB;CAChD,KAAK,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
1
+ {"version":3,"file":"core-N07x1OaR.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["import type {\n\tdisposeState,\n\tReadableFamilyToken,\n\tReadableToken,\n\tRegularAtomFamilyToken,\n\tRegularAtomToken,\n\tSetter,\n\tTimelineFamilyToken,\n\tTimelineManageable,\n\tTimelineToken,\n\tTransactionToken,\n\tViewOf,\n\tWritableFamilyToken,\n\tWritableToken,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tclearTimelineInStore,\n\tdisposeFromStore,\n\tfindInStore,\n\tfindTimelineInStore,\n\tgetFromStore,\n\tgetTimelineTransactionAtHead,\n\tIMPLICIT,\n\tsetIntoStore,\n\tsubscribeToState,\n\tsubscribeToTimeline,\n\ttimeTravel,\n\ttimeTravelTransactionGroupInStore,\n\twithdraw,\n} from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type {\n\tExitParticipant,\n\tPresenceCoordinator,\n\tPresenceTarget,\n} from \"./presence.ts\"\n\nexport type Cleanup = () => void\n// A callable interface permits the recursive Children union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Children. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Children\n/** A JSX descriptor for an intrinsic tag, component, or fragment. */\nexport interface SpaElement {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\n/** Renderable content, including nested groups and reactive accessors. */\nexport type Children =\n\t| SpaElement\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Children[]\n\t| Accessor<Children>\nexport interface RootOptions {\n\tcapabilities?: readonly Capability[]\n\tstore?: RootStore\n\tidPrefix?: string\n\tonError?: (error: unknown) => void\n}\ninterface BoundaryOptions extends Omit<RootOptions, `capabilities`> {\n\t_capabilities?: Map<string, Capability>\n}\nexport interface Scope {\n\t_exiting?: boolean\n\t_exits?: Set<ExitParticipant>\n\t_targets?: Set<PresenceTarget>\n\t_root: Root\n\t_parent?: Scope | undefined\n\t_options?: BoundaryOptions | undefined\n\t_setupOrder: number\n\t_cleanups: Set<Cleanup | Scope>\n\t_updates: Cleanup[]\n\t_dead: boolean\n}\nexport interface Root extends Scope {\n\t_onRead?:\n\t\t| ((value: unknown, token: ReadableToken<unknown>, store: RootStore) => void)\n\t\t| undefined\n\t_presence?: PresenceCoordinator\n\t_presenceFactory?: Capability[`presence`]\n\t_capabilities: Map<string, Capability>\n\t_boundaryCapabilities?: Map<Capability, number>\n\t_prepareCapability?: ((capability: Capability) => void) | undefined\n\t_failure?: { error: unknown; report: Root[`error`] } | undefined\n\t_store: RootStore\n\t_prefix: string\n\t_id: number\n\t_queue: Set<Cleanup>\n\t_enqueueCount?: number\n\t_mounts: Cleanup[] | undefined\n\t_commits?: Set<CommitJob>\n\t_flushing?: boolean\n\t_forms?: Set<() => boolean>\n\t_host?: Element\n\tflush: Cleanup\n\terror: (error: unknown) => void\n}\n\ninterface CommitJob {\n\tscope: Scope\n\torder: number\n\trun: Cleanup\n\tloopError: Error | undefined\n}\ninterface CommitGroup {\n\torder: number\n\tchildren: CommitGroup[]\n\tjobs: CommitJob[]\n}\n\nexport let owner: Scope | undefined\ntype Subscribe = (notify: Cleanup) => Cleanup\nlet tracking: ((subscribe: Subscribe) => void) | undefined\nlet serial = 0\nlet setupOrder = 0\n\nfunction scopedErrorHandler(\n\tscope: Scope,\n\terror: unknown,\n): Root[`error`] | undefined {\n\tconst failure = scope._root._failure\n\treturn failure && Object.is(failure.error, error)\n\t\t? failure.report\n\t\t: scope._options?.onError\n}\nfunction throwScopedError(\n\tscope: Scope,\n\terror: unknown,\n\treport = scopedErrorHandler(scope, error),\n): never {\n\tif (report) scope._root._failure = { error, report }\n\tthrow error\n}\nexport function within<T>(scope: Scope, run: () => T): T {\n\tconst previous = owner\n\towner = scope\n\ttry {\n\t\treturn run()\n\t} catch (error) {\n\t\tthrowScopedError(scope, error)\n\t} finally {\n\t\towner = previous\n\t}\n}\nexport function untrack<T>(run: () => T): T {\n\tconst previous = tracking\n\ttracking = undefined\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\ttracking = previous\n\t}\n}\nexport function createScope(parent?: Scope): Scope {\n\tconst child: Scope = {\n\t\t_root: parent?._root as Root,\n\t\t_parent: parent,\n\t\t_options: parent?._options,\n\t\t_setupOrder: setupOrder++,\n\t\t_cleanups: new Set(),\n\t\t_updates: [],\n\t\t_dead: false,\n\t}\n\tparent?._cleanups.add(child)\n\treturn child\n}\nexport function fail(scope: Scope, error: unknown): never {\n\tconst report = scopedErrorHandler(scope, error)\n\ttry {\n\t\tdispose(scope)\n\t} catch (cleanup) {\n\t\tthrowScopedError(scope, new AggregateError([error, cleanup]), report)\n\t}\n\tthrow error\n}\nexport function dispose(scope: Scope): void {\n\tif (scope._dead) return\n\tscope._dead = true\n\tconst errors: unknown[] = []\n\tlet report: Root[`error`] | undefined\n\tconst record = (error: unknown) => {\n\t\terrors.push(error)\n\t\t// Keep the first boundary handler as nested disposal wraps its errors.\n\t\treport ??= scopedErrorHandler(scope, error)\n\t}\n\ttry {\n\t\tscope._root._presence?.forget(scope)\n\t} catch (error) {\n\t\trecord(error)\n\t}\n\tfor (const cleanup of [...scope._cleanups].reverse()) {\n\t\ttry {\n\t\t\ttypeof cleanup === `function` ? cleanup() : dispose(cleanup)\n\t\t} catch (error) {\n\t\t\trecord(error)\n\t\t}\n\t}\n\tscope._parent?._cleanups.delete(scope)\n\tscope._cleanups.clear()\n\tscope._targets?.clear()\n\tscope._updates.length = 0\n\tif (errors.length) throwScopedError(scope, new AggregateError(errors), report)\n}\nexport function invalidate(scope: Scope): void {\n\tfor (const run of scope._updates) enqueue(scope, run)\n\tfor (const child of scope._cleanups)\n\t\tif (typeof child !== `function`) invalidate(child)\n}\nexport function enqueue(scope: Scope, run: Cleanup): void {\n\tif (!isPresent(scope)) return\n\tconst root = scope._root\n\tif (!root._queue.size && !root._flushing)\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\troot.flush()\n\t\t\t} catch (error) {\n\t\t\t\tconst report = scopedErrorHandler(root, error) ?? root.error\n\t\t\t\troot._failure = undefined\n\t\t\t\treport(error)\n\t\t\t}\n\t\t})\n\t// A write can invalidate an observer that is already pending.\n\tif (import.meta.env.DEV) root._enqueueCount = (root._enqueueCount ?? 0) + 1\n\troot._queue.add(run)\n}\n\nfunction runCommits(root: Root, pending: Set<CommitJob>): CommitJob | undefined {\n\tconst top: CommitGroup = { order: root._setupOrder, children: [], jobs: [] }\n\tconst groups = new Map<Scope, CommitGroup>([[root, top]])\n\t// Keep only branches with pending work. Visit siblings in setup order.\n\tconst groupFor = (scope: Scope): CommitGroup => {\n\t\tlet group = groups.get(scope)\n\t\tif (!group) {\n\t\t\tgroup = { order: scope._setupOrder, children: [], jobs: [] }\n\t\t\tgroups.set(scope, group)\n\t\t\tgroupFor(scope._parent!).children.push(group)\n\t\t}\n\t\treturn group\n\t}\n\tfor (const job of [...pending].sort((a, b) => a.order - b.order))\n\t\tgroupFor(job.scope).jobs.push(job)\n\tlet last: CommitJob | undefined\n\tconst visit = (group: CommitGroup) => {\n\t\tfor (const child of group.children.sort((a, b) => a.order - b.order))\n\t\t\tvisit(child)\n\t\tfor (const job of group.jobs) {\n\t\t\tif (pending.delete(job) && isPresent(job.scope)) {\n\t\t\t\tconst enqueueCount = import.meta.env.DEV ? root._enqueueCount : undefined\n\t\t\t\tjob.run()\n\t\t\t\tif (import.meta.env.DEV && root._enqueueCount !== enqueueCount)\n\t\t\t\t\tlast = job\n\t\t\t}\n\t\t}\n\t}\n\tvisit(top)\n\treturn last\n}\n\nfunction capabilityMap(list: readonly Capability[] | undefined) {\n\tconst capabilities = new Map<string, Capability>()\n\tfor (const capability of list ?? []) {\n\t\tif (capabilities.has(capability.namespace))\n\t\t\tthrow new Error(`spa: duplicate capability ${capability.namespace}`)\n\t\tcapabilities.set(capability.namespace, capability)\n\t}\n\treturn capabilities\n}\nfunction registerPresence(\n\troot: Root,\n\tcapability: Capability,\n\tshared = false,\n): void {\n\tconst create = capability.presence\n\tif (!create) return\n\tif (root._presence) {\n\t\tif (!shared || root._presenceFactory !== create)\n\t\t\tthrow new Error(`spa: multiple presence coordinators`)\n\t} else {\n\t\troot._presence = create(root)\n\t\troot._presenceFactory = create\n\t}\n}\nexport function scopeCapabilities(scope: Scope): Map<string, Capability> {\n\treturn scope._options?._capabilities ?? scope._root._capabilities\n}\nexport function reportScopeError(scope: Scope, error: unknown): void {\n\tconst report = scopedErrorHandler(scope, error) ?? scope._root.error\n\ttry {\n\t\tfail(scope._root, error)\n\t} catch (failure) {\n\t\tscope._root._failure = undefined\n\t\treport(failure)\n\t}\n}\n\n/** Override root options for these children while sharing their parent's ownership. */\nexport function RootBoundary(\n\tprops: RootOptions & { children?: Children },\n): Children {\n\tconst scope = owner!\n\tconst { store, idPrefix, onError, capabilities } = props\n\tconst options = { ...scope._options }\n\tif (store !== undefined) options.store = store\n\tif (idPrefix !== undefined) options.idPrefix = idPrefix\n\tif (onError !== undefined) options.onError = onError\n\tif (capabilities !== undefined) {\n\t\toptions._capabilities = capabilityMap(capabilities)\n\t\tconst root = scope._root\n\t\tconst active = (root._boundaryCapabilities ??= new Map())\n\t\tfor (const capability of options._capabilities.values()) {\n\t\t\tregisterPresence(root, capability, true)\n\t\t\tactive.set(capability, (active.get(capability) ?? 0) + 1)\n\t\t\tscope._cleanups.add(() => {\n\t\t\t\tconst remaining = active.get(capability)! - 1\n\t\t\t\tif (remaining) active.set(capability, remaining)\n\t\t\t\telse active.delete(capability)\n\t\t\t})\n\t\t\troot._prepareCapability?.(capability)\n\t\t}\n\t}\n\tscope._options = options\n\treturn () => props.children\n}\n\nexport function createRoot(options: RootOptions = {}, server = false): Root {\n\tconst capabilities = capabilityMap(options.capabilities)\n\tconst root = {\n\t\t_capabilities: capabilities,\n\t\t_store: options.store ?? IMPLICIT.STORE,\n\t\t_prefix: options.idPrefix ?? `w${serial++}`,\n\t\t_id: 0,\n\t\t...createScope(),\n\t\t_queue: new Set(),\n\t\t_mounts: server ? undefined : [],\n\t} as unknown as Root\n\troot._root = root\n\troot.error =\n\t\toptions.onError ??\n\t\t((error) => {\n\t\t\tthrow error\n\t\t})\n\tfor (const capability of capabilities.values())\n\t\tregisterPresence(root, capability)\n\tconst hasWrites = () => root._queue.size || root._mounts!.length\n\tconst hasWork = () => hasWrites() || root._commits?.size\n\tlet flushPendingWrites: Cleanup | undefined\n\troot.flush = () => {\n\t\tconst nested = root._flushing\n\t\tif (!(nested ? hasWrites() : hasWork()) && !root._forms?.size) return\n\t\troot._flushing = true\n\t\ttry {\n\t\t\tif (nested) {\n\t\t\t\t// The outer flush owns commit dispatch. Mount callbacks can drain writes.\n\t\t\t\tflushPendingWrites?.()\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot._failure = undefined\n\t\t\tlet passes = 0\n\t\t\tlet lastCommit: CommitJob | undefined\n\t\t\tconst checkLoop = () => {\n\t\t\t\tif (import.meta.env.DEV && ++passes > 100)\n\t\t\t\t\tthrow lastCommit?.loopError ?? new Error(`spa: update loop`)\n\t\t\t}\n\t\t\tconst runWriteBatch = () => {\n\t\t\t\tconst commits = new Map<Capability, Cleanup | undefined>()\n\t\t\t\tconst prepare = (capability: Capability) => {\n\t\t\t\t\tif (!commits.has(capability))\n\t\t\t\t\t\tcommits.set(capability, capability.beforeUpdate?.(root))\n\t\t\t\t}\n\t\t\t\tconst previous = root._prepareCapability\n\t\t\t\troot._prepareCapability = prepare\n\t\t\t\tlet formsReady = true\n\t\t\t\ttry {\n\t\t\t\t\tfor (const capability of capabilities.values()) prepare(capability)\n\t\t\t\t\tfor (const capability of root._boundaryCapabilities?.keys() ?? [])\n\t\t\t\t\t\tprepare(capability)\n\t\t\t\t\twhile (hasWrites()) {\n\t\t\t\t\t\tcheckLoop()\n\t\t\t\t\t\tfor (const run of [...root._queue])\n\t\t\t\t\t\t\tif (root._queue.delete(run)) run()\n\t\t\t\t\t\tfor (const run of root._mounts!.splice(0)) run()\n\t\t\t\t\t}\n\t\t\t\t\tfor (const restore of root._forms ?? [])\n\t\t\t\t\t\tif (!untrack(restore)) formsReady = false\n\t\t\t\t} finally {\n\t\t\t\t\troot._prepareCapability = previous\n\t\t\t\t\tfor (const commit of commits.values()) commit?.()\n\t\t\t\t}\n\t\t\t\treturn formsReady\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tflushPendingWrites = runWriteBatch\n\t\t\t\tconst formsReady = runWriteBatch()\n\t\t\t\tflushPendingWrites = undefined\n\t\t\t\tif (!hasWrites()) {\n\t\t\t\t\t// Form event completion schedules a flush to restore the controls.\n\t\t\t\t\tif (!formsReady || !root._commits?.size) break\n\t\t\t\t\tcheckLoop()\n\t\t\t\t\tlastCommit = runCommits(root, root._commits) ?? lastCommit\n\t\t\t\t}\n\t\t\t} while (hasWork())\n\t\t\troot._failure = undefined\n\t\t} catch (error) {\n\t\t\tflushPendingWrites = undefined\n\t\t\tfail(root, error)\n\t\t} finally {\n\t\t\tif (!nested) root._flushing = false\n\t\t}\n\t}\n\treturn root\n}\n/** Return the atom.io store selected by the current owner. */\nexport function useStore(): RootStore {\n\treturn owner!._options?.store ?? owner!._root._store\n}\n/** Return atom.io disposal bound to the current root's store. */\nexport function useDisposal(): typeof disposeState {\n\treturn disposeFromStore.bind(null, useStore()) as typeof disposeState\n}\nexport function onCleanup(cleanup: Cleanup): void {\n\towner!._cleanups.add(cleanup)\n}\nexport function onMount(run: Cleanup): void {\n\tconst scope = owner!\n\tscope._root._mounts?.push(() => {\n\t\tif (!scope._dead)\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(run)\n\t\t\t})\n\t})\n}\n/** Observe state during setup and apply changes after the root's writes. */\nexport function onCommit<T>(\n\tread: Accessor<T>,\n\tapply: (value: T, previous: T | undefined) => void | Cleanup,\n): void {\n\tconst scope = owner!\n\tconst root = scope._root\n\tif (!root._mounts) return\n\tconst pending = (root._commits ??= new Set())\n\tlet ran = false\n\tlet next: T\n\tlet previous: T | undefined\n\tlet cleanup: Cleanup | void\n\tconst clear = () => {\n\t\tconst release = cleanup\n\t\tcleanup = undefined\n\t\tif (release) untrack(release)\n\t}\n\tconst job: CommitJob = {\n\t\tscope,\n\t\torder: setupOrder++,\n\t\t// The registration stack identifies the component in a feedback loop.\n\t\tloopError: import.meta.env.DEV\n\t\t\t? new Error(`spa: onCommit update loop`)\n\t\t\t: undefined,\n\t\trun() {\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(() => {\n\t\t\t\t\tclear()\n\t\t\t\t\tif (!isPresent(scope)) return\n\t\t\t\t\tconst old = previous\n\t\t\t\t\tprevious = next\n\t\t\t\t\tran = true\n\t\t\t\t\tcleanup = apply(next, old)\n\t\t\t\t\tif (scope._dead) clear()\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t}\n\tscope._cleanups.add(() => {\n\t\tpending.delete(job)\n\t\tclear()\n\t})\n\tobserve(scope, read, (value) => {\n\t\tnext = value\n\t\tif (!ran || !Object.is(value, previous)) pending.add(job)\n\t\telse pending.delete(job)\n\t})\n}\nexport function useId(): string {\n\tconst root = owner!._root\n\treturn `${owner!._options?.idPrefix ?? root._prefix}-${root._id++}`\n}\n\nexport function observe<T>(\n\tscope: Scope,\n\tread: Accessor<T>,\n\tapply: (value: T) => void,\n): void {\n\tconst subscriptions = new Map<Subscribe, Cleanup>()\n\tconst run = () => {\n\t\tif (!isPresent(scope)) return\n\t\tconst used = new Set<Subscribe>()\n\t\tconst previous = tracking\n\t\ttracking = (subscribe) => {\n\t\t\tused.add(subscribe)\n\t\t\tif (!subscriptions.has(subscribe))\n\t\t\t\tsubscriptions.set(\n\t\t\t\t\tsubscribe,\n\t\t\t\t\tsubscribe(() => {\n\t\t\t\t\t\tenqueue(scope, run)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t}\n\t\tlet value: T\n\t\ttry {\n\t\t\tvalue = within(scope, read)\n\t\t} finally {\n\t\t\ttracking = previous\n\t\t\tfor (const [subscribe, unsubscribe] of subscriptions)\n\t\t\t\tif (!used.has(subscribe)) {\n\t\t\t\t\tunsubscribe()\n\t\t\t\t\tsubscriptions.delete(subscribe)\n\t\t\t\t}\n\t\t}\n\t\twithin(scope, () => {\n\t\t\tuntrack(() => {\n\t\t\t\tapply(value)\n\t\t\t})\n\t\t})\n\t}\n\tscope._updates.push(run)\n\tscope._cleanups.add(() => {\n\t\tscope._root._queue.delete(run)\n\t\tfor (const unsubscribe of subscriptions.values()) unsubscribe()\n\t})\n\trun()\n}\n\n/** Resolve a fixed family key in the current owner's store. */\nexport function resolveStateToken(token: any, key?: Canonical): any {\n\tconst store = useStore()\n\treturn token.type.endsWith(`_family`) ? findInStore(store, token, key!) : token\n}\n\n/** Capture a token for this instance. Change the component key to change its token. */\nexport function useGetter<T, E = never>(\n\ttoken: ReadableToken<T, any, E>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter<T, K extends Canonical, E = never>(\n\tfamily: ReadableFamilyToken<T, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter(token: any, key?: Canonical): Accessor<any> {\n\ttoken = resolveStateToken(token, key)\n\tconst root = owner!._root\n\tconst store = useStore()\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToState(store, token, `spa:${serial++}`, notify)\n\treturn () => {\n\t\tconst value = getFromStore(store, token)\n\t\troot._onRead?.(value, token, store)\n\t\ttracking?.(subscribe)\n\t\treturn value\n\t}\n}\nexport function useSetter<T>(\n\ttoken: WritableToken<T, any, any>,\n): (value: T | Setter<T>) => void\nexport function useSetter<T, K extends Canonical>(\n\tfamily: WritableFamilyToken<T, K, any>,\n\tkey: NoInfer<K>,\n): (value: T | Setter<T>) => void\nexport function useSetter(token: any, key?: Canonical): (value: any) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\treturn (value) => {\n\t\tsetIntoStore(store, token, value)\n\t}\n}\nexport function useTransaction<F extends (...args: any[]) => any>(\n\ttoken: TransactionToken<F>,\n): (...args: Parameters<F>) => ReturnType<F> {\n\treturn actUponStore(useStore(), token, `spa:${serial++}`)\n}\n\nconst refs = new WeakMap<RootStore, Map<string, object>>()\nexport function useRef<E extends Element>(\n\ttoken: RegularAtomToken<E | null>,\n): (element: E | null) => void\nexport function useRef<E extends Element, K extends Canonical>(\n\tfamily: RegularAtomFamilyToken<E | null, K>,\n\tkey: NoInfer<K>,\n): (element: E | null) => void\nexport function useRef<E extends Element>(\n\ttoken: any,\n\tkey?: Canonical,\n): (element: E | null) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\tconst owners = refs.get(store) ?? new Map<string, object>()\n\trefs.set(store, owners)\n\tconst identity = {}\n\tlet held: E | null = null\n\treturn (element) => {\n\t\tif (element) {\n\t\t\theld = element\n\t\t\towners.set(token.key, identity)\n\t\t\tsetIntoStore(store, token, element)\n\t\t} else if (owners.get(token.key) === identity) {\n\t\t\towners.delete(token.key)\n\t\t\tif (getFromStore(store, token) === held) setIntoStore(store, token, null)\n\t\t\theld = null\n\t\t}\n\t}\n}\nexport interface TimelineControls {\n\tgetCursor(): number\n\tgetLength(): number\n\tundo(): void\n\tredo(): void\n\tclear(): void\n\tgetTransaction(): { undo?: Cleanup; redo?: Cleanup }\n}\nexport function useTimeline<M extends TimelineManageable>(\n\ttoken: TimelineToken<M>,\n): TimelineControls\nexport function useTimeline<K extends Canonical, M extends TimelineManageable>(\n\tfamily: TimelineFamilyToken<K, M>,\n\tkey: NoInfer<K>,\n): TimelineControls\nexport function useTimeline(token: any, key?: Canonical): TimelineControls {\n\tconst store = useStore()\n\tconst selected: TimelineToken<any> =\n\t\ttoken.type === `timeline_family`\n\t\t\t? findTimelineInStore(store, token, key!)\n\t\t\t: token\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToTimeline(store, selected, `spa:${serial++}`, notify)\n\tconst read = () => {\n\t\tconst timeline = withdraw(store, selected)\n\t\ttracking?.(subscribe)\n\t\treturn timeline\n\t}\n\treturn {\n\t\tgetCursor: () => read().at,\n\t\tgetLength: () => read().history.length,\n\t\tundo: () => {\n\t\t\ttimeTravel(store, `undo`, selected)\n\t\t},\n\t\tredo: () => {\n\t\t\ttimeTravel(store, `redo`, selected)\n\t\t},\n\t\tclear: () => {\n\t\t\tclearTimelineInStore(store, selected)\n\t\t},\n\t\tgetTransaction: () => {\n\t\t\tconst timeline = read()\n\t\t\tconst controls: ReturnType<TimelineControls[`getTransaction`]> = {}\n\t\t\tfor (const direction of [`undo`, `redo`] as const) {\n\t\t\t\tconst group = getTimelineTransactionAtHead(timeline, direction)\n\t\t\t\tif (group)\n\t\t\t\t\tcontrols[direction] = () => {\n\t\t\t\t\t\ttimeTravelTransactionGroupInStore(store, direction, group)\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn controls\n\t\t},\n\t}\n}\n\nexport function plain(value: Children): string {\n\tif (typeof value === `function`) return plain(value())\n\tif (Array.isArray(value)) return value.map(plain).join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (import.meta.env.DEV && typeof value === `object`)\n\t\tthrow new Error(`spa: text required`)\n\t// oxlint-disable-next-line typescript/no-base-to-string -- Valid text children are primitives here; development rejects malformed object children.\n\treturn String(value)\n}\n\nexport function isPresent(scope: Scope): boolean {\n\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\tif (at._dead || at._exiting) return false\n\treturn true\n}\n"],"mappings":";;AA0HA,IAAW;AAEX,IAAI;AACJ,IAAI,SAAS;AACb,IAAI,aAAa;AAEjB,SAAS,mBACR,OACA,OAC4B;CAC5B,MAAM,UAAU,MAAM,MAAM;CAC5B,OAAO,WAAW,OAAO,GAAG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AAW,SAAS;EACpB,OAAO;CACR;CACA,OAAO;EACN,iBAAiB,KAAK,CAAC,CAAC;EACxB,iBAAiB,KAAK,CAAC,CAAC,QAAQ;EAChC,YAAY;GACX,WAAW,OAAO,QAAQ,QAAQ;EACnC;EACA,YAAY;GACX,WAAW,OAAO,QAAQ,QAAQ;EACnC;EACA,aAAa;GACZ,qBAAqB,OAAO,QAAQ;EACrC;EACA,sBAAsB;GACrB,MAAM,WAAW,KAAK;GACtB,MAAM,WAA2D,CAAC;GAClE,KAAK,MAAM,aAAa,CAAC,QAAQ,MAAM,GAAY;IAClD,MAAM,QAAQ,6BAA6B,UAAU,SAAS;IAC9D,IAAI,OACH,SAAS,mBAAmB;KAC3B,kCAAkC,OAAO,WAAW,KAAK;IAC1D;GACF;GACA,OAAO;EACR;CACD;AACD;AAEA,SAAgB,MAAM,OAAyB;CAC9C,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAAC;CACrD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE;CACzD,IAAI,SAAS,QAAQ,OAAO,UAAU,WAAW,OAAO;CAIxD,OAAO,OAAO,KAAK;AACpB;AAEA,SAAgB,UAAU,OAAuB;CAChD,KAAK,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
@@ -0,0 +1,140 @@
1
+ import { jsx } from "@atom.io/spa/jsx-runtime";
2
+ import { DZ2_ORBITAL_LIGHTS, DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND, createDz2OrbitalCamera, createDz2OrbitalModel, disposeDz2OrbitalModel } from "./brand-model.js";
3
+ import { f as onMount, u as onCleanup } from "./core-D1FWUMMC.js";
4
+ import { h as PointLight, i as Canvas, l as Mesh, o as Group, t as AmbientLight } from "./three-F5D1OnE9.js";
5
+ // src/BrandMarkScene.module.css
6
+ var BrandMarkScene_module_default = { "class": "atom-io-spa-BrandMarkScene-module-class" };
7
+ // src/BrandMarkScene.tsx
8
+ const canvas = { Canvas };
9
+ function BrandMarkScene(props) {
10
+ const view = props.view;
11
+ const camera = createDz2OrbitalCamera();
12
+ const model = createDz2OrbitalModel();
13
+ const mark = () => props.variant === `mark`;
14
+ const narrow = () => view.innerWidth < 680;
15
+ let orbital = null;
16
+ let dirty = true;
17
+ const preference = view.matchMedia(`(prefers-reduced-motion: reduce)`);
18
+ const invalidate = () => {
19
+ dirty = true;
20
+ };
21
+ onMount(() => {
22
+ preference.addEventListener(`change`, invalidate);
23
+ view.document.addEventListener(`visibilitychange`, invalidate);
24
+ onCleanup(() => {
25
+ preference.removeEventListener(`change`, invalidate);
26
+ view.document.removeEventListener(`visibilitychange`, invalidate);
27
+ });
28
+ });
29
+ onCleanup(() => {
30
+ disposeDz2OrbitalModel(model);
31
+ });
32
+ return jsx("brand-mark-scene", {
33
+ get "class"() {
34
+ return BrandMarkScene_module_default[`class`];
35
+ },
36
+ children: jsx(canvas.Canvas, {
37
+ get "camera"() {
38
+ return camera;
39
+ },
40
+ get "width"() {
41
+ return props.width;
42
+ },
43
+ get "height"() {
44
+ return props.height;
45
+ },
46
+ get "dpr"() {
47
+ return Math.min(view.devicePixelRatio || 1, mark() ? 2 : 1.35, mark() ? 1e400 : Math.sqrt(16e6 / (props.width * props.height)));
48
+ },
49
+ get "rendererOptions"() {
50
+ return {
51
+ alpha: true,
52
+ antialias: true,
53
+ powerPreference: mark() ? `low-power` : `high-performance`
54
+ };
55
+ },
56
+ get "onError"() {
57
+ return props.onError;
58
+ },
59
+ "onCreated": (({ scene, renderer }) => {
60
+ renderer.render(scene, camera);
61
+ props.onReady();
62
+ }),
63
+ "onResize": (({ width, height }) => {
64
+ camera.aspect = width / height;
65
+ camera.updateProjectionMatrix();
66
+ invalidate();
67
+ }),
68
+ "renderWhen": (() => !view.document.hidden && (dirty || !preference.matches)),
69
+ "onFrame": (({ delta }) => {
70
+ if (view.document.hidden) return;
71
+ if (!preference.matches) orbital.rotation.y += Math.min(delta, .1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND;
72
+ dirty = false;
73
+ }),
74
+ children: [
75
+ jsx(AmbientLight, {
76
+ get "color"() {
77
+ return DZ2_ORBITAL_LIGHTS.ambient.color;
78
+ },
79
+ get "intensity"() {
80
+ return DZ2_ORBITAL_LIGHTS.ambient.intensity;
81
+ }
82
+ }),
83
+ jsx(PointLight, {
84
+ get "color"() {
85
+ return DZ2_ORBITAL_LIGHTS.core.color;
86
+ },
87
+ get "intensity"() {
88
+ return DZ2_ORBITAL_LIGHTS.core.intensity;
89
+ },
90
+ get "distance"() {
91
+ return DZ2_ORBITAL_LIGHTS.core.distance;
92
+ },
93
+ get "position"() {
94
+ return DZ2_ORBITAL_LIGHTS.core.position;
95
+ }
96
+ }),
97
+ jsx(Group, {
98
+ get "scale"() {
99
+ return mark() ? 1.25 : narrow() ? .52 : .72;
100
+ },
101
+ get "position"() {
102
+ return [
103
+ 0,
104
+ !mark() && narrow() ? -.08 : 0,
105
+ 0
106
+ ];
107
+ },
108
+ "ref": ((node) => {
109
+ orbital = node;
110
+ if (node) node.rotation.copy(model.orbital.rotation);
111
+ }),
112
+ get children() {
113
+ return model.meshes.map((mesh, index) => jsx(Mesh, {
114
+ get "key"() {
115
+ return index;
116
+ },
117
+ get "args"() {
118
+ return [mesh.geometry, mesh.material];
119
+ },
120
+ get "position"() {
121
+ return mesh.position.toArray();
122
+ },
123
+ get "rotation"() {
124
+ return [
125
+ mesh.rotation.x,
126
+ mesh.rotation.y,
127
+ mesh.rotation.z
128
+ ];
129
+ }
130
+ }));
131
+ }
132
+ })
133
+ ]
134
+ })
135
+ });
136
+ }
137
+ BrandMarkScene.spa = true;
138
+ export { BrandMarkScene };
139
+
140
+ //# sourceMappingURL=BrandMarkScene-B282kBA3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandMarkScene-B282kBA3.js","names":["_spa","css"],"sources":["../../src/BrandMarkScene.tsx"],"sourcesContent":["/** @jsxImportSource @atom.io/spa */\nimport type * as THREE from \"three\"\n\nimport {\n\tcreateDz2OrbitalCamera,\n\tcreateDz2OrbitalModel,\n\tdisposeDz2OrbitalModel,\n\tDZ2_ORBITAL_LIGHTS,\n\tDZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND,\n} from \"./brand-model.ts\"\nimport css from \"./BrandMarkScene.module.css\"\nimport type { SpaElement } from \"./core.ts\"\nimport { onCleanup, onMount } from \"./core.ts\"\nimport { AmbientLight, Canvas, Group, Mesh, PointLight } from \"./three.ts\"\n\nconst canvas = { Canvas }\nexport function BrandMarkScene(props: {\n\tvariant: `mark` | `splash`\n\twidth: number\n\theight: number\n\tview: Window\n\tonReady(): void\n\tonError(error: unknown): void\n}): SpaElement {\n\tconst view = props.view\n\tconst camera = createDz2OrbitalCamera()\n\tconst model = createDz2OrbitalModel()\n\tconst mark = () => props.variant === `mark`\n\tconst narrow = () => view.innerWidth < 680\n\tlet orbital: THREE.Object3D | null = null\n\tlet dirty = true\n\tconst preference = view.matchMedia(`(prefers-reduced-motion: reduce)`)\n\tconst invalidate = () => {\n\t\tdirty = true\n\t}\n\tonMount(() => {\n\t\tpreference.addEventListener(`change`, invalidate)\n\t\tview.document.addEventListener(`visibilitychange`, invalidate)\n\t\tonCleanup(() => {\n\t\t\tpreference.removeEventListener(`change`, invalidate)\n\t\t\tview.document.removeEventListener(`visibilitychange`, invalidate)\n\t\t})\n\t})\n\tonCleanup(() => {\n\t\tdisposeDz2OrbitalModel(model)\n\t})\n\treturn (\n\t\t<brand-mark-scene class={css[`class`]}>\n\t\t\t<canvas.Canvas\n\t\t\t\tcamera={camera}\n\t\t\t\twidth={props.width}\n\t\t\t\theight={props.height}\n\t\t\t\tdpr={Math.min(\n\t\t\t\t\tview.devicePixelRatio || 1,\n\t\t\t\t\tmark() ? 2 : 1.35,\n\t\t\t\t\tmark()\n\t\t\t\t\t\t? Infinity\n\t\t\t\t\t\t: Math.sqrt(16_000_000 / (props.width * props.height)),\n\t\t\t\t)}\n\t\t\t\trendererOptions={{\n\t\t\t\t\talpha: true,\n\t\t\t\t\tantialias: true,\n\t\t\t\t\tpowerPreference: mark() ? `low-power` : `high-performance`,\n\t\t\t\t}}\n\t\t\t\tonError={props.onError}\n\t\t\t\tonCreated={({ scene, renderer }) => {\n\t\t\t\t\trenderer.render(scene, camera)\n\t\t\t\t\tprops.onReady()\n\t\t\t\t}}\n\t\t\t\tonResize={({ width, height }) => {\n\t\t\t\t\tcamera.aspect = width / height\n\t\t\t\t\tcamera.updateProjectionMatrix()\n\t\t\t\t\tinvalidate()\n\t\t\t\t}}\n\t\t\t\trenderWhen={() =>\n\t\t\t\t\t!view.document.hidden && (dirty || !preference.matches)\n\t\t\t\t}\n\t\t\t\tonFrame={({ delta }) => {\n\t\t\t\t\tif (view.document.hidden) return\n\t\t\t\t\tif (!preference.matches)\n\t\t\t\t\t\torbital!.rotation.y +=\n\t\t\t\t\t\t\tMath.min(delta, 0.1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND\n\t\t\t\t\tdirty = false\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AmbientLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.ambient.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.ambient.intensity}\n\t\t\t\t/>\n\t\t\t\t<PointLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.core.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.core.intensity}\n\t\t\t\t\tdistance={DZ2_ORBITAL_LIGHTS.core.distance}\n\t\t\t\t\tposition={DZ2_ORBITAL_LIGHTS.core.position}\n\t\t\t\t/>\n\t\t\t\t<Group\n\t\t\t\t\tscale={mark() ? 1.25 : narrow() ? 0.52 : 0.72}\n\t\t\t\t\tposition={[0, !mark() && narrow() ? -0.08 : 0, 0]}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\torbital = node\n\t\t\t\t\t\tif (node) node.rotation.copy(model.orbital.rotation)\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{model.meshes.map((mesh, index) => (\n\t\t\t\t\t\t<Mesh\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\targs={[mesh.geometry, mesh.material]}\n\t\t\t\t\t\t\tposition={mesh.position.toArray()}\n\t\t\t\t\t\t\trotation={[mesh.rotation.x, mesh.rotation.y, mesh.rotation.z]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</Group>\n\t\t\t</canvas.Canvas>\n\t\t</brand-mark-scene>\n\t)\n}\n"],"mappings":";;;;;;;AAeA,MAAM,SAAS,EAAE,OAAO;AACxB,SAAgB,eAAe,OAOhB;CACd,MAAM,OAAO,MAAM;CACnB,MAAM,SAAS,uBAAuB;CACtC,MAAM,QAAQ,sBAAsB;CACpC,MAAM,aAAa,MAAM,YAAY;CACrC,MAAM,eAAe,KAAK,aAAa;CACvC,IAAI,UAAiC;CACrC,IAAI,QAAQ;CACZ,MAAM,aAAa,KAAK,WAAW,kCAAkC;CACrE,MAAM,mBAAmB;EACxB,QAAQ;CACT;CACA,cAAc;EACb,WAAW,iBAAiB,UAAU,UAAU;EAChD,KAAK,SAAS,iBAAiB,oBAAoB,UAAU;EAC7D,gBAAgB;GACf,WAAW,oBAAoB,UAAU,UAAU;GACnD,KAAK,SAAS,oBAAoB,oBAAoB,UAAU;EACjE,CAAC;CACF,CAAC;CACD,gBAAgB;EACf,uBAAuB,KAAK;CAC7B,CAAC;CACD,OACCA,IAAA,oBAAA;EAAA,IAAA,UAAA;GAAA,OAAyBC,8BAAI;EAAQ;EAAA,UACpCD,IAAA,OAAA,QAAA;GAAA,IAAA,WAAA;IAAA,OACS;GAAM;GAAA,IAAA,UAAA;IAAA,OACP,MAAM;GAAK;GAAA,IAAA,WAAA;IAAA,OACV,MAAM;GAAM;GAAA,IAAA,QAAA;IAAA,OACf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A,SAC3C,SAAS;MACd,UAAU;MACV,IAAI,MAAM,KAAK,SAAS,KAAK,MAAM,QAAQ,QAAQ;KACpD;KAAC,IAAA,WAAA;MAAA,OAEA,MAAM,OAAO,KAAK,MAAM,UACxBA,IAAA,MAAA;OAAA,IAAA,QAAA;QAAA,OACM;OAAK;OAAA,IAAA,SAAA;QAAA,OACJ,CAAC,KAAK,UAAU,KAAK,QAAQ;OAAC;OAAA,IAAA,aAAA;QAAA,OAC1B,KAAK,SAAS,QAAQ;OAAC;OAAA,IAAA,aAAA;QAAA,OACvB;SAAC,KAAK,SAAS;SAAG,KAAK,SAAS;SAAG,KAAK,SAAS;QAAC;OAAC;MAAA,CAAA,CAE9D;KAAC;IAAA,CAAA;GACK;EAAA,CAAA;CACO,CAAA;AAGnB"}
@@ -1,5 +1,5 @@
1
- import { t as applicationContext } from "./astro-context-OdlexHR4.js";
2
1
  import { IMPLICIT, subscribeToStateSubject, withdraw } from "atom.io/internal";
2
+ import { t as applicationContext } from "./astro-context-B9XKrz8c.js";
3
3
  // src/astro-application.ts
4
4
  const applications = /* @__PURE__ */ new WeakMap();
5
5
  /** Called by the integration's early page script, before island preparation. */
@@ -1,10 +1,10 @@
1
+ import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
1
2
  import { browserApplication } from "./astro-application.js";
2
- import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
3
- import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
4
- import { b as useGetter } from "./core-DrUd8x25.js";
5
- import { n as render, t as hydrate } from "./dom-BRFv7FP_.js";
3
+ import { n as failPreparation, r as storeContext } from "./astro-context-B9XKrz8c.js";
4
+ import { n as islandStore, t as island } from "./astro-shared-CwBaV3Xu.js";
5
+ import { b as useGetter } from "./core-D1FWUMMC.js";
6
+ import { n as render, t as hydrate } from "./dom-C1cVf5Vm.js";
6
7
  import { onRootDispose } from "./hot.js";
7
- import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
8
8
  // src/astro-client.ts
9
9
  const roots = /* @__PURE__ */ new WeakMap();
10
10
  const states = /* @__PURE__ */ new WeakMap();
@@ -76,4 +76,4 @@ function failPreparation(error, dispose) {
76
76
  }
77
77
  export { failPreparation as n, storeContext as r, applicationContext as t };
78
78
 
79
- //# sourceMappingURL=astro-context-OdlexHR4.js.map
79
+ //# sourceMappingURL=astro-context-B9XKrz8c.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"astro-context-OdlexHR4.js","names":[],"sources":["../../src/astro-context.ts"],"sourcesContent":["import type {\n\tAstroApplicationContext,\n\tAstroStoreContext,\n} from \"./astro-shared.ts\"\n\ntype Lifetime = {\n\tsignal: AbortSignal\n\tonCleanup(cleanup: () => void): () => void\n\tdispose(): void\n\tcancelled: Promise<undefined>\n}\n\nfunction lifetime(): Lifetime {\n\tconst controller = new AbortController()\n\tconst cleanups = new Set<() => void>()\n\tlet cancel!: () => void\n\tconst cancelled = new Promise<undefined>((resolve) => {\n\t\tcancel = () => {\n\t\t\tresolve(undefined)\n\t\t}\n\t})\n\treturn {\n\t\tsignal: controller.signal,\n\t\tonCleanup(cleanup) {\n\t\t\tif (controller.signal.aborted) cleanup()\n\t\t\telse cleanups.add(cleanup)\n\t\t\treturn () => {\n\t\t\t\tcleanups.delete(cleanup)\n\t\t\t}\n\t\t},\n\t\tcancelled,\n\t\tdispose() {\n\t\t\tif (controller.signal.aborted) return\n\t\t\tcontroller.abort()\n\t\t\tcancel()\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const cleanup of [...cleanups].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tcleanup()\n\t\t\t\t} catch (error) {\n\t\t\t\t\terrors.push(error)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanups.clear()\n\t\t\tif (errors.length)\n\t\t\t\tthrow new AggregateError(errors, `spa: Astro store cleanup failed`)\n\t\t},\n\t}\n}\n\nexport type Application = Lifetime &\n\tAstroApplicationContext & { canResume: boolean }\nexport function applicationContext(): Application {\n\tconst life = lifetime()\n\tconst resources = new Map<unknown, unknown>()\n\tlife.onCleanup(() => {\n\t\tresources.clear()\n\t})\n\treturn {\n\t\t...life,\n\t\tcanResume: true,\n\t\tget<T>(key: unknown, initialize: () => T): T {\n\t\t\tlife.signal.throwIfAborted()\n\t\t\tif (!resources.has(key)) resources.set(key, initialize())\n\t\t\treturn resources.get(key) as T\n\t\t},\n\t}\n}\n\n/** Island resources and shared application resources have distinct owners. */\nexport function storeContext(\n\telement?: HTMLElement,\n\tshared?: ReturnType<typeof applicationContext>,\n): {\n\tcontext: AstroStoreContext\n\tdispose(): void\n\tcancelled: Promise<undefined>\n} {\n\tconst life = lifetime()\n\tconst application = shared ?? applicationContext()\n\tif (shared) life.onCleanup(shared.onCleanup(life.dispose))\n\telse life.onCleanup(application.dispose)\n\treturn {\n\t\tcontext: {\n\t\t\telement,\n\t\t\tsignal: life.signal,\n\t\t\tonCleanup: life.onCleanup,\n\t\t\tapplication,\n\t\t},\n\t\tdispose: life.dispose,\n\t\tcancelled: life.cancelled,\n\t}\n}\n\nexport function failPreparation(error: unknown, dispose: () => void): never {\n\ttry {\n\t\tdispose()\n\t} catch (cleanup) {\n\t\tthrow new AggregateError([error, cleanup])\n\t}\n\tthrow error\n}\n"],"mappings":";AAYA,SAAS,WAAqB;CAC7B,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,2BAAW,IAAI,IAAgB;CACrC,IAAI;CACJ,MAAM,YAAY,IAAI,SAAoB,YAAY;EACrD,eAAe;GACd,QAAQ,KAAA,CAAS;EAClB;CACD,CAAC;CACD,OAAO;EACN,QAAQ,WAAW;EACnB,UAAU,SAAS;GAClB,IAAI,WAAW,OAAO,SAAS,QAAQ;QAClC,SAAS,IAAI,OAAO;GACzB,aAAa;IACZ,SAAS,OAAO,OAAO;GACxB;EACD;EACA;EACA,UAAU;GACT,IAAI,WAAW,OAAO,SAAS;GAC/B,WAAW,MAAM;GACjB,OAAO;GACP,MAAM,SAAoB,CAAC;GAC3B,KAAK,MAAM,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,QAAQ,GAC3C,IAAI;IACH,QAAQ;GACT,SAAS,OAAO;IACf,OAAO,KAAK,KAAK;GAClB;GAED,SAAS,MAAM;GACf,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,iCAAiC;EACpE;CACD;AACD;AAIA,SAAgB,qBAAkC;CACjD,MAAM,OAAO,SAAS;CACtB,MAAM,4BAAY,IAAI,IAAsB;CAC5C,KAAK,gBAAgB;EACpB,UAAU,MAAM;CACjB,CAAC;CACD,OAAO;EACN,GAAG;EACH,WAAW;EACX,IAAO,KAAc,YAAwB;GAC5C,KAAK,OAAO,eAAe;GAC3B,IAAI,CAAC,UAAU,IAAI,GAAG,GAAG,UAAU,IAAI,KAAK,WAAW,CAAC;GACxD,OAAO,UAAU,IAAI,GAAG;EACzB;CACD;AACD;;AAGA,SAAgB,aACf,SACA,QAKC;CACD,MAAM,OAAO,SAAS;CACtB,MAAM,cAAc,UAAU,mBAAmB;CACjD,IAAI,QAAQ,KAAK,UAAU,OAAO,UAAU,KAAK,OAAO,CAAC;MACpD,KAAK,UAAU,YAAY,OAAO;CACvC,OAAO;EACN,SAAS;GACR;GACA,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB;EACD;EACA,SAAS,KAAK;EACd,WAAW,KAAK;CACjB;AACD;AAEA,SAAgB,gBAAgB,OAAgB,SAA4B;CAC3E,IAAI;EACH,QAAQ;CACT,SAAS,SAAS;EACjB,MAAM,IAAI,eAAe,CAAC,OAAO,OAAO,CAAC;CAC1C;CACA,MAAM;AACP"}
1
+ {"version":3,"file":"astro-context-B9XKrz8c.js","names":[],"sources":["../../src/astro-context.ts"],"sourcesContent":["import type {\n\tAstroApplicationContext,\n\tAstroStoreContext,\n} from \"./astro-shared.ts\"\n\ntype Lifetime = {\n\tsignal: AbortSignal\n\tonCleanup(cleanup: () => void): () => void\n\tdispose(): void\n\tcancelled: Promise<undefined>\n}\n\nfunction lifetime(): Lifetime {\n\tconst controller = new AbortController()\n\tconst cleanups = new Set<() => void>()\n\tlet cancel!: () => void\n\tconst cancelled = new Promise<undefined>((resolve) => {\n\t\tcancel = () => {\n\t\t\tresolve(undefined)\n\t\t}\n\t})\n\treturn {\n\t\tsignal: controller.signal,\n\t\tonCleanup(cleanup) {\n\t\t\tif (controller.signal.aborted) cleanup()\n\t\t\telse cleanups.add(cleanup)\n\t\t\treturn () => {\n\t\t\t\tcleanups.delete(cleanup)\n\t\t\t}\n\t\t},\n\t\tcancelled,\n\t\tdispose() {\n\t\t\tif (controller.signal.aborted) return\n\t\t\tcontroller.abort()\n\t\t\tcancel()\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const cleanup of [...cleanups].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tcleanup()\n\t\t\t\t} catch (error) {\n\t\t\t\t\terrors.push(error)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanups.clear()\n\t\t\tif (errors.length)\n\t\t\t\tthrow new AggregateError(errors, `spa: Astro store cleanup failed`)\n\t\t},\n\t}\n}\n\nexport type Application = Lifetime &\n\tAstroApplicationContext & { canResume: boolean }\nexport function applicationContext(): Application {\n\tconst life = lifetime()\n\tconst resources = new Map<unknown, unknown>()\n\tlife.onCleanup(() => {\n\t\tresources.clear()\n\t})\n\treturn {\n\t\t...life,\n\t\tcanResume: true,\n\t\tget<T>(key: unknown, initialize: () => T): T {\n\t\t\tlife.signal.throwIfAborted()\n\t\t\tif (!resources.has(key)) resources.set(key, initialize())\n\t\t\treturn resources.get(key) as T\n\t\t},\n\t}\n}\n\n/** Island resources and shared application resources have distinct owners. */\nexport function storeContext(\n\telement?: HTMLElement,\n\tshared?: ReturnType<typeof applicationContext>,\n): {\n\tcontext: AstroStoreContext\n\tdispose(): void\n\tcancelled: Promise<undefined>\n} {\n\tconst life = lifetime()\n\tconst application = shared ?? applicationContext()\n\tif (shared) life.onCleanup(shared.onCleanup(life.dispose))\n\telse life.onCleanup(application.dispose)\n\treturn {\n\t\tcontext: {\n\t\t\telement,\n\t\t\tsignal: life.signal,\n\t\t\tonCleanup: life.onCleanup,\n\t\t\tapplication,\n\t\t},\n\t\tdispose: life.dispose,\n\t\tcancelled: life.cancelled,\n\t}\n}\n\nexport function failPreparation(error: unknown, dispose: () => void): never {\n\ttry {\n\t\tdispose()\n\t} catch (cleanup) {\n\t\tthrow new AggregateError([error, cleanup])\n\t}\n\tthrow error\n}\n"],"mappings":";AAYA,SAAS,WAAqB;CAC7B,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,2BAAW,IAAI,IAAgB;CACrC,IAAI;CACJ,MAAM,YAAY,IAAI,SAAoB,YAAY;EACrD,eAAe;GACd,QAAQ,KAAA,CAAS;EAClB;CACD,CAAC;CACD,OAAO;EACN,QAAQ,WAAW;EACnB,UAAU,SAAS;GAClB,IAAI,WAAW,OAAO,SAAS,QAAQ;QAClC,SAAS,IAAI,OAAO;GACzB,aAAa;IACZ,SAAS,OAAO,OAAO;GACxB;EACD;EACA;EACA,UAAU;GACT,IAAI,WAAW,OAAO,SAAS;GAC/B,WAAW,MAAM;GACjB,OAAO;GACP,MAAM,SAAoB,CAAC;GAC3B,KAAK,MAAM,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,QAAQ,GAC3C,IAAI;IACH,QAAQ;GACT,SAAS,OAAO;IACf,OAAO,KAAK,KAAK;GAClB;GAED,SAAS,MAAM;GACf,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,iCAAiC;EACpE;CACD;AACD;AAIA,SAAgB,qBAAkC;CACjD,MAAM,OAAO,SAAS;CACtB,MAAM,4BAAY,IAAI,IAAsB;CAC5C,KAAK,gBAAgB;EACpB,UAAU,MAAM;CACjB,CAAC;CACD,OAAO;EACN,GAAG;EACH,WAAW;EACX,IAAO,KAAc,YAAwB;GAC5C,KAAK,OAAO,eAAe;GAC3B,IAAI,CAAC,UAAU,IAAI,GAAG,GAAG,UAAU,IAAI,KAAK,WAAW,CAAC;GACxD,OAAO,UAAU,IAAI,GAAG;EACzB;CACD;AACD;;AAGA,SAAgB,aACf,SACA,QAKC;CACD,MAAM,OAAO,SAAS;CACtB,MAAM,cAAc,UAAU,mBAAmB;CACjD,IAAI,QAAQ,KAAK,UAAU,OAAO,UAAU,KAAK,OAAO,CAAC;MACpD,KAAK,UAAU,YAAY,OAAO;CACvC,OAAO;EACN,SAAS;GACR;GACA,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB;EACD;EACA,SAAS,KAAK;EACd,WAAW,KAAK;CACjB;AACD;AAEA,SAAgB,gBAAgB,OAAgB,SAA4B;CAC3E,IAAI;EACH,QAAQ;CACT,SAAS,SAAS;EACjB,MAAM,IAAI,eAAe,CAAC,OAAO,OAAO,CAAC;CAC1C;CACA,MAAM;AACP"}
@@ -1,5 +1,5 @@
1
- import { n as failPreparation } from "./astro-context-OdlexHR4.js";
2
- import { t as requestApplication } from "./astro-request-DRKvDjsO.js";
1
+ import { n as failPreparation } from "./astro-context-B9XKrz8c.js";
2
+ import { t as requestApplication } from "./astro-request-C0eYQlmS.js";
3
3
  // src/astro-middleware.ts
4
4
  /** Keep request resources alive until the streamed response is finished. */
5
5
  const onRequest = async ({ request }, next) => {
@@ -1,5 +1,5 @@
1
- import { t as applicationContext } from "./astro-context-OdlexHR4.js";
2
1
  import { IMPLICIT, Store } from "atom.io/internal";
2
+ import { t as applicationContext } from "./astro-context-B9XKrz8c.js";
3
3
  // src/astro-request.ts
4
4
  const requests = /* @__PURE__ */ new WeakMap();
5
5
  function createRequest() {
@@ -67,4 +67,4 @@ function syncDefinitions(store) {
67
67
  }
68
68
  export { requestApplication as t };
69
69
 
70
- //# sourceMappingURL=astro-request-DRKvDjsO.js.map
70
+ //# sourceMappingURL=astro-request-C0eYQlmS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"astro-request-DRKvDjsO.js","names":[],"sources":["../../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\nfunction syncDefinitions(store: RootStore): void {\n\tconst source = IMPLICIT.STORE\n\tfor (const field of [\n\t\t`families`,\n\t\t`atoms`,\n\t\t`readonlySelectors`,\n\t\t`writableSelectors`,\n\t\t`transactions`,\n\t\t`timelineFamilies`,\n\t\t`timelines`,\n\t] as const) {\n\t\tfor (const [key, resource] of source[field]) {\n\t\t\tif (!store[field].has(key)) resource.install(store)\n\t\t}\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,2BAAW,IAAI,QAAmD;AACxE,SAAS,gBAAgB;CACxB,MAAM,cAAc,mBAAmB;CACvC,IAAI;CACJ,OAAO;EACN;EACA,IAAI,QAAmB;GACtB,YAAY,OAAO,eAAe;GAClC,IAAI,CAAC,OAAO;IACX,QAAQ,IAAI,MACX;KAAE,MAAM;KAAe,UAAU;KAAa,cAAc;IAAK,GACjE,SAAS,KACV;IACA,MAAM,WAAW;IACjB,YAAY,gBAAgB;KAC3B,MAAM,SAAoB,CAAC;KAC3B,KAAK,MAAM,SAAS,SAAS,MAAM,OAAO,GACzC,IAAI;MACH,MAAM,UAAU;KACjB,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,KAAK,MAAM,YAAY,SAAS,cAAc,OAAO,GACpD,IAAI;MACH,SAAS,OAAO,QAAQ,CAAC;KAC1B,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,6BAA6B;IAChE,CAAC;GACF;GACA,gBAAgB,KAAK;GACrB,OAAO;EACR;CACD;AACD;AACA,SAAgB,mBACf,SACmC;CACnC,IAAI,MAAM,SAAS,IAAI,OAAO;CAC9B,IAAI,CAAC,KAAK;EACT,MAAM,cAAc;EACpB,SAAS,IAAI,SAAS,GAAG;EACzB,MAAM,gBAAgB;GACrB,IAAK,YAAY,QAAQ;EAC1B;EACA,QAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAChE,IAAI,YAAY,gBAAgB;GAC/B,QAAQ,OAAO,oBAAoB,SAAS,OAAO;EACpD,CAAC;EACD,IAAI,QAAQ,OAAO,SAAS,QAAQ;CACrC;CACA,OAAO;AACR;;AAEA,SAAS,gBAAgB,OAAwB;CAChD,MAAM,SAAS,SAAS;CACxB,KAAK,MAAM,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,GACC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QACpC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,GAAG,GAAG,SAAS,QAAQ,KAAK;AAGrD"}
1
+ {"version":3,"file":"astro-request-C0eYQlmS.js","names":[],"sources":["../../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\nfunction syncDefinitions(store: RootStore): void {\n\tconst source = IMPLICIT.STORE\n\tfor (const field of [\n\t\t`families`,\n\t\t`atoms`,\n\t\t`readonlySelectors`,\n\t\t`writableSelectors`,\n\t\t`transactions`,\n\t\t`timelineFamilies`,\n\t\t`timelines`,\n\t] as const) {\n\t\tfor (const [key, resource] of source[field]) {\n\t\t\tif (!store[field].has(key)) resource.install(store)\n\t\t}\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,2BAAW,IAAI,QAAmD;AACxE,SAAS,gBAAgB;CACxB,MAAM,cAAc,mBAAmB;CACvC,IAAI;CACJ,OAAO;EACN;EACA,IAAI,QAAmB;GACtB,YAAY,OAAO,eAAe;GAClC,IAAI,CAAC,OAAO;IACX,QAAQ,IAAI,MACX;KAAE,MAAM;KAAe,UAAU;KAAa,cAAc;IAAK,GACjE,SAAS,KACV;IACA,MAAM,WAAW;IACjB,YAAY,gBAAgB;KAC3B,MAAM,SAAoB,CAAC;KAC3B,KAAK,MAAM,SAAS,SAAS,MAAM,OAAO,GACzC,IAAI;MACH,MAAM,UAAU;KACjB,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,KAAK,MAAM,YAAY,SAAS,cAAc,OAAO,GACpD,IAAI;MACH,SAAS,OAAO,QAAQ,CAAC;KAC1B,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,6BAA6B;IAChE,CAAC;GACF;GACA,gBAAgB,KAAK;GACrB,OAAO;EACR;CACD;AACD;AACA,SAAgB,mBACf,SACmC;CACnC,IAAI,MAAM,SAAS,IAAI,OAAO;CAC9B,IAAI,CAAC,KAAK;EACT,MAAM,cAAc;EACpB,SAAS,IAAI,SAAS,GAAG;EACzB,MAAM,gBAAgB;GACrB,IAAK,YAAY,QAAQ;EAC1B;EACA,QAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAChE,IAAI,YAAY,gBAAgB;GAC/B,QAAQ,OAAO,oBAAoB,SAAS,OAAO;EACpD,CAAC;EACD,IAAI,QAAQ,OAAO,SAAS,QAAQ;CACrC;CACA,OAAO;AACR;;AAEA,SAAS,gBAAgB,OAAwB;CAChD,MAAM,SAAS,SAAS;CACxB,KAAK,MAAM,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,GACC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QACpC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,GAAG,GAAG,SAAS,QAAQ,KAAK;AAGrD"}
@@ -1,6 +1,6 @@
1
+ import { browserResumption, captureElement, createResumption } from "resumability/astro-client";
1
2
  import { browserApplication } from "./astro-application.js";
2
3
  import { createHydrator } from "./astro-client.js";
3
- import { browserResumption, captureElement, createResumption } from "resumability/astro-client";
4
4
  // src/astro-resumability-client.ts
5
5
  var astro_resumability_client_default = createHydrator((store, _props, { element, application }) => {
6
6
  const scopes = application.get(createResumption, () => /* @__PURE__ */ new WeakMap());
@@ -1,5 +1,5 @@
1
- import { createRenderer } from "./astro-server.js";
2
1
  import { resumableRenderer } from "resumability/astro-server";
2
+ import { createRenderer } from "./astro-server.js";
3
3
  // src/astro-resumability-server.ts
4
4
  var astro_resumability_server_default = resumableRenderer(createRenderer(true), { isolate: (component) => Boolean(component.createStore ?? component.isolate) });
5
5
  export { astro_resumability_server_default as default };
@@ -1,7 +1,7 @@
1
- import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
2
- import { t as requestApplication } from "./astro-request-DRKvDjsO.js";
3
- import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
4
- import { t as renderToStringWithReads } from "./server-renderer-u1-c5PGd.js";
1
+ import { n as failPreparation, r as storeContext } from "./astro-context-B9XKrz8c.js";
2
+ import { t as requestApplication } from "./astro-request-C0eYQlmS.js";
3
+ import { n as islandStore, t as island } from "./astro-shared-CwBaV3Xu.js";
4
+ import { t as renderToStringWithReads } from "./server-renderer-B-L5tNg7.js";
5
5
  // src/astro-server.ts
6
6
  const createRenderer = (awaitState = false) => ({
7
7
  name: `spa`,
@@ -1,5 +1,5 @@
1
- import { n as jsx } from "./jsx-runtime-BGDPK50B.js";
2
1
  import { IMPLICIT, Store } from "atom.io/internal";
2
+ import { n as jsx } from "./jsx-runtime-B2XxfA3E.js";
3
3
  // src/astro-shared.ts
4
4
  async function islandStore(component, props, context, shared, prepare) {
5
5
  const store = await (component.createStore?.(props, context) ?? shared ?? new Store({
@@ -28,4 +28,4 @@ function island(component, props, slots) {
28
28
  }
29
29
  export { islandStore as n, island as t };
30
30
 
31
- //# sourceMappingURL=astro-shared-DBwINQav.js.map
31
+ //# sourceMappingURL=astro-shared-CwBaV3Xu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"astro-shared-DBwINQav.js","names":[],"sources":["../../src/astro-shared.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type { Component, SpaElement } from \"./core.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\n\nexport interface AstroApplicationContext {\n\t/** Whether the application still represents its initial server snapshot. */\n\treadonly canResume: boolean\n\treadonly signal: AbortSignal\n\tonCleanup(cleanup: () => void): void\n\t/** Initialize a resource once for this application lifetime. */\n\tget<T>(key: unknown, initialize: () => T): T\n}\nexport interface AstroStoreContext {\n\t/** Shared across default islands; private for explicitly isolated islands. */\n\tapplication: AstroApplicationContext\n\t/** The browser island host; undefined during server rendering. */\n\telement: HTMLElement | undefined\n\t/** Aborted when preparation is cancelled or the island is released. */\n\tsignal: AbortSignal\n\t/** Release resources even if preparation or rendering fails. */\n\tonCleanup(cleanup: () => void): void\n}\nexport type AstroStoreFactory<P = Record<string, any>> = (\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => RootStore | Promise<RootStore>\nexport type AstroStorePreparation<P = Record<string, any>> = (\n\tstore: RootStore,\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => void | Promise<void>\nexport type Island<P = any> = Component<P> & {\n\tspa?: boolean\n\t/** Capabilities are scoped to this island root on the server and client. */\n\tcapabilities?: readonly Capability[]\n\t/** Opt into a private island store instead of the shared application store. */\n\tisolate?: boolean\n\tcreateStore?: AstroStoreFactory<P>\n\tprepareStore?: AstroStorePreparation<P>\n}\nexport async function islandStore(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tcontext: AstroStoreContext,\n\tshared?: RootStore,\n\tprepare?: AstroStorePreparation,\n): Promise<RootStore> {\n\tconst store = await (component.createStore?.(props, context) ??\n\t\tshared ??\n\t\t(new Store(\n\t\t\t{ name: `spa-island`, lifespan: `ephemeral`, isProduction: true },\n\t\t\tIMPLICIT.STORE,\n\t\t) as RootStore))\n\tcontext.signal.throwIfAborted()\n\tawait prepare?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\tawait component.prepareStore?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\treturn store\n}\nexport function island(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tslots: Record<string, string>,\n): SpaElement {\n\tconst children = Object.fromEntries(\n\t\tObject.entries(slots).map(([name, html]) => [\n\t\t\tname,\n\t\t\tjsx(`astro-slot`, {\n\t\t\t\tkey: html,\n\t\t\t\tname: name === `default` ? undefined : name,\n\t\t\t\tinnerHTML: html,\n\t\t\t}),\n\t\t]),\n\t)\n\treturn jsx(component, {\n\t\t...props,\n\t\tslots: children,\n\t\tchildren: children[`default`],\n\t})\n}\n"],"mappings":";;;AA2CA,eAAsB,YACrB,WACA,OACA,SACA,QACA,SACqB;CACrB,MAAM,QAAQ,OAAO,UAAU,cAAc,OAAO,OAAO,KAC1D,UACC,IAAI,MACJ;EAAE,MAAM;EAAc,UAAU;EAAa,cAAc;CAAK,GAChE,SAAS,KACV;CACD,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,OAAO,OAAO,OAAO;CACrC,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,eAAe,OAAO,OAAO,OAAO;CACpD,QAAQ,OAAO,eAAe;CAC9B,OAAO;AACR;AACA,SAAgB,OACf,WACA,OACA,OACa;CACb,MAAM,WAAW,OAAO,YACvB,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAC3C,MACA,IAAI,cAAc;EACjB,KAAK;EACL,MAAM,SAAS,YAAY,KAAA,IAAY;EACvC,WAAW;CACZ,CAAC,CACF,CAAC,CACF;CACA,OAAO,IAAI,WAAW;EACrB,GAAG;EACH,OAAO;EACP,UAAU,SAAS;CACpB,CAAC;AACF"}
1
+ {"version":3,"file":"astro-shared-CwBaV3Xu.js","names":[],"sources":["../../src/astro-shared.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type { Component, SpaElement } from \"./core.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\n\nexport interface AstroApplicationContext {\n\t/** Whether the application still represents its initial server snapshot. */\n\treadonly canResume: boolean\n\treadonly signal: AbortSignal\n\tonCleanup(cleanup: () => void): void\n\t/** Initialize a resource once for this application lifetime. */\n\tget<T>(key: unknown, initialize: () => T): T\n}\nexport interface AstroStoreContext {\n\t/** Shared across default islands; private for explicitly isolated islands. */\n\tapplication: AstroApplicationContext\n\t/** The browser island host; undefined during server rendering. */\n\telement: HTMLElement | undefined\n\t/** Aborted when preparation is cancelled or the island is released. */\n\tsignal: AbortSignal\n\t/** Release resources even if preparation or rendering fails. */\n\tonCleanup(cleanup: () => void): void\n}\nexport type AstroStoreFactory<P = Record<string, any>> = (\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => RootStore | Promise<RootStore>\nexport type AstroStorePreparation<P = Record<string, any>> = (\n\tstore: RootStore,\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => void | Promise<void>\nexport type Island<P = any> = Component<P> & {\n\tspa?: boolean\n\t/** Capabilities are scoped to this island root on the server and client. */\n\tcapabilities?: readonly Capability[]\n\t/** Opt into a private island store instead of the shared application store. */\n\tisolate?: boolean\n\tcreateStore?: AstroStoreFactory<P>\n\tprepareStore?: AstroStorePreparation<P>\n}\nexport async function islandStore(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tcontext: AstroStoreContext,\n\tshared?: RootStore,\n\tprepare?: AstroStorePreparation,\n): Promise<RootStore> {\n\tconst store = await (component.createStore?.(props, context) ??\n\t\tshared ??\n\t\t(new Store(\n\t\t\t{ name: `spa-island`, lifespan: `ephemeral`, isProduction: true },\n\t\t\tIMPLICIT.STORE,\n\t\t) as RootStore))\n\tcontext.signal.throwIfAborted()\n\tawait prepare?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\tawait component.prepareStore?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\treturn store\n}\nexport function island(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tslots: Record<string, string>,\n): SpaElement {\n\tconst children = Object.fromEntries(\n\t\tObject.entries(slots).map(([name, html]) => [\n\t\t\tname,\n\t\t\tjsx(`astro-slot`, {\n\t\t\t\tkey: html,\n\t\t\t\tname: name === `default` ? undefined : name,\n\t\t\t\tinnerHTML: html,\n\t\t\t}),\n\t\t]),\n\t)\n\treturn jsx(component, {\n\t\t...props,\n\t\tslots: children,\n\t\tchildren: children[`default`],\n\t})\n}\n"],"mappings":";;;AA2CA,eAAsB,YACrB,WACA,OACA,SACA,QACA,SACqB;CACrB,MAAM,QAAQ,OAAO,UAAU,cAAc,OAAO,OAAO,KAC1D,UACC,IAAI,MACJ;EAAE,MAAM;EAAc,UAAU;EAAa,cAAc;CAAK,GAChE,SAAS,KACV;CACD,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,OAAO,OAAO,OAAO;CACrC,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,eAAe,OAAO,OAAO,OAAO;CACpD,QAAQ,OAAO,eAAe;CAC9B,OAAO;AACR;AACA,SAAgB,OACf,WACA,OACA,OACa;CACb,MAAM,WAAW,OAAO,YACvB,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAC3C,MACA,IAAI,cAAc;EACjB,KAAK;EACL,MAAM,SAAS,YAAY,KAAA,IAAY;EACvC,WAAW;CACZ,CAAC,CACF,CAAC,CACF;CACA,OAAO,IAAI,WAAW;EACrB,GAAG;EACH,OAAO;EACP,UAAU,SAAS;CACpB,CAAC;AACF"}
@@ -1,4 +1,4 @@
1
- import { t as spa } from "./vite-WUiz1ju6.js";
1
+ import { t as spa } from "./vite-BKxEE-ZO.js";
2
2
  // src/astro.ts
3
3
  function integration(options = {}) {
4
4
  return {
@@ -0,0 +1,120 @@
1
+ import * as THREE from "three";
2
+ // src/brand-model.ts
3
+ const DZ2_ORBITAL_FINAL_SPIN_RADIANS = 1.1;
4
+ const DZ2_ORBITAL_SETTLED_ROTATION_X = 1.4;
5
+ const DZ2_ORBITAL_SETTLED_ROTATION_Z = -1.4;
6
+ const DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND = Math.PI / 128;
7
+ const DZ2_ORBITAL_LOBE_CENTER_OFFSET = .05;
8
+ const DZ2_ORBITAL_CAMERA = {
9
+ fov: 34,
10
+ near: .1,
11
+ far: 100,
12
+ position: [
13
+ 4.2,
14
+ 2.4,
15
+ 6.6
16
+ ],
17
+ lookAt: [
18
+ 0,
19
+ 0,
20
+ 0
21
+ ]
22
+ };
23
+ /** @internal Used by contributor tools or implementation tests. */
24
+ const DZ2_ORBITAL_LIGHTS = {
25
+ core: {
26
+ color: 0xffffff,
27
+ intensity: 28,
28
+ distance: 9,
29
+ position: [
30
+ 1.8,
31
+ 1.7,
32
+ 3.5
33
+ ]
34
+ },
35
+ ambient: {
36
+ color: 0x9fd6ff,
37
+ intensity: 1.4
38
+ }
39
+ };
40
+ function makeLobeGeometry(direction) {
41
+ const points = [];
42
+ const height = 1.5;
43
+ const radius = .75;
44
+ for (let index = 0; index <= 44; index++) {
45
+ const progress = index / 45;
46
+ const easedRadius = radius * Math.sin(Math.PI * progress) ** .58 * (.5 + progress * .6);
47
+ points.push(new THREE.Vector2(easedRadius, direction * progress * height));
48
+ }
49
+ for (let index = 440; index <= 450; index++) {
50
+ const progress = index / 450;
51
+ const easedRadius = radius * Math.sin(Math.PI * progress) ** .58 * (.5 + progress * .6);
52
+ points.push(new THREE.Vector2(easedRadius, direction * progress * height));
53
+ }
54
+ const lastPoint = points[points.length - 1];
55
+ const nextToLastPoint = points[points.length - 2];
56
+ lastPoint.setY(nextToLastPoint.y);
57
+ points[0].setY(points[1].y);
58
+ return new THREE.LatheGeometry(points, 96);
59
+ }
60
+ function createDz2OrbitalCamera(aspect = 1) {
61
+ const camera = new THREE.PerspectiveCamera(DZ2_ORBITAL_CAMERA.fov, aspect, DZ2_ORBITAL_CAMERA.near, DZ2_ORBITAL_CAMERA.far);
62
+ camera.position.set(...DZ2_ORBITAL_CAMERA.position);
63
+ camera.lookAt(...DZ2_ORBITAL_CAMERA.lookAt);
64
+ return camera;
65
+ }
66
+ function addDz2OrbitalLights(scene) {
67
+ const coreLight = new THREE.PointLight(DZ2_ORBITAL_LIGHTS.core.color, DZ2_ORBITAL_LIGHTS.core.intensity, DZ2_ORBITAL_LIGHTS.core.distance);
68
+ coreLight.position.set(...DZ2_ORBITAL_LIGHTS.core.position);
69
+ scene.add(coreLight);
70
+ scene.add(new THREE.AmbientLight(DZ2_ORBITAL_LIGHTS.ambient.color, DZ2_ORBITAL_LIGHTS.ambient.intensity));
71
+ }
72
+ function setDz2OrbitalRotation(orbital, y = DZ2_ORBITAL_FINAL_SPIN_RADIANS) {
73
+ orbital.rotation.set(DZ2_ORBITAL_SETTLED_ROTATION_X, y, DZ2_ORBITAL_SETTLED_ROTATION_Z);
74
+ }
75
+ function createDz2OrbitalModel() {
76
+ const orbital = new THREE.Group();
77
+ setDz2OrbitalRotation(orbital);
78
+ const lobeMaterial = new THREE.MeshToonMaterial({
79
+ color: 0xff3366,
80
+ emissive: 0xff3366,
81
+ emissiveIntensity: .22,
82
+ opacity: .82,
83
+ side: THREE.DoubleSide
84
+ });
85
+ const torusMaterial = new THREE.MeshToonMaterial({
86
+ color: 39423,
87
+ emissive: 39423,
88
+ emissiveIntensity: .17,
89
+ opacity: .72,
90
+ side: THREE.DoubleSide
91
+ });
92
+ const topLobe = new THREE.Mesh(makeLobeGeometry(1), lobeMaterial);
93
+ const bottomLobe = new THREE.Mesh(makeLobeGeometry(-1), lobeMaterial);
94
+ topLobe.position.y = DZ2_ORBITAL_LOBE_CENTER_OFFSET;
95
+ bottomLobe.position.y = -.05;
96
+ const torus = new THREE.Mesh(new THREE.TorusGeometry(1.2, .3, 36, 144), torusMaterial);
97
+ torus.rotation.x = Math.PI / 2;
98
+ const meshes = [
99
+ topLobe,
100
+ bottomLobe,
101
+ torus
102
+ ];
103
+ orbital.add(...meshes);
104
+ return {
105
+ orbital,
106
+ meshes,
107
+ materials: {
108
+ lobe: lobeMaterial,
109
+ torus: torusMaterial
110
+ }
111
+ };
112
+ }
113
+ function disposeDz2OrbitalModel(model) {
114
+ for (const mesh of model.meshes) mesh.geometry.dispose();
115
+ model.materials.lobe.dispose();
116
+ model.materials.torus.dispose();
117
+ }
118
+ export { DZ2_ORBITAL_FINAL_SPIN_RADIANS, DZ2_ORBITAL_LIGHTS, DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND, addDz2OrbitalLights, createDz2OrbitalCamera, createDz2OrbitalModel, disposeDz2OrbitalModel, setDz2OrbitalRotation };
119
+
120
+ //# sourceMappingURL=brand-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-model.js","names":[],"sources":["../../src/brand-model.ts"],"sourcesContent":["import * as THREE from \"three\"\n\nexport const DZ2_ORBITAL_FINAL_SPIN_RADIANS = 1.1\nconst DZ2_ORBITAL_SETTLED_ROTATION_X = 1.4\nconst DZ2_ORBITAL_SETTLED_ROTATION_Z = -1.4\nexport const DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND = Math.PI / 128\nconst DZ2_ORBITAL_LOBE_CENTER_OFFSET = 0.05\n\nconst DZ2_ORBITAL_CAMERA = {\n\tfov: 34,\n\tnear: 0.1,\n\tfar: 100,\n\tposition: [4.2, 2.4, 6.6],\n\tlookAt: [0, 0, 0],\n} satisfies {\n\tfov: number\n\tnear: number\n\tfar: number\n\tposition: [number, number, number]\n\tlookAt: [number, number, number]\n}\n\n/** @internal Used by contributor tools or implementation tests. */\nexport const DZ2_ORBITAL_LIGHTS = {\n\tcore: {\n\t\tcolor: 0xffffff,\n\t\tintensity: 28,\n\t\tdistance: 9,\n\t\tposition: [1.8, 1.7, 3.5],\n\t},\n\tambient: {\n\t\tcolor: 0x9fd6ff,\n\t\tintensity: 1.4,\n\t},\n} satisfies {\n\tcore: {\n\t\tcolor: number\n\t\tintensity: number\n\t\tdistance: number\n\t\tposition: [number, number, number]\n\t}\n\tambient: {\n\t\tcolor: number\n\t\tintensity: number\n\t}\n}\n\ntype Dz2OrbitalMesh = THREE.Mesh<THREE.BufferGeometry, THREE.MeshToonMaterial>\n\nexport type Dz2OrbitalModel = {\n\torbital: THREE.Group\n\tmeshes: Dz2OrbitalMesh[]\n\tmaterials: {\n\t\tlobe: THREE.MeshToonMaterial\n\t\ttorus: THREE.MeshToonMaterial\n\t}\n}\n\nfunction makeLobeGeometry(direction: 1 | -1): THREE.LatheGeometry {\n\tconst points: THREE.Vector2[] = []\n\tconst height = 1.5\n\tconst radius = 0.75\n\tfor (let index = 0; index <= 44; index++) {\n\t\tconst progress = index / 45\n\t\tconst easedRadius =\n\t\t\tradius * Math.sin(Math.PI * progress) ** 0.58 * (0.5 + progress * 0.6)\n\n\t\tpoints.push(new THREE.Vector2(easedRadius, direction * progress * height))\n\t}\n\n\tfor (let index = 440; index <= 450; index++) {\n\t\tconst progress = index / 450\n\t\tconst easedRadius =\n\t\t\tradius * Math.sin(Math.PI * progress) ** 0.58 * (0.5 + progress * 0.6)\n\t\tpoints.push(new THREE.Vector2(easedRadius, direction * progress * height))\n\t}\n\n\tconst lastPoint = points[points.length - 1]\n\tconst nextToLastPoint = points[points.length - 2]\n\tlastPoint.setY(nextToLastPoint.y)\n\tpoints[0].setY(points[1].y)\n\treturn new THREE.LatheGeometry(points, 96)\n}\n\nexport function createDz2OrbitalCamera(aspect = 1): THREE.PerspectiveCamera {\n\tconst camera = new THREE.PerspectiveCamera(\n\t\tDZ2_ORBITAL_CAMERA.fov,\n\t\taspect,\n\t\tDZ2_ORBITAL_CAMERA.near,\n\t\tDZ2_ORBITAL_CAMERA.far,\n\t)\n\tcamera.position.set(...DZ2_ORBITAL_CAMERA.position)\n\tcamera.lookAt(...DZ2_ORBITAL_CAMERA.lookAt)\n\treturn camera\n}\n\nexport function addDz2OrbitalLights(scene: THREE.Scene): void {\n\tconst coreLight = new THREE.PointLight(\n\t\tDZ2_ORBITAL_LIGHTS.core.color,\n\t\tDZ2_ORBITAL_LIGHTS.core.intensity,\n\t\tDZ2_ORBITAL_LIGHTS.core.distance,\n\t)\n\tcoreLight.position.set(...DZ2_ORBITAL_LIGHTS.core.position)\n\tscene.add(coreLight)\n\tscene.add(\n\t\tnew THREE.AmbientLight(\n\t\t\tDZ2_ORBITAL_LIGHTS.ambient.color,\n\t\t\tDZ2_ORBITAL_LIGHTS.ambient.intensity,\n\t\t),\n\t)\n}\n\nexport function setDz2OrbitalRotation(\n\torbital: THREE.Object3D,\n\ty = DZ2_ORBITAL_FINAL_SPIN_RADIANS,\n): void {\n\torbital.rotation.set(\n\t\tDZ2_ORBITAL_SETTLED_ROTATION_X,\n\t\ty,\n\t\tDZ2_ORBITAL_SETTLED_ROTATION_Z,\n\t)\n}\n\nexport function createDz2OrbitalModel(): Dz2OrbitalModel {\n\tconst orbital = new THREE.Group()\n\tsetDz2OrbitalRotation(orbital)\n\n\tconst lobeMaterial = new THREE.MeshToonMaterial({\n\t\tcolor: 0xff3366,\n\t\temissive: 0xff3366,\n\t\temissiveIntensity: 0.22,\n\t\topacity: 0.82,\n\t\tside: THREE.DoubleSide,\n\t})\n\tconst torusMaterial = new THREE.MeshToonMaterial({\n\t\tcolor: 0x0099ff,\n\t\temissive: 0x0099ff,\n\t\temissiveIntensity: 0.17,\n\t\topacity: 0.72,\n\t\tside: THREE.DoubleSide,\n\t})\n\n\tconst topLobe: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tmakeLobeGeometry(1),\n\t\tlobeMaterial,\n\t)\n\tconst bottomLobe: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tmakeLobeGeometry(-1),\n\t\tlobeMaterial,\n\t)\n\ttopLobe.position.y = DZ2_ORBITAL_LOBE_CENTER_OFFSET\n\tbottomLobe.position.y = -DZ2_ORBITAL_LOBE_CENTER_OFFSET\n\tconst torus: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tnew THREE.TorusGeometry(1.2, 0.3, 36, 144),\n\t\ttorusMaterial,\n\t)\n\ttorus.rotation.x = Math.PI / 2\n\tconst meshes = [topLobe, bottomLobe, torus]\n\torbital.add(...meshes)\n\n\treturn {\n\t\torbital,\n\t\tmeshes,\n\t\tmaterials: {\n\t\t\tlobe: lobeMaterial,\n\t\t\ttorus: torusMaterial,\n\t\t},\n\t}\n}\n\nexport function disposeDz2OrbitalModel(model: Dz2OrbitalModel): void {\n\tfor (const mesh of model.meshes) {\n\t\tmesh.geometry.dispose()\n\t}\n\tmodel.materials.lobe.dispose()\n\tmodel.materials.torus.dispose()\n}\n"],"mappings":";;AAEA,MAAa,iCAAiC;AAC9C,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAa,4CAA4C,KAAK,KAAK;AACnE,MAAM,iCAAiC;AAEvC,MAAM,qBAAqB;CAC1B,KAAK;CACL,MAAM;CACN,KAAK;CACL,UAAU;EAAC;EAAK;EAAK;CAAG;CACxB,QAAQ;EAAC;EAAG;EAAG;CAAC;AACjB;;AASA,MAAa,qBAAqB;CACjC,MAAM;EACL,OAAO;EACP,WAAW;EACX,UAAU;EACV,UAAU;GAAC;GAAK;GAAK;EAAG;CACzB;CACA,SAAS;EACR,OAAO;EACP,WAAW;CACZ;AACD;AAwBA,SAAS,iBAAiB,WAAwC;CACjE,MAAM,SAA0B,CAAC;CACjC,MAAM,SAAS;CACf,MAAM,SAAS;CACf,KAAK,IAAI,QAAQ,GAAG,SAAS,IAAI,SAAS;EACzC,MAAM,WAAW,QAAQ;EACzB,MAAM,cACL,SAAS,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAK,OAAQ,KAAM,WAAW;EAEnE,OAAO,KAAK,IAAI,MAAM,QAAQ,aAAa,YAAY,WAAW,MAAM,CAAC;CAC1E;CAEA,KAAK,IAAI,QAAQ,KAAK,SAAS,KAAK,SAAS;EAC5C,MAAM,WAAW,QAAQ;EACzB,MAAM,cACL,SAAS,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAK,OAAQ,KAAM,WAAW;EACnE,OAAO,KAAK,IAAI,MAAM,QAAQ,aAAa,YAAY,WAAW,MAAM,CAAC;CAC1E;CAEA,MAA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