@ai-matrx/rich-content 0.0.0 → 0.2.2
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/CHANGELOG.md +72 -0
- package/LICENSE +1 -1
- package/README.md +58 -3
- package/dist/display/blocks/csv/CsvBlock.d.ts +10 -0
- package/dist/display/blocks/csv/CsvBlock.js +245 -0
- package/dist/display/blocks/table/parseMarkdownTable.d.ts +20 -0
- package/dist/display/blocks/table/parseMarkdownTable.js +35 -0
- package/dist/display/chat-markdown/citations/remarkMatrxCite.d.ts +33 -0
- package/dist/display/chat-markdown/citations/remarkMatrxCite.js +71 -0
- package/dist/display/chat-markdown/matrx-variables/remarkMatrxVariable.d.ts +29 -0
- package/dist/display/chat-markdown/matrx-variables/remarkMatrxVariable.js +71 -0
- package/dist/display/chat-markdown/page-break/remarkMatrxPageBreak.d.ts +55 -0
- package/dist/display/chat-markdown/page-break/remarkMatrxPageBreak.js +108 -0
- package/dist/display/chat-markdown/rehypeSafeRawHtml.d.ts +59 -0
- package/dist/display/chat-markdown/rehypeSafeRawHtml.js +140 -0
- package/dist/display/markdown-classification/processors/bock-processors/parse-markdown-table.d.ts +14 -0
- package/dist/display/markdown-classification/processors/bock-processors/parse-markdown-table.js +171 -0
- package/dist/display/markdown-classification/processors/types.d.ts +120 -0
- package/dist/display/markdown-classification/processors/types.js +10 -0
- package/dist/display/markdown-classification/processors/utils/client-blocks.d.ts +169 -0
- package/dist/display/markdown-classification/processors/utils/client-blocks.js +0 -0
- package/dist/display/markdown-classification/processors/utils/content-splitter-core.d.ts +223 -0
- package/dist/display/markdown-classification/processors/utils/content-splitter-core.js +1791 -0
- package/dist/display/markdown-classification/processors/utils/content-splitter-v2.d.ts +15 -0
- package/dist/display/markdown-classification/processors/utils/content-splitter-v2.js +19 -0
- package/dist/display/markdown-classification/processors/utils/expand-text-blocks.d.ts +9 -0
- package/dist/display/markdown-classification/processors/utils/expand-text-blocks.js +36 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-lines.d.ts +5 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-lines.js +40 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-vector-inputs.d.ts +16 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-vector-inputs.js +385 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-vectors.d.ts +43 -0
- package/dist/display/markdown-classification/processors/utils/gfm-table-vectors.js +33 -0
- package/dist/display/markdown-classification/processors/utils/table-data-parser.d.ts +9 -0
- package/dist/display/markdown-classification/processors/utils/table-data-parser.js +30 -0
- package/dist/display/markdown-classification/processors/utils/thinking-parser.d.ts +7 -0
- package/dist/display/markdown-classification/processors/utils/thinking-parser.js +70 -0
- package/dist/display/render-block.d.ts +23 -0
- package/dist/display/render-block.js +0 -0
- package/dist/display/themes.d.ts +1023 -0
- package/dist/display/themes.js +1105 -0
- package/dist/display/types.d.ts +32 -0
- package/dist/display/types.js +0 -0
- package/dist/host/ContentIrHostBoundary.d.ts +8 -0
- package/dist/host/ContentIrHostBoundary.js +15 -0
- package/dist/host/ErrorActions.d.ts +4 -0
- package/dist/host/ErrorActions.js +11 -0
- package/dist/host/NestedContent.d.ts +3 -0
- package/dist/host/NestedContent.js +12 -0
- package/dist/host/ResourcePeek.d.ts +6 -0
- package/dist/host/ResourcePeek.js +14 -0
- package/dist/host/component-registry.d.ts +2 -0
- package/dist/host/component-registry.js +25 -0
- package/dist/host/diagnostics.d.ts +2 -0
- package/dist/host/diagnostics.js +15 -0
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.js +18 -0
- package/dist/host/kind-incident.d.ts +3 -0
- package/dist/host/kind-incident.js +12 -0
- package/dist/host/kind-registry.d.ts +2 -0
- package/dist/host/kind-registry.js +35 -0
- package/dist/host/people.d.ts +3 -0
- package/dist/host/people.js +12 -0
- package/dist/host/registry.d.ts +27 -0
- package/dist/host/registry.js +55 -0
- package/dist/host/splitter-envelopes.d.ts +2 -0
- package/dist/host/splitter-envelopes.js +7 -0
- package/dist/host/tables.d.ts +6 -0
- package/dist/host/tables.js +8 -0
- package/dist/host/toast.d.ts +2 -0
- package/dist/host/toast.js +57 -0
- package/dist/host/types.d.ts +157 -0
- package/dist/host/types.js +0 -0
- package/dist/host/wikilinks.d.ts +15 -0
- package/dist/host/wikilinks.js +23 -0
- package/dist/kinds/host/route-env.d.ts +33 -0
- package/dist/kinds/host/route-env.js +16 -0
- package/dist/kinds/react/KindEscapedNotice.d.ts +14 -0
- package/dist/kinds/react/KindEscapedNotice.js +72 -0
- package/dist/kinds/react/ProvisionalKindBoundary.d.ts +19 -0
- package/dist/kinds/react/ProvisionalKindBoundary.js +17 -0
- package/dist/kinds/react/ensure-kind-renderable.d.ts +14 -0
- package/dist/kinds/react/ensure-kind-renderable.js +45 -0
- package/dist/kinds/react/kind-problems.d.ts +62 -0
- package/dist/kinds/react/kind-problems.js +134 -0
- package/dist/kinds/react/kind-route.d.ts +23 -0
- package/dist/kinds/react/kind-route.js +24 -0
- package/dist/kinds/react/loading/infer-loading-slug.d.ts +58 -0
- package/dist/kinds/react/loading/infer-loading-slug.js +100 -0
- package/dist/kinds/react/loading/kind-loading-components.d.ts +48 -0
- package/dist/kinds/react/loading/kind-loading-components.js +447 -0
- package/dist/kinds/react/loading/kind-loading-registry.d.ts +21 -0
- package/dist/kinds/react/loading/kind-loading-registry.js +62 -0
- package/dist/kinds/react/loading/kind-loading-slugs.d.ts +18 -0
- package/dist/kinds/react/loading/kind-loading-slugs.js +34 -0
- package/dist/kinds/react/loading/kind-loading.types.d.ts +79 -0
- package/dist/kinds/react/loading/kind-loading.types.js +31 -0
- package/dist/kinds/react/loading/resolve-loading-slug.d.ts +29 -0
- package/dist/kinds/react/loading/resolve-loading-slug.js +51 -0
- package/dist/kinds/react/partial-kind-route.d.ts +32 -0
- package/dist/kinds/react/partial-kind-route.js +27 -0
- package/dist/kinds/react/registry-versioned.d.ts +54 -0
- package/dist/kinds/react/registry-versioned.js +18 -0
- package/dist/kinds/react/route-at-version.d.ts +38 -0
- package/dist/kinds/react/route-at-version.js +78 -0
- package/dist/kinds/react/slot/KindSlot.d.ts +87 -0
- package/dist/kinds/react/slot/KindSlot.js +65 -0
- package/dist/kinds/react/use-registry-repaint.d.ts +6 -0
- package/dist/kinds/react/use-registry-repaint.js +36 -0
- package/dist/kinds/react/useIrNode.d.ts +9 -0
- package/dist/kinds/react/useIrNode.js +46 -0
- package/dist/kinds/react/useLiveJsonRegion.d.ts +15 -0
- package/dist/kinds/react/useLiveJsonRegion.js +84 -0
- package/dist/kinds/redux/render-block-envelope.d.ts +14 -0
- package/dist/kinds/redux/render-block-envelope.js +26 -0
- package/dist/kinds/registry/kind-correctors.d.ts +63 -0
- package/dist/kinds/registry/kind-correctors.js +94 -0
- package/dist/kinds/registry/legacy-quiz-envelope.d.ts +1 -0
- package/dist/kinds/registry/legacy-quiz-envelope.js +1 -0
- package/dist/kinds/registry/region-envelope-memo.d.ts +45 -0
- package/dist/kinds/registry/region-envelope-memo.js +94 -0
- package/dist/kinds/registry/registry-debug.d.ts +38 -0
- package/dist/kinds/registry/registry-debug.js +39 -0
- package/dist/markdown-core/MarkdownCore.d.ts +6 -0
- package/dist/markdown-core/MarkdownCore.js +32 -0
- package/dist/markdown-core/MarkdownCoreImpl.d.ts +3 -0
- package/dist/markdown-core/MarkdownCoreImpl.js +27 -0
- package/dist/markdown-core/MarkdownCoreServer.d.ts +4 -0
- package/dist/markdown-core/MarkdownCoreServer.js +26 -0
- package/dist/markdown-core/heading-anchors-context.d.ts +2 -0
- package/dist/markdown-core/heading-anchors-context.js +11 -0
- package/dist/markdown-core/heading-anchors-props.d.ts +2 -0
- package/dist/markdown-core/heading-anchors-props.js +6 -0
- package/dist/markdown-core/markdown-core-html.d.ts +3 -0
- package/dist/markdown-core/markdown-core-html.js +33 -0
- package/dist/markdown-core/markdown-core-presets.d.ts +22 -0
- package/dist/markdown-core/markdown-core-presets.js +118 -0
- package/dist/markdown-core/markdown-core-types.d.ts +43 -0
- package/dist/markdown-core/markdown-core-types.js +0 -0
- package/dist/markdown-core/math/vendor/micromark-math-math-flow.d.ts +15 -0
- package/dist/markdown-core/math/vendor/micromark-math-math-flow.js +143 -0
- package/dist/markdown-core/math/vendor/micromark-math-math-text.d.ts +24 -0
- package/dist/markdown-core/math/vendor/micromark-math-math-text.js +127 -0
- package/dist/markdown-core/math/vendor/micromark-math-syntax.d.ts +30 -0
- package/dist/markdown-core/math/vendor/micromark-math-syntax.js +15 -0
- package/dist/markdown-core/math/vendor/rehype-katex.d.ts +15 -0
- package/dist/markdown-core/math/vendor/rehype-katex.js +83 -0
- package/dist/markdown-core/math/vendor/remark-math.d.ts +9 -0
- package/dist/markdown-core/math/vendor/remark-math.js +20 -0
- package/dist/markdown-core/math-normalizer.d.ts +57 -0
- package/dist/markdown-core/math-normalizer.js +315 -0
- package/dist/markdown-core/plain-title.d.ts +2 -0
- package/dist/markdown-core/plain-title.js +1 -0
- package/dist/markdown-core/stream-heal.d.ts +2 -0
- package/dist/markdown-core/stream-heal.js +184 -0
- package/dist/markdown-core/streaming-context.d.ts +2 -0
- package/dist/markdown-core/streaming-context.js +11 -0
- package/dist/markdown-core/syntax/callout-types.d.ts +9 -0
- package/dist/markdown-core/syntax/callout-types.js +101 -0
- package/dist/markdown-core/syntax/containers.d.ts +17 -0
- package/dist/markdown-core/syntax/containers.js +353 -0
- package/dist/markdown-core/syntax/document-numbering.d.ts +52 -0
- package/dist/markdown-core/syntax/document-numbering.js +184 -0
- package/dist/markdown-core/syntax/elements/CalloutIcon.d.ts +3 -0
- package/dist/markdown-core/syntax/elements/CalloutIcon.js +41 -0
- package/dist/markdown-core/syntax/elements/CrossRef.d.ts +12 -0
- package/dist/markdown-core/syntax/elements/CrossRef.js +57 -0
- package/dist/markdown-core/syntax/elements/CsvFence.d.ts +4 -0
- package/dist/markdown-core/syntax/elements/CsvFence.js +18 -0
- package/dist/markdown-core/syntax/elements/DetailsElements.d.ts +12 -0
- package/dist/markdown-core/syntax/elements/DetailsElements.js +38 -0
- package/dist/markdown-core/syntax/elements/DocumentNumbering.d.ts +20 -0
- package/dist/markdown-core/syntax/elements/DocumentNumbering.js +37 -0
- package/dist/markdown-core/syntax/elements/DocumentPropertiesPanel.d.ts +4 -0
- package/dist/markdown-core/syntax/elements/DocumentPropertiesPanel.js +46 -0
- package/dist/markdown-core/syntax/elements/InDocAnchor.d.ts +11 -0
- package/dist/markdown-core/syntax/elements/InDocAnchor.js +87 -0
- package/dist/markdown-core/syntax/elements/MarkdownSourceEdit.d.ts +24 -0
- package/dist/markdown-core/syntax/elements/MarkdownSourceEdit.js +28 -0
- package/dist/markdown-core/syntax/elements/MatrxTabs.d.ts +10 -0
- package/dist/markdown-core/syntax/elements/MatrxTabs.js +59 -0
- package/dist/markdown-core/syntax/elements/MentionChip.d.ts +7 -0
- package/dist/markdown-core/syntax/elements/MentionChip.js +69 -0
- package/dist/markdown-core/syntax/elements/NestedBody.d.ts +3 -0
- package/dist/markdown-core/syntax/elements/NestedBody.js +13 -0
- package/dist/markdown-core/syntax/elements/TableOfContents.d.ts +5 -0
- package/dist/markdown-core/syntax/elements/TableOfContents.js +44 -0
- package/dist/markdown-core/syntax/elements/TaskCheckbox.d.ts +7 -0
- package/dist/markdown-core/syntax/elements/TaskCheckbox.js +63 -0
- package/dist/markdown-core/syntax/elements/WikiEmbed.d.ts +7 -0
- package/dist/markdown-core/syntax/elements/WikiEmbed.js +68 -0
- package/dist/markdown-core/syntax/elements/WikiLink.d.ts +10 -0
- package/dist/markdown-core/syntax/elements/WikiLink.js +114 -0
- package/dist/markdown-core/syntax/elements/core-syntax-elements.d.ts +22 -0
- package/dist/markdown-core/syntax/elements/core-syntax-elements.js +70 -0
- package/dist/markdown-core/syntax/elements/find-in-document.d.ts +3 -0
- package/dist/markdown-core/syntax/elements/find-in-document.js +20 -0
- package/dist/markdown-core/syntax/elements/wiki-target.d.ts +5 -0
- package/dist/markdown-core/syntax/elements/wiki-target.js +8 -0
- package/dist/markdown-core/syntax/frontmatter.d.ts +26 -0
- package/dist/markdown-core/syntax/frontmatter.js +72 -0
- package/dist/markdown-core/syntax/gfm-cell-pipes.d.ts +11 -0
- package/dist/markdown-core/syntax/gfm-cell-pipes.js +4 -0
- package/dist/markdown-core/syntax/inline-syntax.d.ts +26 -0
- package/dist/markdown-core/syntax/inline-syntax.js +163 -0
- package/dist/markdown-core/syntax/linear-scan.d.ts +46 -0
- package/dist/markdown-core/syntax/linear-scan.js +129 -0
- package/dist/markdown-core/syntax/mdast-helpers.d.ts +48 -0
- package/dist/markdown-core/syntax/mdast-helpers.js +48 -0
- package/dist/markdown-core/syntax/mentions.d.ts +2 -0
- package/dist/markdown-core/syntax/mentions.js +42 -0
- package/dist/markdown-core/syntax/names.d.ts +6 -0
- package/dist/markdown-core/syntax/names.js +18 -0
- package/dist/markdown-core/syntax/prepare-syntax-source.d.ts +1 -0
- package/dist/markdown-core/syntax/prepare-syntax-source.js +78 -0
- package/dist/markdown-core/syntax/rehype-matrx-syntax.d.ts +9 -0
- package/dist/markdown-core/syntax/rehype-matrx-syntax.js +180 -0
- package/dist/markdown-core/syntax/remark-inline-only.d.ts +23 -0
- package/dist/markdown-core/syntax/remark-inline-only.js +25 -0
- package/dist/markdown-core/syntax/remark-matrx-syntax.d.ts +7 -0
- package/dist/markdown-core/syntax/remark-matrx-syntax.js +351 -0
- package/dist/markdown-core/syntax/remark-table-code-pipes.d.ts +7 -0
- package/dist/markdown-core/syntax/remark-table-code-pipes.js +23 -0
- package/dist/markdown-core/syntax/stream-heal-syntax.d.ts +2 -0
- package/dist/markdown-core/syntax/stream-heal-syntax.js +108 -0
- package/dist/markdown-core/syntax/task-source.d.ts +10 -0
- package/dist/markdown-core/syntax/task-source.js +34 -0
- package/dist/markdown-core/syntax/useDocumentProperties.d.ts +3 -0
- package/dist/markdown-core/syntax/useDocumentProperties.js +8 -0
- package/dist/styles.css +0 -0
- package/dist/utils/addressWithoutNavigating.d.ts +68 -0
- package/dist/utils/addressWithoutNavigating.js +60 -0
- package/dist/utils/client-lazy.d.ts +13 -0
- package/dist/utils/client-lazy.js +24 -0
- package/dist/utils/decision-options.d.ts +21 -0
- package/dist/utils/decision-options.js +32 -0
- package/dist/utils/gfm-lexer.d.ts +5 -0
- package/dist/utils/gfm-lexer.js +10 -0
- package/dist/utils/json.d.ts +63 -0
- package/dist/utils/json.js +22 -0
- package/dist/utils/plain-title.d.ts +25 -0
- package/dist/utils/plain-title.js +51 -0
- package/dist/utils/table-source.d.ts +62 -0
- package/dist/utils/table-source.js +191 -0
- package/dist/utils/youtube.d.ts +52 -0
- package/dist/utils/youtube.js +137 -0
- package/package.json +132 -5
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hardcoded kind loading-component library (zero fetch delay). Each
|
|
3
|
+
* accepts the early-key contract (kind-loading.types.ts) and renders a small,
|
|
4
|
+
* enterprise-grade shimmer/skeleton while a kind instance streams in and its
|
|
5
|
+
* schema/component cold-fetch resolves.
|
|
6
|
+
*
|
|
7
|
+
* Rules: semantic tokens for structure, Lucide only, no emojis, no heavy
|
|
8
|
+
* deps — every loader is a handful of divs. Each loader carries ONE accent
|
|
9
|
+
* tone (Arman, 2026-08-24: "everything has a little touch of color so things
|
|
10
|
+
* feel and look alive — not overdoing it"): a tinted icon chip, a tinted
|
|
11
|
+
* spinner, and a faint wash; bodies may tint ONE element class. Selection
|
|
12
|
+
* lives in kind-loading-registry.ts (`kind_definition.metadata.loading_component`).
|
|
13
|
+
*/
|
|
14
|
+
import React from "react";
|
|
15
|
+
import type { KindLoadingProps } from "./kind-loading.types.js";
|
|
16
|
+
type IconComponent = React.ComponentType<{
|
|
17
|
+
className?: string;
|
|
18
|
+
}>;
|
|
19
|
+
/** Icon-hint slugs an emitter may send via the early `icon` key. */
|
|
20
|
+
export declare const ICON_HINTS: Record<string, IconComponent>;
|
|
21
|
+
export declare const CardLoading: React.FC<KindLoadingProps>;
|
|
22
|
+
export declare const ListLoading: React.FC<KindLoadingProps>;
|
|
23
|
+
export declare const TableLoading: React.FC<KindLoadingProps>;
|
|
24
|
+
export declare const TimelineLoading: React.FC<KindLoadingProps>;
|
|
25
|
+
export declare const ChartLoading: React.FC<KindLoadingProps>;
|
|
26
|
+
export declare const DeckLoading: React.FC<KindLoadingProps>;
|
|
27
|
+
export declare const FormLoading: React.FC<KindLoadingProps>;
|
|
28
|
+
export declare const MediaLoading: React.FC<KindLoadingProps>;
|
|
29
|
+
export declare const StatGridLoading: React.FC<KindLoadingProps>;
|
|
30
|
+
export declare const DocumentLoading: React.FC<KindLoadingProps>;
|
|
31
|
+
/** flashcard_set — one big card face, with the deck's pager beneath it. */
|
|
32
|
+
export declare const FlashcardsLoading: React.FC<KindLoadingProps>;
|
|
33
|
+
/** quiz_set — a question, then its answer choices, then the next question. */
|
|
34
|
+
export declare const QuizLoading: React.FC<KindLoadingProps>;
|
|
35
|
+
/** study_notes — an overview paragraph, then headed sections with key points. */
|
|
36
|
+
export declare const NotesLoading: React.FC<KindLoadingProps>;
|
|
37
|
+
export declare const DiagramLoading: React.FC<KindLoadingProps>;
|
|
38
|
+
export declare const ChatLoading: React.FC<KindLoadingProps>;
|
|
39
|
+
export declare const GalleryLoading: React.FC<KindLoadingProps>;
|
|
40
|
+
export declare const KanbanLoading: React.FC<KindLoadingProps>;
|
|
41
|
+
export declare const TreeLoading: React.FC<KindLoadingProps>;
|
|
42
|
+
export declare const CodeLoading: React.FC<KindLoadingProps>;
|
|
43
|
+
export declare const MapLoading: React.FC<KindLoadingProps>;
|
|
44
|
+
export declare const ProgressLoading: React.FC<KindLoadingProps>;
|
|
45
|
+
export declare const MinimalLoading: React.FC<KindLoadingProps>;
|
|
46
|
+
/** The generic default — the early-key-aware successor of the old skeleton. */
|
|
47
|
+
export declare const GenericLoading: React.FC<KindLoadingProps>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {
|
|
6
|
+
BarChart3,
|
|
7
|
+
Code2,
|
|
8
|
+
FileText,
|
|
9
|
+
GalleryHorizontalEnd,
|
|
10
|
+
GitBranch,
|
|
11
|
+
Image as ImageIcon,
|
|
12
|
+
CircleHelp,
|
|
13
|
+
Dot,
|
|
14
|
+
Kanban,
|
|
15
|
+
Layers,
|
|
16
|
+
LayoutGrid,
|
|
17
|
+
ListChecks,
|
|
18
|
+
Loader2,
|
|
19
|
+
NotebookPen,
|
|
20
|
+
Map as MapIcon,
|
|
21
|
+
MessagesSquare,
|
|
22
|
+
Network,
|
|
23
|
+
Presentation,
|
|
24
|
+
Shapes,
|
|
25
|
+
Table as TableIcon,
|
|
26
|
+
TextCursorInput,
|
|
27
|
+
TimerReset,
|
|
28
|
+
TrendingUp
|
|
29
|
+
} from "lucide-react";
|
|
30
|
+
const ICON_HINTS = {
|
|
31
|
+
card: LayoutGrid,
|
|
32
|
+
list: ListChecks,
|
|
33
|
+
table: TableIcon,
|
|
34
|
+
timeline: TimerReset,
|
|
35
|
+
chart: BarChart3,
|
|
36
|
+
deck: Presentation,
|
|
37
|
+
form: TextCursorInput,
|
|
38
|
+
media: ImageIcon,
|
|
39
|
+
stats: TrendingUp,
|
|
40
|
+
document: FileText,
|
|
41
|
+
diagram: Network,
|
|
42
|
+
chat: MessagesSquare,
|
|
43
|
+
gallery: GalleryHorizontalEnd,
|
|
44
|
+
kanban: Kanban,
|
|
45
|
+
tree: GitBranch,
|
|
46
|
+
code: Code2,
|
|
47
|
+
map: MapIcon,
|
|
48
|
+
shapes: Shapes
|
|
49
|
+
};
|
|
50
|
+
const TONES = {
|
|
51
|
+
violet: {
|
|
52
|
+
chip: "bg-violet-500/10",
|
|
53
|
+
icon: "text-violet-600 dark:text-violet-400",
|
|
54
|
+
spin: "text-violet-500",
|
|
55
|
+
wash: "bg-gradient-to-br from-violet-500/[0.05] via-card/50 to-card/50"
|
|
56
|
+
},
|
|
57
|
+
sky: {
|
|
58
|
+
chip: "bg-sky-500/10",
|
|
59
|
+
icon: "text-sky-600 dark:text-sky-400",
|
|
60
|
+
spin: "text-sky-500",
|
|
61
|
+
wash: "bg-gradient-to-br from-sky-500/[0.05] via-card/50 to-card/50"
|
|
62
|
+
},
|
|
63
|
+
indigo: {
|
|
64
|
+
chip: "bg-indigo-500/10",
|
|
65
|
+
icon: "text-indigo-600 dark:text-indigo-400",
|
|
66
|
+
spin: "text-indigo-500",
|
|
67
|
+
wash: "bg-gradient-to-br from-indigo-500/[0.05] via-card/50 to-card/50"
|
|
68
|
+
},
|
|
69
|
+
amber: {
|
|
70
|
+
chip: "bg-amber-500/10",
|
|
71
|
+
icon: "text-amber-600 dark:text-amber-400",
|
|
72
|
+
spin: "text-amber-500",
|
|
73
|
+
wash: "bg-gradient-to-br from-amber-500/[0.05] via-card/50 to-card/50"
|
|
74
|
+
},
|
|
75
|
+
emerald: {
|
|
76
|
+
chip: "bg-emerald-500/10",
|
|
77
|
+
icon: "text-emerald-600 dark:text-emerald-400",
|
|
78
|
+
spin: "text-emerald-500",
|
|
79
|
+
wash: "bg-gradient-to-br from-emerald-500/[0.05] via-card/50 to-card/50"
|
|
80
|
+
},
|
|
81
|
+
fuchsia: {
|
|
82
|
+
chip: "bg-fuchsia-500/10",
|
|
83
|
+
icon: "text-fuchsia-600 dark:text-fuchsia-400",
|
|
84
|
+
spin: "text-fuchsia-500",
|
|
85
|
+
wash: "bg-gradient-to-br from-fuchsia-500/[0.05] via-card/50 to-card/50"
|
|
86
|
+
},
|
|
87
|
+
blue: {
|
|
88
|
+
chip: "bg-blue-500/10",
|
|
89
|
+
icon: "text-blue-600 dark:text-blue-400",
|
|
90
|
+
spin: "text-blue-500",
|
|
91
|
+
wash: "bg-gradient-to-br from-blue-500/[0.05] via-card/50 to-card/50"
|
|
92
|
+
},
|
|
93
|
+
teal: {
|
|
94
|
+
chip: "bg-teal-500/10",
|
|
95
|
+
icon: "text-teal-600 dark:text-teal-400",
|
|
96
|
+
spin: "text-teal-500",
|
|
97
|
+
wash: "bg-gradient-to-br from-teal-500/[0.05] via-card/50 to-card/50"
|
|
98
|
+
},
|
|
99
|
+
cyan: {
|
|
100
|
+
chip: "bg-cyan-500/10",
|
|
101
|
+
icon: "text-cyan-600 dark:text-cyan-400",
|
|
102
|
+
spin: "text-cyan-500",
|
|
103
|
+
wash: "bg-gradient-to-br from-cyan-500/[0.05] via-card/50 to-card/50"
|
|
104
|
+
},
|
|
105
|
+
pink: {
|
|
106
|
+
chip: "bg-pink-500/10",
|
|
107
|
+
icon: "text-pink-600 dark:text-pink-400",
|
|
108
|
+
spin: "text-pink-500",
|
|
109
|
+
wash: "bg-gradient-to-br from-pink-500/[0.05] via-card/50 to-card/50"
|
|
110
|
+
},
|
|
111
|
+
orange: {
|
|
112
|
+
chip: "bg-orange-500/10",
|
|
113
|
+
icon: "text-orange-600 dark:text-orange-400",
|
|
114
|
+
spin: "text-orange-500",
|
|
115
|
+
wash: "bg-gradient-to-br from-orange-500/[0.05] via-card/50 to-card/50"
|
|
116
|
+
},
|
|
117
|
+
lime: {
|
|
118
|
+
chip: "bg-lime-500/10",
|
|
119
|
+
icon: "text-lime-600 dark:text-lime-500",
|
|
120
|
+
spin: "text-lime-500",
|
|
121
|
+
wash: "bg-gradient-to-br from-lime-500/[0.05] via-card/50 to-card/50"
|
|
122
|
+
},
|
|
123
|
+
rose: {
|
|
124
|
+
chip: "bg-rose-500/10",
|
|
125
|
+
icon: "text-rose-600 dark:text-rose-400",
|
|
126
|
+
spin: "text-rose-500",
|
|
127
|
+
wash: "bg-gradient-to-br from-rose-500/[0.05] via-card/50 to-card/50"
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function clampCount(count, fallback, max = 8) {
|
|
131
|
+
if (count === void 0) return fallback;
|
|
132
|
+
return Math.max(1, Math.min(max, Math.round(count)));
|
|
133
|
+
}
|
|
134
|
+
const PhaseContext = React.createContext("arriving");
|
|
135
|
+
function useReserved() {
|
|
136
|
+
return React.useContext(PhaseContext) === "reserved";
|
|
137
|
+
}
|
|
138
|
+
function pulse(p) {
|
|
139
|
+
return p.phase === "reserved" ? "" : "animate-pulse";
|
|
140
|
+
}
|
|
141
|
+
const Sk = ({ className }) => {
|
|
142
|
+
const reserved = useReserved();
|
|
143
|
+
return /* @__PURE__ */ jsx(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: `rounded ${reserved ? "bg-muted/60" : "animate-pulse bg-muted"} ${className ?? ""}`
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
const Reveal = ({
|
|
151
|
+
text,
|
|
152
|
+
className
|
|
153
|
+
}) => /* @__PURE__ */ jsx("span", { className: `animate-[fade-in_0.6s_ease-out] ${className ?? ""}`, children: text }, text);
|
|
154
|
+
const Shell = ({
|
|
155
|
+
kind,
|
|
156
|
+
phase = "arriving",
|
|
157
|
+
chrome = "full",
|
|
158
|
+
title,
|
|
159
|
+
description,
|
|
160
|
+
loadingMessage,
|
|
161
|
+
loadingSubtext,
|
|
162
|
+
icon,
|
|
163
|
+
defaultIcon,
|
|
164
|
+
tone = "violet",
|
|
165
|
+
children
|
|
166
|
+
}) => {
|
|
167
|
+
const Icon = icon && ICON_HINTS[icon] || defaultIcon;
|
|
168
|
+
const t = TONES[tone];
|
|
169
|
+
const reserved = phase === "reserved";
|
|
170
|
+
if (chrome === "bare") {
|
|
171
|
+
return /* @__PURE__ */ jsx(PhaseContext.Provider, { value: phase, children: /* @__PURE__ */ jsx(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
"data-kind-loading": kind ?? "unknown",
|
|
175
|
+
"data-kind-loading-phase": phase,
|
|
176
|
+
className: reserved ? "animate-[kind-slot-breathe_3.2s_ease-in-out_infinite]" : void 0,
|
|
177
|
+
children
|
|
178
|
+
}
|
|
179
|
+
) });
|
|
180
|
+
}
|
|
181
|
+
const heading = title ?? loadingMessage;
|
|
182
|
+
const sub = title ? loadingMessage ?? description : description ?? loadingSubtext;
|
|
183
|
+
return /* @__PURE__ */ jsx(PhaseContext.Provider, { value: phase, children: /* @__PURE__ */ jsxs(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: `my-3 rounded-lg border p-4 ${// A placeholder reads as a reserved SLOT, not as a live region: a
|
|
187
|
+
// dashed edge says "something belongs here" the way an empty frame
|
|
188
|
+
// does, and it becomes solid the moment content starts arriving.
|
|
189
|
+
reserved ? "border-dashed border-border/70 bg-card/40" : `border-border ${t.wash}`}`,
|
|
190
|
+
"aria-busy": reserved ? void 0 : "true",
|
|
191
|
+
role: "status",
|
|
192
|
+
"data-kind-loading": kind ?? "unknown",
|
|
193
|
+
"data-kind-loading-phase": phase,
|
|
194
|
+
children: [
|
|
195
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-start gap-2.5", children: [
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
className: `mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md ${t.chip} ${// Alive, but calm — one slow breath rather than a pulse. This is
|
|
200
|
+
// the podcast placeholder's proven move: a single gently moving
|
|
201
|
+
// element, everything else still.
|
|
202
|
+
reserved ? "animate-[kind-slot-breathe_3.2s_ease-in-out_infinite]" : ""}`,
|
|
203
|
+
children: /* @__PURE__ */ jsx(Icon, { className: `h-4 w-4 ${t.icon}` })
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
207
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-5 items-center gap-2", children: [
|
|
208
|
+
heading ? /* @__PURE__ */ jsx(
|
|
209
|
+
Reveal,
|
|
210
|
+
{
|
|
211
|
+
text: heading,
|
|
212
|
+
className: `truncate text-sm font-medium ${reserved ? "text-muted-foreground" : "text-foreground"}`
|
|
213
|
+
}
|
|
214
|
+
) : reserved ? /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-muted-foreground", children: kind ? formatKindLabel(kind) : "Coming up" }) : /* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-40" }),
|
|
215
|
+
reserved ? null : /* @__PURE__ */ jsx(Loader2, { className: `h-3 w-3 shrink-0 animate-spin ${t.spin}` })
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 min-h-4 truncate text-xs text-muted-foreground", children: reserved ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70", children: "Coming up" }) : sub ? /* @__PURE__ */ jsx(Reveal, { text: sub }) : null }),
|
|
218
|
+
loadingSubtext && !reserved && sub !== loadingSubtext ? /* @__PURE__ */ jsx("p", { className: "mt-0.5 truncate text-xs text-muted-foreground/70", children: /* @__PURE__ */ jsx(Reveal, { text: loadingSubtext }) }) : null
|
|
219
|
+
] })
|
|
220
|
+
] }),
|
|
221
|
+
children
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
) });
|
|
225
|
+
};
|
|
226
|
+
function formatKindLabel(kind) {
|
|
227
|
+
return humanizeIdentifier(kind) || kind;
|
|
228
|
+
}
|
|
229
|
+
const CardLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: LayoutGrid, tone: "violet", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-2/3" }),
|
|
231
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-1/2" }),
|
|
232
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 pt-1", children: [
|
|
233
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-5 w-16 rounded-full bg-violet-500/15" }),
|
|
234
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-5 w-20 rounded-full" })
|
|
235
|
+
] })
|
|
236
|
+
] }) });
|
|
237
|
+
const ListLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: ListChecks, tone: "sky", children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Array.from({ length: clampCount(p.count, 4) }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
238
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-3.5 rounded-sm bg-sky-500/20" }),
|
|
239
|
+
/* @__PURE__ */ jsx(Sk, { className: `h-3 ${i % 2 ? "w-1/2" : "w-2/3"}` })
|
|
240
|
+
] }, i)) }) });
|
|
241
|
+
const TableLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: TableIcon, tone: "indigo", children: /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border border-border/60", children: [
|
|
242
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-px bg-indigo-500/10 p-2", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx(Sk, { className: "h-3 flex-1 bg-indigo-500/20" }, i)) }),
|
|
243
|
+
Array.from({ length: clampCount(p.count, 3, 6) }).map((_, r) => /* @__PURE__ */ jsx("div", { className: "flex gap-px border-t border-border/40 p-2", children: [0, 1, 2, 3].map((c) => /* @__PURE__ */ jsx(Sk, { className: "h-2.5 flex-1" }, c)) }, r))
|
|
244
|
+
] }) });
|
|
245
|
+
const TimelineLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: TimerReset, tone: "amber", children: /* @__PURE__ */ jsx("div", { className: "space-y-3 pl-1", children: Array.from({ length: clampCount(p.count, 4, 6) }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
246
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-2.5 rounded-full bg-amber-500/40" }),
|
|
248
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 h-6 w-px bg-amber-500/25" })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
251
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-1/3" }),
|
|
252
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-2/3" })
|
|
253
|
+
] })
|
|
254
|
+
] }, i)) }) });
|
|
255
|
+
const ChartLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: BarChart3, tone: "emerald", children: /* @__PURE__ */ jsx("div", { className: "flex h-24 items-end gap-2 px-1", children: [40, 70, 55, 90, 62, 78, 45].map((h, i) => /* @__PURE__ */ jsx(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: `flex-1 rounded-t ${pulse(p)} ${i % 2 ? "bg-emerald-500/20" : "bg-emerald-500/30"}`,
|
|
259
|
+
style: { height: `${h}%` }
|
|
260
|
+
},
|
|
261
|
+
i
|
|
262
|
+
)) }) });
|
|
263
|
+
const DeckLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Presentation, tone: "fuchsia", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
264
|
+
/* @__PURE__ */ jsxs("div", { className: "aspect-video flex-[3] space-y-2 rounded-md border border-fuchsia-500/25 bg-fuchsia-500/[0.04] p-3", children: [
|
|
265
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-1/2 bg-fuchsia-500/20" }),
|
|
266
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-3/4" }),
|
|
267
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-2/3" })
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-2", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx(Sk, { className: "aspect-video w-full rounded-md" }, i)) })
|
|
270
|
+
] }) });
|
|
271
|
+
const FormLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: TextCursorInput, tone: "cyan", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: clampCount(p.count, 3, 5) }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
272
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-24 bg-cyan-500/20" }),
|
|
273
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-8 w-full rounded-md" })
|
|
274
|
+
] }, i)) }) });
|
|
275
|
+
const MediaLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: ImageIcon, tone: "pink", children: /* @__PURE__ */ jsx("div", { className: "flex aspect-video w-full items-center justify-center rounded-md bg-gradient-to-br from-pink-500/10 via-muted/60 to-muted/60", children: /* @__PURE__ */ jsx(ImageIcon, { className: `h-6 w-6 ${pulse(p)} text-pink-500/50` }) }) });
|
|
276
|
+
const StatGridLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: TrendingUp, tone: "lime", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2 sm:grid-cols-4", children: Array.from({ length: clampCount(p.count, 4, 8) }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 rounded-md border border-border/60 p-3", children: [
|
|
277
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-14" }),
|
|
278
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-5 w-10 bg-lime-500/25" })
|
|
279
|
+
] }, i)) }) });
|
|
280
|
+
const DocumentLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: FileText, tone: "orange", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
281
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-1/3 bg-orange-500/20" }),
|
|
282
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-full" }),
|
|
283
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-11/12" }),
|
|
284
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-4/5" }),
|
|
285
|
+
/* @__PURE__ */ jsx(Sk, { className: "mt-3 h-3.5 w-1/4 bg-orange-500/20" }),
|
|
286
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-full" }),
|
|
287
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-3/4" })
|
|
288
|
+
] }) });
|
|
289
|
+
const FlashcardsLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Layers, tone: "violet", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2.5", children: [
|
|
290
|
+
/* @__PURE__ */ jsxs("div", { className: "flex aspect-[16/9] w-full flex-col items-center justify-center gap-2 rounded-lg border border-violet-500/25 bg-violet-500/[0.04] p-4", children: [
|
|
291
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-2/5" }),
|
|
292
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-3/5" })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-1.5", children: Array.from({ length: clampCount(p.count, 5, 8) }).map((_, i) => /* @__PURE__ */ jsx(
|
|
295
|
+
Sk,
|
|
296
|
+
{
|
|
297
|
+
className: `h-1.5 w-1.5 rounded-full ${i === 0 ? "bg-violet-500/50" : ""}`
|
|
298
|
+
},
|
|
299
|
+
i
|
|
300
|
+
)) })
|
|
301
|
+
] }) });
|
|
302
|
+
const QuizLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: CircleHelp, tone: "blue", children: /* @__PURE__ */ jsx("div", { className: "space-y-4", children: Array.from({ length: clampCount(p.count, 2, 4) }).map((_, q) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
303
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
304
|
+
/* @__PURE__ */ jsx(Sk, { className: "mt-0.5 h-4 w-4 shrink-0 rounded-full bg-blue-500/25" }),
|
|
305
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-3/4" })
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1.5 pl-6", children: [0, 1, 2, 3].map((o) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
308
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-3 shrink-0 rounded-full bg-blue-500/15" }),
|
|
309
|
+
/* @__PURE__ */ jsx(Sk, { className: `h-2.5 ${["w-2/3", "w-1/2", "w-3/5", "w-5/12"][o]}` })
|
|
310
|
+
] }, o)) })
|
|
311
|
+
] }, q)) }) });
|
|
312
|
+
const NotesLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: NotebookPen, tone: "teal", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
313
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
314
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-full" }),
|
|
315
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-11/12" }),
|
|
316
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-3/4" })
|
|
317
|
+
] }),
|
|
318
|
+
Array.from({ length: clampCount(p.count, 2, 4) }).map((_, section) => /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
319
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-1/3 bg-teal-500/20" }),
|
|
320
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-full" }),
|
|
321
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 pl-4", children: [0, 1, 2].map((point) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-teal-500/40" }),
|
|
323
|
+
/* @__PURE__ */ jsx(Sk, { className: `h-2.5 ${["w-3/4", "w-2/3", "w-4/5"][point]}` })
|
|
324
|
+
] }, point)) })
|
|
325
|
+
] }, section))
|
|
326
|
+
] }) });
|
|
327
|
+
const DiagramLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Network, tone: "indigo", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 py-2", children: [
|
|
328
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-8 w-28 rounded-md bg-indigo-500/15" }),
|
|
329
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-indigo-500/30" }),
|
|
330
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
331
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-8 w-24 rounded-md" }),
|
|
332
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-8 w-24 rounded-md" })
|
|
333
|
+
] })
|
|
334
|
+
] }) });
|
|
335
|
+
const ChatLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: MessagesSquare, tone: "sky", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
336
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-start", children: /* @__PURE__ */ jsx(Sk, { className: "h-8 w-1/2 rounded-lg rounded-bl-sm" }) }),
|
|
337
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Sk, { className: "h-8 w-2/5 rounded-lg rounded-br-sm bg-sky-500/15" }) }),
|
|
338
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-start", children: /* @__PURE__ */ jsx(Sk, { className: "h-8 w-3/5 rounded-lg rounded-bl-sm" }) })
|
|
339
|
+
] }) });
|
|
340
|
+
const GalleryLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: GalleryHorizontalEnd, tone: "pink", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-2", children: Array.from({ length: clampCount(p.count, 6, 9) }).map((_, i) => /* @__PURE__ */ jsx(
|
|
341
|
+
Sk,
|
|
342
|
+
{
|
|
343
|
+
className: `aspect-square w-full rounded-md ${i === 0 ? "bg-pink-500/15" : ""}`
|
|
344
|
+
},
|
|
345
|
+
i
|
|
346
|
+
)) }) });
|
|
347
|
+
const KanbanLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Kanban, tone: "amber", children: /* @__PURE__ */ jsx("div", { className: "flex gap-2", children: [0, 1, 2].map((col) => /* @__PURE__ */ jsxs(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
className: `flex-1 space-y-2 rounded-md p-2 ${col === 0 ? "bg-amber-500/10" : "bg-muted/40"}`,
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-16" }),
|
|
353
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-10 w-full rounded-md" }),
|
|
354
|
+
col !== 2 ? /* @__PURE__ */ jsx(Sk, { className: "h-10 w-full rounded-md" }) : null
|
|
355
|
+
]
|
|
356
|
+
},
|
|
357
|
+
col
|
|
358
|
+
)) }) });
|
|
359
|
+
const TreeLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: GitBranch, tone: "emerald", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
360
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
361
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-3.5 rounded-sm bg-emerald-500/25" }),
|
|
362
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-1/3" })
|
|
363
|
+
] }),
|
|
364
|
+
[0, 1].map((i) => /* @__PURE__ */ jsxs("div", { className: "ml-5 flex items-center gap-2", children: [
|
|
365
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-3.5 rounded-sm bg-emerald-500/15" }),
|
|
366
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-2/5" })
|
|
367
|
+
] }, i)),
|
|
368
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-10 flex items-center gap-2", children: [
|
|
369
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3.5 w-3.5 rounded-sm" }),
|
|
370
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-3 w-1/4" })
|
|
371
|
+
] })
|
|
372
|
+
] }) });
|
|
373
|
+
const CodeLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Code2, tone: "cyan", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 rounded-md bg-muted/40 p-3 font-mono", children: [
|
|
374
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-1/3 bg-cyan-500/25" }),
|
|
375
|
+
/* @__PURE__ */ jsx(Sk, { className: "ml-4 h-2.5 w-1/2" }),
|
|
376
|
+
/* @__PURE__ */ jsx(Sk, { className: "ml-4 h-2.5 w-2/5 bg-fuchsia-500/15" }),
|
|
377
|
+
/* @__PURE__ */ jsx(Sk, { className: "ml-8 h-2.5 w-1/3" }),
|
|
378
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-1/6 bg-cyan-500/25" })
|
|
379
|
+
] }) });
|
|
380
|
+
const MapLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: MapIcon, tone: "emerald", children: /* @__PURE__ */ jsxs("div", { className: "relative flex aspect-[2/1] w-full items-center justify-center overflow-hidden rounded-md bg-gradient-to-br from-emerald-500/10 via-muted/50 to-muted/50", children: [
|
|
381
|
+
/* @__PURE__ */ jsx(MapIcon, { className: `h-6 w-6 ${pulse(p)} text-emerald-500/50` }),
|
|
382
|
+
/* @__PURE__ */ jsx(Sk, { className: "absolute left-1/4 top-1/3 h-2.5 w-2.5 rounded-full bg-rose-500/50" }),
|
|
383
|
+
/* @__PURE__ */ jsx(Sk, { className: "absolute right-1/3 top-1/2 h-2.5 w-2.5 rounded-full bg-rose-500/40" }),
|
|
384
|
+
/* @__PURE__ */ jsx(Sk, { className: "absolute bottom-1/4 left-1/2 h-2.5 w-2.5 rounded-full bg-rose-500/30" })
|
|
385
|
+
] }) });
|
|
386
|
+
const ProgressLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: TrendingUp, tone: "blue", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: clampCount(p.count, 3, 5) }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
387
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
388
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-24" }),
|
|
389
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-8" })
|
|
390
|
+
] }),
|
|
391
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-full overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx(
|
|
392
|
+
"div",
|
|
393
|
+
{
|
|
394
|
+
className: `h-full rounded-full bg-blue-500/40 ${pulse(p)}`,
|
|
395
|
+
style: { width: `${[62, 38, 80, 25, 55][i % 5]}%` }
|
|
396
|
+
}
|
|
397
|
+
) })
|
|
398
|
+
] }, i)) }) });
|
|
399
|
+
const MinimalLoading = (p) => {
|
|
400
|
+
const reserved = p.phase === "reserved";
|
|
401
|
+
const label = p.title ?? p.loadingMessage;
|
|
402
|
+
return /* @__PURE__ */ jsx(PhaseContext.Provider, { value: p.phase ?? "arriving", children: /* @__PURE__ */ jsxs(
|
|
403
|
+
"div",
|
|
404
|
+
{
|
|
405
|
+
className: `my-2 inline-flex items-center gap-2 rounded-md border px-3 py-1.5 ${reserved ? "border-dashed border-border/70 bg-card/40" : "border-border bg-card/50"}`,
|
|
406
|
+
"aria-busy": reserved ? void 0 : "true",
|
|
407
|
+
role: "status",
|
|
408
|
+
"data-kind-loading": p.kind ?? "unknown",
|
|
409
|
+
"data-kind-loading-phase": p.phase ?? "arriving",
|
|
410
|
+
children: [
|
|
411
|
+
reserved ? /* @__PURE__ */ jsx(Dot, { className: "h-3 w-3 animate-[kind-slot-breathe_3.2s_ease-in-out_infinite] text-violet-500/70" }) : /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin text-violet-500" }),
|
|
412
|
+
label ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: label }) : reserved ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Coming up" }) : /* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-28" })
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
) });
|
|
416
|
+
};
|
|
417
|
+
const GenericLoading = (p) => /* @__PURE__ */ jsx(Shell, { ...p, defaultIcon: Shapes, tone: "violet", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
418
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-2/3" }),
|
|
419
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-1/2 bg-violet-500/10" }),
|
|
420
|
+
/* @__PURE__ */ jsx(Sk, { className: "h-2.5 w-5/6" })
|
|
421
|
+
] }) });
|
|
422
|
+
export {
|
|
423
|
+
CardLoading,
|
|
424
|
+
ChartLoading,
|
|
425
|
+
ChatLoading,
|
|
426
|
+
CodeLoading,
|
|
427
|
+
DeckLoading,
|
|
428
|
+
DiagramLoading,
|
|
429
|
+
DocumentLoading,
|
|
430
|
+
FlashcardsLoading,
|
|
431
|
+
FormLoading,
|
|
432
|
+
GalleryLoading,
|
|
433
|
+
GenericLoading,
|
|
434
|
+
ICON_HINTS,
|
|
435
|
+
KanbanLoading,
|
|
436
|
+
ListLoading,
|
|
437
|
+
MapLoading,
|
|
438
|
+
MediaLoading,
|
|
439
|
+
MinimalLoading,
|
|
440
|
+
NotesLoading,
|
|
441
|
+
ProgressLoading,
|
|
442
|
+
QuizLoading,
|
|
443
|
+
StatGridLoading,
|
|
444
|
+
TableLoading,
|
|
445
|
+
TimelineLoading,
|
|
446
|
+
TreeLoading
|
|
447
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kind loading-component registry — slug → hardcoded loader.
|
|
3
|
+
*
|
|
4
|
+
* Selection: `kind_definition.metadata.loading_component` names one of these
|
|
5
|
+
* slugs; missing/unknown slugs resolve to the `generic` skeleton. The studio
|
|
6
|
+
* / creator agent sets the slug at authoring time; this module only READS it.
|
|
7
|
+
*
|
|
8
|
+
* The library is intentionally hardcoded (zero fetch delay — it must render
|
|
9
|
+
* the instant a cloud kind is identified, before any DB answer) and light.
|
|
10
|
+
* Growing it = add the component in kind-loading-components.tsx + one row
|
|
11
|
+
* here + document the slug in SHAPE_SYSTEM.md.
|
|
12
|
+
*/
|
|
13
|
+
import type React from "react";
|
|
14
|
+
import type { KindLoadingProps } from "./kind-loading.types.js";
|
|
15
|
+
export { DEFAULT_KIND_LOADING_SLUG, KIND_LOADING_SLUGS } from "./kind-loading-slugs.js";
|
|
16
|
+
export declare const KIND_LOADING_COMPONENTS: Readonly<Record<string, React.ComponentType<KindLoadingProps>>>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a loading component: the kind's declared slug, else the generic
|
|
19
|
+
* default. Never null — the loading layer must always have something to show.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveKindLoadingComponent(slug: string | null | undefined): React.ComponentType<KindLoadingProps>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CardLoading,
|
|
4
|
+
ChartLoading,
|
|
5
|
+
ChatLoading,
|
|
6
|
+
CodeLoading,
|
|
7
|
+
DeckLoading,
|
|
8
|
+
DiagramLoading,
|
|
9
|
+
DocumentLoading,
|
|
10
|
+
FlashcardsLoading,
|
|
11
|
+
FormLoading,
|
|
12
|
+
GalleryLoading,
|
|
13
|
+
GenericLoading,
|
|
14
|
+
KanbanLoading,
|
|
15
|
+
ListLoading,
|
|
16
|
+
MapLoading,
|
|
17
|
+
MediaLoading,
|
|
18
|
+
MinimalLoading,
|
|
19
|
+
NotesLoading,
|
|
20
|
+
ProgressLoading,
|
|
21
|
+
QuizLoading,
|
|
22
|
+
StatGridLoading,
|
|
23
|
+
TableLoading,
|
|
24
|
+
TimelineLoading,
|
|
25
|
+
TreeLoading
|
|
26
|
+
} from "./kind-loading-components.js";
|
|
27
|
+
import { DEFAULT_KIND_LOADING_SLUG, KIND_LOADING_SLUGS } from "./kind-loading-slugs.js";
|
|
28
|
+
const KIND_LOADING_COMPONENTS_EXACT = {
|
|
29
|
+
card: CardLoading,
|
|
30
|
+
list: ListLoading,
|
|
31
|
+
table: TableLoading,
|
|
32
|
+
timeline: TimelineLoading,
|
|
33
|
+
chart: ChartLoading,
|
|
34
|
+
deck: DeckLoading,
|
|
35
|
+
flashcards: FlashcardsLoading,
|
|
36
|
+
quiz: QuizLoading,
|
|
37
|
+
notes: NotesLoading,
|
|
38
|
+
form: FormLoading,
|
|
39
|
+
media: MediaLoading,
|
|
40
|
+
"stat-grid": StatGridLoading,
|
|
41
|
+
document: DocumentLoading,
|
|
42
|
+
diagram: DiagramLoading,
|
|
43
|
+
chat: ChatLoading,
|
|
44
|
+
gallery: GalleryLoading,
|
|
45
|
+
kanban: KanbanLoading,
|
|
46
|
+
tree: TreeLoading,
|
|
47
|
+
code: CodeLoading,
|
|
48
|
+
map: MapLoading,
|
|
49
|
+
progress: ProgressLoading,
|
|
50
|
+
minimal: MinimalLoading,
|
|
51
|
+
generic: GenericLoading
|
|
52
|
+
};
|
|
53
|
+
const KIND_LOADING_COMPONENTS = KIND_LOADING_COMPONENTS_EXACT;
|
|
54
|
+
function resolveKindLoadingComponent(slug) {
|
|
55
|
+
return (slug ? KIND_LOADING_COMPONENTS[slug] : void 0) ?? GenericLoading;
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
DEFAULT_KIND_LOADING_SLUG,
|
|
59
|
+
KIND_LOADING_COMPONENTS,
|
|
60
|
+
KIND_LOADING_SLUGS,
|
|
61
|
+
resolveKindLoadingComponent
|
|
62
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kind loading-component LIBRARY SLUGS — the pure half of the loading
|
|
3
|
+
* registry, importable anywhere (shape doctor, CLI, server) without pulling
|
|
4
|
+
* React or the components themselves.
|
|
5
|
+
*
|
|
6
|
+
* ONE SOURCE OF TRUTH: `kind-loading-registry.ts` types its component map as
|
|
7
|
+
* `Record<KindLoadingSlug, …>`, so a slug added here without a component (or
|
|
8
|
+
* vice versa) is a compile error, never silent drift.
|
|
9
|
+
*
|
|
10
|
+
* A `kind_definition.metadata.loading_component` (or a compiled definition's
|
|
11
|
+
* `loadingComponent`) naming a slug NOT in this list silently falls back to
|
|
12
|
+
* the `generic` skeleton at runtime — that is the defect the shape doctor's
|
|
13
|
+
* `loading` column screams about (`unknown-loading-component`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const KIND_LOADING_SLUGS: readonly ["card", "list", "table", "timeline", "chart", "deck", "flashcards", "quiz", "notes", "form", "media", "stat-grid", "document", "diagram", "chat", "gallery", "kanban", "tree", "code", "map", "progress", "minimal", "generic"];
|
|
16
|
+
export type KindLoadingSlug = (typeof KIND_LOADING_SLUGS)[number];
|
|
17
|
+
export declare const DEFAULT_KIND_LOADING_SLUG: "generic";
|
|
18
|
+
export declare function isKnownKindLoadingSlug(slug: string): slug is KindLoadingSlug;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const KIND_LOADING_SLUGS = [
|
|
2
|
+
"card",
|
|
3
|
+
"list",
|
|
4
|
+
"table",
|
|
5
|
+
"timeline",
|
|
6
|
+
"chart",
|
|
7
|
+
"deck",
|
|
8
|
+
"flashcards",
|
|
9
|
+
"quiz",
|
|
10
|
+
"notes",
|
|
11
|
+
"form",
|
|
12
|
+
"media",
|
|
13
|
+
"stat-grid",
|
|
14
|
+
"document",
|
|
15
|
+
"diagram",
|
|
16
|
+
"chat",
|
|
17
|
+
"gallery",
|
|
18
|
+
"kanban",
|
|
19
|
+
"tree",
|
|
20
|
+
"code",
|
|
21
|
+
"map",
|
|
22
|
+
"progress",
|
|
23
|
+
"minimal",
|
|
24
|
+
"generic"
|
|
25
|
+
];
|
|
26
|
+
const DEFAULT_KIND_LOADING_SLUG = "generic";
|
|
27
|
+
function isKnownKindLoadingSlug(slug) {
|
|
28
|
+
return KIND_LOADING_SLUGS.includes(slug);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
DEFAULT_KIND_LOADING_SLUG,
|
|
32
|
+
KIND_LOADING_SLUGS,
|
|
33
|
+
isKnownKindLoadingSlug
|
|
34
|
+
};
|