@heyramzi/ui 2.9.0 → 2.10.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/agents/helpers.js +52 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/page-state.js +65 -0
- package/dist/agents/types.js +1 -0
- package/dist/agents/vendor/color.js +149 -0
- package/dist/agents/vendor/draw.js +548 -0
- package/dist/agents/vendor/engine.js +632 -0
- package/dist/agents/vendor/mesh.js +727 -0
- package/dist/agents/vendor/plastic.js +3273 -0
- package/dist/agents/vendor/presets.js +171 -0
- package/dist/agents/vendor/shapes.js +24 -0
- package/dist/agents/vendor/ticker.js +56 -0
- package/dist/agents/vendor/types.js +0 -0
- package/dist/agents/vendor/wear.js +1525 -0
- package/dist/ai/ai-button/index.js +2 -0
- package/dist/ai/confirmation/confirmation-context.svelte.js +12 -0
- package/dist/ai/confirmation/index.js +9 -0
- package/dist/ai/generation-progress/index.js +2 -0
- package/dist/ai/index.js +11 -0
- package/dist/ai/loading-state/index.js +3 -0
- package/dist/ai/prompt-input/index.js +6 -0
- package/dist/ai/reasoning/index.js +4 -0
- package/dist/ai/reasoning/reasoning-context.svelte.js +12 -0
- package/dist/ai/response/index.js +3 -0
- package/dist/ai/suggestion/index.js +3 -0
- package/dist/ai/thinking-dots/index.js +3 -0
- package/dist/ai/typing-dots/index.js +2 -0
- package/dist/ai/voice-waveform/index.js +3 -0
- package/dist/animations/text-swap.js +30 -0
- package/dist/brand/index.js +65 -0
- package/dist/canvas/card/resize.js +10 -0
- package/dist/canvas/edges/edge-path.js +284 -0
- package/dist/canvas/editor/context-menu.js +42 -0
- package/dist/canvas/editor/dispatch.svelte.js +157 -0
- package/dist/canvas/editor/editor-context.js +8 -0
- package/dist/canvas/editor/editor-mode.js +0 -0
- package/dist/canvas/editor/frame.js +87 -0
- package/dist/canvas/editor/hand-context.js +8 -0
- package/dist/canvas/editor/history-core.js +221 -0
- package/dist/canvas/editor/keymap.js +193 -0
- package/dist/canvas/editor/layout-actions.js +170 -0
- package/dist/canvas/editor/lock.js +65 -0
- package/dist/canvas/editor/rebase.js +279 -0
- package/dist/canvas/editor/style.js +174 -0
- package/dist/canvas/editor/text-field-context.js +8 -0
- package/dist/canvas/editor/z-order.js +82 -0
- package/dist/canvas/headless/alignment.js +20 -0
- package/dist/canvas/headless/break-apart-find.js +324 -0
- package/dist/canvas/headless/break-apart-pieces.js +74 -0
- package/dist/canvas/headless/break-apart-plan.js +378 -0
- package/dist/canvas/headless/break-apart-style.js +93 -0
- package/dist/canvas/headless/break-apart.js +206 -0
- package/dist/canvas/headless/canvas-cleanup.js +70 -0
- package/dist/canvas/headless/edge-anchors.js +134 -0
- package/dist/canvas/headless/edge-memo.js +28 -0
- package/dist/canvas/headless/edge-serialization.js +31 -0
- package/dist/canvas/headless/figure-geometry.js +331 -0
- package/dist/canvas/headless/fit-viewport.js +82 -0
- package/dist/canvas/headless/grid.js +96 -0
- package/dist/canvas/headless/icon-node.js +45 -0
- package/dist/canvas/headless/index.js +1 -0
- package/dist/canvas/headless/linkify.js +25 -0
- package/dist/canvas/headless/pen-marks.js +115 -0
- package/dist/canvas/headless/sketch.js +250 -0
- package/dist/canvas/headless/snap-guides.js +100 -0
- package/dist/canvas/headless/svg-figure.js +137 -0
- package/dist/canvas/headless/table-layout.js +161 -0
- package/dist/canvas/index.js +25 -0
- package/dist/canvas/lod/lod-mode.svelte.js +22 -0
- package/dist/canvas/lod/render-all.svelte.js +45 -0
- package/dist/canvas/ops/arrange.js +83 -0
- package/dist/canvas/ops/ops.js +318 -0
- package/dist/canvas/pen/colors.js +41 -0
- package/dist/canvas/pen/eraser.js +35 -0
- package/dist/canvas/pen/geometry.js +143 -0
- package/dist/canvas/pen/index.js +9 -0
- package/dist/canvas/pen/ops.js +15 -0
- package/dist/canvas/pen/pen-session.js +171 -0
- package/dist/canvas/pen/plugin.js +129 -0
- package/dist/canvas/pen/shapes.js +80 -0
- package/dist/canvas/pen/stroke-path.js +37 -0
- package/dist/canvas/pen/types.js +30 -0
- package/dist/canvas/pen/ui.js +20 -0
- package/dist/canvas/plugin.js +51 -0
- package/dist/canvas/screen/glyphs.js +24 -0
- package/dist/canvas/screen/labels.js +24 -0
- package/dist/canvas/screen/parts.js +140 -0
- package/dist/canvas/screen/plugin.js +71 -0
- package/dist/canvas/screen/types.js +44 -0
- package/dist/canvas/screen/ui.js +13 -0
- package/dist/canvas/test-utils.js +18 -0
- package/dist/canvas/types.js +0 -0
- package/dist/canvas/ui/forward-wheel.js +27 -0
- package/dist/canvas/ui/icons.js +133 -0
- package/dist/canvas/ui/place-panel.js +57 -0
- package/dist/canvas/ui/shortcut-tip.js +18 -0
- package/dist/canvas/ui/tools.js +411 -0
- package/dist/charts/dashboard/chart.js +1 -0
- package/dist/charts/dashboard/data-table.js +7 -0
- package/dist/charts/dashboard/index.js +13 -0
- package/dist/charts/dashboard/windows.js +5 -0
- package/dist/charts/edge-fade.js +7 -0
- package/dist/charts/hover-band.js +13 -0
- package/dist/charts/index.js +19 -0
- package/dist/charts/motion.js +15 -0
- package/dist/charts/primitives/chart-utils.js +22 -0
- package/dist/charts/primitives/index.js +4 -0
- package/dist/components/copy/clipboard.js +38 -0
- package/dist/components/copy/copied.svelte.js +26 -0
- package/dist/components/copy/index.js +3 -0
- package/dist/components/data-table/data-table.js +55 -0
- package/dist/components/data-table/index.js +7 -0
- package/dist/components/docs/index.js +3 -0
- package/dist/components/docs/scroll-spy.svelte.js +71 -0
- package/dist/components/field-row/index.js +1 -0
- package/dist/components/hold-to-confirm/index.js +1 -0
- package/dist/components/icon/index.js +1 -0
- package/dist/components/language-flag/index.js +1 -0
- package/dist/components/list-page/filter-section.js +4 -0
- package/dist/components/list-page/index.js +25 -0
- package/dist/components/list-page/list-table.js +5 -0
- package/dist/components/list-page/queue-rail.js +3 -0
- package/dist/components/list-page/section-host.js +8 -0
- package/dist/components/list-page/step.js +5 -0
- package/dist/components/list-page/types.js +0 -0
- package/dist/components/locale-switch/index.js +1 -0
- package/dist/components/mark/index.js +1 -0
- package/dist/components/open-in/index.js +1 -0
- package/dist/components/picker/index.js +3 -0
- package/dist/components/picker/trigger.js +33 -0
- package/dist/components/picker/types.js +0 -0
- package/dist/components/section-card/index.js +1 -0
- package/dist/components/section-header/index.js +2 -0
- package/dist/components/segmented/collapse.js +32 -0
- package/dist/components/segmented/index.js +8 -0
- package/dist/components/segmented/segmented.js +50 -0
- package/dist/components/star-rating-input/index.js +2 -0
- package/dist/components/svg/index.js +1 -0
- package/dist/components/table-view/index.js +1 -0
- package/dist/components/table-view/types.js +0 -0
- package/dist/components/tags-input/index.js +2 -0
- package/dist/components/tags-input/tags.js +90 -0
- package/dist/components/theme/index.js +3 -0
- package/dist/components/toolbar/index.js +3 -0
- package/dist/components/toolbar/toolbar-trigger.js +4 -0
- package/dist/editor/anchors.js +17 -0
- package/dist/editor/block-id.js +62 -0
- package/dist/editor/block-ops.js +105 -0
- package/dist/editor/doc-blocks.js +181 -0
- package/dist/editor/extensions.js +200 -0
- package/dist/editor/index.js +4 -0
- package/dist/editor/markdown-test-helpers.js +6 -0
- package/dist/editor/markdown.js +486 -0
- package/dist/editor/serializer.js +268 -0
- package/dist/editor/slash-items.js +104 -0
- package/dist/editor/youtube-url.js +27 -0
- package/dist/effects/animated-beam/index.js +1 -0
- package/dist/effects/animated-beam/path-calculator.svelte.js +42 -0
- package/dist/effects/animated-beam/types.js +0 -0
- package/dist/effects/border-beam/css.js +420 -0
- package/dist/effects/border-beam/presets.js +1792 -0
- package/dist/effects/border-beam/register-properties.js +39 -0
- package/dist/effects/border-beam/types.js +0 -0
- package/dist/effects/image-comparison/compare.js +4 -0
- package/dist/effects/image-reveal/index.js +1 -0
- package/dist/effects/image-reveal/types.js +0 -0
- package/dist/effects/magnetic/magnetic.js +54 -0
- package/dist/effects/reveal/index.js +4 -0
- package/dist/effects/reveal/observe.js +43 -0
- package/dist/effects/reveal/types.js +0 -0
- package/dist/effects/shader-gradient/color.js +34 -0
- package/dist/effects/shader-gradient/index.js +1 -0
- package/dist/effects/shader-gradient/renderer.js +320 -0
- package/dist/effects/shader-gradient/shaders.js +280 -0
- package/dist/effects/shader-gradient/types.js +0 -0
- package/dist/icons/apple-symbol-exports.js +126 -0
- package/dist/icons/sf-symbols.js +465 -0
- package/dist/icons/trades.js +34 -0
- package/dist/inbox/index.js +4 -0
- package/dist/inbox/logic.js +156 -0
- package/dist/inbox/types.js +46 -0
- package/dist/index.js +18 -0
- package/dist/lib/arrive.js +13 -0
- package/dist/lib/icon-types.js +0 -0
- package/dist/lib/initials.js +17 -0
- package/dist/lib/layout.js +1 -0
- package/dist/lib/panel.js +3 -0
- package/dist/lib/result.js +26 -0
- package/dist/lib/sliding-pill.js +45 -0
- package/dist/lib/theme-transition.js +53 -0
- package/dist/lib/tone.js +32 -0
- package/dist/lib/utils.js +5 -0
- package/dist/onboarding/define-tours.js +28 -0
- package/dist/onboarding/index.js +4 -0
- package/dist/onboarding/onboarding.svelte.js +15 -0
- package/dist/onboarding/pick.js +16 -0
- package/dist/onboarding/stores.js +50 -0
- package/dist/onboarding/types.js +1 -0
- package/dist/onboarding/wait.js +25 -0
- package/dist/panel/index.js +1 -0
- package/dist/panel/side-panel-types.js +0 -0
- package/dist/record/demo-data.js +512 -0
- package/dist/record/fields.js +148 -0
- package/dist/record/format.js +97 -0
- package/dist/record/gutter.js +1 -0
- package/dist/record/index.js +15 -0
- package/dist/record/kinds.js +110 -0
- package/dist/record/logic.js +255 -0
- package/dist/record/types.js +52 -0
- package/dist/shadcn/accordion/index.js +5 -0
- package/dist/shadcn/alert/index.js +5 -0
- package/dist/shadcn/alert-dialog/index.js +12 -0
- package/dist/shadcn/attachment/index.js +10 -0
- package/dist/shadcn/avatar/index.js +7 -0
- package/dist/shadcn/badge/index.js +2 -0
- package/dist/shadcn/breadcrumb/index.js +8 -0
- package/dist/shadcn/bubble/index.js +5 -0
- package/dist/shadcn/button/index.js +2 -0
- package/dist/shadcn/calendar/index.js +19 -0
- package/dist/shadcn/card/index.js +8 -0
- package/dist/shadcn/checkbox/index.js +2 -0
- package/dist/shadcn/code-block/index.js +9 -0
- package/dist/shadcn/collapsible/index.js +4 -0
- package/dist/shadcn/command/index.js +13 -0
- package/dist/shadcn/context-menu/index.js +17 -0
- package/dist/shadcn/dialog/index.js +11 -0
- package/dist/shadcn/dropdown-menu/index.js +19 -0
- package/dist/shadcn/dropdown-menu/menu-item.js +23 -0
- package/dist/shadcn/empty/index.js +7 -0
- package/dist/shadcn/field/index.js +12 -0
- package/dist/shadcn/hooks/highlighter.js +92 -0
- package/dist/shadcn/hooks/is-mobile.svelte.js +7 -0
- package/dist/shadcn/hooks/use-highlighted-code.svelte.js +65 -0
- package/dist/shadcn/hover-card/index.js +5 -0
- package/dist/shadcn/input/index.js +3 -0
- package/dist/shadcn/input-otp/index.js +5 -0
- package/dist/shadcn/kbd/index.js +3 -0
- package/dist/shadcn/label/index.js +2 -0
- package/dist/shadcn/marker/index.js +4 -0
- package/dist/shadcn/message/index.js +7 -0
- package/dist/shadcn/message-scroller/index.js +8 -0
- package/dist/shadcn/popover/index.js +9 -0
- package/dist/shadcn/progress/index.js +2 -0
- package/dist/shadcn/progress/tone.js +11 -0
- package/dist/shadcn/radio-group/index.js +3 -0
- package/dist/shadcn/scroll-area/index.js +3 -0
- package/dist/shadcn/select/index.js +12 -0
- package/dist/shadcn/separator/index.js +2 -0
- package/dist/shadcn/sheet/index.js +11 -0
- package/dist/shadcn/sidebar/constants.js +6 -0
- package/dist/shadcn/sidebar/context.svelte.js +38 -0
- package/dist/shadcn/sidebar/index.js +25 -0
- package/dist/shadcn/skeleton/index.js +2 -0
- package/dist/shadcn/slider/index.js +2 -0
- package/dist/shadcn/sonner/index.js +1 -0
- package/dist/shadcn/spinner/index.js +1 -0
- package/dist/shadcn/switch/index.js +2 -0
- package/dist/shadcn/table/index.js +9 -0
- package/dist/shadcn/tabs/index.js +5 -0
- package/dist/shadcn/textarea/index.js +2 -0
- package/dist/shadcn/toggle/index.js +3 -0
- package/dist/shadcn/toggle-group/index.js +3 -0
- package/dist/shadcn/tooltip/context.js +8 -0
- package/dist/shadcn/tooltip/index.js +6 -0
- package/dist/shadcn/trace/index.js +9 -0
- package/dist/slides/bridges.js +66 -0
- package/dist/slides/deck-controller.svelte.js +221 -0
- package/dist/slides/export/capture.js +81 -0
- package/dist/slides/export/ffmpeg.js +85 -0
- package/dist/slides/export/index.js +4 -0
- package/dist/slides/export/launch.js +8 -0
- package/dist/slides/export/pdf.js +78 -0
- package/dist/slides/export/types.js +0 -0
- package/dist/slides/index.js +7 -0
- package/dist/slides/labels.js +26 -0
- package/dist/slides/layout.js +47 -0
- package/dist/slides/model.js +9 -0
- package/dist/slides/navigation.js +89 -0
- package/dist/slides/types.js +6 -0
- package/dist/status/define-statuses.js +16 -0
- package/dist/status/index.js +4 -0
- package/dist/status/status-types.js +0 -0
- package/dist/test-setup.js +26 -0
- package/dist/thread/index.js +3 -0
- package/dist/thread/logic.js +94 -0
- package/dist/thread/types.js +23 -0
- package/dist/work/board-order.js +109 -0
- package/dist/work/dates.js +19 -0
- package/dist/work/detail/detail-types.js +20 -0
- package/dist/work/docs/edited.js +39 -0
- package/dist/work/docs/index.js +7 -0
- package/dist/work/docs/labels.js +38 -0
- package/dist/work/docs/menu.js +121 -0
- package/dist/work/docs/outline.js +39 -0
- package/dist/work/gantt/logic.js +260 -0
- package/dist/work/inbox/inbox-logic.js +94 -0
- package/dist/work/inbox/inbox-statuses.js +86 -0
- package/dist/work/inbox/inbox-types.js +0 -0
- package/dist/work/inbox/index.js +1 -0
- package/dist/work/index.js +21 -0
- package/dist/work/kanban-drag.js +25 -0
- package/dist/work/kanban-types.js +0 -0
- package/dist/work/presets/sales.js +35 -0
- package/dist/work/reorder.js +10 -0
- package/dist/work/task-types.js +0 -0
- package/dist/work/time/duration.js +60 -0
- package/dist/work/time/time-types.js +25 -0
- package/dist/work/use-kanban-dnd.svelte.js +128 -0
- package/package.json +45 -3
- package/src/components/toolbar/toolbar-trigger.ts +8 -2
- package/src/record/demo-data.ts +4 -4
- package/src/record/record-demo.svelte +2 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const READ_LINE = 80;
|
|
2
|
+
export class ScrollSpy {
|
|
3
|
+
active = $state("");
|
|
4
|
+
#scroller = null;
|
|
5
|
+
#items = [];
|
|
6
|
+
#locate;
|
|
7
|
+
#frame = 0;
|
|
8
|
+
attach(scroller, items, locate) {
|
|
9
|
+
this.#scroller = scroller;
|
|
10
|
+
this.#items = items;
|
|
11
|
+
this.#locate = locate;
|
|
12
|
+
if (!scroller || items.length === 0) {
|
|
13
|
+
this.active = "";
|
|
14
|
+
return ()=>{};
|
|
15
|
+
}
|
|
16
|
+
const schedule = ()=>{
|
|
17
|
+
this.#frame ||= requestAnimationFrame(()=>{
|
|
18
|
+
this.#frame = 0;
|
|
19
|
+
this.update();
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
scroller.addEventListener("scroll", schedule, {
|
|
23
|
+
passive: true
|
|
24
|
+
});
|
|
25
|
+
const observer = new ResizeObserver(schedule);
|
|
26
|
+
observer.observe(scroller);
|
|
27
|
+
for (const child of scroller.children)observer.observe(child);
|
|
28
|
+
this.update();
|
|
29
|
+
return ()=>{
|
|
30
|
+
scroller.removeEventListener("scroll", schedule);
|
|
31
|
+
observer.disconnect();
|
|
32
|
+
if (this.#frame) cancelAnimationFrame(this.#frame);
|
|
33
|
+
this.#frame = 0;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
topOf(id) {
|
|
37
|
+
const scroller = this.#scroller;
|
|
38
|
+
if (!scroller) return null;
|
|
39
|
+
if (this.#locate) return this.#locate(id);
|
|
40
|
+
const el = scroller.querySelector(`#${CSS.escape(id)}`);
|
|
41
|
+
if (!el) return null;
|
|
42
|
+
return el.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
|
|
43
|
+
}
|
|
44
|
+
update() {
|
|
45
|
+
const scroller = this.#scroller;
|
|
46
|
+
if (!scroller || this.#items.length === 0) return;
|
|
47
|
+
const atEnd = scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight - 2;
|
|
48
|
+
if (atEnd && scroller.scrollTop > 0) {
|
|
49
|
+
this.active = this.#items[this.#items.length - 1].id;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const line = scroller.scrollTop + READ_LINE + 1;
|
|
53
|
+
let current = this.#items[0].id;
|
|
54
|
+
for (const item of this.#items){
|
|
55
|
+
const top = this.topOf(item.id);
|
|
56
|
+
if (top !== null && top <= line) current = item.id;
|
|
57
|
+
}
|
|
58
|
+
this.active = current;
|
|
59
|
+
}
|
|
60
|
+
jump(id) {
|
|
61
|
+
const scroller = this.#scroller;
|
|
62
|
+
const top = this.topOf(id);
|
|
63
|
+
if (!scroller || top === null) return;
|
|
64
|
+
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
65
|
+
this.active = id;
|
|
66
|
+
scroller.scrollTo({
|
|
67
|
+
top: Math.max(0, top - READ_LINE),
|
|
68
|
+
behavior: reduced ? "auto" : "smooth"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FieldRow } from "../../../src/components/field-row/field-row.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as HoldToConfirm } from "../../../src/components/hold-to-confirm/hold-to-confirm.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Icon } from "../../../src/components/icon/icon.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LanguageFlag } from "../../../src/components/language-flag/language-flag.svelte";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { default as DetailEmpty } from "../../../src/components/list-page/detail-empty.svelte";
|
|
2
|
+
export { default as DetailHeader } from "../../../src/components/list-page/detail-header.svelte";
|
|
3
|
+
export { default as DetailPanel } from "../../../src/components/list-page/detail-panel.svelte";
|
|
4
|
+
export { default as DetailRow } from "../../../src/components/list-page/detail-row.svelte";
|
|
5
|
+
export { default as DetailStack } from "../../../src/components/list-page/detail-stack.svelte";
|
|
6
|
+
export { default as EmptyState } from "../../../src/components/list-page/empty-state.svelte";
|
|
7
|
+
export { default as FilterItem } from "../../../src/components/list-page/filter-item.svelte";
|
|
8
|
+
export { default as PrevNext } from "../../../src/components/list-page/prev-next.svelte";
|
|
9
|
+
export { stepTo } from "./step.js";
|
|
10
|
+
export { default as NoticeBar } from "../../../src/components/list-page/notice-bar.svelte";
|
|
11
|
+
export { default as RailBody } from "../../../src/components/list-page/rail-body.svelte";
|
|
12
|
+
export { default as RailEmpty } from "../../../src/components/list-page/rail-empty.svelte";
|
|
13
|
+
export { default as RailHead } from "../../../src/components/list-page/rail-head.svelte";
|
|
14
|
+
export { default as RailRow } from "../../../src/components/list-page/rail-row.svelte";
|
|
15
|
+
export { default as SectionLabel } from "../../../src/components/section-header/section-label.svelte";
|
|
16
|
+
export { queueRailClass, queueRailWidth } from "./queue-rail.js";
|
|
17
|
+
export { default as FilterPopover } from "../../../src/components/list-page/filter-popover.svelte";
|
|
18
|
+
export { filterSectionClass } from "./filter-section.js";
|
|
19
|
+
export { default as GroupedList } from "../../../src/components/list-page/grouped-list.svelte";
|
|
20
|
+
export { default as ListPageShell } from "../../../src/components/list-page/list-page-shell.svelte";
|
|
21
|
+
export { default as MasterDetail } from "../../../src/components/list-page/master-detail.svelte";
|
|
22
|
+
export { default as ToolbarSearch } from "../../../src/components/toolbar/toolbar-search.svelte";
|
|
23
|
+
export { toolbarTriggerClass } from "../toolbar/toolbar-trigger.js";
|
|
24
|
+
export { listTable } from "./list-table.js";
|
|
25
|
+
export { getSectionHost, setSectionHost } from "./section-host.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
export const listTable = {
|
|
3
|
+
headRow: (className)=>cn("hover:translate-y-0 hover:bg-transparent hover:shadow-none [&>th]:h-9 [&>th]:border-b [&>th]:border-border", className),
|
|
4
|
+
row: (className)=>cn("border-b border-border/50 last:border-b-0 hover:translate-y-0 hover:bg-muted/40 hover:shadow-none [&>td]:h-10 [&>td]:py-0", className)
|
|
5
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LocaleSwitch } from "../../../src/components/locale-switch/locale-switch.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Mark } from "../../../src/components/mark/mark.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OpenIn } from "../../../src/components/open-in/open-in.svelte";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const pickerTriggerClass = tv({
|
|
3
|
+
base: [
|
|
4
|
+
"t-press inline-flex min-w-0 items-center gap-1.5 rounded-md text-[13px] font-medium whitespace-nowrap select-none",
|
|
5
|
+
"hover:bg-muted data-[state=open]:bg-muted",
|
|
6
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
7
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
8
|
+
],
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "h-6 ps-1.5 pe-2 any-pointer-coarse:h-11 any-pointer-coarse:pe-2.5",
|
|
12
|
+
default: "h-7 ps-1.5 pe-2.5 any-pointer-coarse:h-11"
|
|
13
|
+
},
|
|
14
|
+
block: {
|
|
15
|
+
true: "flex w-full",
|
|
16
|
+
false: "w-fit"
|
|
17
|
+
},
|
|
18
|
+
empty: {
|
|
19
|
+
true: "text-muted-foreground/70 hover:text-muted-foreground",
|
|
20
|
+
false: ""
|
|
21
|
+
},
|
|
22
|
+
inert: {
|
|
23
|
+
true: "hover:bg-transparent cursor-default",
|
|
24
|
+
false: ""
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "default",
|
|
29
|
+
block: false,
|
|
30
|
+
empty: false,
|
|
31
|
+
inert: false
|
|
32
|
+
}
|
|
33
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SectionCard } from "../../../src/components/section-card/section-card.svelte";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const SEGMENT_MAX = 6;
|
|
2
|
+
export function splitSegments(items, max, activeIndex) {
|
|
3
|
+
if (max < 3 || items.length <= max) return {
|
|
4
|
+
visible: [
|
|
5
|
+
...items
|
|
6
|
+
],
|
|
7
|
+
hidden: []
|
|
8
|
+
};
|
|
9
|
+
const slots = max - 1;
|
|
10
|
+
if (activeIndex < slots && activeIndex >= 0) {
|
|
11
|
+
return {
|
|
12
|
+
visible: items.slice(0, slots),
|
|
13
|
+
hidden: items.slice(slots)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (activeIndex < 0 || activeIndex >= items.length) {
|
|
17
|
+
return {
|
|
18
|
+
visible: items.slice(0, slots),
|
|
19
|
+
hidden: items.slice(slots)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
visible: [
|
|
24
|
+
...items.slice(0, slots - 1),
|
|
25
|
+
...items.slice(activeIndex, activeIndex + 1)
|
|
26
|
+
],
|
|
27
|
+
hidden: items.filter((_, i)=>i >= slots - 1 && i !== activeIndex)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function resolveSegmentMax(max) {
|
|
31
|
+
return max === "none" ? Number.POSITIVE_INFINITY : max;
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import AnimatedTabs from "../../../src/components/segmented/animated-tabs.svelte";
|
|
2
|
+
import SegmentedFilter from "../../../src/components/segmented/segmented-filter.svelte";
|
|
3
|
+
import SegmentedNav from "../../../src/components/segmented/segmented-nav.svelte";
|
|
4
|
+
import SectionRuns from "../../../src/components/segmented/section-runs.svelte";
|
|
5
|
+
import "../../../src/components/segmented/segment.svelte";
|
|
6
|
+
import { segmentedRowClass } from "./segmented.js";
|
|
7
|
+
import { SEGMENT_MAX } from "./collapse.js";
|
|
8
|
+
export { AnimatedTabs, SectionRuns, SegmentedFilter, SegmentedNav, SEGMENT_MAX, segmentedRowClass };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
import { pageGutterClass } from "../../lib/layout.js";
|
|
3
|
+
export const segmentedTrackClass = tv({
|
|
4
|
+
base: "h-7 any-pointer-coarse:h-11 shrink-0 items-stretch",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
pill: "overflow-hidden rounded-lg border border-border p-0.5 any-pointer-coarse:border-0 any-pointer-coarse:px-[3px] any-pointer-coarse:py-0",
|
|
8
|
+
underline: "gap-5 border-b border-border"
|
|
9
|
+
},
|
|
10
|
+
fill: {
|
|
11
|
+
true: "flex w-full",
|
|
12
|
+
false: "inline-flex w-fit"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "pill",
|
|
17
|
+
fill: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export const segmentedTriggerClass = tv({
|
|
21
|
+
base: [
|
|
22
|
+
"ui-segment group/segment t-press relative z-[1] inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium select-none",
|
|
23
|
+
"text-muted-foreground hover:text-foreground",
|
|
24
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
25
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
26
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:outline-none",
|
|
27
|
+
"h-full text-xs"
|
|
28
|
+
],
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
pill: "rounded-[calc(var(--radius-lg)-3px)] px-2.5 any-pointer-coarse:px-3.5",
|
|
32
|
+
underline: "rounded-sm px-0"
|
|
33
|
+
},
|
|
34
|
+
fill: {
|
|
35
|
+
true: "min-w-fit flex-auto",
|
|
36
|
+
false: ""
|
|
37
|
+
},
|
|
38
|
+
active: {
|
|
39
|
+
true: "text-foreground",
|
|
40
|
+
false: ""
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: "pill",
|
|
45
|
+
fill: false,
|
|
46
|
+
active: false
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export const segmentedRowClass = `flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 py-2 ${pageGutterClass}`;
|
|
50
|
+
export const segmentedActiveClass = "data-active:text-foreground";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Svg } from "../../../src/components/svg/svg.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TableView } from "../../../src/components/table-view/table-view.svelte";
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export function splitTags(text) {
|
|
2
|
+
return text.split(/[,\n]/).map((part)=>part.trim()).filter(Boolean);
|
|
3
|
+
}
|
|
4
|
+
export function fold(text) {
|
|
5
|
+
return text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[\s._-]+/g, "");
|
|
6
|
+
}
|
|
7
|
+
const same = (a, b)=>fold(a) === fold(b);
|
|
8
|
+
export function editDistance(a, b, limit = 2) {
|
|
9
|
+
if (Math.abs(a.length - b.length) > limit) return limit + 1;
|
|
10
|
+
let prev2 = [];
|
|
11
|
+
let prev = Array.from({
|
|
12
|
+
length: b.length + 1
|
|
13
|
+
}, (_, j)=>j);
|
|
14
|
+
for(let i = 1; i <= a.length; i++){
|
|
15
|
+
const row = [
|
|
16
|
+
i
|
|
17
|
+
];
|
|
18
|
+
for(let j = 1; j <= b.length; j++){
|
|
19
|
+
let d = Math.min(prev[j] + 1, row[j - 1] + 1, prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
20
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d = Math.min(d, prev2[j - 2] + 1);
|
|
21
|
+
row.push(d);
|
|
22
|
+
}
|
|
23
|
+
prev2 = prev;
|
|
24
|
+
prev = row;
|
|
25
|
+
}
|
|
26
|
+
return prev[b.length];
|
|
27
|
+
}
|
|
28
|
+
function rank(option, query) {
|
|
29
|
+
const o = fold(option);
|
|
30
|
+
const q = fold(query);
|
|
31
|
+
if (o === q) return 0;
|
|
32
|
+
if (o.startsWith(q)) return 1;
|
|
33
|
+
if (o.includes(q)) return 2;
|
|
34
|
+
const limit = q.length >= 7 ? 2 : q.length >= 4 ? 1 : 0;
|
|
35
|
+
return limit > 0 && editDistance(o, q, limit) <= limit ? 3 : null;
|
|
36
|
+
}
|
|
37
|
+
export function matchOptions(options, tags, query, limit = 8) {
|
|
38
|
+
const open = options.filter((option)=>!tags.some((held)=>same(held, option)));
|
|
39
|
+
if (!query.trim()) return open.slice(0, limit);
|
|
40
|
+
return open.flatMap((option)=>{
|
|
41
|
+
const r = rank(option, query);
|
|
42
|
+
return r === null ? [] : [
|
|
43
|
+
{
|
|
44
|
+
option,
|
|
45
|
+
r
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
}).sort((a, b)=>a.r - b.r).map(({ option })=>option).slice(0, limit);
|
|
49
|
+
}
|
|
50
|
+
export function findOption(options, input) {
|
|
51
|
+
return options.find((option)=>same(option, input));
|
|
52
|
+
}
|
|
53
|
+
export function canCreate(options, tags, query, allowCreate = true) {
|
|
54
|
+
return allowCreate && query.trim() !== "" && ![
|
|
55
|
+
...options,
|
|
56
|
+
...tags
|
|
57
|
+
].some((held)=>same(held, query));
|
|
58
|
+
}
|
|
59
|
+
export function addTag(tags, name, options = [], max) {
|
|
60
|
+
const tag = findOption(options, name) ?? name.trim();
|
|
61
|
+
if (!tag || tags.some((held)=>same(held, tag))) return tags;
|
|
62
|
+
if (max !== undefined && tags.length >= max) return tags;
|
|
63
|
+
return [
|
|
64
|
+
...tags,
|
|
65
|
+
tag
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
export function removeTag(tags, tag) {
|
|
69
|
+
return tags.filter((held)=>!same(held, tag));
|
|
70
|
+
}
|
|
71
|
+
export function cleanTags(tags, options = []) {
|
|
72
|
+
return tags.reduce((out, tag)=>[
|
|
73
|
+
...addTag(out, tag, options)
|
|
74
|
+
], []);
|
|
75
|
+
}
|
|
76
|
+
export function collectOptions(lists) {
|
|
77
|
+
const seen = new Map();
|
|
78
|
+
for (const list of lists)for (const raw of list){
|
|
79
|
+
const tag = raw.trim();
|
|
80
|
+
if (!tag) continue;
|
|
81
|
+
const spellings = seen.get(fold(tag)) ?? new Map();
|
|
82
|
+
spellings.set(tag, (spellings.get(tag) ?? 0) + 1);
|
|
83
|
+
seen.set(fold(tag), spellings);
|
|
84
|
+
}
|
|
85
|
+
return [
|
|
86
|
+
...seen.values()
|
|
87
|
+
].map((spellings)=>[
|
|
88
|
+
...spellings
|
|
89
|
+
].sort((a, b)=>b[1] - a[1])[0][0]).sort((a, b)=>a.localeCompare(b));
|
|
90
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
export function toolbarTriggerClass({ active = false, className } = {}) {
|
|
3
|
+
return cn("t-press inline-flex cursor-pointer items-center gap-1.5 rounded-lg border border-border font-medium shadow-btn transition-[background-color,border-color,color] duration-quick ease-smooth-out hover:border-foreground/15 motion-reduce:transition-none", "h-7 px-2.5 text-xs any-pointer-coarse:h-11 any-pointer-coarse:px-3", active ? "bg-foreground/6 text-foreground" : "bg-card text-muted-foreground hover:bg-foreground/3 hover:text-foreground", className);
|
|
4
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function slugify(text) {
|
|
2
|
+
const slug = text.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "");
|
|
3
|
+
return slug || "section";
|
|
4
|
+
}
|
|
5
|
+
export function anchorIds(labels) {
|
|
6
|
+
const seen = new Map();
|
|
7
|
+
const taken = new Set();
|
|
8
|
+
return labels.map((label)=>{
|
|
9
|
+
const base = slugify(label);
|
|
10
|
+
let count = (seen.get(base) ?? 0) + 1;
|
|
11
|
+
let id = count === 1 ? base : `${base}-${count}`;
|
|
12
|
+
while(taken.has(id))id = `${base}-${++count}`;
|
|
13
|
+
seen.set(base, count);
|
|
14
|
+
taken.add(id);
|
|
15
|
+
return id;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
const TOP_LEVEL_BLOCK_TYPES = new Set([
|
|
4
|
+
"paragraph",
|
|
5
|
+
"heading",
|
|
6
|
+
"bulletList",
|
|
7
|
+
"orderedList",
|
|
8
|
+
"blockquote",
|
|
9
|
+
"codeBlock",
|
|
10
|
+
"horizontalRule"
|
|
11
|
+
]);
|
|
12
|
+
export function generateBlockId() {
|
|
13
|
+
return crypto.randomUUID();
|
|
14
|
+
}
|
|
15
|
+
function isTopLevelBlock(node) {
|
|
16
|
+
return TOP_LEVEL_BLOCK_TYPES.has(node.type.name);
|
|
17
|
+
}
|
|
18
|
+
const blockIdPluginKey = new PluginKey("blockId");
|
|
19
|
+
export const BlockIdExtension = Extension.create({
|
|
20
|
+
name: "blockId",
|
|
21
|
+
addGlobalAttributes () {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
types: Array.from(TOP_LEVEL_BLOCK_TYPES),
|
|
25
|
+
attributes: {
|
|
26
|
+
id: {
|
|
27
|
+
default: null,
|
|
28
|
+
parseHTML: (element)=>element.getAttribute("data-block-id") || null,
|
|
29
|
+
renderHTML: (attributes)=>{
|
|
30
|
+
if (!attributes.id) return {};
|
|
31
|
+
return {
|
|
32
|
+
"data-block-id": attributes.id
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
addProseMirrorPlugins () {
|
|
41
|
+
return [
|
|
42
|
+
new Plugin({
|
|
43
|
+
key: blockIdPluginKey,
|
|
44
|
+
appendTransaction (_transactions, _oldState, newState) {
|
|
45
|
+
const { tr, doc } = newState;
|
|
46
|
+
let changed = false;
|
|
47
|
+
doc.forEach((node, offset)=>{
|
|
48
|
+
if (!isTopLevelBlock(node)) return;
|
|
49
|
+
if (node.attrs.id) return;
|
|
50
|
+
const id = generateBlockId();
|
|
51
|
+
tr.setNodeMarkup(offset, undefined, {
|
|
52
|
+
...node.attrs,
|
|
53
|
+
id
|
|
54
|
+
});
|
|
55
|
+
changed = true;
|
|
56
|
+
});
|
|
57
|
+
return changed ? tr : null;
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { markdownToTiptap } from "./markdown.js";
|
|
2
|
+
function extractText(nodes) {
|
|
3
|
+
if (!nodes?.length) return "";
|
|
4
|
+
return nodes.map((n)=>{
|
|
5
|
+
if (n.type === "text") return n.text ?? "";
|
|
6
|
+
if (n.type === "hardBreak") return " ";
|
|
7
|
+
return extractText(n.content);
|
|
8
|
+
}).join("");
|
|
9
|
+
}
|
|
10
|
+
function blockText(node) {
|
|
11
|
+
const raw = extractText(node.content).trim();
|
|
12
|
+
return raw.length > 120 ? raw.slice(0, 117) + "..." : raw;
|
|
13
|
+
}
|
|
14
|
+
function getId(node) {
|
|
15
|
+
const id = node.attrs?.id;
|
|
16
|
+
return typeof id === "string" && id.length > 0 ? id : null;
|
|
17
|
+
}
|
|
18
|
+
function requireDoc(doc) {
|
|
19
|
+
const d = doc;
|
|
20
|
+
if (!d || d.type !== "doc" || !Array.isArray(d.content)) {
|
|
21
|
+
throw new Error("Invalid doc: expected { type: 'doc', content: [...] }");
|
|
22
|
+
}
|
|
23
|
+
return d;
|
|
24
|
+
}
|
|
25
|
+
function requireBlockById(doc, id) {
|
|
26
|
+
const idx = doc.content.findIndex((n)=>getId(n) === id);
|
|
27
|
+
if (idx === -1) {
|
|
28
|
+
throw new Error(`Block id "${id}" not found in doc`);
|
|
29
|
+
}
|
|
30
|
+
return idx;
|
|
31
|
+
}
|
|
32
|
+
function newBlocksFromMd(markdown) {
|
|
33
|
+
const parsed = markdownToTiptap(markdown);
|
|
34
|
+
return parsed.content;
|
|
35
|
+
}
|
|
36
|
+
export function listBlocks(doc) {
|
|
37
|
+
const d = requireDoc(doc);
|
|
38
|
+
return d.content.map((node)=>({
|
|
39
|
+
id: getId(node) ?? "",
|
|
40
|
+
type: node.type,
|
|
41
|
+
text: blockText(node)
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
export function appendBlocks(doc, markdown) {
|
|
45
|
+
const d = requireDoc(doc);
|
|
46
|
+
const added = newBlocksFromMd(markdown);
|
|
47
|
+
return {
|
|
48
|
+
type: "doc",
|
|
49
|
+
content: [
|
|
50
|
+
...d.content,
|
|
51
|
+
...added
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function prependBlocks(doc, markdown) {
|
|
56
|
+
const d = requireDoc(doc);
|
|
57
|
+
const added = newBlocksFromMd(markdown);
|
|
58
|
+
return {
|
|
59
|
+
type: "doc",
|
|
60
|
+
content: [
|
|
61
|
+
...added,
|
|
62
|
+
...d.content
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function insertBlocksAfter(doc, afterId, markdown) {
|
|
67
|
+
const d = requireDoc(doc);
|
|
68
|
+
const idx = requireBlockById(d, afterId);
|
|
69
|
+
const added = newBlocksFromMd(markdown);
|
|
70
|
+
const content = [
|
|
71
|
+
...d.content.slice(0, idx + 1),
|
|
72
|
+
...added,
|
|
73
|
+
...d.content.slice(idx + 1)
|
|
74
|
+
];
|
|
75
|
+
return {
|
|
76
|
+
type: "doc",
|
|
77
|
+
content
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function replaceBlock(doc, id, markdown) {
|
|
81
|
+
const d = requireDoc(doc);
|
|
82
|
+
const idx = requireBlockById(d, id);
|
|
83
|
+
const added = newBlocksFromMd(markdown);
|
|
84
|
+
const content = [
|
|
85
|
+
...d.content.slice(0, idx),
|
|
86
|
+
...added,
|
|
87
|
+
...d.content.slice(idx + 1)
|
|
88
|
+
];
|
|
89
|
+
return {
|
|
90
|
+
type: "doc",
|
|
91
|
+
content
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function deleteBlock(doc, id) {
|
|
95
|
+
const d = requireDoc(doc);
|
|
96
|
+
const idx = requireBlockById(d, id);
|
|
97
|
+
const content = [
|
|
98
|
+
...d.content.slice(0, idx),
|
|
99
|
+
...d.content.slice(idx + 1)
|
|
100
|
+
];
|
|
101
|
+
return {
|
|
102
|
+
type: "doc",
|
|
103
|
+
content
|
|
104
|
+
};
|
|
105
|
+
}
|