@dxos/react-ui-attention 0.8.2-main.12df754 → 0.8.2-main.2f9c567

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.
@@ -1,13 +1,13 @@
1
1
  // packages/ui/react-ui-attention/src/attention.ts
2
2
  import { untracked } from "@preact/signals-core";
3
- import { S } from "@dxos/echo-schema";
3
+ import { Schema } from "effect";
4
4
  import { live } from "@dxos/live-object";
5
5
  import { ComplexMap } from "@dxos/util";
6
6
  var ATTENDABLE_PATH_SEPARATOR = "~";
7
- var AttentionSchema = S.mutable(S.Struct({
8
- hasAttention: S.Boolean,
9
- isAncestor: S.Boolean,
10
- isRelated: S.Boolean
7
+ var AttentionSchema = Schema.mutable(Schema.Struct({
8
+ hasAttention: Schema.Boolean,
9
+ isAncestor: Schema.Boolean,
10
+ isRelated: Schema.Boolean
11
11
  }));
12
12
  var stringKey = (key) => key.join(",");
13
13
  var AttentionManager = class {
@@ -407,4 +407,4 @@ export {
407
407
  useSelectedItems,
408
408
  useSelectionActions
409
409
  };
410
- //# sourceMappingURL=chunk-Y62DKRHK.mjs.map
410
+ //# sourceMappingURL=chunk-P3YUKXYT.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\nimport { Schema } from 'effect';\n\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = Schema.mutable(\n Schema.Struct({\n hasAttention: Schema.Boolean,\n isAncestor: Schema.Boolean,\n isRelated: Schema.Boolean,\n }),\n);\n\nexport type Attention = Schema.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
+ "mappings": ";AAIA,SAASA,iBAAiB;AAC1B,SAASC,cAAc;AAEvB,SAASC,YAAuB;AAChC,SAASC,kBAAkB;AAGpB,IAAMC,4BAA4B;AAElC,IAAMC,kBAAkBC,OAAOC,QACpCD,OAAOE,OAAO;EACZC,cAAcH,OAAOI;EACrBC,YAAYL,OAAOI;EACnBE,WAAWN,OAAOI;AACpB,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMXC,YAAYC,UAAoB,CAAA,GAAI;AAHnBC;;gBAAO,IAAIC,WAAsCP,SAAAA;AACjDQ,kBAASC,KAA4B;MAAEC,SAAS,CAAA;IAAG,CAAA;AAGlE,QAAIL,QAAQM,SAAS,GAAG;AACtB,WAAKC,OAAOP,OAAAA;IACd;EACF;;;;;;EAOA,IAAIK,UAAmC;AACrC,WAAO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B;AACxCd,gBAAUwB,gBAAgBd,WAAWa,EAAAA;IACvC;EACF,GACA;IAACvB;IAAWc;GAAiB;AAG/B,QAAMW,QAAQN,YAAY,MAAA;AACxB,eAAWT,aAAaI,kBAAkB;AACxCd,gBAAU0B,eAAehB,SAAAA;IAC3B;EACF,GAAG;IAACV;IAAWc;GAAiB;AAEhC,SAAO;IAAEI;IAAQI;IAAQG;EAAM;AACjC;",
6
+ "names": ["untracked", "Schema", "live", "ComplexMap", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "Schema", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "_map", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "React", "forwardRef", "useMemo", "Icon", "mx", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "createContext", "Primitive", "Slot", "React", "useMemo", "forwardRef", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "attention", "AttentionManager", "path", "UNKNOWN_ATTENDABLE", "hasAttention", "isAncestor", "isRelated", "useAttention", "attendableId", "current", "split", "ATTENDABLE_PATH_SEPARATOR", "get", "useAttended", "useAttendableAttributes", "useMemo", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "selector", "Array", "from", "document", "querySelectorAll", "map", "el", "getAttribute", "join", "prev", "next", "getAttendables", "target", "length", "find", "id", "index", "update", "React", "div", "role", "className", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "forwardRef", "classNames", "asChild", "props", "forwardedRef", "attendableAttrs", "Root", "Slot", "Primitive", "mx", "tabIndex", "ref", "untracked", "live", "SelectionManager", "constructor", "initial", "_state", "live", "selections", "Object", "keys", "length", "untracked", "getSelection", "contextId", "Set", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "id", "current", "has", "delete", "add", "createContext", "React", "useCallback", "useMemo", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "SelectionManager", "SelectionProvider", "children", "propsSelection", "useDefaultValue", "React", "emptySet", "Set", "useSelectedItems", "contextId", "getSelection", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "select", "useCallback", "ids", "updateSelection", "toggle", "id", "toggleSelection", "clear", "clearSelection"]
7
+ }
@@ -20,7 +20,7 @@ import {
20
20
  useAttentionPath,
21
21
  useSelectedItems,
22
22
  useSelectionActions
23
- } from "./chunk-Y62DKRHK.mjs";
23
+ } from "./chunk-P3YUKXYT.mjs";
24
24
  export {
25
25
  ATTENABLE_ATTRIBUTE,
26
26
  ATTENDABLE_PATH_SEPARATOR,
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16666,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/browser/chunk-Y62DKRHK.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":965},"packages/ui/react-ui-attention/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":697},"packages/ui/react-ui-attention/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/browser/chunk-Y62DKRHK.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":367},"packages/ui/react-ui-attention/dist/lib/browser/chunk-Y62DKRHK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30528},"packages/ui/react-ui-attention/dist/lib/browser/chunk-Y62DKRHK.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3625},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13819}}}
1
+ {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16721,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/browser/chunk-P3YUKXYT.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":965},"packages/ui/react-ui-attention/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":697},"packages/ui/react-ui-attention/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/browser/chunk-P3YUKXYT.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":367},"packages/ui/react-ui-attention/dist/lib/browser/chunk-P3YUKXYT.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30564},"packages/ui/react-ui-attention/dist/lib/browser/chunk-P3YUKXYT.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3644},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13838}}}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RootAttentionProvider
3
- } from "../chunk-Y62DKRHK.mjs";
3
+ } from "../chunk-P3YUKXYT.mjs";
4
4
 
5
5
  // packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts
