@dxos/react-ui-attention 0.8.2 → 0.8.3-main.672df60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-4I5OVUE3.mjs → chunk-GS3SZRGH.mjs} +5 -5
- package/dist/lib/browser/{chunk-4I5OVUE3.mjs.map → chunk-GS3SZRGH.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-EGMHOB43.cjs → chunk-FCPQP37W.cjs} +9 -9
- package/dist/lib/node/{chunk-EGMHOB43.cjs.map → chunk-FCPQP37W.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +24 -24
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +2 -2
- package/dist/lib/node-esm/{chunk-GBD6BNIC.mjs → chunk-ZGL23C7V.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-GBD6BNIC.mjs.map → chunk-ZGL23C7V.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/components/AttentionProvider.d.ts +2 -2
- package/dist/types/src/components/AttentionProvider.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/components/AttentionProvider.stories.tsx +3 -3
- package/src/components/AttentionProvider.tsx +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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[]): void {\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>): void {\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-accentSurfaceText [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-accentSurfaceText';\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';\nimport { Match } from 'effect';\n\nimport { invariant } from '@dxos/invariant';\nimport { live, type Live } from '@dxos/live-object';\n\nexport type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';\n\nexport type Selection =\n | { mode: 'single'; id?: string }\n | { mode: 'multi'; ids: string[] }\n | { mode: 'range'; from?: string; to?: string }\n | { mode: 'multi-range'; ranges: { from: string; to: string }[] };\n\nexport const defaultSelection = Match.type<SelectionMode>().pipe(\n Match.when('single', () => ({ mode: 'single' }) as Selection),\n Match.when('multi', () => ({ mode: 'multi', ids: [] }) as Selection),\n Match.when('range', () => ({ mode: 'range' }) as Selection),\n Match.when('multi-range', () => ({ mode: 'multi-range', ranges: [] }) as Selection),\n Match.exhaustive,\n);\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own selection mode and state.\n */\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Selection> }>({ selections: {} });\n\n constructor(initial: Record<string, Selection> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n getSelection<T extends SelectionMode | undefined>(\n contextId: string,\n mode: T = undefined as T,\n ): T extends undefined ? Live<Selection> | undefined : Live<Selection> {\n const selection = untracked(() => this._state.selections[contextId]);\n if (!mode || selection) {\n return selection;\n }\n\n return untracked(() => {\n this._state.selections[contextId] = defaultSelection(mode);\n return this._state.selections[contextId];\n });\n }\n\n getSelected<T extends SelectionMode>(\n contextId: string,\n mode: T = 'multi' as T,\n ): T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never {\n const selection = this.getSelection(contextId, mode);\n invariant(selection?.mode === mode, 'Selection mode mismatch');\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(selection) as any;\n }\n\n updateSingle(contextId: string, id: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId, 'single');\n invariant(selection?.mode === 'single', 'Selection mode is not single');\n selection.id = id;\n });\n }\n\n updateMulti(contextId: string, ids: string[]) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n selection.ids = ids;\n });\n }\n\n updateRange(contextId: string, from: string, to: string) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'range');\n invariant(selection?.mode === 'range', 'Selection mode is not range');\n selection.from = from;\n selection.to = to;\n });\n }\n\n updateMultiRange(contextId: string, ranges: { from: string; to: string }[]) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi-range');\n invariant(selection?.mode === 'multi-range', 'Selection mode is not multi-range');\n selection.ranges = ranges;\n });\n }\n\n clearSelection(contextId: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId);\n if (selection) {\n this._state.selections[contextId] = defaultSelection(selection.mode);\n }\n });\n }\n\n toggleSelection(contextId: string, id: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n\n if (selection.ids.includes(id)) {\n const index = selection.ids.indexOf(id);\n selection.ids.splice(index, 1);\n } else {\n selection.ids.push(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport { Match } from 'effect';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { defaultSelection, SelectionManager, type Selection, type SelectionMode } 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): 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\nexport const useSelected = <T extends SelectionMode>(\n contextId?: string,\n mode: T = 'multi' as T,\n): T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n if (contextId) {\n return selection.getSelected(contextId, mode);\n }\n\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(defaultSelection(mode)) as any;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[], mode: SelectionMode = 'multi') => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]); // TODO(burdon): Avoid stringify.\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const singleSelect = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.updateSingle(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const multiSelect = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateMulti(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const rangeSelect = useCallback(\n (from: string, to: string) => {\n for (const contextId of stableContextIds) {\n selection.updateRange(contextId, from, to);\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 { singleSelect, multiSelect, rangeSelect, 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;AAC1B,IAAAC,iBAAsB;AAEtB,uBAA0B;AAC1B,IAAAC,sBAAgC;;ACJhC,IAAAC,wBAA8B;AAC9B,IAAAF,iBAAsB;AACtB,IAAAJ,gBAAoE;AAEpE,IAAAC,mBAAgC;AJGzB,IAAMM,4BAA4B;AAElC,IAAMC,kBAAkBC,qBAAOC,QACpCD,qBAAOE,OAAO;EACZC,cAAcH,qBAAOI;EACrBC,YAAYL,qBAAOI;EACnBE,WAAWN,qBAAOI;AACpB,CAAA,CAAA;AAMF,IAAMG,YAAY,CAACC,QAAkBA,IAAIC,KAAK,GAAA;AAMvC,IAAMC,mBAAN,MAAMA;EAMX,YAAYC,UAAoB,CAAA,GAA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AAA;IACpC;EACF,GACA;IAAC2B;IAAWsB;GAAiB;AAG/B,QAAMK,kBAAcD,2BAClB,CAACnC,QAAAA;AACC,eAAWO,aAAawB,kBAAkB;AACxCtB,gBAAUM,YAAYR,WAAWP,GAAAA;IACnC;EACF,GACA;IAACS;IAAWsB;GAAiB;AAG/B,QAAMM,kBAAcF,2BAClB,CAACnK,MAAc6I,OAAAA;AACb,eAAWN,aAAawB,kBAAkB;AACxCtB,gBAAUO,YAAYT,WAAWvI,MAAM6I,EAAAA;IACzC;EACF,GACA;IAACJ;IAAWsB;GAAiB;AAG/B,QAAMO,aAASH,2BACb,CAACrD,OAAAA;AACC,eAAWyB,aAAawB,kBAAkB;AACxCtB,gBAAUU,gBAAgBZ,WAAWzB,EAAAA;IACvC;EACF,GACA;IAAC2B;IAAWsB;GAAiB;AAG/B,QAAMQ,YAAQJ,2BAAY,MAAA;AACxB,eAAW5B,aAAawB,kBAAkB;AACxCtB,gBAAUS,eAAeX,SAAAA;IAC3B;EACF,GAAG;IAACE;IAAWsB;GAAiB;AAEhC,SAAO;IAAEG;IAAcE;IAAaC;IAAaC;IAAQC;EAAM;AACjE;",
|
|
6
|
-
"names": ["import_react", "import_react_ui", "import_react_ui_theme", "import_signals_core", "import_effect", "import_live_object", "import_react_context", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "Schema", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "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", "
|
|
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[]): void {\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>): void {\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-accentSurfaceText [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-accentSurfaceText';\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 useAttentionAttributes = (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 attentionAttrs = useAttentionAttributes(id);\n const Root = asChild ? Slot : Primitive.div;\n return (\n <Root\n role='none'\n {...attentionAttrs}\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 useAttentionAttributes,\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';\nimport { Match } from 'effect';\n\nimport { invariant } from '@dxos/invariant';\nimport { live, type Live } from '@dxos/live-object';\n\nexport type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';\n\nexport type Selection =\n | { mode: 'single'; id?: string }\n | { mode: 'multi'; ids: string[] }\n | { mode: 'range'; from?: string; to?: string }\n | { mode: 'multi-range'; ranges: { from: string; to: string }[] };\n\nexport const defaultSelection = Match.type<SelectionMode>().pipe(\n Match.when('single', () => ({ mode: 'single' }) as Selection),\n Match.when('multi', () => ({ mode: 'multi', ids: [] }) as Selection),\n Match.when('range', () => ({ mode: 'range' }) as Selection),\n Match.when('multi-range', () => ({ mode: 'multi-range', ranges: [] }) as Selection),\n Match.exhaustive,\n);\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own selection mode and state.\n */\nexport class SelectionManager {\n private readonly _state = live<{ selections: Record<string, Selection> }>({ selections: {} });\n\n constructor(initial: Record<string, Selection> = {}) {\n if (Object.keys(initial).length > 0) {\n untracked(() => {\n this._state.selections = initial;\n });\n }\n }\n\n getSelection<T extends SelectionMode | undefined>(\n contextId: string,\n mode: T = undefined as T,\n ): T extends undefined ? Live<Selection> | undefined : Live<Selection> {\n const selection = untracked(() => this._state.selections[contextId]);\n if (!mode || selection) {\n return selection;\n }\n\n return untracked(() => {\n this._state.selections[contextId] = defaultSelection(mode);\n return this._state.selections[contextId];\n });\n }\n\n getSelected<T extends SelectionMode>(\n contextId: string,\n mode: T = 'multi' as T,\n ): T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never {\n const selection = this.getSelection(contextId, mode);\n invariant(selection?.mode === mode, 'Selection mode mismatch');\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(selection) as any;\n }\n\n updateSingle(contextId: string, id: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId, 'single');\n invariant(selection?.mode === 'single', 'Selection mode is not single');\n selection.id = id;\n });\n }\n\n updateMulti(contextId: string, ids: string[]) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n selection.ids = ids;\n });\n }\n\n updateRange(contextId: string, from: string, to: string) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'range');\n invariant(selection?.mode === 'range', 'Selection mode is not range');\n selection.from = from;\n selection.to = to;\n });\n }\n\n updateMultiRange(contextId: string, ranges: { from: string; to: string }[]) {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi-range');\n invariant(selection?.mode === 'multi-range', 'Selection mode is not multi-range');\n selection.ranges = ranges;\n });\n }\n\n clearSelection(contextId: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId);\n if (selection) {\n this._state.selections[contextId] = defaultSelection(selection.mode);\n }\n });\n }\n\n toggleSelection(contextId: string, id: string): void {\n untracked(() => {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n\n if (selection.ids.includes(id)) {\n const index = selection.ids.indexOf(id);\n selection.ids.splice(index, 1);\n } else {\n selection.ids.push(id);\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport { Match } from 'effect';\nimport React, { useCallback, useMemo, type PropsWithChildren } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-ui';\n\nimport { defaultSelection, SelectionManager, type Selection, type SelectionMode } 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): 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\nexport const useSelected = <T extends SelectionMode>(\n contextId?: string,\n mode: T = 'multi' as T,\n): T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n if (contextId) {\n return selection.getSelected(contextId, mode);\n }\n\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(defaultSelection(mode)) as any;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[], mode: SelectionMode = 'multi') => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]); // TODO(burdon): Avoid stringify.\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const singleSelect = useCallback(\n (id: string) => {\n for (const contextId of stableContextIds) {\n selection.updateSingle(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const multiSelect = useCallback(\n (ids: string[]) => {\n for (const contextId of stableContextIds) {\n selection.updateMulti(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const rangeSelect = useCallback(\n (from: string, to: string) => {\n for (const contextId of stableContextIds) {\n selection.updateRange(contextId, from, to);\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 { singleSelect, multiSelect, rangeSelect, 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,gB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["import_react", "import_react_ui", "import_react_ui_theme", "import_signals_core", "import_effect", "import_live_object", "import_react_context", "ATTENDABLE_PATH_SEPARATOR", "AttentionSchema", "Schema", "mutable", "Struct", "hasAttention", "Boolean", "isAncestor", "isRelated", "stringKey", "key", "join", "AttentionManager", "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", "useAttentionAttributes", "attributes", "useAttentionPath", "RootAttentionProvider", "children", "propsAttention", "onChange", "useDefaultValue", "handleFocus", "event", "querySelectorAll", "el", "prev", "target", "id", "index", "onFocusCapture", "AttentionProvider", "nextPath", "AttendableContainer", "asChild", "attentionAttrs", "Root", "Slot", "Primitive", "tabIndex", "defaultSelection", "Match", "type", "pipe", "when", "mode", "ids", "ranges", "exhaustive", "SelectionManager", "selections", "Object", "getSelection", "contextId", "undefined", "selection", "getSelected", "invariant", "s", "to", "updateSingle", "updateMulti", "updateRange", "updateMultiRange", "clearSelection", "toggleSelection", "includes", "indexOf", "splice", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "SelectionProvider", "propsSelection", "useSelected", "useSelectionActions", "contextIds", "stableContextIds", "JSON", "stringify", "singleSelect", "useCallback", "multiSelect", "rangeSelect", "toggle", "clear"]
|
|
7
7
|
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,31 +18,31 @@ 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: () =>
|
|
22
|
-
ATTENDABLE_PATH_SEPARATOR: () =>
|
|
23
|
-
ATTENTION_NAME: () =>
|
|
24
|
-
ATTENTION_SOURCE_ATTRIBUTE: () =>
|
|
25
|
-
AttendableContainer: () =>
|
|
26
|
-
AttentionGlyph: () =>
|
|
27
|
-
AttentionManager: () =>
|
|
28
|
-
AttentionProvider: () =>
|
|
29
|
-
AttentionSchema: () =>
|
|
30
|
-
RootAttentionProvider: () =>
|
|
31
|
-
SelectionManager: () =>
|
|
32
|
-
SelectionProvider: () =>
|
|
33
|
-
Syncing: () =>
|
|
34
|
-
defaultSelection: () =>
|
|
35
|
-
getAttendables: () =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
useAttentionContext: () =>
|
|
40
|
-
useAttentionPath: () =>
|
|
41
|
-
useSelected: () =>
|
|
42
|
-
useSelectionActions: () =>
|
|
21
|
+
ATTENABLE_ATTRIBUTE: () => import_chunk_FCPQP37W.ATTENABLE_ATTRIBUTE,
|
|
22
|
+
ATTENDABLE_PATH_SEPARATOR: () => import_chunk_FCPQP37W.ATTENDABLE_PATH_SEPARATOR,
|
|
23
|
+
ATTENTION_NAME: () => import_chunk_FCPQP37W.ATTENTION_NAME,
|
|
24
|
+
ATTENTION_SOURCE_ATTRIBUTE: () => import_chunk_FCPQP37W.ATTENTION_SOURCE_ATTRIBUTE,
|
|
25
|
+
AttendableContainer: () => import_chunk_FCPQP37W.AttendableContainer,
|
|
26
|
+
AttentionGlyph: () => import_chunk_FCPQP37W.AttentionGlyph,
|
|
27
|
+
AttentionManager: () => import_chunk_FCPQP37W.AttentionManager,
|
|
28
|
+
AttentionProvider: () => import_chunk_FCPQP37W.AttentionProvider,
|
|
29
|
+
AttentionSchema: () => import_chunk_FCPQP37W.AttentionSchema,
|
|
30
|
+
RootAttentionProvider: () => import_chunk_FCPQP37W.RootAttentionProvider,
|
|
31
|
+
SelectionManager: () => import_chunk_FCPQP37W.SelectionManager,
|
|
32
|
+
SelectionProvider: () => import_chunk_FCPQP37W.SelectionProvider,
|
|
33
|
+
Syncing: () => import_chunk_FCPQP37W.Syncing,
|
|
34
|
+
defaultSelection: () => import_chunk_FCPQP37W.defaultSelection,
|
|
35
|
+
getAttendables: () => import_chunk_FCPQP37W.getAttendables,
|
|
36
|
+
useAttended: () => import_chunk_FCPQP37W.useAttended,
|
|
37
|
+
useAttention: () => import_chunk_FCPQP37W.useAttention,
|
|
38
|
+
useAttentionAttributes: () => import_chunk_FCPQP37W.useAttentionAttributes,
|
|
39
|
+
useAttentionContext: () => import_chunk_FCPQP37W.useAttentionContext,
|
|
40
|
+
useAttentionPath: () => import_chunk_FCPQP37W.useAttentionPath,
|
|
41
|
+
useSelected: () => import_chunk_FCPQP37W.useSelected,
|
|
42
|
+
useSelectionActions: () => import_chunk_FCPQP37W.useSelectionActions
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(node_exports);
|
|
45
|
-
var
|
|
45
|
+
var import_chunk_FCPQP37W = require("./chunk-FCPQP37W.cjs");
|
|
46
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
47
|
0 && (module.exports = {
|
|
48
48
|
ATTENABLE_ATTRIBUTE,
|
|
@@ -60,9 +60,9 @@ var import_chunk_EGMHOB43 = require("./chunk-EGMHOB43.cjs");
|
|
|
60
60
|
Syncing,
|
|
61
61
|
defaultSelection,
|
|
62
62
|
getAttendables,
|
|
63
|
-
useAttendableAttributes,
|
|
64
63
|
useAttended,
|
|
65
64
|
useAttention,
|
|
65
|
+
useAttentionAttributes,
|
|
66
66
|
useAttentionContext,
|
|
67
67
|
useAttentionPath,
|
|
68
68
|
useSelected,
|
|
@@ -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 defaultSelection,\n getAttendables,\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 defaultSelection,\n getAttendables,\n useAttended,\n useAttention,\n useAttentionAttributes,\n useAttentionContext,\n useAttentionPath,\n useSelected,\n useSelectionActions\n} from \"./chunk-FCPQP37W.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 defaultSelection,\n getAttendables,\n useAttended,\n useAttention,\n useAttentionAttributes,\n useAttentionContext,\n useAttentionPath,\n useSelected,\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;AAAA,4BAuBO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16529,"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":11213,"imports":[{"path":"@preact-signals/safe-react/tracking","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}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16529,"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":11213,"imports":[{"path":"@preact-signals/safe-react/tracking","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}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20808,"imports":[{"path":"@preact-signals/safe-react/tracking","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":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":15715,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","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":11475,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect","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":721,"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":658,"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":1350,"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":506,"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":484,"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-FCPQP37W.cjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","defaultSelection","getAttendables","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useAttentionPath","useSelected","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":993},"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-FCPQP37W.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-FCPQP37W.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":37357},"packages/ui/react-ui-attention/dist/lib/node/chunk-FCPQP37W.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":"@preact-signals/safe-react/tracking","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/safe-react/tracking","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":"effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect","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","defaultSelection","getAttendables","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useAttentionPath","useSelected","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3644},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3714},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3705},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":4356},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":2644},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":18889}}}
|
|
@@ -21,10 +21,10 @@ __export(testing_exports, {
|
|
|
21
21
|
withAttention: () => withAttention
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(testing_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_FCPQP37W = require("../chunk-FCPQP37W.cjs");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var withAttention = (Story) => {
|
|
27
|
-
return (0, import_react.createElement)(
|
|
27
|
+
return (0, import_react.createElement)(import_chunk_FCPQP37W.RootAttentionProvider, {
|
|
28
28
|
children: (0, import_react.createElement)(Story)
|
|
29
29
|
});
|
|
30
30
|
};
|
|
@@ -238,7 +238,7 @@ var useAttended = () => {
|
|
|
238
238
|
const { attention } = useAttentionContext(ATTENTION_NAME);
|
|
239
239
|
return attention.current;
|
|
240
240
|
};
|
|
241
|
-
var
|
|
241
|
+
var useAttentionAttributes = (attendableId) => {
|
|
242
242
|
const { hasAttention } = useAttention(attendableId);
|
|
243
243
|
return useMemo2(() => {
|
|
244
244
|
const attributes = {
|
|
@@ -307,11 +307,11 @@ var AttentionProvider = ({ id, children }) => {
|
|
|
307
307
|
var AttendableContainer = /* @__PURE__ */ forwardRef2(({ id, classNames, children, asChild, ...props }, forwardedRef) => {
|
|
308
308
|
var _effect = _useSignals2();
|
|
309
309
|
try {
|
|
310
|
-
const
|
|
310
|
+
const attentionAttrs = useAttentionAttributes(id);
|
|
311
311
|
const Root = asChild ? Slot : Primitive.div;
|
|
312
312
|
return /* @__PURE__ */ React2.createElement(Root, {
|
|
313
313
|
role: "none",
|
|
314
|
-
...
|
|
314
|
+
...attentionAttrs,
|
|
315
315
|
...props,
|
|
316
316
|
className: mx2("attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
|
|
317
317
|
ref: forwardedRef
|
|
@@ -580,7 +580,7 @@ export {
|
|
|
580
580
|
useAttentionContext,
|
|
581
581
|
useAttention,
|
|
582
582
|
useAttended,
|
|
583
|
-
|
|
583
|
+
useAttentionAttributes,
|
|
584
584
|
useAttentionPath,
|
|
585
585
|
RootAttentionProvider,
|
|
586
586
|
AttentionProvider,
|
|
@@ -591,4 +591,4 @@ export {
|
|
|
591
591
|
useSelected,
|
|
592
592
|
useSelectionActions
|
|
593
593
|
};
|
|
594
|
-
//# sourceMappingURL=chunk-
|
|
594
|
+
//# sourceMappingURL=chunk-ZGL23C7V.mjs.map
|