@btst/stack 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.cjs +1 -1
- package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +1 -1
- package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.cjs +77 -0
- package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs +79 -3
- package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.cjs +140 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.mjs +119 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +80 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs +64 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs +18 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs +16 -0
- package/dist/packages/better-stack/src/plugins/kanban/api/plugin.cjs +846 -0
- package/dist/packages/better-stack/src/plugins/kanban/api/plugin.mjs +844 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.cjs +85 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.mjs +83 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.cjs +72 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.mjs +70 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.cjs +200 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.mjs +198 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.cjs +47 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.mjs +45 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.cjs +30 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.mjs +28 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.cjs +27 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.mjs +25 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.cjs +31 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.cjs +458 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.mjs +456 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.mjs +29 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.cjs +30 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.cjs +72 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.mjs +70 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.mjs +28 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.cjs +30 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.cjs +51 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.mjs +49 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.mjs +28 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.cjs +76 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.mjs +74 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.cjs +27 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.mjs +25 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.cjs +32 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.mjs +30 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.cjs +78 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.mjs +76 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.cjs +15 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.mjs +13 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.cjs +68 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.mjs +66 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.cjs +32 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.mjs +30 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.cjs +391 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +381 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/plugin.cjs +290 -0
- package/dist/packages/better-stack/src/plugins/kanban/client/plugin.mjs +288 -0
- package/dist/packages/better-stack/src/plugins/kanban/db.cjs +125 -0
- package/dist/packages/better-stack/src/plugins/kanban/db.mjs +123 -0
- package/dist/packages/better-stack/src/plugins/kanban/schemas.cjs +117 -0
- package/dist/packages/better-stack/src/plugins/kanban/schemas.mjs +102 -0
- package/dist/packages/better-stack/src/plugins/kanban/utils.cjs +49 -0
- package/dist/packages/better-stack/src/plugins/kanban/utils.mjs +45 -0
- package/dist/packages/ui/src/components/avatar.cjs +58 -0
- package/dist/packages/ui/src/components/avatar.mjs +54 -0
- package/dist/packages/ui/src/components/command.cjs +3 -3
- package/dist/packages/ui/src/components/command.mjs +3 -3
- package/dist/packages/ui/src/components/form-builder/index.mjs +2 -2
- package/dist/packages/ui/src/components/kanban.cjs +835 -0
- package/dist/packages/ui/src/components/kanban.mjs +805 -0
- package/dist/packages/ui/src/components/minimal-tiptap/utils.cjs +15 -11
- package/dist/packages/ui/src/components/minimal-tiptap/utils.mjs +15 -11
- package/dist/packages/ui/src/components/popover.cjs +8 -3
- package/dist/packages/ui/src/components/popover.mjs +9 -4
- package/dist/packages/ui/src/components/search-select.cjs +75 -0
- package/dist/packages/ui/src/components/search-select.mjs +73 -0
- package/dist/packages/ui/src/components/ui-builder/index.cjs +9 -7
- package/dist/packages/ui/src/components/ui-builder/index.mjs +9 -7
- package/dist/packages/ui/src/components/ui-builder/internal/canvas/auto-frame.cjs +6 -3
- package/dist/packages/ui/src/components/ui-builder/internal/canvas/auto-frame.mjs +6 -3
- package/dist/packages/ui/src/components/ui-builder/internal/components/add-component-popover.cjs +228 -48
- package/dist/packages/ui/src/components/ui-builder/internal/components/add-component-popover.mjs +228 -48
- package/dist/packages/ui/src/components/ui-builder/internal/components/element-selector.cjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/components/element-selector.mjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/components/error-fallback.cjs +4 -2
- package/dist/packages/ui/src/components/ui-builder/internal/components/error-fallback.mjs +4 -2
- package/dist/packages/ui/src/components/ui-builder/internal/components/multi-select.cjs +6 -3
- package/dist/packages/ui/src/components/ui-builder/internal/components/multi-select.mjs +6 -3
- package/dist/packages/ui/src/components/ui-builder/internal/dnd/draggable-new-component.cjs +67 -0
- package/dist/packages/ui/src/components/ui-builder/internal/dnd/draggable-new-component.mjs +62 -0
- package/dist/packages/ui/src/components/ui-builder/internal/dnd/drop-zone.cjs +181 -37
- package/dist/packages/ui/src/components/ui-builder/internal/dnd/drop-zone.mjs +181 -38
- package/dist/packages/ui/src/components/ui-builder/internal/editor-panel.cjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/editor-panel.mjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-group-control.cjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-group-control.mjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-item-control.cjs +9 -2
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-item-control.mjs +9 -2
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/iconname-field.cjs +3 -2
- package/dist/packages/ui/src/components/ui-builder/internal/form-fields/iconname-field.mjs +3 -2
- package/dist/packages/ui/src/components/ui-builder/internal/layers-panel.cjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/layers-panel.mjs +1 -1
- package/dist/packages/ui/src/components/ui-builder/internal/props-panel.cjs +17 -5
- package/dist/packages/ui/src/components/ui-builder/internal/props-panel.mjs +17 -5
- package/dist/packages/ui/src/components/ui-builder/internal/utils/render-utils.cjs +70 -16
- package/dist/packages/ui/src/components/ui-builder/internal/utils/render-utils.mjs +73 -20
- package/dist/packages/ui/src/lib/compose-refs.cjs +56 -0
- package/dist/packages/ui/src/lib/compose-refs.mjs +39 -0
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-context-colission-utils.cjs +14 -9
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-context-colission-utils.mjs +14 -9
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-context.cjs +38 -10
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-context.mjs +35 -11
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-contexts.cjs +1 -0
- package/dist/packages/ui/src/lib/ui-builder/context/dnd-contexts.mjs +1 -0
- package/dist/packages/ui/src/lib/ui-builder/context/drag-overlay.cjs +7 -4
- package/dist/packages/ui/src/lib/ui-builder/context/drag-overlay.mjs +7 -4
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-auto-scroll.cjs +4 -4
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-auto-scroll.mjs +4 -4
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-dnd-event-handlers.cjs +53 -16
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-dnd-event-handlers.mjs +53 -16
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-drop-validation.cjs +23 -7
- package/dist/packages/ui/src/lib/ui-builder/hooks/use-drop-validation.mjs +23 -7
- package/dist/packages/ui/src/lib/ui-builder/registry/form-field-overrides.cjs +110 -11
- package/dist/packages/ui/src/lib/ui-builder/registry/form-field-overrides.mjs +111 -13
- package/dist/packages/ui/src/lib/ui-builder/store/editor-store.cjs +3 -2
- package/dist/packages/ui/src/lib/ui-builder/store/editor-store.mjs +3 -2
- package/dist/packages/ui/src/lib/ui-builder/store/layer-store.cjs +53 -7
- package/dist/packages/ui/src/lib/ui-builder/store/layer-store.mjs +54 -8
- package/dist/packages/ui/src/lib/ui-builder/store/layer-utils.cjs +4 -3
- package/dist/packages/ui/src/lib/ui-builder/store/layer-utils.mjs +4 -3
- package/dist/packages/ui/src/lib/ui-builder/utils/variable-resolver.cjs +12 -0
- package/dist/packages/ui/src/lib/ui-builder/utils/variable-resolver.mjs +12 -1
- package/dist/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/kanban/api/index.cjs +7 -0
- package/dist/plugins/kanban/api/index.d.cts +403 -0
- package/dist/plugins/kanban/api/index.d.mts +403 -0
- package/dist/plugins/kanban/api/index.d.ts +403 -0
- package/dist/plugins/kanban/api/index.mjs +1 -0
- package/dist/plugins/kanban/client/components/index.cjs +35 -0
- package/dist/plugins/kanban/client/components/index.d.cts +102 -0
- package/dist/plugins/kanban/client/components/index.d.mts +102 -0
- package/dist/plugins/kanban/client/components/index.d.ts +102 -0
- package/dist/plugins/kanban/client/components/index.mjs +15 -0
- package/dist/plugins/kanban/client/hooks/index.cjs +15 -0
- package/dist/plugins/kanban/client/hooks/index.d.cts +143 -0
- package/dist/plugins/kanban/client/hooks/index.d.mts +143 -0
- package/dist/plugins/kanban/client/hooks/index.d.ts +143 -0
- package/dist/plugins/kanban/client/hooks/index.mjs +1 -0
- package/dist/plugins/kanban/client/index.cjs +7 -0
- package/dist/plugins/kanban/client/index.d.cts +196 -0
- package/dist/plugins/kanban/client/index.d.mts +196 -0
- package/dist/plugins/kanban/client/index.d.ts +196 -0
- package/dist/plugins/kanban/client/index.mjs +1 -0
- package/dist/plugins/kanban/client.css +68 -0
- package/dist/plugins/kanban/query-keys.cjs +105 -0
- package/dist/plugins/kanban/query-keys.d.cts +59 -0
- package/dist/plugins/kanban/query-keys.d.mts +59 -0
- package/dist/plugins/kanban/query-keys.d.ts +59 -0
- package/dist/plugins/kanban/query-keys.mjs +103 -0
- package/dist/plugins/kanban/style.css +7 -0
- package/dist/plugins/ui-builder/client/components/index.d.cts +1 -1
- package/dist/plugins/ui-builder/client/components/index.d.mts +1 -1
- package/dist/plugins/ui-builder/client/components/index.d.ts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.cts +2 -2
- package/dist/plugins/ui-builder/client/hooks/index.d.mts +2 -2
- package/dist/plugins/ui-builder/client/hooks/index.d.ts +2 -2
- package/dist/plugins/ui-builder/client/index.d.cts +17 -7
- package/dist/plugins/ui-builder/client/index.d.mts +17 -7
- package/dist/plugins/ui-builder/client/index.d.ts +17 -7
- package/dist/plugins/ui-builder/index.d.cts +2 -2
- package/dist/plugins/ui-builder/index.d.mts +2 -2
- package/dist/plugins/ui-builder/index.d.ts +2 -2
- package/dist/plugins/ui-builder/style.css +6 -0
- package/dist/shared/{stack.BSM2cgoq.d.cts → stack.BYysGdHl.d.cts} +1 -1
- package/dist/shared/{stack.CqfZWfjJ.d.cts → stack.BdJFrdyt.d.cts} +8 -2
- package/dist/shared/{stack.e1FN86dE.d.mts → stack.ChVuHi5e.d.mts} +8 -2
- package/dist/shared/stack.DKDMI-QO.d.cts +70 -0
- package/dist/shared/stack.DKDMI-QO.d.mts +70 -0
- package/dist/shared/stack.DKDMI-QO.d.ts +70 -0
- package/dist/shared/{stack.CLtOoAqF.d.mts → stack.DYCFcnkL.d.mts} +1 -1
- package/dist/shared/{stack.MMntCVZZ.d.ts → stack.EhM4pmtN.d.ts} +8 -2
- package/dist/shared/stack.FeaWkglm.d.cts +190 -0
- package/dist/shared/stack.FeaWkglm.d.mts +190 -0
- package/dist/shared/stack.FeaWkglm.d.ts +190 -0
- package/dist/shared/{stack.BD1m-4yB.d.ts → stack.kFbDspnF.d.ts} +1 -1
- package/package.json +56 -2
- package/src/plugins/kanban/api/index.ts +6 -0
- package/src/plugins/kanban/api/plugin.ts +1245 -0
- package/src/plugins/kanban/client/components/forms/board-form.tsx +108 -0
- package/src/plugins/kanban/client/components/forms/column-form.tsx +97 -0
- package/src/plugins/kanban/client/components/forms/task-form.tsx +274 -0
- package/src/plugins/kanban/client/components/index.tsx +21 -0
- package/src/plugins/kanban/client/components/loading/board-skeleton.tsx +49 -0
- package/src/plugins/kanban/client/components/loading/boards-list-skeleton.tsx +34 -0
- package/src/plugins/kanban/client/components/loading/index.tsx +2 -0
- package/src/plugins/kanban/client/components/pages/404-page.tsx +28 -0
- package/src/plugins/kanban/client/components/pages/board-page.internal.tsx +575 -0
- package/src/plugins/kanban/client/components/pages/board-page.tsx +31 -0
- package/src/plugins/kanban/client/components/pages/boards-list-page.internal.tsx +101 -0
- package/src/plugins/kanban/client/components/pages/boards-list-page.tsx +26 -0
- package/src/plugins/kanban/client/components/pages/new-board-page.internal.tsx +65 -0
- package/src/plugins/kanban/client/components/pages/new-board-page.tsx +26 -0
- package/src/plugins/kanban/client/components/shared/column-content.tsx +108 -0
- package/src/plugins/kanban/client/components/shared/default-error.tsx +32 -0
- package/src/plugins/kanban/client/components/shared/empty-state.tsx +37 -0
- package/src/plugins/kanban/client/components/shared/kanban-board.tsx +87 -0
- package/src/plugins/kanban/client/components/shared/page-wrapper.tsx +20 -0
- package/src/plugins/kanban/client/components/shared/task-card.tsx +79 -0
- package/src/plugins/kanban/client/components/shared/user-avatar.tsx +63 -0
- package/src/plugins/kanban/client/hooks/index.tsx +11 -0
- package/src/plugins/kanban/client/hooks/kanban-hooks.tsx +560 -0
- package/src/plugins/kanban/client/index.ts +8 -0
- package/src/plugins/kanban/client/localization/index.ts +28 -0
- package/src/plugins/kanban/client/localization/kanban-common.ts +69 -0
- package/src/plugins/kanban/client/localization/kanban-forms.ts +70 -0
- package/src/plugins/kanban/client/localization/kanban-list.ts +36 -0
- package/src/plugins/kanban/client/overrides.ts +145 -0
- package/src/plugins/kanban/client/plugin.tsx +463 -0
- package/src/plugins/kanban/client.css +68 -0
- package/src/plugins/kanban/db.ts +125 -0
- package/src/plugins/kanban/query-keys.ts +154 -0
- package/src/plugins/kanban/schemas.ts +143 -0
- package/src/plugins/kanban/style.css +7 -0
- package/src/plugins/kanban/types.ts +106 -0
- package/src/plugins/kanban/utils.ts +107 -0
- package/src/plugins/ui-builder/style.css +6 -0
- package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.cts} +1 -1
- package/dist/shared/{stack.DLhzx1-D.d.ts → stack.CcI4sYJP.d.mts} +1 -1
- package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.ts} +1 -1
|
@@ -62,6 +62,82 @@ function normalizeDisabled(disabled) {
|
|
|
62
62
|
return disabled;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
// To-do: We should be calculating scale transformation
|
|
66
|
+
const defaultScale = {
|
|
67
|
+
scaleX: 1,
|
|
68
|
+
scaleY: 1
|
|
69
|
+
};
|
|
70
|
+
const horizontalListSortingStrategy = _ref => {
|
|
71
|
+
var _rects$activeIndex;
|
|
72
|
+
|
|
73
|
+
let {
|
|
74
|
+
rects,
|
|
75
|
+
activeNodeRect: fallbackActiveRect,
|
|
76
|
+
activeIndex,
|
|
77
|
+
overIndex,
|
|
78
|
+
index
|
|
79
|
+
} = _ref;
|
|
80
|
+
const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
|
|
81
|
+
|
|
82
|
+
if (!activeNodeRect) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const itemGap = getItemGap(rects, index, activeIndex);
|
|
87
|
+
|
|
88
|
+
if (index === activeIndex) {
|
|
89
|
+
const newIndexRect = rects[overIndex];
|
|
90
|
+
|
|
91
|
+
if (!newIndexRect) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left,
|
|
97
|
+
y: 0,
|
|
98
|
+
...defaultScale
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (index > activeIndex && index <= overIndex) {
|
|
103
|
+
return {
|
|
104
|
+
x: -activeNodeRect.width - itemGap,
|
|
105
|
+
y: 0,
|
|
106
|
+
...defaultScale
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (index < activeIndex && index >= overIndex) {
|
|
111
|
+
return {
|
|
112
|
+
x: activeNodeRect.width + itemGap,
|
|
113
|
+
y: 0,
|
|
114
|
+
...defaultScale
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
x: 0,
|
|
120
|
+
y: 0,
|
|
121
|
+
...defaultScale
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
function getItemGap(rects, index, activeIndex) {
|
|
126
|
+
const currentRect = rects[index];
|
|
127
|
+
const previousRect = rects[index - 1];
|
|
128
|
+
const nextRect = rects[index + 1];
|
|
129
|
+
|
|
130
|
+
if (!currentRect || !previousRect && !nextRect) {
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (activeIndex < index) {
|
|
135
|
+
return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width);
|
|
139
|
+
}
|
|
140
|
+
|
|
65
141
|
const rectSortingStrategy = _ref => {
|
|
66
142
|
let {
|
|
67
143
|
rects,
|
|
@@ -669,6 +745,7 @@ exports.arrayMove = arrayMove;
|
|
|
669
745
|
exports.defaultAnimateLayoutChanges = defaultAnimateLayoutChanges;
|
|
670
746
|
exports.defaultNewIndexGetter = defaultNewIndexGetter;
|
|
671
747
|
exports.hasSortableData = hasSortableData;
|
|
748
|
+
exports.horizontalListSortingStrategy = horizontalListSortingStrategy;
|
|
672
749
|
exports.rectSortingStrategy = rectSortingStrategy;
|
|
673
750
|
exports.sortableKeyboardCoordinates = sortableKeyboardCoordinates;
|
|
674
751
|
exports.useSortable = useSortable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useMemo, useRef, useEffect, useContext, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useDndContext, useDroppable, useDraggable, getClientRect, KeyboardCode, closestCorners, getFirstCollision, getScrollableAncestors } from '../../../../../@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.mjs';
|
|
3
|
+
import { useUniqueId, useIsomorphicLayoutEffect, useCombinedRefs, CSS, isKeyboardEvent, subtract } from '../../../../../@dnd-kit_utilities@3.2.2_react@19.2.0/node_modules/@dnd-kit/utilities/dist/utilities.esm.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Move an array item to a different position. Returns a new array with the item moved to the new position.
|
|
@@ -56,6 +56,82 @@ function normalizeDisabled(disabled) {
|
|
|
56
56
|
return disabled;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// To-do: We should be calculating scale transformation
|
|
60
|
+
const defaultScale = {
|
|
61
|
+
scaleX: 1,
|
|
62
|
+
scaleY: 1
|
|
63
|
+
};
|
|
64
|
+
const horizontalListSortingStrategy = _ref => {
|
|
65
|
+
var _rects$activeIndex;
|
|
66
|
+
|
|
67
|
+
let {
|
|
68
|
+
rects,
|
|
69
|
+
activeNodeRect: fallbackActiveRect,
|
|
70
|
+
activeIndex,
|
|
71
|
+
overIndex,
|
|
72
|
+
index
|
|
73
|
+
} = _ref;
|
|
74
|
+
const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
|
|
75
|
+
|
|
76
|
+
if (!activeNodeRect) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const itemGap = getItemGap(rects, index, activeIndex);
|
|
81
|
+
|
|
82
|
+
if (index === activeIndex) {
|
|
83
|
+
const newIndexRect = rects[overIndex];
|
|
84
|
+
|
|
85
|
+
if (!newIndexRect) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left,
|
|
91
|
+
y: 0,
|
|
92
|
+
...defaultScale
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (index > activeIndex && index <= overIndex) {
|
|
97
|
+
return {
|
|
98
|
+
x: -activeNodeRect.width - itemGap,
|
|
99
|
+
y: 0,
|
|
100
|
+
...defaultScale
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (index < activeIndex && index >= overIndex) {
|
|
105
|
+
return {
|
|
106
|
+
x: activeNodeRect.width + itemGap,
|
|
107
|
+
y: 0,
|
|
108
|
+
...defaultScale
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
x: 0,
|
|
114
|
+
y: 0,
|
|
115
|
+
...defaultScale
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function getItemGap(rects, index, activeIndex) {
|
|
120
|
+
const currentRect = rects[index];
|
|
121
|
+
const previousRect = rects[index - 1];
|
|
122
|
+
const nextRect = rects[index + 1];
|
|
123
|
+
|
|
124
|
+
if (!currentRect || !previousRect && !nextRect) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (activeIndex < index) {
|
|
129
|
+
return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width);
|
|
133
|
+
}
|
|
134
|
+
|
|
59
135
|
const rectSortingStrategy = _ref => {
|
|
60
136
|
let {
|
|
61
137
|
rects,
|
|
@@ -658,4 +734,4 @@ function isAfter(a, b) {
|
|
|
658
734
|
return a.data.current.sortable.index < b.data.current.sortable.index;
|
|
659
735
|
}
|
|
660
736
|
|
|
661
|
-
export { SortableContext, arrayMove, defaultAnimateLayoutChanges, defaultNewIndexGetter, hasSortableData, rectSortingStrategy, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy };
|
|
737
|
+
export { SortableContext, arrayMove, defaultAnimateLayoutChanges, defaultNewIndexGetter, hasSortableData, horizontalListSortingStrategy, rectSortingStrategy, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const React = require('react');
|
|
5
|
+
const index = require('../../../../../@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs');
|
|
6
|
+
const index$2 = require('../../../../../@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs');
|
|
7
|
+
const index$3 = require('../../../../../@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs');
|
|
8
|
+
const index$1 = require('../../../../../@radix-ui_react-primitive@2.1.4_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_43b950ce9f6b8d55739cce33fe173a1c/node_modules/@radix-ui/react-primitive/dist/index.cjs');
|
|
9
|
+
const index$4 = require('../../../../../@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs');
|
|
10
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
function _interopNamespaceCompat(e) {
|
|
13
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
14
|
+
const n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
for (const k in e) {
|
|
17
|
+
n[k] = e[k];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
|
|
25
|
+
|
|
26
|
+
var AVATAR_NAME = "Avatar";
|
|
27
|
+
var [createAvatarContext] = index.createContextScope(AVATAR_NAME);
|
|
28
|
+
var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
|
|
29
|
+
var Avatar = React__namespace.forwardRef(
|
|
30
|
+
(props, forwardedRef) => {
|
|
31
|
+
const { __scopeAvatar, ...avatarProps } = props;
|
|
32
|
+
const [imageLoadingStatus, setImageLoadingStatus] = React__namespace.useState("idle");
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
AvatarProvider,
|
|
35
|
+
{
|
|
36
|
+
scope: __scopeAvatar,
|
|
37
|
+
imageLoadingStatus,
|
|
38
|
+
onImageLoadingStatusChange: setImageLoadingStatus,
|
|
39
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Primitive.span, { ...avatarProps, ref: forwardedRef })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
Avatar.displayName = AVATAR_NAME;
|
|
45
|
+
var IMAGE_NAME = "AvatarImage";
|
|
46
|
+
var AvatarImage = React__namespace.forwardRef(
|
|
47
|
+
(props, forwardedRef) => {
|
|
48
|
+
const { __scopeAvatar, src, onLoadingStatusChange = () => {
|
|
49
|
+
}, ...imageProps } = props;
|
|
50
|
+
const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
|
|
51
|
+
const imageLoadingStatus = useImageLoadingStatus(src, imageProps);
|
|
52
|
+
const handleLoadingStatusChange = index$2.useCallbackRef((status) => {
|
|
53
|
+
onLoadingStatusChange(status);
|
|
54
|
+
context.onImageLoadingStatusChange(status);
|
|
55
|
+
});
|
|
56
|
+
index$3.useLayoutEffect(() => {
|
|
57
|
+
if (imageLoadingStatus !== "idle") {
|
|
58
|
+
handleLoadingStatusChange(imageLoadingStatus);
|
|
59
|
+
}
|
|
60
|
+
}, [imageLoadingStatus, handleLoadingStatusChange]);
|
|
61
|
+
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
AvatarImage.displayName = IMAGE_NAME;
|
|
65
|
+
var FALLBACK_NAME = "AvatarFallback";
|
|
66
|
+
var AvatarFallback = React__namespace.forwardRef(
|
|
67
|
+
(props, forwardedRef) => {
|
|
68
|
+
const { __scopeAvatar, delayMs, ...fallbackProps } = props;
|
|
69
|
+
const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
|
|
70
|
+
const [canRender, setCanRender] = React__namespace.useState(delayMs === void 0);
|
|
71
|
+
React__namespace.useEffect(() => {
|
|
72
|
+
if (delayMs !== void 0) {
|
|
73
|
+
const timerId = window.setTimeout(() => setCanRender(true), delayMs);
|
|
74
|
+
return () => window.clearTimeout(timerId);
|
|
75
|
+
}
|
|
76
|
+
}, [delayMs]);
|
|
77
|
+
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
AvatarFallback.displayName = FALLBACK_NAME;
|
|
81
|
+
function resolveLoadingStatus(image, src) {
|
|
82
|
+
if (!image) {
|
|
83
|
+
return "idle";
|
|
84
|
+
}
|
|
85
|
+
if (!src) {
|
|
86
|
+
return "error";
|
|
87
|
+
}
|
|
88
|
+
if (image.src !== src) {
|
|
89
|
+
image.src = src;
|
|
90
|
+
}
|
|
91
|
+
return image.complete && image.naturalWidth > 0 ? "loaded" : "loading";
|
|
92
|
+
}
|
|
93
|
+
function useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) {
|
|
94
|
+
const isHydrated = index$4.useIsHydrated();
|
|
95
|
+
const imageRef = React__namespace.useRef(null);
|
|
96
|
+
const image = (() => {
|
|
97
|
+
if (!isHydrated) return null;
|
|
98
|
+
if (!imageRef.current) {
|
|
99
|
+
imageRef.current = new window.Image();
|
|
100
|
+
}
|
|
101
|
+
return imageRef.current;
|
|
102
|
+
})();
|
|
103
|
+
const [loadingStatus, setLoadingStatus] = React__namespace.useState(
|
|
104
|
+
() => resolveLoadingStatus(image, src)
|
|
105
|
+
);
|
|
106
|
+
index$3.useLayoutEffect(() => {
|
|
107
|
+
setLoadingStatus(resolveLoadingStatus(image, src));
|
|
108
|
+
}, [image, src]);
|
|
109
|
+
index$3.useLayoutEffect(() => {
|
|
110
|
+
const updateStatus = (status) => () => {
|
|
111
|
+
setLoadingStatus(status);
|
|
112
|
+
};
|
|
113
|
+
if (!image) return;
|
|
114
|
+
const handleLoad = updateStatus("loaded");
|
|
115
|
+
const handleError = updateStatus("error");
|
|
116
|
+
image.addEventListener("load", handleLoad);
|
|
117
|
+
image.addEventListener("error", handleError);
|
|
118
|
+
if (referrerPolicy) {
|
|
119
|
+
image.referrerPolicy = referrerPolicy;
|
|
120
|
+
}
|
|
121
|
+
if (typeof crossOrigin === "string") {
|
|
122
|
+
image.crossOrigin = crossOrigin;
|
|
123
|
+
}
|
|
124
|
+
return () => {
|
|
125
|
+
image.removeEventListener("load", handleLoad);
|
|
126
|
+
image.removeEventListener("error", handleError);
|
|
127
|
+
};
|
|
128
|
+
}, [image, crossOrigin, referrerPolicy]);
|
|
129
|
+
return loadingStatus;
|
|
130
|
+
}
|
|
131
|
+
var Root = Avatar;
|
|
132
|
+
var Image = AvatarImage;
|
|
133
|
+
var Fallback = AvatarFallback;
|
|
134
|
+
|
|
135
|
+
exports.Avatar = Avatar;
|
|
136
|
+
exports.AvatarFallback = AvatarFallback;
|
|
137
|
+
exports.AvatarImage = AvatarImage;
|
|
138
|
+
exports.Fallback = Fallback;
|
|
139
|
+
exports.Image = Image;
|
|
140
|
+
exports.Root = Root;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { createContextScope } from '../../../../../@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs';
|
|
4
|
+
import { useCallbackRef } from '../../../../../@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs';
|
|
5
|
+
import { useLayoutEffect as useLayoutEffect2 } from '../../../../../@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs';
|
|
6
|
+
import { Primitive } from '../../../../../@radix-ui_react-primitive@2.1.4_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_43b950ce9f6b8d55739cce33fe173a1c/node_modules/@radix-ui/react-primitive/dist/index.mjs';
|
|
7
|
+
import { useIsHydrated } from '../../../../../@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
var AVATAR_NAME = "Avatar";
|
|
11
|
+
var [createAvatarContext] = createContextScope(AVATAR_NAME);
|
|
12
|
+
var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
|
|
13
|
+
var Avatar = React.forwardRef(
|
|
14
|
+
(props, forwardedRef) => {
|
|
15
|
+
const { __scopeAvatar, ...avatarProps } = props;
|
|
16
|
+
const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
AvatarProvider,
|
|
19
|
+
{
|
|
20
|
+
scope: __scopeAvatar,
|
|
21
|
+
imageLoadingStatus,
|
|
22
|
+
onImageLoadingStatusChange: setImageLoadingStatus,
|
|
23
|
+
children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
Avatar.displayName = AVATAR_NAME;
|
|
29
|
+
var IMAGE_NAME = "AvatarImage";
|
|
30
|
+
var AvatarImage = React.forwardRef(
|
|
31
|
+
(props, forwardedRef) => {
|
|
32
|
+
const { __scopeAvatar, src, onLoadingStatusChange = () => {
|
|
33
|
+
}, ...imageProps } = props;
|
|
34
|
+
const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
|
|
35
|
+
const imageLoadingStatus = useImageLoadingStatus(src, imageProps);
|
|
36
|
+
const handleLoadingStatusChange = useCallbackRef((status) => {
|
|
37
|
+
onLoadingStatusChange(status);
|
|
38
|
+
context.onImageLoadingStatusChange(status);
|
|
39
|
+
});
|
|
40
|
+
useLayoutEffect2(() => {
|
|
41
|
+
if (imageLoadingStatus !== "idle") {
|
|
42
|
+
handleLoadingStatusChange(imageLoadingStatus);
|
|
43
|
+
}
|
|
44
|
+
}, [imageLoadingStatus, handleLoadingStatusChange]);
|
|
45
|
+
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
AvatarImage.displayName = IMAGE_NAME;
|
|
49
|
+
var FALLBACK_NAME = "AvatarFallback";
|
|
50
|
+
var AvatarFallback = React.forwardRef(
|
|
51
|
+
(props, forwardedRef) => {
|
|
52
|
+
const { __scopeAvatar, delayMs, ...fallbackProps } = props;
|
|
53
|
+
const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
|
|
54
|
+
const [canRender, setCanRender] = React.useState(delayMs === void 0);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (delayMs !== void 0) {
|
|
57
|
+
const timerId = window.setTimeout(() => setCanRender(true), delayMs);
|
|
58
|
+
return () => window.clearTimeout(timerId);
|
|
59
|
+
}
|
|
60
|
+
}, [delayMs]);
|
|
61
|
+
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
AvatarFallback.displayName = FALLBACK_NAME;
|
|
65
|
+
function resolveLoadingStatus(image, src) {
|
|
66
|
+
if (!image) {
|
|
67
|
+
return "idle";
|
|
68
|
+
}
|
|
69
|
+
if (!src) {
|
|
70
|
+
return "error";
|
|
71
|
+
}
|
|
72
|
+
if (image.src !== src) {
|
|
73
|
+
image.src = src;
|
|
74
|
+
}
|
|
75
|
+
return image.complete && image.naturalWidth > 0 ? "loaded" : "loading";
|
|
76
|
+
}
|
|
77
|
+
function useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) {
|
|
78
|
+
const isHydrated = useIsHydrated();
|
|
79
|
+
const imageRef = React.useRef(null);
|
|
80
|
+
const image = (() => {
|
|
81
|
+
if (!isHydrated) return null;
|
|
82
|
+
if (!imageRef.current) {
|
|
83
|
+
imageRef.current = new window.Image();
|
|
84
|
+
}
|
|
85
|
+
return imageRef.current;
|
|
86
|
+
})();
|
|
87
|
+
const [loadingStatus, setLoadingStatus] = React.useState(
|
|
88
|
+
() => resolveLoadingStatus(image, src)
|
|
89
|
+
);
|
|
90
|
+
useLayoutEffect2(() => {
|
|
91
|
+
setLoadingStatus(resolveLoadingStatus(image, src));
|
|
92
|
+
}, [image, src]);
|
|
93
|
+
useLayoutEffect2(() => {
|
|
94
|
+
const updateStatus = (status) => () => {
|
|
95
|
+
setLoadingStatus(status);
|
|
96
|
+
};
|
|
97
|
+
if (!image) return;
|
|
98
|
+
const handleLoad = updateStatus("loaded");
|
|
99
|
+
const handleError = updateStatus("error");
|
|
100
|
+
image.addEventListener("load", handleLoad);
|
|
101
|
+
image.addEventListener("error", handleError);
|
|
102
|
+
if (referrerPolicy) {
|
|
103
|
+
image.referrerPolicy = referrerPolicy;
|
|
104
|
+
}
|
|
105
|
+
if (typeof crossOrigin === "string") {
|
|
106
|
+
image.crossOrigin = crossOrigin;
|
|
107
|
+
}
|
|
108
|
+
return () => {
|
|
109
|
+
image.removeEventListener("load", handleLoad);
|
|
110
|
+
image.removeEventListener("error", handleError);
|
|
111
|
+
};
|
|
112
|
+
}, [image, crossOrigin, referrerPolicy]);
|
|
113
|
+
return loadingStatus;
|
|
114
|
+
}
|
|
115
|
+
var Root = Avatar;
|
|
116
|
+
var Image = AvatarImage;
|
|
117
|
+
var Fallback = AvatarFallback;
|
|
118
|
+
|
|
119
|
+
export { Avatar, AvatarFallback, AvatarImage, Fallback, Image, Root };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const React = require('react');
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
function _interopNamespaceCompat(e) {
|
|
7
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
8
|
+
const n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
n[k] = e[k];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
n.default = e;
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
|
|
19
|
+
|
|
20
|
+
// src/create-context.tsx
|
|
21
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
22
|
+
let defaultContexts = [];
|
|
23
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
24
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
25
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
26
|
+
const index = defaultContexts.length;
|
|
27
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
28
|
+
const Provider = (props) => {
|
|
29
|
+
const { scope, children, ...context } = props;
|
|
30
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
31
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
33
|
+
};
|
|
34
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
35
|
+
function useContext2(consumerName, scope) {
|
|
36
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
37
|
+
const context = React__namespace.useContext(Context);
|
|
38
|
+
if (context) return context;
|
|
39
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
40
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
41
|
+
}
|
|
42
|
+
return [Provider, useContext2];
|
|
43
|
+
}
|
|
44
|
+
const createScope = () => {
|
|
45
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
46
|
+
return React__namespace.createContext(defaultContext);
|
|
47
|
+
});
|
|
48
|
+
return function useScope(scope) {
|
|
49
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
50
|
+
return React__namespace.useMemo(
|
|
51
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
52
|
+
[scope, contexts]
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
createScope.scopeName = scopeName;
|
|
57
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
58
|
+
}
|
|
59
|
+
function composeContextScopes(...scopes) {
|
|
60
|
+
const baseScope = scopes[0];
|
|
61
|
+
if (scopes.length === 1) return baseScope;
|
|
62
|
+
const createScope = () => {
|
|
63
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
64
|
+
useScope: createScope2(),
|
|
65
|
+
scopeName: createScope2.scopeName
|
|
66
|
+
}));
|
|
67
|
+
return function useComposedScopes(overrideScopes) {
|
|
68
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
69
|
+
const scopeProps = useScope(overrideScopes);
|
|
70
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
71
|
+
return { ...nextScopes2, ...currentScope };
|
|
72
|
+
}, {});
|
|
73
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
createScope.scopeName = baseScope.scopeName;
|
|
77
|
+
return createScope;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.createContextScope = createContextScope;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/create-context.tsx
|
|
5
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
6
|
+
let defaultContexts = [];
|
|
7
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
8
|
+
const BaseContext = React.createContext(defaultContext);
|
|
9
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
10
|
+
const index = defaultContexts.length;
|
|
11
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
12
|
+
const Provider = (props) => {
|
|
13
|
+
const { scope, children, ...context } = props;
|
|
14
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
15
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
16
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
17
|
+
};
|
|
18
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
19
|
+
function useContext2(consumerName, scope) {
|
|
20
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
21
|
+
const context = React.useContext(Context);
|
|
22
|
+
if (context) return context;
|
|
23
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
24
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
25
|
+
}
|
|
26
|
+
return [Provider, useContext2];
|
|
27
|
+
}
|
|
28
|
+
const createScope = () => {
|
|
29
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
30
|
+
return React.createContext(defaultContext);
|
|
31
|
+
});
|
|
32
|
+
return function useScope(scope) {
|
|
33
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
34
|
+
return React.useMemo(
|
|
35
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
36
|
+
[scope, contexts]
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
createScope.scopeName = scopeName;
|
|
41
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
42
|
+
}
|
|
43
|
+
function composeContextScopes(...scopes) {
|
|
44
|
+
const baseScope = scopes[0];
|
|
45
|
+
if (scopes.length === 1) return baseScope;
|
|
46
|
+
const createScope = () => {
|
|
47
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
48
|
+
useScope: createScope2(),
|
|
49
|
+
scopeName: createScope2.scopeName
|
|
50
|
+
}));
|
|
51
|
+
return function useComposedScopes(overrideScopes) {
|
|
52
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
53
|
+
const scopeProps = useScope(overrideScopes);
|
|
54
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
55
|
+
return { ...nextScopes2, ...currentScope };
|
|
56
|
+
}, {});
|
|
57
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
createScope.scopeName = baseScope.scopeName;
|
|
61
|
+
return createScope;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { createContextScope };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('../../../../../../../_virtual/index3.cjs');
|
|
4
|
+
|
|
5
|
+
// src/use-is-hydrated.tsx
|
|
6
|
+
function useIsHydrated() {
|
|
7
|
+
return index.shimExports.useSyncExternalStore(
|
|
8
|
+
subscribe,
|
|
9
|
+
() => true,
|
|
10
|
+
() => false
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
function subscribe() {
|
|
14
|
+
return () => {
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.useIsHydrated = useIsHydrated;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { s as shimExports } from '../../../../../../../_virtual/index3.mjs';
|
|
2
|
+
|
|
3
|
+
// src/use-is-hydrated.tsx
|
|
4
|
+
function useIsHydrated() {
|
|
5
|
+
return shimExports.useSyncExternalStore(
|
|
6
|
+
subscribe,
|
|
7
|
+
() => true,
|
|
8
|
+
() => false
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
function subscribe() {
|
|
12
|
+
return () => {
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useIsHydrated };
|