6
6
  import { createElement } from "react";
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_4XPI2NDU_exports = {};
30
- __export(chunk_4XPI2NDU_exports, {
29
+ var chunk_Y5ML4SF6_exports = {};
30
+ __export(chunk_Y5ML4SF6_exports, {
31
31
  ATTENABLE_ATTRIBUTE: () => ATTENABLE_ATTRIBUTE,
32
32
  ATTENDABLE_PATH_SEPARATOR: () => ATTENDABLE_PATH_SEPARATOR,
33
33
  ATTENTION_NAME: () => ATTENTION_NAME,
@@ -50,9 +50,9 @@ __export(chunk_4XPI2NDU_exports, {
50
50
  useSelectedItems: () => useSelectedItems,
51
51
  useSelectionActions: () => useSelectionActions
52
52
  });
53
- module.exports = __toCommonJS(chunk_4XPI2NDU_exports);
53
+ module.exports = __toCommonJS(chunk_Y5ML4SF6_exports);
54
54
  var import_signals_core = require("@preact/signals-core");
55
- var import_echo_schema = require("@dxos/echo-schema");
55
+ var import_effect = require("effect");
56
56
  var import_live_object = require("@dxos/live-object");
57
57
  var import_util = require("@dxos/util");
58
58
  var import_react = __toESM(require("react"));
@@ -70,10 +70,10 @@ var import_react_context2 = require("@radix-ui/react-context");
70
70
  var import_react3 = __toESM(require("react"));
71
71
  var import_react_ui3 = require("@dxos/react-ui");
72
72
  var ATTENDABLE_PATH_SEPARATOR = "~";
73
- var AttentionSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
74
- hasAttention: import_echo_schema.S.Boolean,
75
- isAncestor: import_echo_schema.S.Boolean,
76
- isRelated: import_echo_schema.S.Boolean
73
+ var AttentionSchema = import_effect.Schema.mutable(import_effect.Schema.Struct({
74
+ hasAttention: import_effect.Schema.Boolean,
75
+ isAncestor: import_effect.Schema.Boolean,
76
+ isRelated: import_effect.Schema.Boolean
77
77
  }));
78
78
  var stringKey = (key) => key.join(",");
79
79
  var AttentionManager = class {
@@ -449,4 +449,4 @@ var useSelectionActions = (contextIds) => {
449
449
  useSelectedItems,
450
450
  useSelectionActions
451
451
  });
452
- //# sourceMappingURL=chunk-4XPI2NDU.cjs.map
452
+ //# sourceMappingURL=chunk-Y5ML4SF6.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\nimport { Schema } from 'effect';\n\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = Schema.mutable(\n Schema.Struct({\n hasAttention: Schema.Boolean,\n isAncestor: Schema.Boolean,\n isRelated: Schema.Boolean,\n }),\n);\n\nexport type Attention = Schema.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAA0B;AAC1B,oBAAuB;AAEvB,yBAAgC;AAChC,kBAA2B;ACH3B,mBAA2F;AAE3F,sBAA2C;AAC3C,4BAAmB;ACDnB,2BAA4D;AAC5D,6BAA0B;AAC1B,wBAAqB;AACrB,IAAAA,gBAAgH;AAEhH,IAAAC,mBAAsD;AACtD,IAAAC,yBAAmB;ACTnB,IAAAC,uBAA0B;AAE1B,IAAAC,sBAAg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S,IAAKD,oBAAoBF,cAAAA;AAC1C,SAAOR,YAAYW,UAAUZ,aAAaC,SAAAA,IAAac;AACzD;AAKO,IAAME,sBAAsB,CAACC,eAAAA;AAClC,QAAMC,uBAAmBjF,cAAAA,SAAQ,MAAMgF,YAAY;IAACE,KAAKC,UAAUH,UAAAA;GAAY;AAC/E,QAAM,EAAEN,UAAS,IAAKD,oBAAoBF,cAAAA;AAE1C,QAAMa,aAASC,2BACb,CAACC,QAAAA;AACC,eAAWvB,aAAakB,kBAAkB;AACxCP,gBAAUV,gBAAgBD,WAAWuB,GAAAA;IACvC;EACF,GACA;IAACZ;IAAWO;GAAiB;AAG/B,QAAMM,aAASF,2BACb,CAACtC,OAAAA;AACC,eAAWgB,aAAakB,kBAAkB;AACxCP,gBAAUP,gBAAgBJ,WAAWhB,EAAAA;IACvC;EACF,GACA;IAAC2B;IAAWO;GAAiB;AAG/B,QAAMO,YAAQH,2BAAY,MAAA;AACxB,eAAWtB,aAAakB,kBAAkB;AACxCP,gBAAUR,eAAeH,SAAAA;IAC3B;EACF,GAAG;IAACW;IAAWO;GAAiB;AAEhC,SAAO;IAAEG;IAAQG;IAAQC;EAAM;AACjC;",
6
+ "names": ["import_react", "import_react_ui", "import_react_ui_theme", "import_signals_core", "import_live_object", "import_react_context", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "Schema", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "_map", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "React", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "UNKNOWN_ATTENDABLE", "useAttention", "useAttended", "useAttendableAttributes", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "querySelectorAll", "el", "prev", "target", "id", "index", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "asChild", "attendableAttrs", "Root", "Slot", "Primitive", "tabIndex", "SelectionManager", "selections", "Object", "getSelection", "contextId", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "has", "delete", "add", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "selection", "SelectionProvider", "propsSelection", "emptySet", "useSelectedItems", "useSelectionActions", "contextIds", "stableContextIds", "JSON", "stringify", "select", "useCallback", "ids", "toggle", "clear"]
7
+ }
@@ -18,30 +18,30 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
- ATTENABLE_ATTRIBUTE: () => import_chunk_4XPI2NDU.ATTENABLE_ATTRIBUTE,
22
- ATTENDABLE_PATH_SEPARATOR: () => import_chunk_4XPI2NDU.ATTENDABLE_PATH_SEPARATOR,
23
- ATTENTION_NAME: () => import_chunk_4XPI2NDU.ATTENTION_NAME,
24
- ATTENTION_SOURCE_ATTRIBUTE: () => import_chunk_4XPI2NDU.ATTENTION_SOURCE_ATTRIBUTE,
25
- AttendableContainer: () => import_chunk_4XPI2NDU.AttendableContainer,
26
- AttentionGlyph: () => import_chunk_4XPI2NDU.AttentionGlyph,
27
- AttentionManager: () => import_chunk_4XPI2NDU.AttentionManager,
28
- AttentionProvider: () => import_chunk_4XPI2NDU.AttentionProvider,
29
- AttentionSchema: () => import_chunk_4XPI2NDU.AttentionSchema,
30
- RootAttentionProvider: () => import_chunk_4XPI2NDU.RootAttentionProvider,
31
- SelectionManager: () => import_chunk_4XPI2NDU.SelectionManager,
32
- SelectionProvider: () => import_chunk_4XPI2NDU.SelectionProvider,
33
- Syncing: () => import_chunk_4XPI2NDU.Syncing,
34
- getAttendables: () => import_chunk_4XPI2NDU.getAttendables,
35
- useAttendableAttributes: () => import_chunk_4XPI2NDU.useAttendableAttributes,
36
- useAttended: () => import_chunk_4XPI2NDU.useAttended,
37
- useAttention: () => import_chunk_4XPI2NDU.useAttention,
38
- useAttentionContext: () => import_chunk_4XPI2NDU.useAttentionContext,
39
- useAttentionPath: () => import_chunk_4XPI2NDU.useAttentionPath,
40
- useSelectedItems: () => import_chunk_4XPI2NDU.useSelectedItems,
41
- useSelectionActions: () => import_chunk_4XPI2NDU.useSelectionActions
21
+ ATTENABLE_ATTRIBUTE: () => import_chunk_Y5ML4SF6.ATTENABLE_ATTRIBUTE,
22
+ ATTENDABLE_PATH_SEPARATOR: () => import_chunk_Y5ML4SF6.ATTENDABLE_PATH_SEPARATOR,
23
+ ATTENTION_NAME: () => import_chunk_Y5ML4SF6.ATTENTION_NAME,
24
+ ATTENTION_SOURCE_ATTRIBUTE: () => import_chunk_Y5ML4SF6.ATTENTION_SOURCE_ATTRIBUTE,
25
+ AttendableContainer: () => import_chunk_Y5ML4SF6.AttendableContainer,
26
+ AttentionGlyph: () => import_chunk_Y5ML4SF6.AttentionGlyph,
27
+ AttentionManager: () => import_chunk_Y5ML4SF6.AttentionManager,
28
+ AttentionProvider: () => import_chunk_Y5ML4SF6.AttentionProvider,
29
+ AttentionSchema: () => import_chunk_Y5ML4SF6.AttentionSchema,
30
+ RootAttentionProvider: () => import_chunk_Y5ML4SF6.RootAttentionProvider,
31
+ SelectionManager: () => import_chunk_Y5ML4SF6.SelectionManager,
32
+ SelectionProvider: () => import_chunk_Y5ML4SF6.SelectionProvider,
33
+ Syncing: () => import_chunk_Y5ML4SF6.Syncing,
34
+ getAttendables: () => import_chunk_Y5ML4SF6.getAttendables,
35
+ useAttendableAttributes: () => import_chunk_Y5ML4SF6.useAttendableAttributes,
36
+ useAttended: () => import_chunk_Y5ML4SF6.useAttended,
37
+ useAttention: () => import_chunk_Y5ML4SF6.useAttention,
38
+ useAttentionContext: () => import_chunk_Y5ML4SF6.useAttentionContext,
39
+ useAttentionPath: () => import_chunk_Y5ML4SF6.useAttentionPath,
40
+ useSelectedItems: () => import_chunk_Y5ML4SF6.useSelectedItems,
41
+ useSelectionActions: () => import_chunk_Y5ML4SF6.useSelectionActions
42
42
  });
43
43
  module.exports = __toCommonJS(node_exports);
44
- var import_chunk_4XPI2NDU = require("./chunk-4XPI2NDU.cjs");
44
+ var import_chunk_Y5ML4SF6 = require("./chunk-Y5ML4SF6.cjs");
45
45
  // Annotate the CommonJS export names for ESM import in node:
46
46
  0 && (module.exports = {
47
47
  ATTENABLE_ATTRIBUTE,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.cjs"],
4
- "sourcesContent": ["import {\n ATTENABLE_ATTRIBUTE,\n ATTENDABLE_PATH_SEPARATOR,\n ATTENTION_NAME,\n ATTENTION_SOURCE_ATTRIBUTE,\n AttendableContainer,\n AttentionGlyph,\n AttentionManager,\n AttentionProvider,\n AttentionSchema,\n RootAttentionProvider,\n SelectionManager,\n SelectionProvider,\n Syncing,\n getAttendables,\n useAttendableAttributes,\n useAttended,\n useAttention,\n useAttentionContext,\n useAttentionPath,\n useSelectedItems,\n useSelectionActions\n} from \"./chunk-4XPI2NDU.cjs\";\nexport {\n ATTENABLE_ATTRIBUTE,\n ATTENDABLE_PATH_SEPARATOR,\n ATTENTION_NAME,\n ATTENTION_SOURCE_ATTRIBUTE,\n AttendableContainer,\n AttentionGlyph,\n AttentionManager,\n AttentionProvider,\n AttentionSchema,\n RootAttentionProvider,\n SelectionManager,\n SelectionProvider,\n Syncing,\n getAttendables,\n useAttendableAttributes,\n useAttended,\n useAttention,\n useAttentionContext,\n useAttentionPath,\n useSelectedItems,\n useSelectionActions\n};\n//# sourceMappingURL=index.cjs.map\n"],
4
+ "sourcesContent": ["import {\n ATTENABLE_ATTRIBUTE,\n ATTENDABLE_PATH_SEPARATOR,\n ATTENTION_NAME,\n ATTENTION_SOURCE_ATTRIBUTE,\n AttendableContainer,\n AttentionGlyph,\n AttentionManager,\n AttentionProvider,\n AttentionSchema,\n RootAttentionProvider,\n SelectionManager,\n SelectionProvider,\n Syncing,\n getAttendables,\n useAttendableAttributes,\n useAttended,\n useAttention,\n useAttentionContext,\n useAttentionPath,\n useSelectedItems,\n useSelectionActions\n} from \"./chunk-Y5ML4SF6.cjs\";\nexport {\n ATTENABLE_ATTRIBUTE,\n ATTENDABLE_PATH_SEPARATOR,\n ATTENTION_NAME,\n ATTENTION_SOURCE_ATTRIBUTE,\n AttendableContainer,\n AttentionGlyph,\n AttentionManager,\n AttentionProvider,\n AttentionSchema,\n RootAttentionProvider,\n SelectionManager,\n SelectionProvider,\n Syncing,\n getAttendables,\n useAttendableAttributes,\n useAttended,\n useAttention,\n useAttentionContext,\n useAttentionPath,\n useSelectedItems,\n useSelectionActions\n};\n//# sourceMappingURL=index.cjs.map\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAsBO;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16666,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node/index.cjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node/chunk-4XPI2NDU.cjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":965},"packages/ui/react-ui-attention/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":697},"packages/ui/react-ui-attention/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node/chunk-4XPI2NDU.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":367},"packages/ui/react-ui-attention/dist/lib/node/chunk-4XPI2NDU.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30528},"packages/ui/react-ui-attention/dist/lib/node/chunk-4XPI2NDU.cjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3625},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13819}}}
1
+ {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16721,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node/index.cjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node/chunk-Y5ML4SF6.cjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":965},"packages/ui/react-ui-attention/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":697},"packages/ui/react-ui-attention/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node/chunk-Y5ML4SF6.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":367},"packages/ui/react-ui-attention/dist/lib/node/chunk-Y5ML4SF6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30564},"packages/ui/react-ui-attention/dist/lib/node/chunk-Y5ML4SF6.cjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3644},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13838}}}
@@ -21,10 +21,10 @@ __export(testing_exports, {
21
21
  withAttention: () => withAttention
22
22
  });
