@asanchez-sa/abby 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -2
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/agents/approvals.d.ts +46 -0
- package/dist/agents/approvals.js +58 -0
- package/dist/agents/changes.d.ts +21 -0
- package/dist/agents/changes.js +21 -0
- package/dist/agents/hooks.d.ts +20 -0
- package/dist/agents/hooks.js +58 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/run-tool.d.ts +44 -0
- package/dist/agents/run-tool.js +79 -0
- package/dist/agents/ui-sdk.d.ts +5 -0
- package/dist/agents/ui-sdk.js +3 -0
- package/dist/behaviors/canvas/index.d.ts +2 -0
- package/dist/behaviors/canvas/index.js +1 -0
- package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
- package/dist/behaviors/canvas/ui-sdk.js +1 -0
- package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/index.js +1 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
- package/dist/behaviors/dragging/index.d.ts +2 -0
- package/dist/behaviors/dragging/index.js +1 -0
- package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
- package/dist/behaviors/dragging/ui-sdk.js +1 -0
- package/dist/behaviors/focus/index.d.ts +2 -0
- package/dist/behaviors/focus/index.js +1 -0
- package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
- package/dist/behaviors/focus/ui-sdk.js +1 -0
- package/dist/behaviors/lists/index.d.ts +3 -0
- package/dist/behaviors/lists/index.js +3 -0
- package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
- package/dist/behaviors/lists/ui-sdk.js +3 -0
- package/dist/behaviors/popups/index.d.ts +3 -0
- package/dist/behaviors/popups/index.js +3 -0
- package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
- package/dist/behaviors/popups/ui-sdk.js +3 -0
- package/dist/behaviors/preferences/index.d.ts +3 -0
- package/dist/behaviors/preferences/index.js +3 -0
- package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
- package/dist/behaviors/preferences/ui-sdk.js +3 -0
- package/dist/behaviors/selection/index.d.ts +3 -0
- package/dist/behaviors/selection/index.js +3 -0
- package/dist/behaviors/selection/indicator.d.ts +13 -0
- package/dist/behaviors/selection/indicator.js +20 -0
- package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
- package/dist/behaviors/selection/ui-sdk.js +1 -0
- package/dist/behaviors/transitions/index.d.ts +3 -0
- package/dist/behaviors/transitions/index.js +3 -0
- package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
- package/dist/behaviors/transitions/ui-sdk.js +3 -0
- package/dist/behaviors/trees/index.d.ts +2 -0
- package/dist/behaviors/trees/index.js +1 -0
- package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
- package/dist/behaviors/trees/ui-sdk.js +1 -0
- package/dist/components/accordion/accordion.d.ts +13 -0
- package/dist/components/accordion/accordion.js +165 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.js +131 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/components/alert-dialog/alert-dialog.js +257 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
- package/dist/components/attachment/attachment.d.ts +48 -0
- package/dist/components/attachment/attachment.js +372 -0
- package/dist/components/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.js +466 -0
- package/dist/components/avatar/avatar.d.ts +6 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar-group/avatar-group.d.ts +9 -0
- package/dist/components/avatar-group/avatar-group.js +75 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +31 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +279 -0
- package/dist/components/bubble/bubble.d.ts +26 -0
- package/dist/components/bubble/bubble.js +173 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.js +91 -0
- package/dist/components/button-group/button-group.d.ts +15 -0
- package/dist/components/button-group/button-group.js +71 -0
- package/dist/components/calendar/calendar.d.ts +29 -0
- package/dist/components/calendar/calendar.js +453 -0
- package/dist/components/card/card.d.ts +14 -0
- package/dist/components/card/card.js +213 -0
- package/dist/components/carousel/carousel.d.ts +16 -0
- package/dist/components/carousel/carousel.js +364 -0
- package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
- package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
- package/dist/components/chat/chat.d.ts +48 -0
- package/dist/components/chat/chat.js +207 -0
- package/dist/components/checkbox/checkbox.d.ts +10 -0
- package/dist/components/checkbox/checkbox.js +118 -0
- package/dist/components/checkpoint/checkpoint.d.ts +24 -0
- package/dist/components/checkpoint/checkpoint.js +178 -0
- package/dist/components/choice-cards/choice-cards.d.ts +38 -0
- package/dist/components/choice-cards/choice-cards.js +255 -0
- package/dist/components/code-block/code-block.d.ts +58 -0
- package/dist/components/code-block/code-block.js +506 -0
- package/dist/components/code-block/highlighter.js +96 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
- package/dist/components/code-block/use-highlighted-code.js +54 -0
- package/dist/components/collapsible/collapsible.d.ts +10 -0
- package/dist/components/collapsible/collapsible.js +92 -0
- package/dist/components/color-picker/color-picker.d.ts +17 -0
- package/dist/components/color-picker/color-picker.js +395 -0
- package/dist/components/combobox/combobox.d.ts +54 -0
- package/dist/components/combobox/combobox.js +683 -0
- package/dist/components/command/command.d.ts +23 -0
- package/dist/components/command/command.js +373 -0
- package/dist/components/command-dock/command-dock.d.ts +118 -0
- package/dist/components/command-dock/command-dock.js +944 -0
- package/dist/components/confirmation/confirmation.d.ts +58 -0
- package/dist/components/confirmation/confirmation.js +181 -0
- package/dist/components/context/context.d.ts +82 -0
- package/dist/components/context/context.js +490 -0
- package/dist/components/date-input/date-input.d.ts +16 -0
- package/dist/components/date-input/date-input.js +89 -0
- package/dist/components/date-picker/date-picker.d.ts +28 -0
- package/dist/components/date-picker/date-picker.js +361 -0
- package/dist/components/dialog/dialog.d.ts +14 -0
- package/dist/components/dialog/dialog.js +261 -0
- package/dist/components/drawer/drawer.d.ts +16 -0
- package/dist/components/drawer/drawer.js +309 -0
- package/dist/components/empty/empty.d.ts +18 -0
- package/dist/components/empty/empty.js +192 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.js +261 -0
- package/dist/components/file-input/file-input.d.ts +12 -0
- package/dist/components/file-input/file-input.js +216 -0
- package/dist/components/file-tree/file-tree.d.ts +45 -0
- package/dist/components/file-tree/file-tree.js +283 -0
- package/dist/components/hover-card/hover-card.d.ts +10 -0
- package/dist/components/hover-card/hover-card.js +118 -0
- package/dist/components/icon/icon.d.ts +14 -0
- package/dist/components/icon/icon.js +60 -0
- package/dist/components/image-cropper/image-cropper.d.ts +15 -0
- package/dist/components/image-cropper/image-cropper.js +334 -0
- package/dist/components/inline-citation/inline-citation.d.ts +46 -0
- package/dist/components/inline-citation/inline-citation.js +269 -0
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +43 -0
- package/dist/components/input-group/input-group.d.ts +42 -0
- package/dist/components/input-group/input-group.js +192 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.js +394 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +75 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +40 -0
- package/dist/components/link/link.d.ts +21 -0
- package/dist/components/link/link.js +126 -0
- package/dist/components/listbox/listbox.d.ts +20 -0
- package/dist/components/listbox/listbox.js +199 -0
- package/dist/components/marker/marker.d.ts +11 -0
- package/dist/components/marker/marker.js +88 -0
- package/dist/components/menu/menu.d.ts +38 -0
- package/dist/components/menu/menu.js +553 -0
- package/dist/components/menubar/menubar.d.ts +9 -0
- package/dist/components/menubar/menubar.js +47 -0
- package/dist/components/message/message.d.ts +44 -0
- package/dist/components/message/message.js +328 -0
- package/dist/components/message-scroller/message-scroller.d.ts +111 -0
- package/dist/components/message-scroller/message-scroller.js +957 -0
- package/dist/components/meter/meter.d.ts +8 -0
- package/dist/components/meter/meter.js +162 -0
- package/dist/components/model-selector/model-selector.d.ts +155 -0
- package/dist/components/model-selector/model-selector.js +905 -0
- package/dist/components/native-select/native-select.d.ts +27 -0
- package/dist/components/native-select/native-select.js +226 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
- package/dist/components/navigation-menu/navigation-menu.js +318 -0
- package/dist/components/not-label.js +9 -0
- package/dist/components/note-editor/blocks.d.ts +22 -0
- package/dist/components/note-editor/blocks.js +245 -0
- package/dist/components/note-editor/diff.d.ts +19 -0
- package/dist/components/note-editor/diff.js +64 -0
- package/dist/components/note-editor/editor.js +249 -0
- package/dist/components/note-editor/note-editor.d.ts +109 -0
- package/dist/components/note-editor/note-editor.js +954 -0
- package/dist/components/note-editor/parts/comments.d.ts +24 -0
- package/dist/components/note-editor/parts/comments.js +337 -0
- package/dist/components/note-editor/parts/header.d.ts +25 -0
- package/dist/components/note-editor/parts/header.js +263 -0
- package/dist/components/note-editor/parts/history.d.ts +56 -0
- package/dist/components/note-editor/parts/history.js +409 -0
- package/dist/components/note-editor/parts/presence.d.ts +31 -0
- package/dist/components/note-editor/parts/presence.js +140 -0
- package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
- package/dist/components/note-editor/parts/suggestions.js +316 -0
- package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
- package/dist/components/note-editor/parts/toolbar.js +687 -0
- package/dist/components/note-editor/people.d.ts +84 -0
- package/dist/components/note-editor/people.js +276 -0
- package/dist/components/note-editor/person.d.ts +11 -0
- package/dist/components/note-editor/person.js +15 -0
- package/dist/components/note-place/note-place.d.ts +42 -0
- package/dist/components/note-place/note-place.js +256 -0
- package/dist/components/note-status/note-status.d.ts +59 -0
- package/dist/components/note-status/note-status.js +380 -0
- package/dist/components/number-input/number-input.d.ts +12 -0
- package/dist/components/number-input/number-input.js +252 -0
- package/dist/components/otp-input/otp-input.d.ts +12 -0
- package/dist/components/otp-input/otp-input.js +136 -0
- package/dist/components/pagination/pagination.d.ts +23 -0
- package/dist/components/pagination/pagination.js +218 -0
- package/dist/components/password-input/password-input.d.ts +11 -0
- package/dist/components/password-input/password-input.js +117 -0
- package/dist/components/plan/plan.d.ts +51 -0
- package/dist/components/plan/plan.js +320 -0
- package/dist/components/popover/popover.d.ts +16 -0
- package/dist/components/popover/popover.js +268 -0
- package/dist/components/preferences/preferences.d.ts +5 -0
- package/dist/components/preferences/preferences.js +18 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +162 -0
- package/dist/components/prompt-input/prompt-input.d.ts +247 -0
- package/dist/components/prompt-input/prompt-input.js +1367 -0
- package/dist/components/questionnaire/questionnaire.d.ts +174 -0
- package/dist/components/questionnaire/questionnaire.js +1628 -0
- package/dist/components/queue/queue.d.ts +82 -0
- package/dist/components/queue/queue.js +471 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.js +101 -0
- package/dist/components/rating/rating.d.ts +10 -0
- package/dist/components/rating/rating.js +95 -0
- package/dist/components/reasoning/reasoning.d.ts +50 -0
- package/dist/components/reasoning/reasoning.js +233 -0
- package/dist/components/resizable/resizable.d.ts +6 -0
- package/dist/components/resizable/resizable.js +100 -0
- package/dist/components/scroll-area/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area/scroll-area.js +211 -0
- package/dist/components/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/segmented-control/segmented-control.js +142 -0
- package/dist/components/select/select.d.ts +43 -0
- package/dist/components/select/select.js +577 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +38 -0
- package/dist/components/sheet/sheet.d.ts +24 -0
- package/dist/components/sheet/sheet.js +330 -0
- package/dist/components/sidebar/sidebar.d.ts +138 -0
- package/dist/components/sidebar/sidebar.js +1374 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +40 -0
- package/dist/components/slider/slider.d.ts +9 -0
- package/dist/components/slider/slider.js +193 -0
- package/dist/components/sources/sources.d.ts +35 -0
- package/dist/components/sources/sources.js +209 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +59 -0
- package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
- package/dist/components/stack-trace/parse-stack-trace.js +61 -0
- package/dist/components/stack-trace/stack-trace.d.ts +79 -0
- package/dist/components/stack-trace/stack-trace.js +434 -0
- package/dist/components/subagent/subagent.d.ts +71 -0
- package/dist/components/subagent/subagent.js +450 -0
- package/dist/components/suggestion/suggestion.d.ts +21 -0
- package/dist/components/suggestion/suggestion.js +130 -0
- package/dist/components/switch/switch.d.ts +6 -0
- package/dist/components/switch/switch.js +70 -0
- package/dist/components/table/table.d.ts +19 -0
- package/dist/components/table/table.js +284 -0
- package/dist/components/table-of-contents/spy.js +84 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
- package/dist/components/table-of-contents/table-of-contents.js +787 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +273 -0
- package/dist/components/task/task.d.ts +40 -0
- package/dist/components/task/task.js +262 -0
- package/dist/components/terminal/terminal.d.ts +82 -0
- package/dist/components/terminal/terminal.js +457 -0
- package/dist/components/test-results/test-results.d.ts +127 -0
- package/dist/components/test-results/test-results.js +687 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +43 -0
- package/dist/components/time-input/time-input.d.ts +7 -0
- package/dist/components/time-input/time-input.js +82 -0
- package/dist/components/timeline/timeline.d.ts +19 -0
- package/dist/components/timeline/timeline.js +247 -0
- package/dist/components/toast/toast.d.ts +12 -0
- package/dist/components/toast/toast.js +285 -0
- package/dist/components/toggle/toggle.d.ts +15 -0
- package/dist/components/toggle/toggle.js +137 -0
- package/dist/components/token-input/token-input.d.ts +7 -0
- package/dist/components/token-input/token-input.js +117 -0
- package/dist/components/tool/tool.d.ts +66 -0
- package/dist/components/tool/tool.js +413 -0
- package/dist/components/toolbar/toolbar.d.ts +91 -0
- package/dist/components/toolbar/toolbar.js +655 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +97 -0
- package/dist/components/trace/trace.d.ts +31 -0
- package/dist/components/trace/trace.js +309 -0
- package/dist/components/tree/tree.d.ts +13 -0
- package/dist/components/tree/tree.js +258 -0
- package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
- package/dist/components/trigger-menu/trigger-menu.js +352 -0
- package/dist/components/usage/usage.d.ts +132 -0
- package/dist/components/usage/usage.js +1368 -0
- package/dist/components/waterfall/waterfall.d.ts +20 -0
- package/dist/components/waterfall/waterfall.js +360 -0
- package/dist/components/week-strip/week-strip.d.ts +177 -0
- package/dist/components/week-strip/week-strip.js +1081 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +27 -0
- package/dist/core/ui-sdk.d.ts +3 -0
- package/dist/core/ui-sdk.js +3 -0
- package/dist/core/use-primitive-state.d.ts +14 -0
- package/dist/core/use-primitive-state.js +25 -0
- package/dist/styles/LICENSE-shadcn.md +21 -0
- package/dist/styles/color-scheme.css +32 -0
- package/dist/styles/components.css +303 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/tokens.css +474 -0
- package/dist/styles/typeset/shadcn.css +506 -0
- package/dist/styles/typeset.css +70 -0
- package/dist/styles/utilities.css +555 -0
- package/dist/tools/observe/index.d.ts +2 -0
- package/dist/tools/observe/index.js +3 -0
- package/dist/tools/observe/ui-sdk.d.ts +1 -0
- package/dist/tools/observe/ui-sdk.js +2 -0
- package/dist/tools/testing/check-agent.d.ts +28 -0
- package/dist/tools/testing/check-agent.js +42 -0
- package/dist/tools/testing/index.d.ts +4 -0
- package/dist/tools/testing/index.js +4 -0
- package/dist/tools/testing/ui-sdk.d.ts +1 -0
- package/dist/tools/testing/ui-sdk.js +2 -0
- package/dist/utilities/cn/index.d.ts +12 -0
- package/dist/utilities/cn/index.js +47 -0
- package/dist/utilities/color/index.d.ts +2 -0
- package/dist/utilities/color/index.js +3 -0
- package/dist/utilities/color/ui-sdk.d.ts +1 -0
- package/dist/utilities/color/ui-sdk.js +2 -0
- package/dist/utilities/date/index.d.ts +2 -0
- package/dist/utilities/date/index.js +6 -0
- package/dist/utilities/date/ui-sdk.d.ts +1 -0
- package/dist/utilities/date/ui-sdk.js +2 -0
- package/dist/utilities/image/index.d.ts +2 -0
- package/dist/utilities/image/index.js +3 -0
- package/dist/utilities/image/ui-sdk.d.ts +1 -0
- package/dist/utilities/image/ui-sdk.js +2 -0
- package/dist/utilities/mobile/index.d.ts +2 -0
- package/dist/utilities/mobile/index.js +1 -0
- package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
- package/dist/utilities/mobile/ui-sdk.js +1 -0
- package/dist/utilities/number/index.d.ts +2 -0
- package/dist/utilities/number/index.js +3 -0
- package/dist/utilities/number/ui-sdk.d.ts +1 -0
- package/dist/utilities/number/ui-sdk.js +2 -0
- package/dist/utilities/platform/index.d.ts +3 -0
- package/dist/utilities/platform/index.js +14 -0
- package/dist/utilities/platform/ui-sdk.d.ts +3 -0
- package/dist/utilities/platform/ui-sdk.js +3 -0
- package/dist/utilities/storage/index.d.ts +2 -0
- package/dist/utilities/storage/index.js +1 -0
- package/dist/utilities/storage/ui-sdk.d.ts +2 -0
- package/dist/utilities/storage/ui-sdk.js +1 -0
- package/dist/utilities/text/index.d.ts +3 -0
- package/dist/utilities/text/index.js +3 -0
- package/dist/utilities/text/ui-sdk.d.ts +3 -0
- package/dist/utilities/text/ui-sdk.js +3 -0
- package/package.json +192 -4
- package/skills/agent-ready-ui/SKILL.md +229 -0
- package/skills/blocks/SKILL.md +262 -0
- package/skills/compose-screens/SKILL.md +354 -0
- package/skills/note-editor/SKILL.md +493 -0
- package/skills/note-status/SKILL.md +295 -0
- package/skills/setup/SKILL.md +136 -0
- package/skills/theming/SKILL.md +216 -0
- package/src/blocks/notes/adapters.ts +77 -0
- package/src/blocks/notes/data.ts +508 -0
- package/src/blocks/notes/notes-block.tsx +244 -0
- package/src/blocks/notes/parts/home.tsx +219 -0
- package/src/blocks/notes/parts/no-access.tsx +84 -0
- package/src/blocks/notes/parts/note-screen.tsx +412 -0
- package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
- package/src/blocks/notes/parts/panels.tsx +393 -0
- package/src/blocks/notes/parts/place.ts +15 -0
- package/src/blocks/notes/parts/review-dialog.tsx +159 -0
- package/src/blocks/notes/parts/share.tsx +172 -0
- package/src/blocks/notes/texts.ts +135 -0
- package/src/blocks/shell/adapters.ts +69 -0
- package/src/blocks/shell/data.ts +281 -0
- package/src/blocks/shell/parts/compose.tsx +292 -0
- package/src/blocks/shell/parts/home.tsx +203 -0
- package/src/blocks/shell/parts/marks.tsx +144 -0
- package/src/blocks/shell/parts/rail.tsx +166 -0
- package/src/blocks/shell/parts/rooms-column.tsx +326 -0
- package/src/blocks/shell/shell-block.tsx +210 -0
- package/src/blocks/shell/texts.ts +80 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createChange, definePrimitive } from "../../core/ui-sdk.js";
|
|
3
|
+
import { usePrimitiveState } from "../../core/use-primitive-state.js";
|
|
4
|
+
import { core_exports } from "../../core/index.js";
|
|
5
|
+
import { cn, cnState } from "../../utilities/cn/index.js";
|
|
6
|
+
import { LinkPart } from "../link/link.js";
|
|
7
|
+
import { contourPath, contourWidth, hashTarget, sectionAt, sectionsInView } from "./spy.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { createContext, use, useEffect, useLayoutEffect, useRef } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/components/table-of-contents/table-of-contents.tsx
|
|
12
|
+
const LINK = "[data-slot=\"table-of-contents-link\"]";
|
|
13
|
+
const ITEM = "[data-slot=\"table-of-contents-item\"]";
|
|
14
|
+
const HOLD = 1200;
|
|
15
|
+
/**
|
|
16
|
+
* Not exported: its inferred type names ui-sdk types that aren't public, so
|
|
17
|
+
* the declaration build can't describe it from another module.
|
|
18
|
+
*
|
|
19
|
+
* The active section, and what moves it: a followed link and the scroll spy.
|
|
20
|
+
*/
|
|
21
|
+
const tableOfContents = definePrimitive({
|
|
22
|
+
name: "table-of-contents",
|
|
23
|
+
options: {
|
|
24
|
+
value: "string",
|
|
25
|
+
defaultValue: "string",
|
|
26
|
+
onValueChange: "callback",
|
|
27
|
+
offset: "number",
|
|
28
|
+
root: "value"
|
|
29
|
+
},
|
|
30
|
+
state: (options) => ({
|
|
31
|
+
value: options.value ?? options.defaultValue,
|
|
32
|
+
inView: []
|
|
33
|
+
}),
|
|
34
|
+
sync: (options) => options.value === void 0 ? {} : { value: options.value },
|
|
35
|
+
api: (context) => {
|
|
36
|
+
const change = createChange(context);
|
|
37
|
+
const { store } = context;
|
|
38
|
+
let held = null;
|
|
39
|
+
let release = () => {};
|
|
40
|
+
let placed = false;
|
|
41
|
+
let tracked;
|
|
42
|
+
const scroller = () => {
|
|
43
|
+
const { root } = context.options();
|
|
44
|
+
return root && "current" in root ? root.current : root ?? null;
|
|
45
|
+
};
|
|
46
|
+
const offset = () => Math.max(0, context.options().offset ?? 16);
|
|
47
|
+
const setInView = (inView) => {
|
|
48
|
+
if (inView.join("\n") !== store.get().inView.join("\n")) store.set({ inView });
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Scrolls the root to put a section on the reading line and holds the
|
|
52
|
+
* mark on it until the scroll ends. False when there is no root holding
|
|
53
|
+
* the section, so the browser's own jump is left to happen.
|
|
54
|
+
*/
|
|
55
|
+
const jump = (id, value, moveFocus) => {
|
|
56
|
+
const el = scroller();
|
|
57
|
+
const target = el?.ownerDocument.getElementById(id);
|
|
58
|
+
const view = el?.ownerDocument.defaultView;
|
|
59
|
+
if (!el || !target || !view || !el.contains(target)) return false;
|
|
60
|
+
const port = el.getBoundingClientRect().top + el.clientTop;
|
|
61
|
+
const top = el.scrollTop + target.getBoundingClientRect().top - port - offset();
|
|
62
|
+
release();
|
|
63
|
+
held = value;
|
|
64
|
+
const taken = [
|
|
65
|
+
"wheel",
|
|
66
|
+
"touchstart",
|
|
67
|
+
"keydown"
|
|
68
|
+
];
|
|
69
|
+
const timer = view.setTimeout(() => release(), HOLD);
|
|
70
|
+
release = () => {
|
|
71
|
+
held = null;
|
|
72
|
+
release = () => {};
|
|
73
|
+
view.clearTimeout(timer);
|
|
74
|
+
el.removeEventListener("scrollend", release);
|
|
75
|
+
for (const type of taken) el.removeEventListener(type, release);
|
|
76
|
+
};
|
|
77
|
+
el.addEventListener("scrollend", release);
|
|
78
|
+
for (const type of taken) el.addEventListener(type, release, { passive: true });
|
|
79
|
+
el.scrollTo({
|
|
80
|
+
top: Math.max(0, top),
|
|
81
|
+
behavior: view.matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth"
|
|
82
|
+
});
|
|
83
|
+
if (moveFocus) {
|
|
84
|
+
const outline = target.style.outline;
|
|
85
|
+
const focusable = target.hasAttribute("tabindex");
|
|
86
|
+
if (!focusable) target.setAttribute("tabindex", "-1");
|
|
87
|
+
target.style.outline = "none";
|
|
88
|
+
target.addEventListener("blur", () => {
|
|
89
|
+
target.style.outline = outline;
|
|
90
|
+
if (!focusable) target.removeAttribute("tabindex");
|
|
91
|
+
}, { once: true });
|
|
92
|
+
target.focus({ preventScroll: true });
|
|
93
|
+
}
|
|
94
|
+
if (view.location.hash !== `#${id}`) view.history.replaceState(view.history.state, "", `#${encodeURIComponent(id)}`);
|
|
95
|
+
return true;
|
|
96
|
+
};
|
|
97
|
+
context.onDestroy(() => release());
|
|
98
|
+
return {
|
|
99
|
+
/**
|
|
100
|
+
* A link's click. `section` is the value of the row it sits in and `id`
|
|
101
|
+
* the element its hash names.
|
|
102
|
+
*/
|
|
103
|
+
follow: (section, id, event, link) => {
|
|
104
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || link.getAttribute("target") === "_blank" || !section) return;
|
|
105
|
+
if (!(section === store.get().value || change("value", section, {
|
|
106
|
+
reason: "link-press",
|
|
107
|
+
event
|
|
108
|
+
}))) {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (event.defaultPrevented || !id) return;
|
|
113
|
+
const fromKeys = event.detail === 0 && link.ownerDocument.activeElement === link;
|
|
114
|
+
if (jump(id, section, fromKeys)) event.preventDefault();
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* Watches the sections the links point at and keeps the one at the
|
|
118
|
+
* reading line active. Returns what stops it.
|
|
119
|
+
*/
|
|
120
|
+
observe: () => {
|
|
121
|
+
const nav = context.element("root");
|
|
122
|
+
const view = nav?.ownerDocument.defaultView;
|
|
123
|
+
if (!nav || !view || typeof IntersectionObserver === "undefined") return void 0;
|
|
124
|
+
const doc = nav.ownerDocument;
|
|
125
|
+
const el = scroller();
|
|
126
|
+
const gap = offset();
|
|
127
|
+
const targets = [];
|
|
128
|
+
const seen = /* @__PURE__ */ new Set();
|
|
129
|
+
for (const link of nav.querySelectorAll(LINK)) {
|
|
130
|
+
const id = hashTarget(link.getAttribute("href"));
|
|
131
|
+
const element = id ? doc.getElementById(id) : null;
|
|
132
|
+
const value = link.closest(ITEM)?.dataset.value;
|
|
133
|
+
if (!element || !value || seen.has(element)) continue;
|
|
134
|
+
seen.add(element);
|
|
135
|
+
targets.push({
|
|
136
|
+
element,
|
|
137
|
+
value
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (targets.length === 0) return void 0;
|
|
141
|
+
const measure = () => {
|
|
142
|
+
const line = (el ? el.getBoundingClientRect().top + el.clientTop : 0) + gap;
|
|
143
|
+
const floor = el ? el.getBoundingClientRect().bottom : view.innerHeight;
|
|
144
|
+
const sections = targets.map(({ element, value }) => {
|
|
145
|
+
const rect = element.getBoundingClientRect();
|
|
146
|
+
return {
|
|
147
|
+
value,
|
|
148
|
+
top: rect.top,
|
|
149
|
+
bottom: rect.bottom
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
setInView(sectionsInView(sections, line, floor));
|
|
153
|
+
if (held !== null) return;
|
|
154
|
+
const box = el ?? doc.scrollingElement;
|
|
155
|
+
const room = box ? box.scrollHeight - box.clientHeight : 0;
|
|
156
|
+
const atEnd = box !== null && room > 0 && box.scrollTop >= room - 1;
|
|
157
|
+
const next = sectionAt(sections, line + 1, atEnd);
|
|
158
|
+
if (next === void 0) return;
|
|
159
|
+
const first = !placed;
|
|
160
|
+
placed = true;
|
|
161
|
+
if (next === store.get().value) {
|
|
162
|
+
tracked = next;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (first) {
|
|
166
|
+
tracked = next;
|
|
167
|
+
if (context.options().value === void 0) store.set({ value: next });
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (next === tracked) return;
|
|
171
|
+
tracked = next;
|
|
172
|
+
change("value", next, { reason: "scroll" });
|
|
173
|
+
};
|
|
174
|
+
const observer = new IntersectionObserver(measure, {
|
|
175
|
+
root: el,
|
|
176
|
+
rootMargin: `${-gap}px 0px 0px 0px`,
|
|
177
|
+
threshold: 0
|
|
178
|
+
});
|
|
179
|
+
let frame = 0;
|
|
180
|
+
const onScroll = () => {
|
|
181
|
+
if (frame) return;
|
|
182
|
+
frame = view.requestAnimationFrame(() => {
|
|
183
|
+
frame = 0;
|
|
184
|
+
measure();
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const scrolled = el ?? view;
|
|
188
|
+
scrolled.addEventListener("scroll", onScroll, { passive: true });
|
|
189
|
+
measure();
|
|
190
|
+
for (const { element } of targets) observer.observe(element);
|
|
191
|
+
return () => {
|
|
192
|
+
observer.disconnect();
|
|
193
|
+
scrolled.removeEventListener("scroll", onScroll);
|
|
194
|
+
view.cancelAnimationFrame(frame);
|
|
195
|
+
setInView([]);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
slots: (slot) => ({ root: slot({}) }),
|
|
201
|
+
agent: { actions: [] }
|
|
202
|
+
});
|
|
203
|
+
/** The sections the contour lights: the active one, then the rest on screen. */
|
|
204
|
+
function litSections({ value, inView }) {
|
|
205
|
+
if (value === void 0) return [];
|
|
206
|
+
return inView[0] === value ? inView : [value, ...inView.filter((each) => each !== value)];
|
|
207
|
+
}
|
|
208
|
+
const TableOfContentsContext = createContext(null);
|
|
209
|
+
const TableOfContentsItemContext = createContext(null);
|
|
210
|
+
function useTableOfContentsScope() {
|
|
211
|
+
const scope = use(TableOfContentsContext);
|
|
212
|
+
if (!scope) throw new Error("TableOfContents parts must be used within a TableOfContents.");
|
|
213
|
+
return scope;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The sections of a long page as a rail of links, with one mark on the
|
|
217
|
+
* section being read. `aria-label` names the landmark: translate it, and
|
|
218
|
+
* change it when the page has another navigation.
|
|
219
|
+
*/
|
|
220
|
+
function TableOfContents(t0) {
|
|
221
|
+
const $ = c(41);
|
|
222
|
+
let children;
|
|
223
|
+
let className;
|
|
224
|
+
let defaultValue;
|
|
225
|
+
let observe;
|
|
226
|
+
let onValueChange;
|
|
227
|
+
let props;
|
|
228
|
+
let root;
|
|
229
|
+
let t1;
|
|
230
|
+
let t2;
|
|
231
|
+
let t3;
|
|
232
|
+
let value;
|
|
233
|
+
if ($[0] !== t0) {
|
|
234
|
+
({value, defaultValue, onValueChange, observe, offset: t1, root, variant: t2, "aria-label": t3, className, children, ...props} = t0);
|
|
235
|
+
$[0] = t0;
|
|
236
|
+
$[1] = children;
|
|
237
|
+
$[2] = className;
|
|
238
|
+
$[3] = defaultValue;
|
|
239
|
+
$[4] = observe;
|
|
240
|
+
$[5] = onValueChange;
|
|
241
|
+
$[6] = props;
|
|
242
|
+
$[7] = root;
|
|
243
|
+
$[8] = t1;
|
|
244
|
+
$[9] = t2;
|
|
245
|
+
$[10] = t3;
|
|
246
|
+
$[11] = value;
|
|
247
|
+
} else {
|
|
248
|
+
children = $[1];
|
|
249
|
+
className = $[2];
|
|
250
|
+
defaultValue = $[3];
|
|
251
|
+
observe = $[4];
|
|
252
|
+
onValueChange = $[5];
|
|
253
|
+
props = $[6];
|
|
254
|
+
root = $[7];
|
|
255
|
+
t1 = $[8];
|
|
256
|
+
t2 = $[9];
|
|
257
|
+
t3 = $[10];
|
|
258
|
+
value = $[11];
|
|
259
|
+
}
|
|
260
|
+
const offset = t1 === void 0 ? 16 : t1;
|
|
261
|
+
const variant = t2 === void 0 ? "rail" : t2;
|
|
262
|
+
const ariaLabel = t3 === void 0 ? "Table of contents" : t3;
|
|
263
|
+
let t4;
|
|
264
|
+
if ($[12] !== defaultValue || $[13] !== offset || $[14] !== onValueChange || $[15] !== root || $[16] !== value) {
|
|
265
|
+
t4 = {
|
|
266
|
+
value,
|
|
267
|
+
defaultValue,
|
|
268
|
+
onValueChange,
|
|
269
|
+
offset,
|
|
270
|
+
root
|
|
271
|
+
};
|
|
272
|
+
$[12] = defaultValue;
|
|
273
|
+
$[13] = offset;
|
|
274
|
+
$[14] = onValueChange;
|
|
275
|
+
$[15] = root;
|
|
276
|
+
$[16] = value;
|
|
277
|
+
$[17] = t4;
|
|
278
|
+
} else t4 = $[17];
|
|
279
|
+
const handle = (0, core_exports.usePrimitive)(tableOfContents, t4);
|
|
280
|
+
const spying = observe ?? value === void 0;
|
|
281
|
+
let t5;
|
|
282
|
+
if ($[18] !== handle || $[19] !== spying) {
|
|
283
|
+
t5 = () => spying ? handle.api.observe() : void 0;
|
|
284
|
+
$[18] = handle;
|
|
285
|
+
$[19] = spying;
|
|
286
|
+
$[20] = t5;
|
|
287
|
+
} else t5 = $[20];
|
|
288
|
+
let t6;
|
|
289
|
+
if ($[21] !== handle || $[22] !== offset || $[23] !== root || $[24] !== spying) {
|
|
290
|
+
t6 = [
|
|
291
|
+
handle,
|
|
292
|
+
spying,
|
|
293
|
+
root,
|
|
294
|
+
offset
|
|
295
|
+
];
|
|
296
|
+
$[21] = handle;
|
|
297
|
+
$[22] = offset;
|
|
298
|
+
$[23] = root;
|
|
299
|
+
$[24] = spying;
|
|
300
|
+
$[25] = t6;
|
|
301
|
+
} else t6 = $[25];
|
|
302
|
+
useEffect(t5, t6);
|
|
303
|
+
let t7;
|
|
304
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
305
|
+
t7 = {};
|
|
306
|
+
$[26] = t7;
|
|
307
|
+
} else t7 = $[26];
|
|
308
|
+
let t8;
|
|
309
|
+
if ($[27] !== className) {
|
|
310
|
+
t8 = cnState("flex min-w-0 flex-col gap-2", className);
|
|
311
|
+
$[27] = className;
|
|
312
|
+
$[28] = t8;
|
|
313
|
+
} else t8 = $[28];
|
|
314
|
+
let t9;
|
|
315
|
+
if ($[29] !== handle || $[30] !== variant) {
|
|
316
|
+
t9 = {
|
|
317
|
+
handle,
|
|
318
|
+
variant
|
|
319
|
+
};
|
|
320
|
+
$[29] = handle;
|
|
321
|
+
$[30] = variant;
|
|
322
|
+
$[31] = t9;
|
|
323
|
+
} else t9 = $[31];
|
|
324
|
+
let t10;
|
|
325
|
+
if ($[32] !== children || $[33] !== t9) {
|
|
326
|
+
t10 = /* @__PURE__ */ jsx(TableOfContentsContext, {
|
|
327
|
+
value: t9,
|
|
328
|
+
children
|
|
329
|
+
});
|
|
330
|
+
$[32] = children;
|
|
331
|
+
$[33] = t9;
|
|
332
|
+
$[34] = t10;
|
|
333
|
+
} else t10 = $[34];
|
|
334
|
+
let t11;
|
|
335
|
+
if ($[35] !== ariaLabel || $[36] !== props || $[37] !== t10 || $[38] !== t8 || $[39] !== variant) {
|
|
336
|
+
t11 = {
|
|
337
|
+
"aria-label": ariaLabel,
|
|
338
|
+
"data-variant": variant,
|
|
339
|
+
...props,
|
|
340
|
+
className: t8,
|
|
341
|
+
children: t10
|
|
342
|
+
};
|
|
343
|
+
$[35] = ariaLabel;
|
|
344
|
+
$[36] = props;
|
|
345
|
+
$[37] = t10;
|
|
346
|
+
$[38] = t8;
|
|
347
|
+
$[39] = variant;
|
|
348
|
+
$[40] = t11;
|
|
349
|
+
} else t11 = $[40];
|
|
350
|
+
return (0, core_exports.usePart)(handle, "root", t7, t11, "nav");
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* The small heading above the list, like "On this page". The `nav` already
|
|
354
|
+
* has a name, so this is for the eye. A `p` by default: pass `render={<h2 />}`
|
|
355
|
+
* when the page's outline should list it.
|
|
356
|
+
*/
|
|
357
|
+
function TableOfContentsTitle({ className, render, ...props }) {
|
|
358
|
+
return (0, core_exports.renderElement)("p", {
|
|
359
|
+
"data-slot": "table-of-contents-title",
|
|
360
|
+
...props,
|
|
361
|
+
className: cnState("text-xs font-medium tracking-wider text-muted-foreground uppercase", className)
|
|
362
|
+
}, render);
|
|
363
|
+
}
|
|
364
|
+
const CONTOUR_STEP = 10;
|
|
365
|
+
const CONTOUR_BEND = 5;
|
|
366
|
+
const contourLayer = "pointer-events-none absolute start-0 opacity-0 group-data-ready/toc:opacity-100 group-data-ready/toc:duration-modal group-data-ready/toc:ease-in-out motion-reduce:transition-none";
|
|
367
|
+
/**
|
|
368
|
+
* The ordered list of sections. It draws the rail and the mark, placed from
|
|
369
|
+
* the rows as they measure, and hidden until then so the mark never slides
|
|
370
|
+
* in from the top of the list.
|
|
371
|
+
*/
|
|
372
|
+
function TableOfContentsList(t0) {
|
|
373
|
+
const $ = c(27);
|
|
374
|
+
let children;
|
|
375
|
+
let className;
|
|
376
|
+
let props;
|
|
377
|
+
let ref;
|
|
378
|
+
if ($[0] !== t0) {
|
|
379
|
+
({className, children, ref, ...props} = t0);
|
|
380
|
+
$[0] = t0;
|
|
381
|
+
$[1] = children;
|
|
382
|
+
$[2] = className;
|
|
383
|
+
$[3] = props;
|
|
384
|
+
$[4] = ref;
|
|
385
|
+
} else {
|
|
386
|
+
children = $[1];
|
|
387
|
+
className = $[2];
|
|
388
|
+
props = $[3];
|
|
389
|
+
ref = $[4];
|
|
390
|
+
}
|
|
391
|
+
const { handle, variant } = useTableOfContentsScope();
|
|
392
|
+
const state = usePrimitiveState(handle);
|
|
393
|
+
let t1;
|
|
394
|
+
if ($[5] !== state) {
|
|
395
|
+
t1 = litSections(state).join("\n");
|
|
396
|
+
$[5] = state;
|
|
397
|
+
$[6] = t1;
|
|
398
|
+
} else t1 = $[6];
|
|
399
|
+
const lit = t1;
|
|
400
|
+
const list = useRef(null);
|
|
401
|
+
const track = useRef(null);
|
|
402
|
+
const litLayer = useRef(null);
|
|
403
|
+
const placed = useRef(false);
|
|
404
|
+
const lastStart = useRef(null);
|
|
405
|
+
const direction = useRef("down");
|
|
406
|
+
let t2;
|
|
407
|
+
if ($[7] !== variant) {
|
|
408
|
+
t2 = () => {
|
|
409
|
+
const box = list.current;
|
|
410
|
+
if (!box) return;
|
|
411
|
+
let frame = 0;
|
|
412
|
+
const ready = () => {
|
|
413
|
+
if (placed.current) {
|
|
414
|
+
box.setAttribute("data-ready", "");
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
frame = requestAnimationFrame(() => {
|
|
418
|
+
placed.current = true;
|
|
419
|
+
box.setAttribute("data-ready", "");
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
const placeContour = () => {
|
|
423
|
+
const items = [...box.querySelectorAll(`:scope > ${ITEM}`)];
|
|
424
|
+
if (items.length === 0) return;
|
|
425
|
+
const top = box.getBoundingClientRect().top;
|
|
426
|
+
const rows = items.map((item) => {
|
|
427
|
+
const rect = item.getBoundingClientRect();
|
|
428
|
+
return {
|
|
429
|
+
top: rect.top - top,
|
|
430
|
+
bottom: rect.bottom - top,
|
|
431
|
+
depth: Number(item.dataset.depth ?? 0)
|
|
432
|
+
};
|
|
433
|
+
});
|
|
434
|
+
const path = contourPath(rows, CONTOUR_STEP, CONTOUR_BEND);
|
|
435
|
+
const width = String(contourWidth(rows, CONTOUR_STEP));
|
|
436
|
+
for (const svg of [track.current, litLayer.current]) {
|
|
437
|
+
svg?.setAttribute("width", width);
|
|
438
|
+
svg?.firstElementChild?.setAttribute("d", path);
|
|
439
|
+
}
|
|
440
|
+
const indexes = items.flatMap(_temp);
|
|
441
|
+
const first = rows[indexes[0] ?? -1];
|
|
442
|
+
const last = rows[indexes.at(-1) ?? -1];
|
|
443
|
+
if (!first || !last) {
|
|
444
|
+
box.removeAttribute("data-ready");
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const start = indexes[0];
|
|
448
|
+
if (lastStart.current !== null && start !== lastStart.current) direction.current = start < lastStart.current ? "up" : "down";
|
|
449
|
+
lastStart.current = start;
|
|
450
|
+
const up = direction.current === "up";
|
|
451
|
+
box.style.setProperty("--toc-lit-top", `${first.top}px`);
|
|
452
|
+
box.style.setProperty("--toc-lit-bottom", `${last.bottom}px`);
|
|
453
|
+
box.style.setProperty("--toc-dot-x", `${(up ? first : last).depth * CONTOUR_STEP - 2}px`);
|
|
454
|
+
box.style.setProperty("--toc-dot-y", `${(up ? first.top : last.bottom) - 2.5}px`);
|
|
455
|
+
ready();
|
|
456
|
+
};
|
|
457
|
+
const place = () => {
|
|
458
|
+
if (variant === "contour") {
|
|
459
|
+
placeContour();
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const active = box.querySelector(`${ITEM}[data-active]`);
|
|
463
|
+
if (!active) {
|
|
464
|
+
box.removeAttribute("data-ready");
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const rect_0 = active.getBoundingClientRect();
|
|
468
|
+
box.style.setProperty("--toc-mark-y", `${rect_0.top - box.getBoundingClientRect().top}px`);
|
|
469
|
+
box.style.setProperty("--toc-mark-scale", String(rect_0.height));
|
|
470
|
+
ready();
|
|
471
|
+
};
|
|
472
|
+
place();
|
|
473
|
+
const observer = new ResizeObserver(place);
|
|
474
|
+
observer.observe(box);
|
|
475
|
+
return () => {
|
|
476
|
+
cancelAnimationFrame(frame);
|
|
477
|
+
observer.disconnect();
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
$[7] = variant;
|
|
481
|
+
$[8] = t2;
|
|
482
|
+
} else t2 = $[8];
|
|
483
|
+
let t3;
|
|
484
|
+
if ($[9] !== lit || $[10] !== state.value || $[11] !== variant) {
|
|
485
|
+
t3 = [
|
|
486
|
+
state.value,
|
|
487
|
+
variant,
|
|
488
|
+
lit
|
|
489
|
+
];
|
|
490
|
+
$[9] = lit;
|
|
491
|
+
$[10] = state.value;
|
|
492
|
+
$[11] = variant;
|
|
493
|
+
$[12] = t3;
|
|
494
|
+
} else t3 = $[12];
|
|
495
|
+
useLayoutEffect(t2, t3);
|
|
496
|
+
let t4;
|
|
497
|
+
if ($[13] !== className || $[14] !== variant) {
|
|
498
|
+
t4 = cn("relative m-0 flex list-none flex-col p-0", variant === "contour" ? "group/toc" : [
|
|
499
|
+
"before:pointer-events-none before:absolute before:inset-y-0 before:start-0 before:w-px before:bg-border",
|
|
500
|
+
"after:pointer-events-none after:absolute after:start-0 after:top-0 after:h-px after:w-0.5 after:origin-top after:bg-primary",
|
|
501
|
+
"after:translate-y-(--toc-mark-y,0px) after:scale-y-(--toc-mark-scale,0)",
|
|
502
|
+
"after:opacity-0 data-ready:after:opacity-100",
|
|
503
|
+
"data-ready:after:transition-[translate,scale] data-ready:after:duration-popup data-ready:after:ease-in-out motion-reduce:after:transition-none"
|
|
504
|
+
], className);
|
|
505
|
+
$[13] = className;
|
|
506
|
+
$[14] = variant;
|
|
507
|
+
$[15] = t4;
|
|
508
|
+
} else t4 = $[15];
|
|
509
|
+
let t5;
|
|
510
|
+
if ($[16] !== ref) {
|
|
511
|
+
t5 = (node) => {
|
|
512
|
+
list.current = node;
|
|
513
|
+
if (typeof ref === "function") return ref(node);
|
|
514
|
+
if (ref) ref.current = node;
|
|
515
|
+
};
|
|
516
|
+
$[16] = ref;
|
|
517
|
+
$[17] = t5;
|
|
518
|
+
} else t5 = $[17];
|
|
519
|
+
let t6;
|
|
520
|
+
if ($[18] !== variant) {
|
|
521
|
+
t6 = variant === "contour" ? /* @__PURE__ */ jsxs("li", {
|
|
522
|
+
"aria-hidden": "true",
|
|
523
|
+
role: "presentation",
|
|
524
|
+
"data-slot": "table-of-contents-contour",
|
|
525
|
+
className: "contents",
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ jsx("svg", {
|
|
528
|
+
ref: track,
|
|
529
|
+
height: "100%",
|
|
530
|
+
className: "pointer-events-none absolute inset-y-0 start-0 overflow-visible rtl:-scale-x-100",
|
|
531
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
532
|
+
fill: "none",
|
|
533
|
+
strokeWidth: 1,
|
|
534
|
+
className: "stroke-border"
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
/* @__PURE__ */ jsx("svg", {
|
|
538
|
+
ref: litLayer,
|
|
539
|
+
height: "100%",
|
|
540
|
+
className: cn(contourLayer, "inset-y-0 overflow-visible [clip-path:inset(var(--toc-lit-top,0px)_-4px_calc(100%_-_var(--toc-lit-bottom,0px))_-4px)] group-data-ready/toc:transition-[clip-path] rtl:-scale-x-100"),
|
|
541
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
542
|
+
fill: "none",
|
|
543
|
+
strokeWidth: 1,
|
|
544
|
+
className: "stroke-primary"
|
|
545
|
+
})
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ jsx("span", { className: cn(contourLayer, "top-0 size-[5px] translate-x-(--toc-dot-x,0px) translate-y-(--toc-dot-y,0px) rounded-full bg-primary group-data-ready/toc:transition-[translate] rtl:-translate-x-(--toc-dot-x,0px)") })
|
|
548
|
+
]
|
|
549
|
+
}) : null;
|
|
550
|
+
$[18] = variant;
|
|
551
|
+
$[19] = t6;
|
|
552
|
+
} else t6 = $[19];
|
|
553
|
+
let t7;
|
|
554
|
+
if ($[20] !== children || $[21] !== props || $[22] !== t4 || $[23] !== t5 || $[24] !== t6 || $[25] !== variant) {
|
|
555
|
+
t7 = /* @__PURE__ */ jsxs("ol", {
|
|
556
|
+
"data-slot": "table-of-contents-list",
|
|
557
|
+
"data-variant": variant,
|
|
558
|
+
className: t4,
|
|
559
|
+
...props,
|
|
560
|
+
ref: t5,
|
|
561
|
+
children: [children, t6]
|
|
562
|
+
});
|
|
563
|
+
$[20] = children;
|
|
564
|
+
$[21] = props;
|
|
565
|
+
$[22] = t4;
|
|
566
|
+
$[23] = t5;
|
|
567
|
+
$[24] = t6;
|
|
568
|
+
$[25] = variant;
|
|
569
|
+
$[26] = t7;
|
|
570
|
+
} else t7 = $[26];
|
|
571
|
+
return t7;
|
|
572
|
+
}
|
|
573
|
+
function _temp(item_0, index) {
|
|
574
|
+
return item_0.hasAttribute("data-lit") ? index : [];
|
|
575
|
+
}
|
|
576
|
+
/** One section in the list. It holds the section's `TableOfContentsLink`. */
|
|
577
|
+
function TableOfContentsItem(t0) {
|
|
578
|
+
const $ = c(24);
|
|
579
|
+
let children;
|
|
580
|
+
let className;
|
|
581
|
+
let props;
|
|
582
|
+
let style;
|
|
583
|
+
let t1;
|
|
584
|
+
let value;
|
|
585
|
+
if ($[0] !== t0) {
|
|
586
|
+
({value, depth: t1, className, style, children, ...props} = t0);
|
|
587
|
+
$[0] = t0;
|
|
588
|
+
$[1] = children;
|
|
589
|
+
$[2] = className;
|
|
590
|
+
$[3] = props;
|
|
591
|
+
$[4] = style;
|
|
592
|
+
$[5] = t1;
|
|
593
|
+
$[6] = value;
|
|
594
|
+
} else {
|
|
595
|
+
children = $[1];
|
|
596
|
+
className = $[2];
|
|
597
|
+
props = $[3];
|
|
598
|
+
style = $[4];
|
|
599
|
+
t1 = $[5];
|
|
600
|
+
value = $[6];
|
|
601
|
+
}
|
|
602
|
+
const depth = t1 === void 0 ? 0 : t1;
|
|
603
|
+
const { handle, variant } = useTableOfContentsScope();
|
|
604
|
+
const state = usePrimitiveState(handle);
|
|
605
|
+
const level = Math.max(0, Math.trunc(depth));
|
|
606
|
+
const t2 = state.value === value ? "" : void 0;
|
|
607
|
+
const t3 = variant === "contour" && litSections(state).includes(value) ? "" : void 0;
|
|
608
|
+
let t4;
|
|
609
|
+
if ($[7] !== level || $[8] !== style) {
|
|
610
|
+
t4 = {
|
|
611
|
+
...style,
|
|
612
|
+
"--toc-depth": level
|
|
613
|
+
};
|
|
614
|
+
$[7] = level;
|
|
615
|
+
$[8] = style;
|
|
616
|
+
$[9] = t4;
|
|
617
|
+
} else t4 = $[9];
|
|
618
|
+
const t5 = t4;
|
|
619
|
+
let t6;
|
|
620
|
+
if ($[10] !== className) {
|
|
621
|
+
t6 = cn("min-w-0 ps-[calc(1rem+var(--toc-depth)*0.75rem)]", className);
|
|
622
|
+
$[10] = className;
|
|
623
|
+
$[11] = t6;
|
|
624
|
+
} else t6 = $[11];
|
|
625
|
+
let t7;
|
|
626
|
+
if ($[12] !== children || $[13] !== value) {
|
|
627
|
+
t7 = /* @__PURE__ */ jsx(TableOfContentsItemContext, {
|
|
628
|
+
value,
|
|
629
|
+
children
|
|
630
|
+
});
|
|
631
|
+
$[12] = children;
|
|
632
|
+
$[13] = value;
|
|
633
|
+
$[14] = t7;
|
|
634
|
+
} else t7 = $[14];
|
|
635
|
+
let t8;
|
|
636
|
+
if ($[15] !== level || $[16] !== props || $[17] !== t2 || $[18] !== t3 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7 || $[22] !== value) {
|
|
637
|
+
t8 = /* @__PURE__ */ jsx("li", {
|
|
638
|
+
"data-slot": "table-of-contents-item",
|
|
639
|
+
"data-value": value,
|
|
640
|
+
"data-depth": level,
|
|
641
|
+
"data-active": t2,
|
|
642
|
+
"data-lit": t3,
|
|
643
|
+
style: t5,
|
|
644
|
+
className: t6,
|
|
645
|
+
...props,
|
|
646
|
+
children: t7
|
|
647
|
+
});
|
|
648
|
+
$[15] = level;
|
|
649
|
+
$[16] = props;
|
|
650
|
+
$[17] = t2;
|
|
651
|
+
$[18] = t3;
|
|
652
|
+
$[19] = t5;
|
|
653
|
+
$[20] = t6;
|
|
654
|
+
$[21] = t7;
|
|
655
|
+
$[22] = value;
|
|
656
|
+
$[23] = t8;
|
|
657
|
+
} else t8 = $[23];
|
|
658
|
+
return t8;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The link to one section. Following it moves the mark at once. With a
|
|
662
|
+
* `root`, it scrolls that element to put the section on the reading line; on
|
|
663
|
+
* the page, the browser jumps. The active one has `aria-current="location"`.
|
|
664
|
+
* An agent finds it by its text and follows it with `follow`. For a router's
|
|
665
|
+
* link, pass it to `render`.
|
|
666
|
+
*
|
|
667
|
+
* An `onClick` that calls `preventDefault()` keeps the page still and the
|
|
668
|
+
* mark still moves, for sections that swap in place.
|
|
669
|
+
*/
|
|
670
|
+
function TableOfContentsLink(t0) {
|
|
671
|
+
const $ = c(25);
|
|
672
|
+
let className;
|
|
673
|
+
let disabled;
|
|
674
|
+
let href;
|
|
675
|
+
let onClick;
|
|
676
|
+
let props;
|
|
677
|
+
if ($[0] !== t0) {
|
|
678
|
+
({href, disabled, className, onClick, ...props} = t0);
|
|
679
|
+
$[0] = t0;
|
|
680
|
+
$[1] = className;
|
|
681
|
+
$[2] = disabled;
|
|
682
|
+
$[3] = href;
|
|
683
|
+
$[4] = onClick;
|
|
684
|
+
$[5] = props;
|
|
685
|
+
} else {
|
|
686
|
+
className = $[1];
|
|
687
|
+
disabled = $[2];
|
|
688
|
+
href = $[3];
|
|
689
|
+
onClick = $[4];
|
|
690
|
+
props = $[5];
|
|
691
|
+
}
|
|
692
|
+
const { handle, variant } = useTableOfContentsScope();
|
|
693
|
+
const state = usePrimitiveState(handle);
|
|
694
|
+
let t1;
|
|
695
|
+
if ($[6] !== href) {
|
|
696
|
+
t1 = hashTarget(href);
|
|
697
|
+
$[6] = href;
|
|
698
|
+
$[7] = t1;
|
|
699
|
+
} else t1 = $[7];
|
|
700
|
+
const id = t1;
|
|
701
|
+
const section = use(TableOfContentsItemContext) ?? id;
|
|
702
|
+
const active = section !== null && section === state.value;
|
|
703
|
+
const lit = variant === "contour" && section !== null && litSections(state).includes(section);
|
|
704
|
+
const t2 = active ? "" : void 0;
|
|
705
|
+
const t3 = lit ? "" : void 0;
|
|
706
|
+
const t4 = active ? "location" : void 0;
|
|
707
|
+
let t5;
|
|
708
|
+
if ($[8] !== className) {
|
|
709
|
+
t5 = cnState("block rounded-sm py-1 text-sm text-muted-foreground transition-colors hover:text-foreground focus-ring motion-reduce:transition-none data-active:font-medium data-active:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-lit:text-foreground", className);
|
|
710
|
+
$[8] = className;
|
|
711
|
+
$[9] = t5;
|
|
712
|
+
} else t5 = $[9];
|
|
713
|
+
let t6;
|
|
714
|
+
if ($[10] !== disabled || $[11] !== handle || $[12] !== id || $[13] !== onClick || $[14] !== section) {
|
|
715
|
+
t6 = (event) => {
|
|
716
|
+
onClick?.(event);
|
|
717
|
+
if (!disabled) handle.api.follow(section, id, event.nativeEvent, event.currentTarget);
|
|
718
|
+
};
|
|
719
|
+
$[10] = disabled;
|
|
720
|
+
$[11] = handle;
|
|
721
|
+
$[12] = id;
|
|
722
|
+
$[13] = onClick;
|
|
723
|
+
$[14] = section;
|
|
724
|
+
$[15] = t6;
|
|
725
|
+
} else t6 = $[15];
|
|
726
|
+
let t7;
|
|
727
|
+
if ($[16] !== disabled || $[17] !== href || $[18] !== props || $[19] !== t2 || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6) {
|
|
728
|
+
t7 = /* @__PURE__ */ jsx(LinkPart, {
|
|
729
|
+
"data-slot": "table-of-contents-link",
|
|
730
|
+
href,
|
|
731
|
+
disabled,
|
|
732
|
+
"data-active": t2,
|
|
733
|
+
"data-lit": t3,
|
|
734
|
+
"aria-current": t4,
|
|
735
|
+
...props,
|
|
736
|
+
className: t5,
|
|
737
|
+
onClick: t6
|
|
738
|
+
});
|
|
739
|
+
$[16] = disabled;
|
|
740
|
+
$[17] = href;
|
|
741
|
+
$[18] = props;
|
|
742
|
+
$[19] = t2;
|
|
743
|
+
$[20] = t3;
|
|
744
|
+
$[21] = t4;
|
|
745
|
+
$[22] = t5;
|
|
746
|
+
$[23] = t6;
|
|
747
|
+
$[24] = t7;
|
|
748
|
+
} else t7 = $[24];
|
|
749
|
+
return t7;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* An identifier inside a link, like a prop's name under an API heading: a
|
|
753
|
+
* small pill in the link's color, so it dims and lights with its row.
|
|
754
|
+
*/
|
|
755
|
+
function TableOfContentsCode(t0) {
|
|
756
|
+
const $ = c(8);
|
|
757
|
+
let className;
|
|
758
|
+
let props;
|
|
759
|
+
if ($[0] !== t0) {
|
|
760
|
+
({className, ...props} = t0);
|
|
761
|
+
$[0] = t0;
|
|
762
|
+
$[1] = className;
|
|
763
|
+
$[2] = props;
|
|
764
|
+
} else {
|
|
765
|
+
className = $[1];
|
|
766
|
+
props = $[2];
|
|
767
|
+
}
|
|
768
|
+
let t1;
|
|
769
|
+
if ($[3] !== className) {
|
|
770
|
+
t1 = cn("rounded-full border border-border bg-muted px-1.5 py-0.5 font-mono text-xs", className);
|
|
771
|
+
$[3] = className;
|
|
772
|
+
$[4] = t1;
|
|
773
|
+
} else t1 = $[4];
|
|
774
|
+
let t2;
|
|
775
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
776
|
+
t2 = /* @__PURE__ */ jsx("code", {
|
|
777
|
+
"data-slot": "table-of-contents-code",
|
|
778
|
+
className: t1,
|
|
779
|
+
...props
|
|
780
|
+
});
|
|
781
|
+
$[5] = props;
|
|
782
|
+
$[6] = t1;
|
|
783
|
+
$[7] = t2;
|
|
784
|
+
} else t2 = $[7];
|
|
785
|
+
return t2;
|
|
786
|
+
}
|
|
787
|
+
export { TableOfContents, TableOfContentsCode, TableOfContentsItem, TableOfContentsLink, TableOfContentsList, TableOfContentsTitle };
|