@metamorph-labs/polymorph-vue-ui 1.0.16 → 1.0.17
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 +134 -0
- package/dist/ai/ArtifactPane.js.map +1 -1
- package/dist/ai/ArtifactPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/archetypes/MasterDetailPage.js.map +1 -1
- package/dist/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/archetypes/app-shell.css +1 -1
- package/dist/archetypes/app-shell.module.js +2 -2
- package/dist/archetypes/app-shell.module.js.map +1 -1
- package/dist/controls/RichTextInput.js +7 -0
- package/dist/controls/RichTextInput.js.map +1 -0
- package/dist/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js +1123 -0
- package/dist/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/controls/rich-text-input.css +1 -0
- package/dist/controls/rich-text-input.module.js +47 -0
- package/dist/controls/rich-text-input.module.js.map +1 -0
- package/dist/controls/selection-bar.css +1 -0
- package/dist/controls/selection-bar.module.js +11 -0
- package/dist/controls/selection-bar.module.js.map +1 -0
- package/dist/index.js +41 -39
- package/dist/index.js.map +1 -1
- package/dist/node/ai/ArtifactPane.js.map +1 -1
- package/dist/node/ai/ArtifactPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/archetypes/MasterDetailPage.js.map +1 -1
- package/dist/node/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/node/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/archetypes/app-shell.module.js +2 -2
- package/dist/node/archetypes/app-shell.module.js.map +1 -1
- package/dist/node/controls/RichTextInput.js +7 -0
- package/dist/node/controls/RichTextInput.js.map +1 -0
- package/dist/node/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js +1123 -0
- package/dist/node/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/node/controls/rich-text-input.module.js +46 -0
- package/dist/node/controls/rich-text-input.module.js.map +1 -0
- package/dist/node/controls/selection-bar.module.js +10 -0
- package/dist/node/controls/selection-bar.module.js.map +1 -0
- package/dist/node/index.js +41 -39
- package/dist/node/index.js.map +1 -1
- package/dist/node/overlays/Toast.js.map +1 -1
- package/dist/node/overlays/Toast.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/node/overlays/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/Accordion.js.map +1 -1
- package/dist/node/structure/Accordion.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/node/structure/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/Collapsible.js.map +1 -1
- package/dist/node/structure/Collapsible.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/node/structure/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/CursorPagination.js.map +1 -1
- package/dist/node/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js +140 -93
- package/dist/node/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/Image.js.map +1 -1
- package/dist/node/structure/Image.vue_vue_type_script_setup_true_lang.js +30 -18
- package/dist/node/structure/Image.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/Pagination.js.map +1 -1
- package/dist/node/structure/Pagination.vue_vue_type_script_setup_true_lang.js +124 -71
- package/dist/node/structure/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/node/structure/RichTextContent.js +7 -0
- package/dist/node/structure/RichTextContent.js.map +1 -0
- package/dist/node/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js +298 -0
- package/dist/node/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/node/structure/RichTextContentBlocks.js +7 -0
- package/dist/node/structure/RichTextContentBlocks.js.map +1 -0
- package/dist/node/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/node/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/node/structure/RichTextContentInlines.js +7 -0
- package/dist/node/structure/RichTextContentInlines.js.map +1 -0
- package/dist/node/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/node/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/node/structure/RichTextContentItem.js +7 -0
- package/dist/node/structure/RichTextContentItem.js.map +1 -0
- package/dist/node/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/node/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/node/structure/code-block.module.js +2 -2
- package/dist/node/structure/code-block.module.js.map +1 -1
- package/dist/node/structure/cursor-pagination.module.js +6 -3
- package/dist/node/structure/cursor-pagination.module.js.map +1 -1
- package/dist/node/structure/pagination.module.js +6 -3
- package/dist/node/structure/pagination.module.js.map +1 -1
- package/dist/node/structure/rich-text-content.module.js +18 -0
- package/dist/node/structure/rich-text-content.module.js.map +1 -0
- package/dist/overlays/Toast.js.map +1 -1
- package/dist/overlays/Toast.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/overlays/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/Accordion.js.map +1 -1
- package/dist/structure/Accordion.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/structure/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/Collapsible.js.map +1 -1
- package/dist/structure/Collapsible.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/structure/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/CursorPagination.js.map +1 -1
- package/dist/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js +140 -93
- package/dist/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/Image.js.map +1 -1
- package/dist/structure/Image.vue_vue_type_script_setup_true_lang.js +30 -18
- package/dist/structure/Image.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/Pagination.js.map +1 -1
- package/dist/structure/Pagination.vue_vue_type_script_setup_true_lang.js +124 -71
- package/dist/structure/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/structure/RichTextContent.js +7 -0
- package/dist/structure/RichTextContent.js.map +1 -0
- package/dist/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js +298 -0
- package/dist/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/structure/RichTextContentBlocks.js +7 -0
- package/dist/structure/RichTextContentBlocks.js.map +1 -0
- package/dist/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/structure/RichTextContentInlines.js +7 -0
- package/dist/structure/RichTextContentInlines.js.map +1 -0
- package/dist/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/structure/RichTextContentItem.js +7 -0
- package/dist/structure/RichTextContentItem.js.map +1 -0
- package/dist/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/structure/code-block.css +1 -1
- package/dist/structure/code-block.module.js +2 -2
- package/dist/structure/code-block.module.js.map +1 -1
- package/dist/structure/cursor-pagination.css +1 -1
- package/dist/structure/cursor-pagination.module.js +6 -3
- package/dist/structure/cursor-pagination.module.js.map +1 -1
- package/dist/structure/pagination.css +1 -1
- package/dist/structure/pagination.module.js +6 -3
- package/dist/structure/pagination.module.js.map +1 -1
- package/dist/structure/rich-text-content.css +1 -0
- package/dist/structure/rich-text-content.module.js +19 -0
- package/dist/structure/rich-text-content.module.js.map +1 -0
- package/dist/types/ai/ArtifactPane.vue.d.ts +1 -1
- package/dist/types/ai/AttachmentChip.vue.d.ts +1 -1
- package/dist/types/ai/ToolCall.vue.d.ts +1 -1
- package/dist/types/controls/RichTextInput.vue.d.ts +210 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/overlays/CommandPanel.vue.d.ts +2 -2
- package/dist/types/structure/Accordion.vue.d.ts +7 -0
- package/dist/types/structure/Collapsible.vue.d.ts +7 -0
- package/dist/types/structure/CursorPagination.vue.d.ts +13 -0
- package/dist/types/structure/EmptyState.vue.d.ts +1 -1
- package/dist/types/structure/Image.vue.d.ts +13 -0
- package/dist/types/structure/Pagination.vue.d.ts +8 -0
- package/dist/types/structure/RichTextContent.vue.d.ts +59 -0
- package/dist/types/structure/RichTextContentBlocks.vue.d.ts +7 -0
- package/dist/types/structure/RichTextContentInlines.vue.d.ts +7 -0
- package/dist/types/structure/RichTextContentItem.vue.d.ts +7 -0
- package/package.json +17 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import e from "./CodeBlock.js";
|
|
2
|
+
import t from "./Heading.js";
|
|
3
|
+
import n from "./Text.js";
|
|
4
|
+
import r from "./rich-text-content.module.js";
|
|
5
|
+
import i from "./RichTextContentInlines.js";
|
|
6
|
+
import a from "./RichTextContentBlocks.js";
|
|
7
|
+
import { richTextPositionAttrs as o } from "@polymorph/vue";
|
|
8
|
+
import { Fragment as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, inject as h, mergeProps as g, normalizeClass as _, openBlock as v, renderList as y, resolveComponent as b, toDisplayString as x, unref as S, withCtx as C } from "vue";
|
|
9
|
+
//#region src/structure/RichTextContentItem.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var w = ["data-level"], T = ["data-level"], E = ["data-level"], D = ["start"], O = /*@__PURE__*/ m({
|
|
11
|
+
name: "RichTextContentItem",
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "RichTextContentItem",
|
|
14
|
+
props: { blocks: {} },
|
|
15
|
+
setup(m) {
|
|
16
|
+
let O = h("polymorph:RichTextContent", {});
|
|
17
|
+
return (h, k) => {
|
|
18
|
+
let A = b("RichTextContentItem", !0);
|
|
19
|
+
return v(), u("li", { class: _(S(r).item) }, [(v(!0), u(s, null, y(m.blocks, (m, h) => (v(), u(s, { key: h }, [m.kind === "paragraph" ? (v(), c(n, {
|
|
20
|
+
key: 0,
|
|
21
|
+
size: S(O).size
|
|
22
|
+
}, {
|
|
23
|
+
default: C(() => [p(i, { inlines: m.inlines }, null, 8, ["inlines"])]),
|
|
24
|
+
_: 2
|
|
25
|
+
}, 1032, ["size"])) : m.kind === "heading" ? (v(), c(t, {
|
|
26
|
+
key: 1,
|
|
27
|
+
level: m.level
|
|
28
|
+
}, {
|
|
29
|
+
default: C(() => [f(x(m.text), 1)]),
|
|
30
|
+
_: 2
|
|
31
|
+
}, 1032, ["level"])) : m.kind === "ownHeading" && m.level === 4 ? (v(), u("h4", {
|
|
32
|
+
key: 2,
|
|
33
|
+
class: _(S(r).heading),
|
|
34
|
+
"data-level": String(m.level)
|
|
35
|
+
}, [p(i, { inlines: m.inlines }, null, 8, ["inlines"])], 10, w)) : m.kind === "ownHeading" && m.level === 3 ? (v(), u("h3", {
|
|
36
|
+
key: 3,
|
|
37
|
+
class: _(S(r).heading),
|
|
38
|
+
"data-level": String(m.level)
|
|
39
|
+
}, [p(i, { inlines: m.inlines }, null, 8, ["inlines"])], 10, T)) : m.kind === "ownHeading" ? (v(), u("h2", {
|
|
40
|
+
key: 4,
|
|
41
|
+
class: _(S(r).heading),
|
|
42
|
+
"data-level": String(m.level)
|
|
43
|
+
}, [p(i, { inlines: m.inlines }, null, 8, ["inlines"])], 10, E)) : m.kind === "list" && m.ordered ? (v(), u("ol", {
|
|
44
|
+
key: 5,
|
|
45
|
+
class: _(S(r).list),
|
|
46
|
+
start: m.start
|
|
47
|
+
}, [(v(!0), u(s, null, y(m.items, (e, t) => (v(), c(A, {
|
|
48
|
+
key: t,
|
|
49
|
+
blocks: e
|
|
50
|
+
}, null, 8, ["blocks"]))), 128))], 10, D)) : m.kind === "list" ? (v(), u("ul", {
|
|
51
|
+
key: 6,
|
|
52
|
+
class: _(S(r).list)
|
|
53
|
+
}, [(v(!0), u(s, null, y(m.items, (e, t) => (v(), c(A, {
|
|
54
|
+
key: t,
|
|
55
|
+
blocks: e
|
|
56
|
+
}, null, 8, ["blocks"]))), 128))], 2)) : m.kind === "quote" ? (v(), u("blockquote", {
|
|
57
|
+
key: 7,
|
|
58
|
+
class: _(S(r).quote)
|
|
59
|
+
}, [p(a, { blocks: m.blocks }, null, 8, ["blocks"])], 2)) : m.kind === "codeBlock" && m.at === null ? (v(), c(e, {
|
|
60
|
+
key: 8,
|
|
61
|
+
copyable: m.copyable,
|
|
62
|
+
label: m.language
|
|
63
|
+
}, {
|
|
64
|
+
default: C(() => [f(x(m.text), 1)]),
|
|
65
|
+
_: 2
|
|
66
|
+
}, 1032, ["copyable", "label"])) : m.kind === "codeBlock" ? (v(), u("div", g({
|
|
67
|
+
key: 9,
|
|
68
|
+
ref_for: !0
|
|
69
|
+
}, S(o)(m.at, !0, !0)), [p(e, {
|
|
70
|
+
copyable: m.copyable,
|
|
71
|
+
label: m.language
|
|
72
|
+
}, {
|
|
73
|
+
default: C(() => [f(x(m.text), 1)]),
|
|
74
|
+
_: 2
|
|
75
|
+
}, 1032, ["copyable", "label"])], 16)) : m.kind === "later" && m.at === null ? (v(), c(n, {
|
|
76
|
+
key: 10,
|
|
77
|
+
size: S(O).size
|
|
78
|
+
}, {
|
|
79
|
+
default: C(() => [f(x(m.text), 1)]),
|
|
80
|
+
_: 2
|
|
81
|
+
}, 1032, ["size"])) : m.kind === "later" ? (v(), c(n, {
|
|
82
|
+
key: 11,
|
|
83
|
+
size: S(O).size
|
|
84
|
+
}, {
|
|
85
|
+
default: C(() => [d("span", g({ ref_for: !0 }, S(o)(m.at, !0)), x(m.text), 17)]),
|
|
86
|
+
_: 2
|
|
87
|
+
}, 1032, ["size"])) : l("", !0)], 64))), 128))], 2);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
//#endregion
|
|
92
|
+
export { O as default };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=RichTextContentItem.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichTextContentItem.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/structure/RichTextContentItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * RichTextContent.Item: a list’s item and its drawn blocks.\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/rich-text-content.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { inject } from 'vue'\n\nimport { richTextPositionAttrs, type RichTextDrawnBlock } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/rich-text-content.module.css'\nimport CodeBlock from './CodeBlock.vue'\nimport Heading from './Heading.vue'\nimport RichTextContentBlocks from './RichTextContentBlocks.vue'\nimport RichTextContentInlines from './RichTextContentInlines.vue'\nimport Text from './Text.vue'\n\nexport interface RichTextContentItemProps {\n blocks: RichTextDrawnBlock[]\n}\n\ndefineOptions({ name: 'RichTextContentItem', inheritAttrs: false })\n\ndefineProps<RichTextContentItemProps>()\nconst owner = inject<Record<string, any>>('polymorph:RichTextContent', {})\n</script>\n\n<template>\n <li :class=\"styles.item\">\n <template v-for=\"(block, index) in blocks\" :key=\"index\">\n <Text v-if=\"block.kind === 'paragraph'\" :size=\"owner.size\">\n <RichTextContentInlines :inlines=\"block.inlines\" />\n </Text>\n <Heading v-else-if=\"block.kind === 'heading'\" :level=\"block.level\">\n {{ block.text }}\n </Heading>\n <h4\n v-else-if=\"block.kind === 'ownHeading' && block.level === 4\"\n :class=\"styles.heading\"\n :data-level=\"String(block.level)\"\n >\n <RichTextContentInlines :inlines=\"block.inlines\" />\n </h4>\n <h3\n v-else-if=\"block.kind === 'ownHeading' && block.level === 3\"\n :class=\"styles.heading\"\n :data-level=\"String(block.level)\"\n >\n <RichTextContentInlines :inlines=\"block.inlines\" />\n </h3>\n <h2\n v-else-if=\"block.kind === 'ownHeading'\"\n :class=\"styles.heading\"\n :data-level=\"String(block.level)\"\n >\n <RichTextContentInlines :inlines=\"block.inlines\" />\n </h2>\n <!-- list -->\n <ol\n v-else-if=\"block.kind === 'list' && block.ordered\"\n :class=\"styles.list\"\n :start=\"block.start\"\n >\n <template v-for=\"(entry, position) in block.items\" :key=\"position\">\n <RichTextContentItem :blocks=\"entry\" />\n </template>\n </ol>\n <!-- list -->\n <ul v-else-if=\"block.kind === 'list'\" :class=\"styles.list\">\n <template v-for=\"(entry, position) in block.items\" :key=\"position\">\n <RichTextContentItem :blocks=\"entry\" />\n </template>\n </ul>\n <!-- quote -->\n <blockquote v-else-if=\"block.kind === 'quote'\" :class=\"styles.quote\">\n <RichTextContentBlocks :blocks=\"block.blocks\" />\n </blockquote>\n <CodeBlock\n v-else-if=\"block.kind === 'codeBlock' && block.at === null\"\n :copyable=\"block.copyable\"\n :label=\"block.language\"\n >\n {{ block.text }}\n </CodeBlock>\n <div\n v-else-if=\"block.kind === 'codeBlock'\"\n v-bind=\"richTextPositionAttrs(block.at, true, true)\"\n >\n <CodeBlock :copyable=\"block.copyable\" :label=\"block.language\">\n {{ block.text }}\n </CodeBlock>\n </div>\n <Text v-else-if=\"block.kind === 'later' && block.at === null\" :size=\"owner.size\">\n {{ block.text }}\n </Text>\n <Text v-else-if=\"block.kind === 'later'\" :size=\"owner.size\">\n <span v-bind=\"richTextPositionAttrs(block.at, true)\">\n {{ block.text }}\n </span>\n </Text>\n </template>\n </li>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region ../recipes/src/structure/code-block.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_block_1j1lk_6 _focusRing_1lfnc_15", t = "_copyable_1j1lk_39", n = "_control_1j1lk_55", r = "_reader_1j1lk_81 _visuallyHidden_qxi8b_14", i = {
|
|
3
3
|
block: e,
|
|
4
4
|
copyable: t,
|
|
5
5
|
control: n,
|
|
6
|
-
"code-block-swap": "_code-block-
|
|
6
|
+
"code-block-swap": "_code-block-swap_1j1lk_1",
|
|
7
7
|
reader: r
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.module.js","names":[],"sources":["../../../../recipes/src/structure/code-block.module.css"],"sourcesContent":["/* CodeBlock — `design/components/code-block.md`.\n *\n * The `<pre>` is the scroll container itself: the spec's anatomy is only\n * `<pre><code>`, and a wrapper would split the border from the scrolling. */\n\n.block {\n composes: focusRing from '../conventions/focus.module.css';\n padding: var(--pm-space-4);\n overflow-x: auto;\n font-family: var(--pm-font-mono);\n font-size: var(--pm-text-sm-size);\n color: var(--pm-text-primary);\n\n /* Whitespace is content, and wrapping a command would change it. */\n white-space: pre;\n background: var(--pm-bg-subtle);\n border: 1px solid var(--pm-border-subtle);\n border-radius: var(--pm-radius-md);\n}\n\n/* With the copy control in the corner, the block reserves
|
|
1
|
+
{"version":3,"file":"code-block.module.js","names":[],"sources":["../../../../recipes/src/structure/code-block.module.css"],"sourcesContent":["/* CodeBlock — `design/components/code-block.md`.\n *\n * The `<pre>` is the scroll container itself: the spec's anatomy is only\n * `<pre><code>`, and a wrapper would split the border from the scrolling. */\n\n.block {\n composes: focusRing from '../conventions/focus.module.css';\n padding: var(--pm-space-4);\n overflow-x: auto;\n font-family: var(--pm-font-mono);\n font-size: var(--pm-text-sm-size);\n\n /* Stated, not inherited, because the copy control is sized in lines. */\n line-height: var(--pm-text-sm-line-height);\n color: var(--pm-text-primary);\n\n /* Whitespace is content, and wrapping a command would change it. */\n white-space: pre;\n background: var(--pm-bg-subtle);\n border: 1px solid var(--pm-border-subtle);\n border-radius: var(--pm-radius-md);\n}\n\n/* With the copy control in the corner, the block reserves the corner's width so\n the longest line scrolls clear of it (container-first: content is never\n covered at rest). */\n.block[data-copyable] {\n padding-inline-end: calc(var(--pm-space-2) + var(--pm-control-height-sm) + var(--pm-space-4));\n}\n\n/* The wrapper exists only when copyable. It is the containing block for the\n corner control and paints nothing.\n\n It is a one-cell grid so the block always fills it. A row that stretches the\n wrapper beside a taller neighbour then stretches the block with it, as it\n stretches a block with no control, and the control, which is sized against\n the wrapper, is sized against the block. `minmax(0, 1fr)` keeps the cell the\n wrapper's width, so a long line scrolls and does not widen it. */\n.copyable {\n position: relative;\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n}\n\n/* Corner control, placed like Dialog's close: the button sits inset from the\n top and inline end by the block's padding step. The control itself reaches\n the block's corner, inside its border, and paints the block's surface, so a\n line that runs into the corner before it is scrolled is cut off at one edge\n and never shows through or beside the glyph.\n\n It ends where the second line of code ends, which is the least that holds\n the button, so it never covers part of a line. A one-line block is shorter\n than that, and the maximum stops the control at the block's bottom padding\n there, clear of the rounded corner and of a scrollbar. */\n.control {\n position: absolute;\n inset-block-start: 1px;\n inset-inline-end: 1px;\n box-sizing: border-box;\n block-size: calc(var(--pm-space-4) + 2 * var(--pm-text-sm-line-height) * var(--pm-text-sm-size));\n max-block-size: calc(100% - 2px - var(--pm-space-4));\n padding-block-start: calc(var(--pm-space-4) - 1px);\n padding-inline: var(--pm-space-2) calc(var(--pm-space-4) - 1px);\n background: var(--pm-bg-subtle);\n border-start-end-radius: var(--pm-radius-md);\n}\n\n/* The `copy` → `confirm` swap fades in at control duration, as Table's sort\n glyph does. Enter only, like Input's clear, because nobody watches the revert.\n Opacity only, so reduced motion has nothing to remove. */\n.copyable[data-state='copied'] .control {\n animation: code-block-swap var(--pm-motion-duration-control) var(--pm-motion-easing-standard);\n}\n\n@keyframes code-block-swap {\n from {\n opacity: 0;\n }\n}\n\n.reader {\n composes: visuallyHidden from '../conventions/a11y.module.css';\n}\n"],"mappings":""}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
//#region ../recipes/src/structure/cursor-pagination.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_pagination_1aa26_14 _focusRing_1lfnc_15", t = "_position_1aa26_23", n = "_end_1aa26_24", r = "_link_1aa26_43 _button_17o12_17 _focusRing_1lfnc_15 _stateFeedback_lkjqs_17 _pressable_lkjqs_38", i = "_linkLabel_1aa26_50 _label_17o12_43", a = "_linkGlyph_1aa26_54 _glyph_17o12_50", o = {
|
|
3
3
|
pagination: e,
|
|
4
4
|
position: t,
|
|
5
|
-
end: n
|
|
5
|
+
end: n,
|
|
6
|
+
link: r,
|
|
7
|
+
linkLabel: i,
|
|
8
|
+
linkGlyph: a
|
|
6
9
|
};
|
|
7
10
|
//#endregion
|
|
8
|
-
export {
|
|
11
|
+
export { o as default, n as end, r as link, a as linkGlyph, i as linkLabel, e as pagination, t as position };
|
|
9
12
|
|
|
10
13
|
//# sourceMappingURL=cursor-pagination.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-pagination.module.js","names":[],"sources":["../../../../recipes/src/structure/cursor-pagination.module.css"],"sourcesContent":["/* CursorPagination — `design/components/cursor-pagination.md`.\n *\n * The controls are Buttons and the row is an Inline, so this
|
|
1
|
+
{"version":3,"file":"cursor-pagination.module.js","names":[],"sources":["../../../../recipes/src/structure/cursor-pagination.module.css"],"sourcesContent":["/* CursorPagination — `design/components/cursor-pagination.md`.\n *\n * The controls are Buttons, or links in Button's look when the windows have\n * addresses, and the row is an Inline, so this styles the position text\n * between the arrows, the append form's end line and the links. */\n\n/* A column, so the append form's end line takes a line of its own under the\n row: beside the position, two muted texts would read as one phrase. The\n replace form has one child, the row, which a column lays out as a row does.\n\n The root takes focus when the app's hold disables the button that had it\n (`cursor-pagination.md`, A11y), so it draws the one focus ring. It has the\n controls' corners, so the ring follows the row it surrounds. */\n.pagination {\n composes: focusRing from '../conventions/focus.module.css';\n display: inline-flex;\n flex-direction: column;\n border-radius: var(--pm-radius-control);\n}\n\n/* As FilterBar's count: muted text at the buttons' type step. The append\n form's end line reads as the position does. */\n.position,\n.end {\n font-family: var(--pm-text-sm-family);\n font-size: var(--pm-text-sm-size);\n font-weight: var(--pm-text-sm-weight);\n line-height: var(--pm-text-sm-line-height);\n letter-spacing: var(--pm-text-sm-tracking);\n color: var(--pm-text-muted);\n}\n\n/* Tabular numerals, so \"26–50\" → \"51–75\" does not shift the arrow. */\n.position {\n font-variant-numeric: var(--pm-font-numeric);\n}\n\n/* A control drawn as a link, when the app gives the windows addresses (`cursor-pagination.md`).\n It is the Button it replaces, by reference, as Link's button variant is: composing `.button`\n brings the base, the sizes, every rest, hover and active cell, the press feedback and the focus\n ring, all keyed off the `data-variant` × `data-tone` × `data-size` attributes the link sets.\n This rule removes what an `<a>` has and a `<button>` does not: the browser's underline. */\n.link {\n composes: button from '../controls/button.module.css';\n text-decoration: none;\n}\n\n/* Button's two content slots, composed: the label that truncates with an ellipsis, and the\n glyph's box. */\n.linkLabel {\n composes: label from '../controls/button.module.css';\n}\n\n.linkGlyph {\n composes: glyph from '../controls/button.module.css';\n}\n"],"mappings":""}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
//#region ../recipes/src/structure/pagination.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_pagination_en48d_10 _focusRing_1lfnc_15", t = "_link_en48d_26 _button_17o12_17 _focusRing_1lfnc_15 _stateFeedback_lkjqs_17 _pressable_lkjqs_38", n = "_linkLabel_en48d_34 _label_17o12_43", r = "_linkGlyph_en48d_38 _glyph_17o12_50", i = "_ellipsis_en48d_44", a = {
|
|
3
3
|
pagination: e,
|
|
4
|
-
|
|
4
|
+
link: t,
|
|
5
|
+
linkLabel: n,
|
|
6
|
+
linkGlyph: r,
|
|
7
|
+
ellipsis: i
|
|
5
8
|
};
|
|
6
9
|
//#endregion
|
|
7
|
-
export {
|
|
10
|
+
export { a as default, i as ellipsis, t as link, r as linkGlyph, n as linkLabel, e as pagination };
|
|
8
11
|
|
|
9
12
|
//# sourceMappingURL=pagination.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.module.js","names":[],"sources":["../../../../recipes/src/structure/pagination.module.css"],"sourcesContent":["/* Pagination — `design/components/pagination.md`.\n *\n * The controls are Buttons and the row is an Inline. This file
|
|
1
|
+
{"version":3,"file":"pagination.module.js","names":[],"sources":["../../../../recipes/src/structure/pagination.module.css"],"sourcesContent":["/* Pagination — `design/components/pagination.md`.\n *\n * The controls are Buttons, or links in Button's look when the pages have\n * addresses, and the row is an Inline. This file keeps each control at least\n * square, so the row does not shift from page 9 to 10. */\n\n/* The root takes focus when the app's hold disables the button that had it\n (`pagination.md`, A11y), so it draws the one focus ring. It has the\n controls' corners, so the ring follows the row it surrounds. */\n.pagination {\n composes: focusRing from '../conventions/focus.module.css';\n display: inline-flex;\n border-radius: var(--pm-radius-control);\n}\n\n.pagination button {\n min-inline-size: var(--pm-control-height-sm);\n}\n\n/* A control drawn as a link, when the app gives the pages addresses (`pagination.md`). It is\n the Button it replaces, by reference, as Link's button variant is: composing `.button` brings\n the base, the sizes, every rest, hover and active cell, the press feedback and the focus ring,\n all keyed off the `data-variant` × `data-tone` × `data-size` attributes the link sets. This rule\n removes what an `<a>` has and a `<button>` does not, the browser's underline, and keeps the\n link at least square, as the rule above keeps a button. */\n.link {\n composes: button from '../controls/button.module.css';\n min-inline-size: var(--pm-control-height-sm);\n text-decoration: none;\n}\n\n/* Button's two content slots, composed: the label that truncates with an ellipsis, and the\n glyph's box. */\n.linkLabel {\n composes: label from '../controls/button.module.css';\n}\n\n.linkGlyph {\n composes: glyph from '../controls/button.module.css';\n}\n\n/* Stands for pages that are not offered. Sized like a number button so the row\n spacing stays even. */\n.ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--pm-control-height-sm);\n font-family: var(--pm-text-sm-family);\n font-size: var(--pm-text-sm-size);\n font-weight: var(--pm-text-sm-weight);\n line-height: var(--pm-text-sm-line-height);\n letter-spacing: var(--pm-text-sm-tracking);\n color: var(--pm-text-muted);\n user-select: none;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region ../recipes/src/structure/rich-text-content.module.css
|
|
2
|
+
var e = "_root_1q2y5_16 _root_z92xs_10", t = "_list_1q2y5_20 _list_z92xs_21", n = "_item_1q2y5_24 _item_z92xs_31", r = "_quote_1q2y5_28 _quote_z92xs_44", i = "_heading_1q2y5_36 _heading_1t0qx_6", a = "_code_1q2y5_42 _code_hc07h_7", o = "_entity_1q2y5_53", s = "_annotation_1q2y5_76", c = "_pressable_1q2y5_103 _focusRing_1lfnc_15", l = "_actions_1q2y5_111", u = "_status_1q2y5_117 _visuallyHidden_qxi8b_14", d = {
|
|
3
|
+
root: e,
|
|
4
|
+
list: t,
|
|
5
|
+
item: n,
|
|
6
|
+
quote: r,
|
|
7
|
+
heading: i,
|
|
8
|
+
code: a,
|
|
9
|
+
entity: o,
|
|
10
|
+
annotation: s,
|
|
11
|
+
pressable: c,
|
|
12
|
+
actions: l,
|
|
13
|
+
status: u
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { l as actions, s as annotation, a as code, d as default, o as entity, i as heading, n as item, t as list, c as pressable, r as quote, e as root, u as status };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=rich-text-content.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text-content.module.js","names":[],"sources":["../../../../recipes/src/structure/rich-text-content.module.css"],"sourcesContent":["/* RichTextContent — `design/components/rich-text-content.md`.\n *\n * Most styling comes from other members through composition: paragraphs are\n * Text, headings are Heading, code blocks are CodeBlock, inline code is Code\n * and links are Link. The spacing between blocks, a list's markers and a\n * quote's rule are Markdown's, composed and not restated, so a list in a reply\n * and a list in a comment are one decision. A heading or inline code the member\n * draws itself composes Heading's or Code's class. The entity token, the\n * annotation, the live region and the wrapper of the selection bar's controls\n * are this sheet's own.\n *\n * Each part is one class, and no rule reaches through the root, because\n * RichTextInput's editable surface composes the same classes so that a\n * document looks the same while it is written. */\n\n.root {\n composes: root from '../ai/markdown.module.css';\n}\n\n.list {\n composes: list from '../ai/markdown.module.css';\n}\n\n.item {\n composes: item from '../ai/markdown.module.css';\n}\n\n.quote {\n composes: quote from '../ai/markdown.module.css';\n}\n\n/* A heading the member draws itself: one that holds a drawn annotation, or any\n heading while the member maps selections. It is Heading's element with\n Heading's class and the level Heading writes (`data-level`), so Heading's\n rules draw it. */\n.heading {\n composes: heading from './heading.module.css';\n}\n\n/* Inline code that holds a drawn annotation: Code's element with Code's class,\n so the highlight sits inside the chip, as the editor draws it. */\n.code {\n composes: code from './code.module.css';\n}\n\n/* A reference to something the app owns, such as a person or an issue, on the\n accent wash. The label carries its trigger character (`@Ada Lovelace`), so\n the token is never marked by colour alone. It takes the surrounding text's\n step and weight, as Code keeps its weight. Padding is on the inline axis\n only, as Code's is, so a line holding a token keeps the line box of a line\n without one. A long label breaks inside the token and each line's part keeps\n the padding and the radius, Code's long-string cell. */\n.entity {\n padding-inline: var(--pm-space-1);\n color: var(--pm-accent-text);\n background: var(--pm-accent-subtle);\n border-radius: var(--pm-radius-sm);\n overflow-wrap: anywhere;\n box-decoration-break: clone;\n}\n\n/* An annotation: the words an application anchored something to, such as a\n comment thread. Each fragment is a `mark`, so the browser's own mark colours\n are replaced: the warning wash, which is neither the selection's fill nor a\n link's accent, and the text's own colour, so a link or code inside keeps its\n look. The wash is opaque, so overlapping annotations read the same, nested\n one inside the other. A rule in the warning border's colour runs under the\n words as a second cue, because the wash alone is faint on a dark surface. It\n is a bottom border, which moves no line and is drawn on every line of a\n fragment that wraps, and not a text decoration, which a link inside already\n draws. The active annotation takes the pressed wash and a frame. The outline\n is transparent at rest, so forced colours, which repaint the wash, draw it,\n and the active frame is thicker. The active rule has the specificity of the\n base rule, so the focus convention's ring wins on a highlight that takes\n focus. RichTextInput's editable surface composes this class. */\n.annotation {\n color: inherit;\n background: var(--pm-warning-subtle);\n border-block-end: 1px solid var(--pm-warning-border);\n outline: 1px solid transparent;\n box-decoration-break: clone;\n}\n\n.annotation:where([data-active]) {\n background: var(--pm-warning-subtle-active);\n outline: 2px solid var(--pm-warning-border);\n}\n\n/* An entity's own wash covers the highlight it sits in, so an annotated entity\n is ringed with the annotation's wash and carries the rule under it itself,\n at the height the fragments beside it draw theirs. */\n.annotation .entity {\n border-block-end: 1px solid var(--pm-warning-border);\n box-shadow: 0 0 0 2px var(--pm-warning-subtle);\n}\n\n.annotation:where([data-active]) .entity {\n box-shadow: 0 0 0 2px var(--pm-warning-subtle-active);\n}\n\n/* A highlight that takes a press (`onAnnotationSelect`). One fragment of each\n annotation is its tab stop, and it draws the one focus ring. */\n.pressable {\n composes: focusRing from '../conventions/focus.module.css';\n cursor: pointer;\n}\n\n/* The wrapper of the application's controls in the selection bar. It draws no\n box, so the controls are the bar's own row. The member reads the focus events\n that pass through it, to give focus back when the bar leaves. */\n.actions {\n display: contents;\n}\n\n/* The selection bar's one live region, hidden by clipping so it stays in the\n accessibility tree. */\n.status {\n composes: visuallyHidden from '../conventions/a11y.module.css';\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","names":[],"sources":["../../src/overlays/Toast.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Notifications that report the outcome of an action (`design/components/toast.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/toast.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, watch } from 'vue'\n\nimport {\n devWarning,\n getToasts,\n removeToast,\n slotNode,\n toast,\n useTrackedSlots,\n type ToastAction,\n} from '@polymorph/vue'\n\nexport interface ToasterMessages {\n dismiss: string\n notification: string\n viewport: string\n}\n\nexport interface ToastProps {\n /**\n * At most one; a shortcut, never the only way to do what it does.\n */\n action?: ToastAction\n description?: string\n /**\n * Required recovery actions stay reachable until their owning state resolves.\n */\n dismissible?: boolean\n /**\n * `Infinity` pins the toast until it is dismissed. A call that sets neither this nor\n * `retained` takes its tone's lifetime (see `retained`); one that sets only `retained` gets\n * `TOAST_DEFAULT_DURATION_MS`.\n */\n durationMs?: number\n /**\n * A live toast's id updates it in place: same card and position, new content, timer restarted.\n * An unknown id raises a new toast. `toast.promise` uses this, not a special path.\n */\n id?: string\n /**\n * State-owned notices are removed by their owner, never evicted by another notification. A\n * call that sets neither this nor `durationMs` takes its tone's lifetime: danger and warning\n * are retained and pinned, and the other tones leave after the default duration.\n */\n retained?: boolean\n title: string\n tone?: 'info' | 'warning' | 'success' | 'danger' | 'neutral'\n}\n\ndefineOptions({ name: 'Toast', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<ToastProps>(), {\n dismissible: undefined,\n retained: undefined,\n})\nconst emit = defineEmits<{ dismiss: [] }>()\nconst callerSlots = defineSlots<{ content?: (props: Record<string, never>) => unknown }>()\nconst slots = useTrackedSlots(callerSlots)\nconst uid = useId()\nconst toastId = computed(() => props.id ?? uid)\nconst options = computed(() => ({\n id: toastId.value,\n title: props.title,\n description: props.description,\n tone: props.tone,\n action: props.action,\n durationMs: props.durationMs,\n dismissible: props.dismissible,\n retained: props.retained,\n content: slotNode(slots.content),\n onDismiss: () => emit('dismiss'),\n}))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = toast(options.value)\n release1 = () => {\n removeToast(ran)\n }\n}\nonMounted(effect1)\nwatch(() => [toastId.value, props.title], effect1, { flush: 'post' })\nonBeforeUnmount(() => release1?.())\nconst effect2 = () => {\n getToasts().some((record) => record.id === toastId.value && record.closing !== true) &&\n toast(options.value)\n}\nwatch(() => options.value, effect2, { flush: 'post' })\nlet release3: (() => void) | undefined\nconst effect3 = () => {\n release3?.()\n const timer = setTimeout(() => {\n devWarning(\n document.querySelector('[data-toast-part=\"list\"]') === null,\n `Toast \"${props.title}\" rendered with no Toast viewport mounted, so nothing draws it. Mount the viewport once at the application root, outside any error boundary whose fallback renders a Toast.`,\n )\n }, 0)\n release3 = () => clearTimeout(timer)\n}\nonMounted(effect3)\nonBeforeUnmount(() => release3?.())\n</script>\n\n<template
|
|
1
|
+
{"version":3,"file":"Toast.js","names":[],"sources":["../../src/overlays/Toast.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Notifications that report the outcome of an action (`design/components/toast.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/toast.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, watch } from 'vue'\n\nimport {\n devWarning,\n getToasts,\n removeToast,\n slotNode,\n toast,\n useTrackedSlots,\n type ToastAction,\n} from '@polymorph/vue'\n\nexport interface ToasterMessages {\n dismiss: string\n notification: string\n viewport: string\n}\n\nexport interface ToastProps {\n /**\n * At most one; a shortcut, never the only way to do what it does.\n */\n action?: ToastAction\n description?: string\n /**\n * Required recovery actions stay reachable until their owning state resolves.\n */\n dismissible?: boolean\n /**\n * `Infinity` pins the toast until it is dismissed. A call that sets neither this nor\n * `retained` takes its tone's lifetime (see `retained`); one that sets only `retained` gets\n * `TOAST_DEFAULT_DURATION_MS`.\n */\n durationMs?: number\n /**\n * A live toast's id updates it in place: same card and position, new content, timer restarted.\n * An unknown id raises a new toast. `toast.promise` uses this, not a special path.\n */\n id?: string\n /**\n * State-owned notices are removed by their owner, never evicted by another notification. A\n * call that sets neither this nor `durationMs` takes its tone's lifetime: danger and warning\n * are retained and pinned, and the other tones leave after the default duration.\n */\n retained?: boolean\n title: string\n tone?: 'info' | 'warning' | 'success' | 'danger' | 'neutral'\n}\n\ndefineOptions({ name: 'Toast', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<ToastProps>(), {\n dismissible: undefined,\n retained: undefined,\n})\nconst emit = defineEmits<{ dismiss: [] }>()\nconst callerSlots = defineSlots<{ content?: (props: Record<string, never>) => unknown }>()\nconst slots = useTrackedSlots(callerSlots)\nconst uid = useId()\nconst toastId = computed(() => props.id ?? uid)\nconst options = computed(() => ({\n id: toastId.value,\n title: props.title,\n description: props.description,\n tone: props.tone,\n action: props.action,\n durationMs: props.durationMs,\n dismissible: props.dismissible,\n retained: props.retained,\n content: slotNode(slots.content),\n onDismiss: () => emit('dismiss'),\n}))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = toast(options.value)\n release1 = () => {\n removeToast(ran)\n }\n}\nonMounted(effect1)\nwatch(() => [toastId.value, props.title], effect1, { flush: 'post' })\nonBeforeUnmount(() => release1?.())\nconst effect2 = () => {\n getToasts().some((record) => record.id === toastId.value && record.closing !== true) &&\n toast(options.value)\n}\nwatch(() => options.value, effect2, { flush: 'post' })\nlet release3: (() => void) | undefined\nconst effect3 = () => {\n release3?.()\n const timer = setTimeout(() => {\n devWarning(\n document.querySelector('[data-toast-part=\"list\"]') === null,\n `Toast \"${props.title}\" rendered with no Toast viewport mounted, so nothing draws it. Mount the viewport once at the application root, outside any error boundary whose fallback renders a Toast.`,\n )\n }, 0)\n release3 = () => clearTimeout(timer)\n}\nonMounted(effect3)\nonBeforeUnmount(() => release3?.())\n</script>\n\n<template>\n <template v-if=\"false\" />\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { devWarning as e, getToasts as t, removeToast as n, slotNode as r, toast as i, useTrackedSlots as a } from "@polymorph/vue";
|
|
2
|
-
import { computed as o,
|
|
2
|
+
import { computed as o, createCommentVNode as s, defineComponent as c, onBeforeUnmount as l, onMounted as u, useId as d, useSlots as f, watch as p } from "vue";
|
|
3
3
|
//#region src/overlays/Toast.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var m = /*@__PURE__*/ c({
|
|
5
5
|
name: "Toast",
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "Toast",
|
|
@@ -22,39 +22,39 @@ var p = /*@__PURE__*/ s({
|
|
|
22
22
|
tone: {}
|
|
23
23
|
},
|
|
24
24
|
emits: ["dismiss"],
|
|
25
|
-
setup(
|
|
26
|
-
let
|
|
27
|
-
id:
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
30
|
-
tone:
|
|
31
|
-
action:
|
|
32
|
-
durationMs:
|
|
33
|
-
dismissible:
|
|
34
|
-
retained:
|
|
35
|
-
content: r(
|
|
36
|
-
onDismiss: () =>
|
|
37
|
-
})),
|
|
38
|
-
|
|
39
|
-
let e = i(
|
|
40
|
-
|
|
25
|
+
setup(c, { emit: m }) {
|
|
26
|
+
let h = c, g = m, _ = a(f()), v = d(), y = o(() => h.id ?? v), b = o(() => ({
|
|
27
|
+
id: y.value,
|
|
28
|
+
title: h.title,
|
|
29
|
+
description: h.description,
|
|
30
|
+
tone: h.tone,
|
|
31
|
+
action: h.action,
|
|
32
|
+
durationMs: h.durationMs,
|
|
33
|
+
dismissible: h.dismissible,
|
|
34
|
+
retained: h.retained,
|
|
35
|
+
content: r(_.content),
|
|
36
|
+
onDismiss: () => g("dismiss")
|
|
37
|
+
})), x, S = () => {
|
|
38
|
+
x?.();
|
|
39
|
+
let e = i(b.value);
|
|
40
|
+
x = () => {
|
|
41
41
|
n(e);
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
|
|
45
|
-
t().some((e) => e.id ===
|
|
44
|
+
u(S), p(() => [y.value, h.title], S, { flush: "post" }), l(() => x?.()), p(() => b.value, () => {
|
|
45
|
+
t().some((e) => e.id === y.value && e.closing !== !0) && i(b.value);
|
|
46
46
|
}, { flush: "post" });
|
|
47
|
-
let
|
|
48
|
-
return
|
|
49
|
-
|
|
47
|
+
let C;
|
|
48
|
+
return u(() => {
|
|
49
|
+
C?.();
|
|
50
50
|
let t = setTimeout(() => {
|
|
51
|
-
e(document.querySelector("[data-toast-part=\"list\"]") === null, `Toast "${
|
|
51
|
+
e(document.querySelector("[data-toast-part=\"list\"]") === null, `Toast "${h.title}" rendered with no Toast viewport mounted, so nothing draws it. Mount the viewport once at the application root, outside any error boundary whose fallback renders a Toast.`);
|
|
52
52
|
}, 0);
|
|
53
|
-
|
|
54
|
-
}),
|
|
53
|
+
C = () => clearTimeout(t);
|
|
54
|
+
}), l(() => C?.()), (e, t) => s("", !0);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
//#endregion
|
|
58
|
-
export {
|
|
58
|
+
export { m as default };
|
|
59
59
|
|
|
60
60
|
//# sourceMappingURL=Toast.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/overlays/Toast.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Notifications that report the outcome of an action (`design/components/toast.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/toast.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, watch } from 'vue'\n\nimport {\n devWarning,\n getToasts,\n removeToast,\n slotNode,\n toast,\n useTrackedSlots,\n type ToastAction,\n} from '@polymorph/vue'\n\nexport interface ToasterMessages {\n dismiss: string\n notification: string\n viewport: string\n}\n\nexport interface ToastProps {\n /**\n * At most one; a shortcut, never the only way to do what it does.\n */\n action?: ToastAction\n description?: string\n /**\n * Required recovery actions stay reachable until their owning state resolves.\n */\n dismissible?: boolean\n /**\n * `Infinity` pins the toast until it is dismissed. A call that sets neither this nor\n * `retained` takes its tone's lifetime (see `retained`); one that sets only `retained` gets\n * `TOAST_DEFAULT_DURATION_MS`.\n */\n durationMs?: number\n /**\n * A live toast's id updates it in place: same card and position, new content, timer restarted.\n * An unknown id raises a new toast. `toast.promise` uses this, not a special path.\n */\n id?: string\n /**\n * State-owned notices are removed by their owner, never evicted by another notification. A\n * call that sets neither this nor `durationMs` takes its tone's lifetime: danger and warning\n * are retained and pinned, and the other tones leave after the default duration.\n */\n retained?: boolean\n title: string\n tone?: 'info' | 'warning' | 'success' | 'danger' | 'neutral'\n}\n\ndefineOptions({ name: 'Toast', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<ToastProps>(), {\n dismissible: undefined,\n retained: undefined,\n})\nconst emit = defineEmits<{ dismiss: [] }>()\nconst callerSlots = defineSlots<{ content?: (props: Record<string, never>) => unknown }>()\nconst slots = useTrackedSlots(callerSlots)\nconst uid = useId()\nconst toastId = computed(() => props.id ?? uid)\nconst options = computed(() => ({\n id: toastId.value,\n title: props.title,\n description: props.description,\n tone: props.tone,\n action: props.action,\n durationMs: props.durationMs,\n dismissible: props.dismissible,\n retained: props.retained,\n content: slotNode(slots.content),\n onDismiss: () => emit('dismiss'),\n}))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = toast(options.value)\n release1 = () => {\n removeToast(ran)\n }\n}\nonMounted(effect1)\nwatch(() => [toastId.value, props.title], effect1, { flush: 'post' })\nonBeforeUnmount(() => release1?.())\nconst effect2 = () => {\n getToasts().some((record) => record.id === toastId.value && record.closing !== true) &&\n toast(options.value)\n}\nwatch(() => options.value, effect2, { flush: 'post' })\nlet release3: (() => void) | undefined\nconst effect3 = () => {\n release3?.()\n const timer = setTimeout(() => {\n devWarning(\n document.querySelector('[data-toast-part=\"list\"]') === null,\n `Toast \"${props.title}\" rendered with no Toast viewport mounted, so nothing draws it. Mount the viewport once at the application root, outside any error boundary whose fallback renders a Toast.`,\n )\n }, 0)\n release3 = () => clearTimeout(timer)\n}\nonMounted(effect3)\nonBeforeUnmount(() => release3?.())\n</script>\n\n<template
|
|
1
|
+
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/overlays/Toast.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Notifications that report the outcome of an action (`design/components/toast.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/toast.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, watch } from 'vue'\n\nimport {\n devWarning,\n getToasts,\n removeToast,\n slotNode,\n toast,\n useTrackedSlots,\n type ToastAction,\n} from '@polymorph/vue'\n\nexport interface ToasterMessages {\n dismiss: string\n notification: string\n viewport: string\n}\n\nexport interface ToastProps {\n /**\n * At most one; a shortcut, never the only way to do what it does.\n */\n action?: ToastAction\n description?: string\n /**\n * Required recovery actions stay reachable until their owning state resolves.\n */\n dismissible?: boolean\n /**\n * `Infinity` pins the toast until it is dismissed. A call that sets neither this nor\n * `retained` takes its tone's lifetime (see `retained`); one that sets only `retained` gets\n * `TOAST_DEFAULT_DURATION_MS`.\n */\n durationMs?: number\n /**\n * A live toast's id updates it in place: same card and position, new content, timer restarted.\n * An unknown id raises a new toast. `toast.promise` uses this, not a special path.\n */\n id?: string\n /**\n * State-owned notices are removed by their owner, never evicted by another notification. A\n * call that sets neither this nor `durationMs` takes its tone's lifetime: danger and warning\n * are retained and pinned, and the other tones leave after the default duration.\n */\n retained?: boolean\n title: string\n tone?: 'info' | 'warning' | 'success' | 'danger' | 'neutral'\n}\n\ndefineOptions({ name: 'Toast', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<ToastProps>(), {\n dismissible: undefined,\n retained: undefined,\n})\nconst emit = defineEmits<{ dismiss: [] }>()\nconst callerSlots = defineSlots<{ content?: (props: Record<string, never>) => unknown }>()\nconst slots = useTrackedSlots(callerSlots)\nconst uid = useId()\nconst toastId = computed(() => props.id ?? uid)\nconst options = computed(() => ({\n id: toastId.value,\n title: props.title,\n description: props.description,\n tone: props.tone,\n action: props.action,\n durationMs: props.durationMs,\n dismissible: props.dismissible,\n retained: props.retained,\n content: slotNode(slots.content),\n onDismiss: () => emit('dismiss'),\n}))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = toast(options.value)\n release1 = () => {\n removeToast(ran)\n }\n}\nonMounted(effect1)\nwatch(() => [toastId.value, props.title], effect1, { flush: 'post' })\nonBeforeUnmount(() => release1?.())\nconst effect2 = () => {\n getToasts().some((record) => record.id === toastId.value && record.closing !== true) &&\n toast(options.value)\n}\nwatch(() => options.value, effect2, { flush: 'post' })\nlet release3: (() => void) | undefined\nconst effect3 = () => {\n release3?.()\n const timer = setTimeout(() => {\n devWarning(\n document.querySelector('[data-toast-part=\"list\"]') === null,\n `Toast \"${props.title}\" rendered with no Toast viewport mounted, so nothing draws it. Mount the viewport once at the application root, outside any error boundary whose fallback renders a Toast.`,\n )\n }, 0)\n release3 = () => clearTimeout(timer)\n}\nonMounted(effect3)\nonBeforeUnmount(() => release3?.())\n</script>\n\n<template>\n <template v-if=\"false\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EA2DA,IAAM,IAAQ,GAIR,IAAO,GAEP,IAAQ,EADM,EACU,CAAW,GACnC,IAAM,EAAM,GACZ,IAAU,QAAe,EAAM,MAAM,CAAG,GACxC,IAAU,SAAgB;GAC9B,IAAI,EAAQ;GACZ,OAAO,EAAM;GACb,aAAa,EAAM;GACnB,MAAM,EAAM;GACZ,QAAQ,EAAM;GACd,YAAY,EAAM;GAClB,aAAa,EAAM;GACnB,UAAU,EAAM;GAChB,SAAS,EAAS,EAAM,OAAO;GAC/B,iBAAiB,EAAK,SAAS;EACjC,EAAE,GACE,GACE,UAAgB;GACpB,IAAW;GACX,IAAM,IAAM,EAAM,EAAQ,KAAK;GAC/B,UAAiB;IACf,EAAY,CAAG;GACjB;EACF;EAQA,AAPA,EAAU,CAAO,GACjB,QAAY,CAAC,EAAQ,OAAO,EAAM,KAAK,GAAG,GAAS,EAAE,OAAO,OAAO,CAAC,GACpE,QAAsB,IAAW,CAAC,GAKlC,QAAY,EAAQ,aAJE;GACpB,EAAU,CAAC,CAAC,MAAM,MAAW,EAAO,OAAO,EAAQ,SAAS,EAAO,YAAY,EAAI,KACjF,EAAM,EAAQ,KAAK;EACvB,GACoC,EAAE,OAAO,OAAO,CAAC;EACrD,IAAI;SAWJ,QAVsB;GACpB,IAAW;GACX,IAAM,IAAQ,iBAAiB;IAC7B,EACE,SAAS,cAAc,4BAA0B,MAAM,MACvD,UAAU,EAAM,MAAM,4KACxB;GACF,GAAG,CAAC;GACJ,UAAiB,aAAa,CAAK;EACrC,CACiB,GACjB,QAAsB,IAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","names":[],"sources":["../../src/structure/Accordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Disclosure list (`design/components/accordion.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/accordion.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n type VNode,\n} from 'vue'\n\nimport * as zag from '@zag-js/accordion'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport { useKeyedPresence } from '@polymorph/vue/motion'\nimport styles from '@polymorph/recipes/structure/accordion.module.css'\n\nexport type AccordionHeadingLevel = NonNullable<AccordionProps['headingLevel']>\n\nexport interface AccordionItem {\n value: string\n label: string\n content: VNode | string\n disabled?: boolean\n}\n\nexport interface AccordionProps {\n /**\n * The open item may be closed again, leaving the list shut.\n */\n collapsible?: boolean\n defaultValue?: string | string[]\n headingLevel?: 3 | 4\n items: AccordionItem[]\n type?: 'single' | 'multiple'\n value?: string | string[]\n}\n\ndefineOptions({ name: 'Accordion', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n collapsible: undefined,\n headingLevel: 3,\n type: 'single',\n})\nconst emit = defineEmits<{ valueChange: [value: string | string[]] }>()\nconst uid = useId()\nconst heights = ref(new Map())\nconst regions = useTemplateRef<HTMLElement[]>('regions')\nconst root = useTemplateRef<HTMLElement>('root')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n multiple: props.type === 'multiple',\n collapsible: props.type === 'multiple' || (props.collapsible ?? true),\n value:\n props.value === undefined\n ? undefined\n : Array.isArray(props.value)\n ? props.value\n : props.value === ''\n ? []\n : [props.value],\n defaultValue:\n props.defaultValue === undefined\n ? undefined\n : Array.isArray(props.defaultValue)\n ? props.defaultValue\n : [props.defaultValue],\n onValueChange: (details) => {\n emit('valueChange', props.type === 'multiple' ? details.value : (details.value[0] ?? ''))\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nconst regionPresent = useKeyedPresence(\n () => api.value.value,\n regions,\n (element) =>\n props.items.find(\n (item) => api.value.getItemContentProps({ value: item.value }).id === element.id,\n )?.value,\n)\nconst effect1 = () => {\n heights.value = new Map(\n (regions.value ?? []).map((region) => [region.id, region.scrollHeight + 'px']),\n )\n}\nonMounted(effect1)\nwatch(() => api.value.value, effect1, { flush: 'post' })\nlet release2: (() => void) | undefined\nconst effect2 = () => {\n release2?.()\n const ran = agentMember({\n member: 'Accordion',\n element: () => root.value,\n state: () => ({\n value: api.value.value,\n items: props.items.map((item) => ({\n id: item.value,\n label: item.label,\n ...(item.disabled === true ? { disabled: true } : {}),\n })),\n }),\n actions: {\n expand: {\n argument: 'id',\n run: (value) =>\n api.value.value.includes(value) ||\n api.value.setValue(props.type === 'multiple' ? [...api.value.value, value] : [value]),\n },\n collapse: {\n argument: 'id',\n run: (value) =>\n (() => {\n if (!api.value.value.includes(value)) return\n if (props.type !== 'multiple' && !(props.collapsible ?? true)) {\n throw new Error('This accordion keeps one item open; expand another item instead.')\n }\n api.value.setValue(api.value.value.filter((shown) => shown !== value))\n })(),\n },\n },\n })\n release2 = () => {\n ran()\n }\n}\nonMounted(effect2)\nonBeforeUnmount(() => release2?.())\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"accordion\">\n <template v-for=\"item in items\" :key=\"item.value\">\n <!-- item -->\n <div\n v-bind=\"api.getItemProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.item\"\n >\n <component :is=\"headingLevel === 4 ? 'h4' : 'h3'\" :class=\"styles.header\">\n <!-- trigger -->\n <button\n v-bind=\"api.getItemTriggerProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.trigger\"\n data-accordion-part=\"trigger\"\n >\n <span :class=\"styles.label\">\n {{ item.label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" />\n </span>\n </button>\n </component>\n <!-- region -->\n <div\n ref=\"regions\"\n v-bind=\"api.getItemContentProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-accordion-content-height': heights.get(\n api.getItemContentProps({ value: item.value, disabled: item.disabled }).id,\n ),\n }\"\n :hidden=\"!regionPresent.has(item.value)\"\n data-accordion-part=\"region\"\n >\n <div :class=\"styles.inner\">\n <template v-if=\"typeof item.content === 'string'\">{{ item.content }}</template>\n <template v-else>\n <component :is=\"item.content\" />\n </template>\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Accordion.js","names":[],"sources":["../../src/structure/Accordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Disclosure list (`design/components/accordion.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/accordion.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n type VNode,\n} from 'vue'\n\nimport * as zag from '@zag-js/accordion'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport { useKeyedPresence } from '@polymorph/vue/motion'\nimport styles from '@polymorph/recipes/structure/accordion.module.css'\n\nexport type AccordionHeadingLevel = NonNullable<AccordionProps['headingLevel']>\n\nexport interface AccordionItem {\n value: string\n label: string\n content: VNode | string\n disabled?: boolean\n}\n\nexport interface AccordionProps {\n /**\n * The open item may be closed again, leaving the list shut.\n */\n collapsible?: boolean\n defaultValue?: string | string[]\n headingLevel?: 3 | 4\n items: AccordionItem[]\n /**\n * Keeps a closed item's content in the document and `hidden`, so a page's server markup\n * carries it and its state survives a close. Without it the React member leaves closed content\n * out. The generated members keep it in every case.\n */\n keepMounted?: boolean\n type?: 'single' | 'multiple'\n value?: string | string[]\n}\n\ndefineOptions({ name: 'Accordion', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n collapsible: undefined,\n headingLevel: 3,\n keepMounted: undefined,\n type: 'single',\n})\nconst emit = defineEmits<{ valueChange: [value: string | string[]] }>()\nconst uid = useId()\nconst heights = ref(new Map())\nconst regions = useTemplateRef<HTMLElement[]>('regions')\nconst root = useTemplateRef<HTMLElement>('root')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n multiple: props.type === 'multiple',\n collapsible: props.type === 'multiple' || (props.collapsible ?? true),\n value:\n props.value === undefined\n ? undefined\n : Array.isArray(props.value)\n ? props.value\n : props.value === ''\n ? []\n : [props.value],\n defaultValue:\n props.defaultValue === undefined\n ? undefined\n : Array.isArray(props.defaultValue)\n ? props.defaultValue\n : [props.defaultValue],\n onValueChange: (details) => {\n emit('valueChange', props.type === 'multiple' ? details.value : (details.value[0] ?? ''))\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nconst regionPresent = useKeyedPresence(\n () => api.value.value,\n regions,\n (element) =>\n props.items.find(\n (item) => api.value.getItemContentProps({ value: item.value }).id === element.id,\n )?.value,\n)\nconst effect1 = () => {\n heights.value = new Map(\n (regions.value ?? []).map((region) => [region.id, region.scrollHeight + 'px']),\n )\n}\nonMounted(effect1)\nwatch(() => api.value.value, effect1, { flush: 'post' })\nlet release2: (() => void) | undefined\nconst effect2 = () => {\n release2?.()\n const ran = agentMember({\n member: 'Accordion',\n element: () => root.value,\n state: () => ({\n value: api.value.value,\n items: props.items.map((item) => ({\n id: item.value,\n label: item.label,\n ...(item.disabled === true ? { disabled: true } : {}),\n })),\n }),\n actions: {\n expand: {\n argument: 'id',\n run: (value) =>\n api.value.value.includes(value) ||\n api.value.setValue(props.type === 'multiple' ? [...api.value.value, value] : [value]),\n },\n collapse: {\n argument: 'id',\n run: (value) =>\n (() => {\n if (!api.value.value.includes(value)) return\n if (props.type !== 'multiple' && !(props.collapsible ?? true)) {\n throw new Error('This accordion keeps one item open; expand another item instead.')\n }\n api.value.setValue(api.value.value.filter((shown) => shown !== value))\n })(),\n },\n },\n })\n release2 = () => {\n ran()\n }\n}\nonMounted(effect2)\nonBeforeUnmount(() => release2?.())\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"accordion\">\n <template v-for=\"item in items\" :key=\"item.value\">\n <!-- item -->\n <div\n v-bind=\"api.getItemProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.item\"\n >\n <component :is=\"headingLevel === 4 ? 'h4' : 'h3'\" :class=\"styles.header\">\n <!-- trigger -->\n <button\n v-bind=\"api.getItemTriggerProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.trigger\"\n data-accordion-part=\"trigger\"\n >\n <span :class=\"styles.label\">\n {{ item.label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" />\n </span>\n </button>\n </component>\n <!-- region -->\n <div\n ref=\"regions\"\n v-bind=\"api.getItemContentProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-accordion-content-height': heights.get(\n api.getItemContentProps({ value: item.value, disabled: item.disabled }).id,\n ),\n }\"\n :hidden=\"!regionPresent.has(item.value)\"\n data-accordion-part=\"region\"\n >\n <div :class=\"styles.inner\">\n <template v-if=\"typeof item.content === 'string'\">{{ item.content }}</template>\n <template v-else>\n <component :is=\"item.content\" />\n </template>\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/structure/Accordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Disclosure list (`design/components/accordion.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/accordion.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n type VNode,\n} from 'vue'\n\nimport * as zag from '@zag-js/accordion'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport { useKeyedPresence } from '@polymorph/vue/motion'\nimport styles from '@polymorph/recipes/structure/accordion.module.css'\n\nexport type AccordionHeadingLevel = NonNullable<AccordionProps['headingLevel']>\n\nexport interface AccordionItem {\n value: string\n label: string\n content: VNode | string\n disabled?: boolean\n}\n\nexport interface AccordionProps {\n /**\n * The open item may be closed again, leaving the list shut.\n */\n collapsible?: boolean\n defaultValue?: string | string[]\n headingLevel?: 3 | 4\n items: AccordionItem[]\n type?: 'single' | 'multiple'\n value?: string | string[]\n}\n\ndefineOptions({ name: 'Accordion', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n collapsible: undefined,\n headingLevel: 3,\n type: 'single',\n})\nconst emit = defineEmits<{ valueChange: [value: string | string[]] }>()\nconst uid = useId()\nconst heights = ref(new Map())\nconst regions = useTemplateRef<HTMLElement[]>('regions')\nconst root = useTemplateRef<HTMLElement>('root')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n multiple: props.type === 'multiple',\n collapsible: props.type === 'multiple' || (props.collapsible ?? true),\n value:\n props.value === undefined\n ? undefined\n : Array.isArray(props.value)\n ? props.value\n : props.value === ''\n ? []\n : [props.value],\n defaultValue:\n props.defaultValue === undefined\n ? undefined\n : Array.isArray(props.defaultValue)\n ? props.defaultValue\n : [props.defaultValue],\n onValueChange: (details) => {\n emit('valueChange', props.type === 'multiple' ? details.value : (details.value[0] ?? ''))\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nconst regionPresent = useKeyedPresence(\n () => api.value.value,\n regions,\n (element) =>\n props.items.find(\n (item) => api.value.getItemContentProps({ value: item.value }).id === element.id,\n )?.value,\n)\nconst effect1 = () => {\n heights.value = new Map(\n (regions.value ?? []).map((region) => [region.id, region.scrollHeight + 'px']),\n )\n}\nonMounted(effect1)\nwatch(() => api.value.value, effect1, { flush: 'post' })\nlet release2: (() => void) | undefined\nconst effect2 = () => {\n release2?.()\n const ran = agentMember({\n member: 'Accordion',\n element: () => root.value,\n state: () => ({\n value: api.value.value,\n items: props.items.map((item) => ({\n id: item.value,\n label: item.label,\n ...(item.disabled === true ? { disabled: true } : {}),\n })),\n }),\n actions: {\n expand: {\n argument: 'id',\n run: (value) =>\n api.value.value.includes(value) ||\n api.value.setValue(props.type === 'multiple' ? [...api.value.value, value] : [value]),\n },\n collapse: {\n argument: 'id',\n run: (value) =>\n (() => {\n if (!api.value.value.includes(value)) return\n if (props.type !== 'multiple' && !(props.collapsible ?? true)) {\n throw new Error('This accordion keeps one item open; expand another item instead.')\n }\n api.value.setValue(api.value.value.filter((shown) => shown !== value))\n })(),\n },\n },\n })\n release2 = () => {\n ran()\n }\n}\nonMounted(effect2)\nonBeforeUnmount(() => release2?.())\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"accordion\">\n <template v-for=\"item in items\" :key=\"item.value\">\n <!-- item -->\n <div\n v-bind=\"api.getItemProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.item\"\n >\n <component :is=\"headingLevel === 4 ? 'h4' : 'h3'\" :class=\"styles.header\">\n <!-- trigger -->\n <button\n v-bind=\"api.getItemTriggerProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.trigger\"\n data-accordion-part=\"trigger\"\n >\n <span :class=\"styles.label\">\n {{ item.label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" />\n </span>\n </button>\n </component>\n <!-- region -->\n <div\n ref=\"regions\"\n v-bind=\"api.getItemContentProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-accordion-content-height': heights.get(\n api.getItemContentProps({ value: item.value, disabled: item.disabled }).id,\n ),\n }\"\n :hidden=\"!regionPresent.has(item.value)\"\n data-accordion-part=\"region\"\n >\n <div :class=\"styles.inner\">\n <template v-if=\"typeof item.content === 'string'\">{{ item.content }}</template>\n <template v-else>\n <component :is=\"item.content\" />\n </template>\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Accordion.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/structure/Accordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Disclosure list (`design/components/accordion.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/accordion.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n type VNode,\n} from 'vue'\n\nimport * as zag from '@zag-js/accordion'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport { useKeyedPresence } from '@polymorph/vue/motion'\nimport styles from '@polymorph/recipes/structure/accordion.module.css'\n\nexport type AccordionHeadingLevel = NonNullable<AccordionProps['headingLevel']>\n\nexport interface AccordionItem {\n value: string\n label: string\n content: VNode | string\n disabled?: boolean\n}\n\nexport interface AccordionProps {\n /**\n * The open item may be closed again, leaving the list shut.\n */\n collapsible?: boolean\n defaultValue?: string | string[]\n headingLevel?: 3 | 4\n items: AccordionItem[]\n /**\n * Keeps a closed item's content in the document and `hidden`, so a page's server markup\n * carries it and its state survives a close. Without it the React member leaves closed content\n * out. The generated members keep it in every case.\n */\n keepMounted?: boolean\n type?: 'single' | 'multiple'\n value?: string | string[]\n}\n\ndefineOptions({ name: 'Accordion', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n collapsible: undefined,\n headingLevel: 3,\n keepMounted: undefined,\n type: 'single',\n})\nconst emit = defineEmits<{ valueChange: [value: string | string[]] }>()\nconst uid = useId()\nconst heights = ref(new Map())\nconst regions = useTemplateRef<HTMLElement[]>('regions')\nconst root = useTemplateRef<HTMLElement>('root')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n multiple: props.type === 'multiple',\n collapsible: props.type === 'multiple' || (props.collapsible ?? true),\n value:\n props.value === undefined\n ? undefined\n : Array.isArray(props.value)\n ? props.value\n : props.value === ''\n ? []\n : [props.value],\n defaultValue:\n props.defaultValue === undefined\n ? undefined\n : Array.isArray(props.defaultValue)\n ? props.defaultValue\n : [props.defaultValue],\n onValueChange: (details) => {\n emit('valueChange', props.type === 'multiple' ? details.value : (details.value[0] ?? ''))\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nconst regionPresent = useKeyedPresence(\n () => api.value.value,\n regions,\n (element) =>\n props.items.find(\n (item) => api.value.getItemContentProps({ value: item.value }).id === element.id,\n )?.value,\n)\nconst effect1 = () => {\n heights.value = new Map(\n (regions.value ?? []).map((region) => [region.id, region.scrollHeight + 'px']),\n )\n}\nonMounted(effect1)\nwatch(() => api.value.value, effect1, { flush: 'post' })\nlet release2: (() => void) | undefined\nconst effect2 = () => {\n release2?.()\n const ran = agentMember({\n member: 'Accordion',\n element: () => root.value,\n state: () => ({\n value: api.value.value,\n items: props.items.map((item) => ({\n id: item.value,\n label: item.label,\n ...(item.disabled === true ? { disabled: true } : {}),\n })),\n }),\n actions: {\n expand: {\n argument: 'id',\n run: (value) =>\n api.value.value.includes(value) ||\n api.value.setValue(props.type === 'multiple' ? [...api.value.value, value] : [value]),\n },\n collapse: {\n argument: 'id',\n run: (value) =>\n (() => {\n if (!api.value.value.includes(value)) return\n if (props.type !== 'multiple' && !(props.collapsible ?? true)) {\n throw new Error('This accordion keeps one item open; expand another item instead.')\n }\n api.value.setValue(api.value.value.filter((shown) => shown !== value))\n })(),\n },\n },\n })\n release2 = () => {\n ran()\n }\n}\nonMounted(effect2)\nonBeforeUnmount(() => release2?.())\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"accordion\">\n <template v-for=\"item in items\" :key=\"item.value\">\n <!-- item -->\n <div\n v-bind=\"api.getItemProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.item\"\n >\n <component :is=\"headingLevel === 4 ? 'h4' : 'h3'\" :class=\"styles.header\">\n <!-- trigger -->\n <button\n v-bind=\"api.getItemTriggerProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.trigger\"\n data-accordion-part=\"trigger\"\n >\n <span :class=\"styles.label\">\n {{ item.label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" />\n </span>\n </button>\n </component>\n <!-- region -->\n <div\n ref=\"regions\"\n v-bind=\"api.getItemContentProps({ value: item.value, disabled: item.disabled })\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-accordion-content-height': heights.get(\n api.getItemContentProps({ value: item.value, disabled: item.disabled }).id,\n ),\n }\"\n :hidden=\"!regionPresent.has(item.value)\"\n data-accordion-part=\"region\"\n >\n <div :class=\"styles.inner\">\n <template v-if=\"typeof item.content === 'string'\">{{ item.content }}</template>\n <template v-else>\n <component :is=\"item.content\" />\n </template>\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.js","names":[],"sources":["../../src/structure/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A single show-or-hide section with one trigger (`design/components/collapsible.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/collapsible.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, useTemplateRef } from 'vue'\n\nimport * as zag from '@zag-js/collapsible'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/collapsible.module.css'\n\nexport interface CollapsibleProps {\n /**\n * Closed by default, because a disclosure that starts open hides nothing.\n */\n defaultOpen?: boolean\n /**\n * The trigger's text, naming what is disclosed in the product's words.\n */\n label: string\n /**\n * Controlled state, paired with `onOpenChange` as in Radix.\n */\n open?: boolean\n}\n\ndefineOptions({ name: 'Collapsible', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), {
|
|
1
|
+
{"version":3,"file":"Collapsible.js","names":[],"sources":["../../src/structure/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A single show-or-hide section with one trigger (`design/components/collapsible.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/collapsible.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, useTemplateRef } from 'vue'\n\nimport * as zag from '@zag-js/collapsible'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/collapsible.module.css'\n\nexport interface CollapsibleProps {\n /**\n * Closed by default, because a disclosure that starts open hides nothing.\n */\n defaultOpen?: boolean\n /**\n * Keeps the closed region's content in the document and `hidden`, so a page's server markup\n * carries it and its state survives a close. Without it the React member leaves closed content\n * out. The generated members keep it in every case.\n */\n keepMounted?: boolean\n /**\n * The trigger's text, naming what is disclosed in the product's words.\n */\n label: string\n /**\n * Controlled state, paired with `onOpenChange` as in Radix.\n */\n open?: boolean\n}\n\ndefineOptions({ name: 'Collapsible', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), {\n defaultOpen: false,\n keepMounted: undefined,\n open: undefined,\n})\nconst emit = defineEmits<{ openChange: [open: boolean] }>()\ndefineSlots<{ default: (props: Record<string, never>) => unknown }>()\nconst uid = useId()\nconst trigger = useTemplateRef<HTMLElement>('trigger')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: (details) => {\n emit('openChange', details.open)\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = agentMember({\n member: 'Collapsible',\n element: () => trigger.value,\n state: () => ({ open: api.value.open }),\n actions: {\n open: () => api.value.open || api.value.setOpen(true),\n close: () => api.value.open && api.value.setOpen(false),\n },\n })\n release1 = () => {\n ran()\n }\n}\nonMounted(effect1)\nonBeforeUnmount(() => release1?.())\n</script>\n\n<template>\n <div v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"collapsible\">\n <!-- trigger -->\n <button ref=\"trigger\" v-bind=\"api.getTriggerProps()\" :class=\"styles.trigger\">\n <span :class=\"styles.label\">\n {{ label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" size=\"sm\" />\n </span>\n </button>\n <!-- content -->\n <div\n v-bind=\"api.getContentProps()\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-collapsible-content-height': Object(api.getContentProps().style)['--height'],\n }\"\n >\n <div :class=\"styles.inner\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/structure/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A single show-or-hide section with one trigger (`design/components/collapsible.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/collapsible.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, useTemplateRef } from 'vue'\n\nimport * as zag from '@zag-js/collapsible'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/collapsible.module.css'\n\nexport interface CollapsibleProps {\n /**\n * Closed by default, because a disclosure that starts open hides nothing.\n */\n defaultOpen?: boolean\n /**\n * The trigger's text, naming what is disclosed in the product's words.\n */\n label: string\n /**\n * Controlled state, paired with `onOpenChange` as in Radix.\n */\n open?: boolean\n}\n\ndefineOptions({ name: 'Collapsible', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), {
|
|
1
|
+
{"version":3,"file":"Collapsible.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/structure/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A single show-or-hide section with one trigger (`design/components/collapsible.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/collapsible.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, useId, useTemplateRef } from 'vue'\n\nimport * as zag from '@zag-js/collapsible'\nimport { normalizeProps, useMachine } from '@zag-js/vue'\n\nimport { Icon, agentMember, useDirection } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/collapsible.module.css'\n\nexport interface CollapsibleProps {\n /**\n * Closed by default, because a disclosure that starts open hides nothing.\n */\n defaultOpen?: boolean\n /**\n * Keeps the closed region's content in the document and `hidden`, so a page's server markup\n * carries it and its state survives a close. Without it the React member leaves closed content\n * out. The generated members keep it in every case.\n */\n keepMounted?: boolean\n /**\n * The trigger's text, naming what is disclosed in the product's words.\n */\n label: string\n /**\n * Controlled state, paired with `onOpenChange` as in Radix.\n */\n open?: boolean\n}\n\ndefineOptions({ name: 'Collapsible', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), {\n defaultOpen: false,\n keepMounted: undefined,\n open: undefined,\n})\nconst emit = defineEmits<{ openChange: [open: boolean] }>()\ndefineSlots<{ default: (props: Record<string, never>) => unknown }>()\nconst uid = useId()\nconst trigger = useTemplateRef<HTMLElement>('trigger')\nconst documentDirection = useDirection()\nconst service = useMachine(\n zag.machine,\n computed(() => ({\n id: uid,\n dir: documentDirection.value,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: (details) => {\n emit('openChange', details.open)\n },\n })),\n)\nconst api = computed(() => zag.connect(service, normalizeProps))\nlet release1: (() => void) | undefined\nconst effect1 = () => {\n release1?.()\n const ran = agentMember({\n member: 'Collapsible',\n element: () => trigger.value,\n state: () => ({ open: api.value.open }),\n actions: {\n open: () => api.value.open || api.value.setOpen(true),\n close: () => api.value.open && api.value.setOpen(false),\n },\n })\n release1 = () => {\n ran()\n }\n}\nonMounted(effect1)\nonBeforeUnmount(() => release1?.())\n</script>\n\n<template>\n <div v-bind=\"api.getRootProps()\" :class=\"styles.root\" data-member=\"collapsible\">\n <!-- trigger -->\n <button ref=\"trigger\" v-bind=\"api.getTriggerProps()\" :class=\"styles.trigger\">\n <span :class=\"styles.label\">\n {{ label }}\n </span>\n <span :class=\"styles.chevron\">\n <Icon name=\"down\" size=\"sm\" />\n </span>\n </button>\n <!-- content -->\n <div\n v-bind=\"api.getContentProps()\"\n :class=\"styles.content\"\n :style=\"{\n '--radix-collapsible-content-height': Object(api.getContentProps().style)['--height'],\n }\"\n >\n <div :class=\"styles.inner\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,IAAM,IAAQ,GAKR,IAAO,GAEP,IAAM,EAAM,GACZ,IAAU,EAA4B,SAAS,GAC/C,IAAoB,EAAa,GACjC,IAAU,EACd,EAAI,SACJ,SAAgB;GACd,IAAI;GACJ,KAAK,EAAkB;GACvB,MAAM,EAAM;GACZ,aAAa,EAAM;GACnB,eAAe,MAAY;IACzB,EAAK,cAAc,EAAQ,IAAI;GACjC;EACF,EAAE,CACJ,GACM,IAAM,QAAe,EAAI,QAAQ,GAAS,CAAc,CAAC,GAC3D;SAgBJ,QAfsB;GACpB,IAAW;GACX,IAAM,IAAM,EAAY;IACtB,QAAQ;IACR,eAAe,EAAQ;IACvB,cAAc,EAAE,MAAM,EAAI,MAAM,KAAK;IACrC,SAAS;KACP,YAAY,EAAI,MAAM,QAAQ,EAAI,MAAM,QAAQ,EAAI;KACpD,aAAa,EAAI,MAAM,QAAQ,EAAI,MAAM,QAAQ,EAAK;IACxD;GACF,CAAC;GACD,UAAiB;IACf,EAAI;GACN;EACF,CACiB,GACjB,QAAsB,IAAW,CAAC,mBAIhC,EAsBM,OAtBN,EAAa,EAsBP,MAtBW,aAAY,GAAA;GAAK,OAAO,EAAA,CAAA,CAAM,CAAC;GAAM,eAAY;OAEhE,EAOS,UAPT,EAOS;YAPG;GAAJ,KAAI;KAAkB,EAAA,MAAI,gBAAe,GAAA,EAAK,OAAO,EAAA,CAAA,CAAM,CAAC,QAAA,CAAA,GAAA,CAClE,EAEO,QAAA,EAFA,OAAK,EAAE,EAAA,CAAA,CAAM,CAAC,KAAK,EAAA,GAAA,EACrB,EAAA,KAAK,GAAA,CAAA,GAEV,EAEO,QAAA,EAFA,OAAK,EAAE,EAAA,CAAA,CAAM,CAAC,OAAO,EAAA,GAAA,CAC1B,EAA8B,EAAA,CAAA,GAAA;GAAxB,MAAK;GAAO,MAAK;iBAI3B,EAUM,OAVN,EACU,EASJ,MATQ,gBAAe,GAAA;GAC1B,OAAO,EAAA,CAAA,CAAM,CAAC;GACd,OAAK,EAAA,sCAAkD,OAAO,EAAA,MAAI,gBAAe,CAAA,CAAG,KAAK,CAAA,CAAA,YAAA;OAI1F,EAEM,OAAA,EAFA,OAAK,EAAE,EAAA,CAAA,CAAM,CAAC,KAAK,EAAA,GAAA,CACvB,EAAQ,EAAA,QAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,CAAA,GAAA,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPagination.js","names":[],"sources":["../../src/structure/CursorPagination.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Previous and next controls for a cursor-paged list (`design/components/cursor-pagination.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/cursor-pagination.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue'\n\nimport { agentMember, devWarning, useListening } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/cursor-pagination.module.css'\nimport Button from '../controls/Button.vue'\nimport Inline from '../layout/Inline.vue'\n\nexport interface CursorPaginationMessages {\n previous: string\n next: string\n more?: string\n end?: string\n}\n\nexport interface CursorPaginationProps {\n /**\n * The app holds the pager while it does something else to the list: every control is disabled\n * and none shows busy. Not `pending`, which says the pager's own request is in flight.\n */\n disabled?: boolean\n hasNext: boolean\n /**\n * Whether the list returned a cursor that way; controlled, as cursors belong to the list. The\n * append form does not read it: it has no previous direction.\n */\n hasPrevious: boolean\n label?: string\n /**\n * Omit for the generic English defaults; localized hosts pass their own.\n */\n messages?: CursorPaginationMessages\n /**\n * `replace` (the default) swaps the window for its neighbour, so the list stays bounded.\n * `append` is \"Load more\": one action that adds the next window below the ones on screen, for\n * a feed or a log read from the top.\n */\n mode?: 'replace' | 'append'\n /**\n * The requested window has not arrived: the pressed direction shows busy and the other is\n * disabled, so a slow fetch cannot be followed by a second request.\n */\n pending?: boolean\n /**\n * The current window in the app's words, such as \"26–50\" or \"Newest first, page 2\"; never a\n * total, because the list does not return one.\n */\n position?: string\n}\n\ndefineOptions({ name: 'CursorPagination', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CursorPaginationProps>(), {\n disabled: false,\n label: 'Pagination',\n messages: () => ({\n previous: 'Previous',\n next: 'Next',\n more: 'Load more',\n end: 'No more to load',\n }),\n mode: 'replace',\n pending: false,\n})\nconst emit = defineEmits<{ next: []; previous: [] }>()\nconst listening = useListening()\nconst focused = ref(null as HTMLElement | null)\nconst taken = ref(null as string | number | null)\nconst asked = ref(null as 'previous' | 'next' | null)\nconst paged = ref(false)\nconst root = useTemplateRef<HTMLElement>('root')\nconst more = computed(() => props.messages.more ?? 'Load more')\nconst end = computed(() => props.messages.end ?? 'No more to load')\nconst ended = computed(() => !props.hasNext && !props.pending)\nconst controls = computed(() =>\n props.mode === 'append' ? (props.hasNext || props.pending ? ['more'] : []) : ['previous', 'next'],\n)\nconst focusIn = computed(() => (event: FocusEvent) => {\n focused.value = event.target as HTMLElement\n})\nconst focusOut = computed(() => (event: FocusEvent) => {\n if (!(event.target as HTMLElement).matches(':disabled')) focused.value = null\n})\nconst keepPlace = computed(() => () => {\n const pager = root.value as HTMLElement | null\n if (pager === null) return\n const names: readonly (string | number)[] = controls.value\n if (!props.disabled) {\n const control = taken.value\n taken.value = null\n if (control === null || document.activeElement !== pager) return\n const button = [...pager.querySelectorAll('button')][names.indexOf(control)]\n if (button !== undefined && !button.matches(':disabled')) button.focus()\n return\n }\n const from = focused.value as HTMLElement | null\n if (from === null || !from.isConnected || !from.matches(':disabled')) return\n const active = document.activeElement\n if (active !== from && active !== null && active !== document.body) return\n taken.value =\n names[[...pager.querySelectorAll('button')].indexOf(from as HTMLButtonElement)] ?? null\n pager.focus()\n})\nconst effect1 = () => {\n props.pending || (asked.value = null)\n}\nwatch(() => props.pending, effect1, { flush: 'post' })\nconst effect2 = () => {\n devWarning(\n props.mode !== 'append' && props.hasPrevious && !listening.previous,\n 'CursorPagination: `hasPrevious` with no `onPrevious` draws a previous button that does nothing.',\n )\n}\nonMounted(effect2)\nwatch(() => props.mode !== 'append' && props.hasPrevious && !listening.previous, effect2, {\n flush: 'post',\n})\nconst effect3 = () => {\n devWarning(\n props.mode === 'append' &&\n (props.messages.more === undefined || props.messages.end === undefined),\n 'CursorPagination: the append form shows `messages.more` and `messages.end`; pass them with the others, so one control never mixes two languages.',\n )\n}\nonMounted(effect3)\nwatch(\n () =>\n props.mode === 'append' &&\n (props.messages.more === undefined || props.messages.end === undefined),\n effect3,\n { flush: 'post' },\n)\nlet release4: (() => void) | undefined\nconst effect4 = () => {\n release4?.()\n const run = () => {\n keepPlace.value()\n }\n const mutation = typeof MutationObserver === 'undefined' ? undefined : new MutationObserver(run)\n for (const element of [root.value])\n if (element)\n mutation?.observe(element, {\n childList: true,\n characterData: true,\n subtree: true,\n attributeFilter: ['disabled'],\n })\n release4 = () => {\n mutation?.disconnect()\n }\n run()\n}\nonMounted(effect4)\nwatch(\n () =>\n props.mode === 'append'\n ? props.hasNext || props.pending || paged.value\n : props.hasPrevious || props.hasNext || props.pending,\n effect4,\n { flush: 'post' },\n)\nonBeforeUnmount(() => release4?.())\nconst effect5 = () => {\n keepPlace.value()\n}\nwatch(() => props.disabled, effect5, { flush: 'post' })\nlet release6: (() => void) | undefined\nconst effect6 = () => {\n release6?.()\n const ran = agentMember({\n member: 'CursorPagination',\n element: () => root.value,\n state: () => ({\n 'has-previous': props.mode !== 'append' && props.hasPrevious,\n 'has-next': props.hasNext,\n position: props.position ?? '',\n pending: props.pending,\n disabled: props.disabled,\n }),\n actions: {\n previous: () =>\n (() => {\n if (props.mode === 'append') throw new Error('The append form has no previous window.')\n if (!props.hasPrevious) throw new Error('There is no previous window.')\n if (props.pending) throw new Error('A window is in flight; wait for it to arrive.')\n asked.value = 'previous'\n emit('previous')\n })(),\n next: () =>\n (() => {\n if (!props.hasNext) throw new Error('There is no next window.')\n if (props.pending) throw new Error('A window is in flight; wait for it to arrive.')\n asked.value = 'next'\n if (props.mode === 'append') paged.value = true\n emit('next')\n })(),\n },\n withholds: () => root.value,\n })\n release6 = () => {\n ran()\n }\n}\nonMounted(effect6)\nonBeforeUnmount(() => release6?.())\n</script>\n\n<template>\n <nav\n v-if=\"mode === 'append' ? hasNext || pending || paged : hasPrevious || hasNext || pending\"\n ref=\"root\"\n :class=\"styles.pagination\"\n :aria-label=\"label\"\n :aria-busy=\"pending ? true : undefined\"\n :data-pending=\"pending ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n tabindex=\"-1\"\n data-member=\"cursor-pagination\"\n @focusin=\"focusIn($event)\"\n @focusout=\"focusOut($event)\"\n >\n <Inline :gap=\"2\" align=\"center\" :wrap=\"true\">\n <template v-if=\"mode === 'append'\">\n <!-- position -->\n <span v-if=\"position !== undefined\" :class=\"styles.position\" aria-live=\"polite\">\n {{ position }}\n </span>\n <Button\n v-if=\"!ended\"\n variant=\"outline\"\n tone=\"neutral\"\n size=\"sm\"\n :label=\"more\"\n :loading=\"pending\"\n :disabled=\"disabled && !pending\"\n @click=\"((asked = 'next'), (paged = true), emit('next'))\"\n />\n </template>\n <template v-else>\n <Button\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n icon=\"previous\"\n :label=\"messages.previous\"\n :loading=\"pending && asked === 'previous'\"\n :disabled=\"!hasPrevious || (pending ? asked !== 'previous' : disabled)\"\n @click=\"((asked = 'previous'), emit('previous'))\"\n />\n <!-- position -->\n <span v-if=\"position !== undefined\" :class=\"styles.position\" aria-live=\"polite\">\n {{ position }}\n </span>\n <Button\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n trailingIcon=\"next\"\n :label=\"messages.next\"\n :loading=\"pending && asked === 'next'\"\n :disabled=\"!hasNext || (pending ? asked !== 'next' : disabled)\"\n @click=\"((asked = 'next'), emit('next'))\"\n />\n </template>\n </Inline>\n <!-- end -->\n <span v-if=\"mode === 'append'\" :class=\"styles.end\" role=\"status\">\n <template v-if=\"ended\">{{ end }}</template>\n </span>\n </nav>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"CursorPagination.js","names":[],"sources":["../../src/structure/CursorPagination.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Previous and next controls for a cursor-paged list (`design/components/cursor-pagination.md`).\n *\n * Generated by `pnpm shells` from `packages/shells/src/members/cursor-pagination.ts`, the member's\n * framework-neutral description. Never edit it by hand: change the description and\n * run `pnpm shells`.\n */\nimport { computed, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue'\n\nimport { Icon, agentMember, devWarning, useListening } from '@polymorph/vue'\nimport styles from '@polymorph/recipes/structure/cursor-pagination.module.css'\nimport Button from '../controls/Button.vue'\nimport Inline from '../layout/Inline.vue'\n\nexport interface CursorPaginationMessages {\n previous: string\n next: string\n more?: string\n end?: string\n}\n\nexport interface CursorPaginationProps {\n /**\n * The app holds the pager while it does something else to the list: every control is disabled\n * and none shows busy. Not `pending`, which says the pager's own request is in flight.\n */\n disabled?: boolean\n hasNext: boolean\n /**\n * Whether the list returned a cursor that way; controlled, as cursors belong to the list. The\n * append form does not read it: it has no previous direction.\n */\n hasPrevious: boolean\n label?: string\n /**\n * Omit for the generic English defaults; localized hosts pass their own.\n */\n messages?: CursorPaginationMessages\n /**\n * `replace` (the default) swaps the window for its neighbour, so the list stays bounded.\n * `append` is \"Load more\": one action that adds the next window below the ones on screen, for\n * a feed or a log read from the top.\n */\n mode?: 'replace' | 'append'\n /**\n * The next window's address, as `previousHref` is the previous one's: next, or in the append\n * form its action, is a link to it while it can be pressed, and a plain click calls `onNext`.\n */\n nextHref?: string\n /**\n * The requested window has not arrived: the pressed direction shows busy and the other is\n * disabled, so a slow fetch cannot be followed by a second request.\n */\n pending?: boolean\n /**\n * The current window in the app's words, such as \"26–50\" or \"Newest first, page 2\"; never a\n * total, because the list does not return one.\n */\n position?: string\n /**\n * The previous window's address, such as `?before=c25`. Given, previous is a link to it while\n * it can be pressed, so a crawler, a new tab and a reader whose script has not loaded can\n * follow it. A click the browser would follow in this tab calls `onPrevious` in place of the\n * navigation; a click with a modifier key opens the address. The append form does not read it:\n * it has no previous direction.\n */\n previousHref?: string\n}\n\ndefineOptions({ name: 'CursorPagination', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CursorPaginationProps>(), {\n disabled: false,\n label: 'Pagination',\n messages: () => ({\n previous: 'Previous',\n next: 'Next',\n more: 'Load more',\n end: 'No more to load',\n }),\n mode: 'replace',\n pending: false,\n})\nconst emit = defineEmits<{ next: []; previous: [] }>()\nconst listening = useListening()\nconst focused = ref(null as HTMLElement | null)\nconst focusedControl = ref(null as string | number | null)\nconst taken = ref(null as string | number | null)\nconst asked = ref(null as 'previous' | 'next' | null)\nconst paged = ref(false)\nconst root = useTemplateRef<HTMLElement>('root')\nconst more = computed(() => props.messages.more ?? 'Load more')\nconst end = computed(() => props.messages.end ?? 'No more to load')\nconst ended = computed(() => !props.hasNext && !props.pending)\nconst controls = computed(() =>\n props.mode === 'append' ? (props.hasNext || props.pending ? ['more'] : []) : ['previous', 'next'],\n)\nconst focusIn = computed(() => (event: FocusEvent) => {\n const target = event.target as HTMLElement\n const pager = root.value as HTMLElement | null\n const names: readonly (string | number)[] = controls.value\n const at = pager === null ? -1 : [...pager.querySelectorAll('button, a[href]')].indexOf(target)\n focused.value = target\n focusedControl.value = at < 0 ? null : (names[at] ?? null)\n})\nconst focusOut = computed(() => (event: FocusEvent) => {\n const target = event.target as HTMLElement\n if (target.matches(':disabled')) return\n queueMicrotask(() => {\n if (focused.value === target && target.isConnected) focused.value = null\n })\n})\nconst keepPlace = computed(() => () => {\n const pager = root.value as HTMLElement | null\n if (pager === null) return\n const names: readonly (string | number)[] = controls.value\n const drawn = () => [...pager.querySelectorAll<HTMLElement>('button, a[href]')]\n const onPage = () => document.activeElement === null || document.activeElement === document.body\n const left = focused.value as HTMLElement | null\n if (left !== null && !left.isConnected) {\n focused.value = null\n const name = focusedControl.value\n const now = name === null ? undefined : drawn()[names.indexOf(name)]\n if (now !== undefined && onPage()) {\n if (now.matches(':disabled')) focused.value = now\n else now.focus()\n }\n }\n if (!props.disabled) {\n const control = taken.value\n taken.value = null\n if (control === null || document.activeElement !== pager) return\n const element = drawn()[names.indexOf(control)]\n if (element !== undefined && !element.matches(':disabled')) element.focus()\n return\n }\n const from = focused.value as HTMLElement | null\n if (from === null || !from.isConnected || !from.matches(':disabled')) return\n const active = document.activeElement\n if (active !== from && active !== null && active !== document.body) return\n taken.value = names[drawn().indexOf(from)] ?? null\n pager.focus()\n})\nconst previousLink = computed(\n () => props.previousHref !== undefined && props.hasPrevious && !props.pending && !props.disabled,\n)\nconst nextLink = computed(\n () => props.nextHref !== undefined && props.hasNext && !props.pending && !props.disabled,\n)\nconst navigatesHere = computed(\n () =>\n (event: MouseEvent): boolean =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey,\n)\nconst followPrevious = computed(() => (event: MouseEvent): void => {\n if (!navigatesHere.value(event)) return\n event.preventDefault()\n asked.value = 'previous'\n emit('previous')\n})\nconst followNext = computed(() => (event: MouseEvent): void => {\n if (!navigatesHere.value(event)) return\n event.preventDefault()\n asked.value = 'next'\n if (props.mode === 'append') paged.value = true\n emit('next')\n})\nconst effect1 = () => {\n props.pending || (asked.value = null)\n}\nwatch(() => props.pending, effect1, { flush: 'post' })\nconst effect2 = () => {\n devWarning(\n props.mode !== 'append' && props.hasPrevious && !listening.previous,\n 'CursorPagination: `hasPrevious` with no `onPrevious` draws a previous button that does nothing.',\n )\n}\nonMounted(effect2)\nwatch(() => props.mode !== 'append' && props.hasPrevious && !listening.previous, effect2, {\n flush: 'post',\n})\nconst effect3 = () => {\n devWarning(\n props.mode === 'append' &&\n (props.messages.more === undefined || props.messages.end === undefined),\n 'CursorPagination: the append form shows `messages.more` and `messages.end`; pass them with the others, so one control never mixes two languages.',\n )\n}\nonMounted(effect3)\nwatch(\n () =>\n props.mode === 'append' &&\n (props.messages.more === undefined || props.messages.end === undefined),\n effect3,\n { flush: 'post' },\n)\nlet release4: (() => void) | undefined\nconst effect4 = () => {\n release4?.()\n const run = () => {\n keepPlace.value()\n }\n const mutation = typeof MutationObserver === 'undefined' ? undefined : new MutationObserver(run)\n for (const element of [root.value])\n if (element)\n mutation?.observe(element, {\n childList: true,\n characterData: true,\n subtree: true,\n attributeFilter: ['disabled'],\n })\n release4 = () => {\n mutation?.disconnect()\n }\n run()\n}\nonMounted(effect4)\nwatch(\n () =>\n props.mode === 'append'\n ? props.hasNext || props.pending || paged.value\n : props.hasPrevious || props.hasNext || props.pending,\n effect4,\n { flush: 'post' },\n)\nonBeforeUnmount(() => release4?.())\nconst effect5 = () => {\n keepPlace.value()\n}\nwatch(() => props.disabled, effect5, { flush: 'post' })\nlet release6: (() => void) | undefined\nconst effect6 = () => {\n release6?.()\n const ran = agentMember({\n member: 'CursorPagination',\n element: () => root.value,\n state: () => ({\n 'has-previous': props.mode !== 'append' && props.hasPrevious,\n 'has-next': props.hasNext,\n position: props.position ?? '',\n pending: props.pending,\n disabled: props.disabled,\n }),\n actions: {\n previous: () =>\n (() => {\n if (props.mode === 'append') throw new Error('The append form has no previous window.')\n if (!props.hasPrevious) throw new Error('There is no previous window.')\n if (props.pending) throw new Error('A window is in flight; wait for it to arrive.')\n asked.value = 'previous'\n emit('previous')\n })(),\n next: () =>\n (() => {\n if (!props.hasNext) throw new Error('There is no next window.')\n if (props.pending) throw new Error('A window is in flight; wait for it to arrive.')\n asked.value = 'next'\n if (props.mode === 'append') paged.value = true\n emit('next')\n })(),\n },\n withholds: () => root.value,\n })\n release6 = () => {\n ran()\n }\n}\nonMounted(effect6)\nonBeforeUnmount(() => release6?.())\n</script>\n\n<template>\n <nav\n v-if=\"mode === 'append' ? hasNext || pending || paged : hasPrevious || hasNext || pending\"\n ref=\"root\"\n :class=\"styles.pagination\"\n :aria-label=\"label\"\n :aria-busy=\"pending ? true : undefined\"\n :data-pending=\"pending ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n tabindex=\"-1\"\n data-member=\"cursor-pagination\"\n @focusin=\"focusIn($event)\"\n @focusout=\"focusOut($event)\"\n >\n <Inline :gap=\"2\" align=\"center\" :wrap=\"true\">\n <template v-if=\"mode === 'append'\">\n <!-- position -->\n <span v-if=\"position !== undefined\" :class=\"styles.position\" aria-live=\"polite\">\n {{ position }}\n </span>\n <!-- link -->\n <a\n v-if=\"!ended && nextLink\"\n :class=\"styles.link\"\n :href=\"nextHref\"\n data-variant=\"outline\"\n data-size=\"sm\"\n data-tone=\"neutral\"\n @click=\"followNext($event)\"\n >\n <!-- label -->\n <span :class=\"styles.linkLabel\">\n {{ more }}\n </span>\n </a>\n <Button\n v-else-if=\"!ended\"\n variant=\"outline\"\n tone=\"neutral\"\n size=\"sm\"\n :label=\"more\"\n :loading=\"pending\"\n :disabled=\"disabled && !pending\"\n @click=\"((asked = 'next'), (paged = true), emit('next'))\"\n />\n </template>\n <template v-else>\n <!-- link -->\n <a\n v-if=\"previousLink\"\n :class=\"styles.link\"\n :href=\"previousHref\"\n data-variant=\"ghost\"\n data-size=\"sm\"\n data-tone=\"neutral\"\n @click=\"followPrevious($event)\"\n >\n <!-- glyph -->\n <span :class=\"styles.linkGlyph\">\n <Icon name=\"previous\" size=\"sm\" />\n </span>\n <!-- label -->\n <span :class=\"styles.linkLabel\">\n {{ messages.previous }}\n </span>\n </a>\n <Button\n v-else\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n icon=\"previous\"\n :label=\"messages.previous\"\n :loading=\"pending && asked === 'previous'\"\n :disabled=\"!hasPrevious || (pending ? asked !== 'previous' : disabled)\"\n @click=\"((asked = 'previous'), emit('previous'))\"\n />\n <!-- position -->\n <span v-if=\"position !== undefined\" :class=\"styles.position\" aria-live=\"polite\">\n {{ position }}\n </span>\n <!-- link -->\n <a\n v-if=\"nextLink\"\n :class=\"styles.link\"\n :href=\"nextHref\"\n data-variant=\"ghost\"\n data-size=\"sm\"\n data-tone=\"neutral\"\n @click=\"followNext($event)\"\n >\n <!-- label -->\n <span :class=\"styles.linkLabel\">\n {{ messages.next }}\n </span>\n <!-- glyph -->\n <span :class=\"styles.linkGlyph\">\n <Icon name=\"next\" size=\"sm\" />\n </span>\n </a>\n <Button\n v-else\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n trailingIcon=\"next\"\n :label=\"messages.next\"\n :loading=\"pending && asked === 'next'\"\n :disabled=\"!hasNext || (pending ? asked !== 'next' : disabled)\"\n @click=\"((asked = 'next'), emit('next'))\"\n />\n </template>\n </Inline>\n <!-- end -->\n <span v-if=\"mode === 'append'\" :class=\"styles.end\" role=\"status\">\n <template v-if=\"ended\">{{ end }}</template>\n </span>\n </nav>\n</template>\n"],"mappings":""}
|