23
23
  module.exports = __toCommonJS(testing_exports);
24
- var import_chunk_4XPI2NDU = require("../chunk-4XPI2NDU.cjs");
24
+ var import_chunk_Y5ML4SF6 = require("../chunk-Y5ML4SF6.cjs");
25
25
  var import_react = require("react");
26
26
  var withAttention = (Story) => {
27
- return (0, import_react.createElement)(import_chunk_4XPI2NDU.RootAttentionProvider, {
27
+ return (0, import_react.createElement)(import_chunk_Y5ML4SF6.RootAttentionProvider, {
28
28
  children: (0, import_react.createElement)(Story)
29
29
  });
30
30
  };
@@ -2,14 +2,14 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
 
3
3
  // packages/ui/react-ui-attention/src/attention.ts
4
4
  import { untracked } from "@preact/signals-core";
5
- import { S } from "@dxos/echo-schema";
5
+ import { Schema } from "effect";
6
6
  import { live } from "@dxos/live-object";
7
7
  import { ComplexMap } from "@dxos/util";
8
8
  var ATTENDABLE_PATH_SEPARATOR = "~";
9
- var AttentionSchema = S.mutable(S.Struct({
10
- hasAttention: S.Boolean,
11
- isAncestor: S.Boolean,
12
- isRelated: S.Boolean
9
+ var AttentionSchema = Schema.mutable(Schema.Struct({
10
+ hasAttention: Schema.Boolean,
11
+ isAncestor: Schema.Boolean,
12
+ isRelated: Schema.Boolean
13
13
  }));
14
14
  var stringKey = (key) => key.join(",");
15
15
  var AttentionManager = class {
@@ -409,4 +409,4 @@ export {
409
409
  useSelectedItems,
410
410
  useSelectionActions
411
411
  };
412
- //# sourceMappingURL=chunk-NZ3MSJKD.mjs.map
412
+ //# sourceMappingURL=chunk-4CPOLHUN.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\nimport { Schema } from 'effect';\n\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = Schema.mutable(\n Schema.Struct({\n hasAttention: Schema.Boolean,\n isAncestor: Schema.Boolean,\n isRelated: Schema.Boolean,\n }),\n);\n\nexport type Attention = Schema.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,iBAAiB;AAC1B,SAASC,cAAc;AAEvB,SAASC,YAAuB;AAChC,SAASC,kBAAkB;AAGpB,IAAMC,4BAA4B;AAElC,IAAMC,kBAAkBC,OAAOC,QACpCD,OAAOE,OAAO;EACZC,cAAcH,OAAOI;EACrBC,YAAYL,OAAOI;EACnBE,WAAWN,OAAOI;AACpB,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMXC,YAAYC,UAAoB,CAAA,GAAI;AAHnBC;;gBAAO,IAAIC,WAAsCP,SAAAA;AACjDQ,kBAASC,KAA4B;MAAEC,SAAS,CAAA;IAAG,CAAA;AAGlE,QAAIL,QAAQM,SAAS,GAAG;AACtB,WAAKC,OAAOP,OAAAA;IACd;EACF;;;;;;EAOA,IAAIK,UAAmC;AACrC,WAAO,KAAKF,OAAOE;EACrB;;;;EAKAG,OAAmB;AACjB,WAAOC,MAAMC,KAAK,KAAKT,KAAKO,KAAI,CAAA;EAClC;;;;EAKAG,IAAIf,KAAgC;A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T,aAAaI,kBAAkB;AACxCd,gBAAU0B,eAAehB,SAAAA;IAC3B;EACF,GAAG;IAACV;IAAWc;GAAiB;AAEhC,SAAO;IAAEI;IAAQI;IAAQG;EAAM;AACjC;",
6
+ "names": ["untracked", "Schema", "live", "ComplexMap", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "Schema", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "_map", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "React", "forwardRef", "useMemo", "Icon", "mx", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "createContext", "Primitive", "Slot", "React", "useMemo", "forwardRef", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "attention", "AttentionManager", "path", "UNKNOWN_ATTENDABLE", "hasAttention", "isAncestor", "isRelated", "useAttention", "attendableId", "current", "split", "ATTENDABLE_PATH_SEPARATOR", "get", "useAttended", "useAttendableAttributes", "useMemo", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "selector", "Array", "from", "document", "querySelectorAll", "map", "el", "getAttribute", "join", "prev", "next", "getAttendables", "target", "length", "find", "id", "index", "update", "React", "div", "role", "className", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "forwardRef", "classNames", "asChild", "props", "forwardedRef", "attendableAttrs", "Root", "Slot", "Primitive", "mx", "tabIndex", "ref", "untracked", "live", "SelectionManager", "constructor", "initial", "_state", "live", "selections", "Object", "keys", "length", "untracked", "getSelection", "contextId", "Set", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "id", "current", "has", "delete", "add", "createContext", "React", "useCallback", "useMemo", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "SelectionManager", "SelectionProvider", "children", "propsSelection", "useDefaultValue", "React", "emptySet", "Set", "useSelectedItems", "contextId", "getSelection", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "select", "useCallback", "ids", "updateSelection", "toggle", "id", "toggleSelection", "clear", "clearSelection"]
7
+ }
@@ -21,7 +21,7 @@ import {
21
21
  useAttentionPath,
22
22
  useSelectedItems,
23
23
  useSelectionActions
24
- } from "./chunk-NZ3MSJKD.mjs";
24
+ } from "./chunk-4CPOLHUN.mjs";
25
25
  export {
26
26
  ATTENABLE_ATTRIBUTE,
27
27
  ATTENDABLE_PATH_SEPARATOR,
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16666,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-NZ3MSJKD.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":1057},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":698},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-NZ3MSJKD.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":459},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-NZ3MSJKD.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30530},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-NZ3MSJKD.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3625},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13912}}}
1
+ {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16721,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10616,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20377,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5776,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7671,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-4CPOLHUN.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":1057},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":698},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-4CPOLHUN.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":459},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-4CPOLHUN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30566},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-4CPOLHUN.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3644},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3209},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3318},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1193},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1662},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13931}}}
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  RootAttentionProvider
4
- } from "../chunk-NZ3MSJKD.mjs";
4
+ } from "../chunk-4CPOLHUN.mjs";
5
5
 
6
6
  // packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts
7
7
  import { createElement } from "react";
@@ -1,12 +1,12 @@
1
- import { S } from '@dxos/echo-schema';
1
+ import { Schema } from 'effect';
2
2
  import { type Live } from '@dxos/live-object';
3
3
  export declare const ATTENDABLE_PATH_SEPARATOR = "~";
4
- export declare const AttentionSchema: S.mutable<S.Struct<{
5
- hasAttention: typeof S.Boolean;
6
- isAncestor: typeof S.Boolean;
7
- isRelated: typeof S.Boolean;
4
+ export declare const AttentionSchema: Schema.mutable<Schema.Struct<{
5
+ hasAttention: typeof Schema.Boolean;
6
+ isAncestor: typeof Schema.Boolean;
7
+ isRelated: typeof Schema.Boolean;
8
8
  }>>;
9
- export type Attention = S.Schema.Type<typeof AttentionSchema>;
9
+ export type Attention = Schema.Schema.Type<typeof AttentionSchema>;
10
10
  /**
11
11
  * Manages attention state for an application.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../../../src/attention.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIpD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,eAAO,MAAM,eAAe;;;;GAM3B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAK9D;;GAEG;AAEH,qBAAa,gBAAgB;IAG3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAE3D,OAAO,GAAE,MAAM,EAAO;IAMlC;;;;OAIG;IACH,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,MAAM,EAAE,CAAC,CAErC;IAED;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE,EAAE;IAIlB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IA8CnC,OAAO,CAAC,IAAI;CAMb;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,aAAc,MAAM,UAAU,OAAO,QAAO,MAAM,EAAE,KAAQ,MAAM,EAqB5F,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../../../src/attention.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIpD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,eAAO,MAAM,eAAe;;;;GAM3B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAKnE;;GAEG;AAEH,qBAAa,gBAAgB;IAG3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAE3D,OAAO,GAAE,MAAM,EAAO;IAMlC;;;;OAIG;IACH,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,MAAM,EAAE,CAAC,CAErC;IAED;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE,EAAE;IAIlB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IA8CnC,OAAO,CAAC,IAAI;CAMb;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,aAAc,MAAM,UAAU,OAAO,QAAO,MAAM,EAAE,KAAQ,MAAM,EAqB5F,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-attention",
3
- "version": "0.8.2-main.12df754",
3
+ "version": "0.8.2-main.2f9c567",
4
4
  "description": "Signifier components and providers for attention system.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -41,9 +41,10 @@
41
41
  "@radix-ui/react-primitive": "2.0.2",
42
42
  "@radix-ui/react-slot": "1.1.2",
43
43
  "@radix-ui/react-use-controllable-state": "1.1.0",
44
- "@dxos/live-object": "0.8.2-main.12df754",
45
- "@dxos/util": "0.8.2-main.12df754",
46
- "@dxos/echo-schema": "0.8.2-main.12df754"
44
+ "effect": "3.14.21",
45
+ "@dxos/echo-schema": "0.8.2-main.2f9c567",
46
+ "@dxos/live-object": "0.8.2-main.2f9c567",
47
+ "@dxos/util": "0.8.2-main.2f9c567"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@phosphor-icons/react": "^2.1.5",
@@ -52,18 +53,19 @@
52
53
  "react": "~18.2.0",
53
54
  "react-dom": "~18.2.0",
54
55
  "vite": "5.4.7",
55
- "@dxos/app-graph": "0.8.2-main.12df754",
56
- "@dxos/react-ui": "0.8.2-main.12df754",
57
- "@dxos/random": "0.8.2-main.12df754",
58
- "@dxos/react-ui-theme": "0.8.2-main.12df754",
59
- "@dxos/storybook-utils": "0.8.2-main.12df754"
56
+ "@dxos/app-graph": "0.8.2-main.2f9c567",
57
+ "@dxos/random": "0.8.2-main.2f9c567",
58
+ "@dxos/react-ui": "0.8.2-main.2f9c567",
59
+ "@dxos/react-ui-theme": "0.8.2-main.2f9c567",
60
+ "@dxos/storybook-utils": "0.8.2-main.2f9c567"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "@phosphor-icons/react": "^2.1.5",
64
+ "effect": "^3.13.3",
63
65
  "react": "~18.2.0",
64
66
  "react-dom": "~18.2.0",
65
- "@dxos/react-ui-theme": "0.8.2-main.12df754",
66
- "@dxos/react-ui": "0.8.2-main.12df754"
67
+ "@dxos/react-ui": "0.8.2-main.2f9c567",
68
+ "@dxos/react-ui-theme": "0.8.2-main.2f9c567"
67
69
  },
68
70
  "publishConfig": {
69
71
  "access": "public"
package/src/attention.ts CHANGED
@@ -3,23 +3,23 @@
3
3
  //
4
4
 
5
5
  import { untracked } from '@preact/signals-core';
6
+ import { Schema } from 'effect';
6
7
 
7
- import { S } from '@dxos/echo-schema';
8
8
  import { live, type Live } from '@dxos/live-object';
9
9
  import { ComplexMap } from '@dxos/util';
10
10
 
11
11
  // NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html
12
12
  export const ATTENDABLE_PATH_SEPARATOR = '~';
13
13
 
14
- export const AttentionSchema = S.mutable(
15
- S.Struct({
16
- hasAttention: S.Boolean,
17
- isAncestor: S.Boolean,
18
- isRelated: S.Boolean,
14
+ export const AttentionSchema = Schema.mutable(
15
+ Schema.Struct({
16
+ hasAttention: Schema.Boolean,
17
+ isAncestor: Schema.Boolean,
18
+ isRelated: Schema.Boolean,
19
19
  }),
20
20
  );
21
21
 
22
- export type Attention = S.Schema.Type<typeof AttentionSchema>;
22
+ export type Attention = Schema.Schema.Type<typeof AttentionSchema>;
23
23
 
24
24
  // TODO(wittjosiah): Use mosaic path utility?
25
25
  const stringKey = (key: string[]) => key.join(',');
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { S } from '@dxos/echo-schema';\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = S.mutable(\n S.Struct({\n hasAttention: S.Boolean,\n isAncestor: S.Boolean,\n isRelated: S.Boolean,\n }),\n);\n\nexport type Attention = S.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
- "mappings": ";AAIA,SAASA,iBAAiB;AAE1B,SAASC,SAAS;AAClB,SAASC,YAAuB;AAChC,SAASC,kBAAkB;AAGpB,IAAMC,4BAA4B;AAElC,IAAMC,kBAAkBC,EAAEC,QAC/BD,EAAEE,OAAO;EACPC,cAAcH,EAAEI;EAChBC,YAAYL,EAAEI;EACdE,WAAWN,EAAEI;AACf,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMXC,YAAYC,UAAoB,CAAA,GAAI;AAHnBC;;gBAAO,IAAIC,WAAsCP,SAAAA;AACjDQ,kBAASC,KAA4B;MAAEC,SAAS,CAAA;IAAG,CAAA;AAGlE,QAAIL,QAAQM,SAAS,GAAG;AACtB,WAAKC,OAAOP,OAAAA;IACd;EACF;;;;;;EAOA,IAAIK,UAAmC;AACrC,WAAO,KAAKF,OAAOE;EACrB;;;;EAKAG,OAAmB;AACjB,WAAOC,MAAMC,KAAK,KAAKT,KAAKO,KAAI,CAAA;EAClC;;;;EAKAG,IAAIf,KAAgC;AAClC,UAAMgB,SAAS,KAAKX,KAAKU,IAAIf,GAAAA;AAC7B,QAAIgB,QAAQ;AACV,aAAOA;IACT;AAEA,UAAMC,YAAYT,KAAKjB,iBAAiB;MAAEI,cAAc;MAAOE,YAAY;MAAOC,WAAW;IAAM,CAAA;AACnG,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H_SEPARATOR", "AttentionSchema", "S", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "_map", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "React", "forwardRef", "useMemo", "Icon", "mx", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "createContext", "Primitive", "Slot", "React", "useMemo", "forwardRef", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "attention", "AttentionManager", "path", "UNKNOWN_ATTENDABLE", "hasAttention", "isAncestor", "isRelated", "useAttention", "attendableId", "current", "split", "ATTENDABLE_PATH_SEPARATOR", "get", "useAttended", "useAttendableAttributes", "useMemo", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "selector", "Array", "from", "document", "querySelectorAll", "map", "el", "getAttribute", "join", "prev", "next", "getAttendables", "target", "length", "find", "id", "index", "update", "React", "div", "role", "className", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "forwardRef", "classNames", "asChild", "props", "forwardedRef", "attendableAttrs", "Root", "Slot", "Primitive", "mx", "tabIndex", "ref", "untracked", "live", "SelectionManager", "constructor", "initial", "_state", "live", "selections", "Object", "keys", "length", "untracked", "getSelection", "contextId", "Set", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "id", "current", "has", "delete", "add", "createContext", "React", "useCallback", "useMemo", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "SelectionManager", "SelectionProvider", "children", "propsSelection", "useDefaultValue", "React", "emptySet", "Set", "useSelectedItems", "contextId", "getSelection", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "select", "useCallback", "ids", "updateSelection", "toggle", "id", "toggleSelection", "clear", "clearSelection"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { S } from '@dxos/echo-schema';\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = S.mutable(\n S.Struct({\n hasAttention: S.Boolean,\n isAncestor: S.Boolean,\n isRelated: S.Boolean,\n }),\n);\n\nexport type Attention = S.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAA0B;AAE1B,yBAAkB;AAClB,yBAAgC;AAChC,kBAA2B;ACH3B,mBAA2F;AAE3F,sBAA2C;AAC3C,4BAAmB;ACDnB,2BAA4D;AAC5D,6BAA0B;AAC1B,wBAAqB;AACrB,IAAAA,gBAAgH;AAEhH,IAAAC,mBAAsD;AACtD,IAAAC,yBAAmB;ACTnB,IAAAC,uBAA0B;AAE1B,IAAAC,sBAAgC;ACFhC,IAAAC,wBAA8B;AAC9B,IAAAL,gBAAoE;AAEpE,IAAAC,mBAAgC;AJIzB,IAAMK,4BAA4B;AAElC,IAAMC,kBAAkBC,qBAAEC,QAC/BD,qBAAEE,OAAO;EACPC,cAAcH,qBAAEI;EAChBC,YAAYL,qBAAEI;EACdE,WAAWN,qBAAEI;AACf,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMXC,YAAYC,UAAoB,CAAA,GAAI;gBAHZ,IAAIC,uBAAsCN,SAAAA;AACjDO,SAAAA,aAASC,yBAA4B;MAAEC,SAAS,CAAA;IAAG,CAAA;AAGlE,QAAIJ,QAAQK,SAAS,GAAG;AACtB,WAAKC,OAAON,OA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WAAWhB,EAAAA;IACvC;EACF,GACA;IAAC2B;IAAWO;GAAiB;AAG/B,QAAMO,YAAQH,2BAAY,MAAA;AACxB,eAAWtB,aAAakB,kBAAkB;AACxCP,gBAAUR,eAAeH,SAAAA;IAC3B;EACF,GAAG;IAACW;IAAWO;GAAiB;AAEhC,SAAO;IAAEG;IAAQG;IAAQC;EAAM;AACjC;",
6
- "names": ["import_react", "import_react_ui", "import_react_ui_theme", "import_signals_core", "import_live_object", "import_react_context", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "S", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "_map", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "React", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "UNKNOWN_ATTENDABLE", "useAttention", "useAttended", "useAttendableAttributes", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "querySelectorAll", "el", "prev", "target", "id", "index", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "asChild", "attendableAttrs", "Root", "Slot", "Primitive", "tabIndex", "SelectionManager", "selections", "Object", "getSelection", "contextId", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "has", "delete", "add", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "selection", "SelectionProvider", "propsSelection", "emptySet", "useSelectedItems", "useSelectionActions", "contextIds", "stableContextIds", "JSON", "stringify", "select", "useCallback", "ids", "toggle", "clear"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/attention.ts", "../../../src/components/AttentionGlyph.tsx", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { S } from '@dxos/echo-schema';\nimport { live, type Live } from '@dxos/live-object';\nimport { ComplexMap } from '@dxos/util';\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const ATTENDABLE_PATH_SEPARATOR = '~';\n\nexport const AttentionSchema = S.mutable(\n S.Struct({\n hasAttention: S.Boolean,\n isAncestor: S.Boolean,\n isRelated: S.Boolean,\n }),\n);\n\nexport type Attention = S.Schema.Type<typeof AttentionSchema>;\n\n// TODO(wittjosiah): Use mosaic path utility?\nconst stringKey = (key: string[]) => key.join(',');\n\n/**\n * Manages attention state for an application.\n */\n// TODO(wittjosiah): Write unit tests.\nexport class AttentionManager {\n // Each attention path is associated with an attention object.\n // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.\n private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);\n private readonly _state = live<{ current: string[] }>({ current: [] });\n\n constructor(initial: string[] = []) {\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Currently attended element.\n *\n * @reactive\n */\n get current(): Live<readonly string[]> {\n return this._state.current;\n }\n\n /**\n * All attention paths.\n */\n keys(): string[][] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given path.\n */\n get(key: string[]): Live<Attention> {\n const object = this._map.get(key);\n if (object) {\n return object;\n }\n\n const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });\n this._map.set(key, newObject);\n return newObject;\n }\n\n /**\n * Update the currently attended element.\n *\n * @internal\n */\n update(nextKey: string[]) {\n const currentKey = untracked(() => this.current);\n const currentRelatedTo = currentKey[0];\n const nextRelatedTo = nextKey[0];\n\n // Ensure related attention object is initialized.\n this.get([nextRelatedTo]);\n\n const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);\n const nextRelatedKeys = this.keys().filter(\n (key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey),\n );\n const prevRelatedKeys = currentRelatedKeys.filter(\n (curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));\n const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));\n const prevAncestorKeys = currentAncestorKeys.filter(\n (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),\n );\n\n this._state.current = nextKey;\n prevRelatedKeys.forEach((key) => this._set(key, {}));\n prevAncestorKeys.forEach((key) => this._set(key, {}));\n nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));\n nextAncestorKeys.forEach((key) => this._set(key, { isAncestor: true }));\n this._set(nextKey, { hasAttention: true });\n }\n\n private _set(key: string[], attention: Partial<Attention>) {\n const object = this.get(key);\n object.hasAttention = attention.hasAttention ?? false;\n object.isAncestor = attention.isAncestor ?? false;\n object.isRelated = attention.isRelated ?? false;\n }\n}\n\n/**\n * Accumulates all attendable id’s between the element provided and the root, inclusive.\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));\n // TODO: Attempt tail recursion.\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst attentionGlyphStyles =\n 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-inverse [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-inverse';\n\nconst presenceIconStyles =\n 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// NOTE(thure): The following unused imports quell TS2742 (“likely not portable”).\n\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { createContext, type Scope, type CreateScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { useMemo, type FocusEvent, type PropsWithChildren, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { useDefaultValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ATTENDABLE_PATH_SEPARATOR, type Attention, AttentionManager, getAttendables } from '../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-is-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n path: string[];\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: new AttentionManager(),\n path: [],\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false };\n\nconst useAttention = (attendableId?: string): Attention => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n if (!attendableId) {\n return UNKNOWN_ATTENDABLE;\n }\n\n const current = [...attendableId.split(ATTENDABLE_PATH_SEPARATOR), ...path];\n return attention.get(current);\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n return attention.current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes\n * @param attendableId\n */\nconst useAttendableAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst useAttentionPath = () => {\n const { path } = useAttentionContext(ATTENTION_NAME);\n return path;\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const attention = useDefaultValue(propsAttention, () => new AttentionManager());\n const handleFocus = (event: FocusEvent) => {\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.current;\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n // NOTE(thure): Use the following to debug the macOS package issue #8540\n\n // const [startEl, setStartEl] = useState<HTMLElement | null>(null);\n // const [endEl, setEndEl] = useState<HTMLElement | null>(null);\n //\n // const handleEventDebug = useCallback((event: any) => {\n // console.log(`[${event.type}]`, event.target, event.currentTarget, [event.clientX, event.clientY]);\n // }, []);\n //\n // const handleStartDebug = useCallback(\n // (event: any) => {\n // setStartEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleEndDebug = useCallback(\n // (event: any) => {\n // setEndEl(event.target);\n // handleEventDebug(event);\n // },\n // [handleEventDebug],\n // );\n //\n // const handleClickDebug = useCallback(\n // (event: any) => {\n // console.log('[click compare]', startEl, endEl, startEl === endEl);\n // handleEventDebug(event);\n // },\n // [startEl, endEl, handleEventDebug],\n // );\n\n return (\n <AttentionContextProvider attention={attention} path={[]}>\n <div\n role='none'\n className='contents'\n onFocusCapture={handleFocus}\n // onClick={handleClickDebug}\n // onMouseDown={handleStartDebug}\n // onMouseUp={handleEndDebug}\n >\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nconst AttentionProvider = ({ id, children }: PropsWithChildren<{ id: string }>) => {\n const { attention, path } = useAttentionContext(ATTENTION_NAME);\n const nextPath = useMemo(() => [id, ...path], [id, path]);\n\n return (\n <AttentionContextProvider attention={attention} path={nextPath}>\n {children}\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it\n * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other\n * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attendableAttrs = useAttendableAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attendableAttrs}\n {...props}\n className={mx('attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Root>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttendableAttributes,\n useAttentionPath,\n ATTENTION_NAME,\n ATTENABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\n\nimport { live, type Live } from '@dxos/live-object';\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own list of selected IDs.\n */\n// TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Set<string>> }>({ selections: {} });\n\n constructor(initial: Record<string, Set<string>> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n get selections(): Live<Record<string, Set<string>>> {\n return this._state.selections;\n }\n\n getSelection(contextId: string): Set<string> {\n if (!this.selections[contextId]) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n return this.selections[contextId];\n }\n\n updateSelection(contextId: string, selectedIds: Set<string> | string[]) {\n untracked(() => {\n this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);\n });\n }\n\n clearSelection(contextId: string) {\n untracked(() => {\n this._state.selections[contextId] = new Set();\n });\n }\n\n toggleSelection(contextId: string, id: string) {\n untracked(() => {\n const current = this.getSelection(contextId);\n if (current.has(id)) {\n current.delete(id);\n } else {\n current.add(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { SelectionManager } from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: new SelectionManager(),\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): Review/remove this.\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const selection = useDefaultValue(propsSelection, () => new SelectionManager());\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\nconst emptySet = new Set<string>();\n\n// TODO(burdon): Return array?\nexport const useSelectedItems = (contextId?: string): Set<string> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return contextId ? selection.getSelection(contextId) : emptySet;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]) => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const select = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateSelection(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { select, toggle, clear };\n};\n"],
5
- "mappings": ";;;AAIA,SAASA,iBAAiB;AAE1B,SAASC,SAAS;AAClB,SAASC,YAAuB;AAChC,SAASC,kBAAkB;AAGpB,IAAMC,4BAA4B;AAElC,IAAMC,kBAAkBC,EAAEC,QAC/BD,EAAEE,OAAO;EACPC,cAAcH,EAAEI;EAChBC,YAAYL,EAAEI;EACdE,WAAWN,EAAEI;AACf,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMXC,YAAYC,UAAoB,CAAA,GAAI;AAHnBC;;gBAAO,IAAIC,WAAsCP,SAAAA;AACjDQ,kBAASC,KAA4B;MAAEC,SAAS,CAAA;IAAG,CAAA;AAGlE,QAAIL,QAAQM,SAAS,GAAG;AACtB,WAAKC,OAAOP,OAAAA;IACd;EACF;;;;;;EAOA,IAAIK,UAAmC;AACrC,WAAO,KAAKF,OAAOE;EACrB;;;;EAKAG,OAAmB;AACjB,WAAOC,MAAMC,KAAK,KAAKT,KAAKO,KAAI,CAAA;EAClC;;;;EAKAG,IAAIf,KAAgC;AAClC,UAAMgB,SAAS,KAAKX,KAAKU,IAAIf,GAAAA;AAC7B,QAAIgB,QAAQ;AACV,aAAOA;IACT;AAEA,UAAMC,YAAYT,KAAKjB,iBAAiB;MAAEI,cAAc;MAAOE,YAAY;MAAOC,WAAW;IAAM,CAAA;AACnG,SAAKO,KAAKa,IAAIlB,KAAKiB,SAAAA;AACnB,WAAOA;EACT;;;;;;EAOAN,OAAOQ,SAAmB;AACxB,UAAMC,aAAaC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AuBC,eAAqCH,gBAAgB;EAC3GI,WAAW,IAAIC,iBAAAA;AACjB,CAAA;AAOO,IAAMC,oBAAoB,CAAC,EAChCC,UACAH,WAAWI,eAAc,MAC2B;AACpD,QAAMJ,YAAYK,iBAAgBD,gBAAgB,MAAM,IAAIH,iBAAAA,CAAAA;AAC5D,SAAO,gBAAAK,OAAA,cAACT,0BAAAA;IAAyBG;KAAuBG,QAAAA;AAC1D;AAEA,IAAMI,WAAW,oBAAIC,IAAAA;AAGd,IAAMC,mBAAmB,CAACC,cAAAA;AAC/B,QAAM,EAAEV,UAAS,IAAKF,oBAAoBF,cAAAA;AAC1C,SAAOc,YAAYV,UAAUW,aAAaD,SAAAA,IAAaH;AACzD;AAKO,IAAMK,sBAAsB,CAACC,eAAAA;AAClC,QAAMC,mBAAmBC,SAAQ,MAAMF,YAAY;IAACG,KAAKC,UAAUJ,UAAAA;GAAY;AAC/E,QAAM,EAAEb,UAAS,IAAKF,oBAAoBF,cAAAA;AAE1C,QAAMsB,SAASC,YACb,CAACC,QAAAA;AACC,eAAWV,aAAaI,kBAAkB;AACxCd,gBAAUqB,gBAAgBX,WAAWU,GAAAA;IACvC;EACF,GACA;IAACpB;IAAWc;GAAiB;AAG/B,QAAMQ,SAASH,YACb,CAACI,OAAAA;AACC,eAAWb,aAAaI,kBAAkB;AACxCd,gBAAUwB,gBAAgBd,WAAWa,EAAAA;IACvC;EACF,GACA;IAACvB;IAAWc;GAAiB;AAG/B,QAAMW,QAAQN,YAAY,MAAA;AACxB,eAAWT,aAAaI,kBAAkB;AACxCd,gBAAU0B,eAAehB,SAAAA;IAC3B;EACF,GAAG;IAACV;IAAWc;GAAiB;AAEhC,SAAO;IAAEI;IAAQI;IAAQG;EAAM;AACjC;",
6
- "names": ["untracked", "S", "live", "ComplexMap", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "S", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "constructor", "initial", "_map", "ComplexMap", "_state", "live", "current", "length", "update", "keys", "Array", "from", "get", "object", "newObject", "set", "nextKey", "currentKey", "untracked", "currentRelatedTo", "nextRelatedTo", "currentRelatedKeys", "filter", "nextRelatedKeys", "prevRelatedKeys", "curr", "find", "next", "currentAncestorKeys", "slice", "map", "_", "i", "nextAncestorKeys", "prevAncestorKeys", "forEach", "_set", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "split", "parentElement", "Set", "React", "forwardRef", "useMemo", "Icon", "mx", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "useMemo", "animationDelay", "Date", "now", "div", "role", "Icon", "icon", "size", "style", "classNames", "AttentionGlyph", "forwardRef", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "mx", "ref", "createContext", "Primitive", "Slot", "React", "useMemo", "forwardRef", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "attention", "AttentionManager", "path", "UNKNOWN_ATTENDABLE", "hasAttention", "isAncestor", "isRelated", "useAttention", "attendableId", "current", "split", "ATTENDABLE_PATH_SEPARATOR", "get", "useAttended", "useAttendableAttributes", "useMemo", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "selector", "Array", "from", "document", "querySelectorAll", "map", "el", "getAttribute", "join", "prev", "next", "getAttendables", "target", "length", "find", "id", "index", "update", "React", "div", "role", "className", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "forwardRef", "classNames", "asChild", "props", "forwardedRef", "attendableAttrs", "Root", "Slot", "Primitive", "mx", "tabIndex", "ref", "untracked", "live", "SelectionManager", "constructor", "initial", "_state", "live", "selections", "Object", "keys", "length", "untracked", "getSelection", "contextId", "Set", "updateSelection", "selectedIds", "clearSelection", "toggleSelection", "id", "current", "has", "delete", "add", "createContext", "React", "useCallback", "useMemo", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "SelectionManager", "SelectionProvider", "children", "propsSelection", "useDefaultValue", "React", "emptySet", "Set", "useSelectedItems", "contextId", "getSelection", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "select", "useCallback", "ids", "updateSelection", "toggle", "id", "toggleSelection", "clear", "clearSelection"]
7
- }