@glimstone/vue 4.9.0 → 4.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,8 @@ type __VLS_Props = {
21
21
  declare const __VLS_template: () => {
22
22
  __VLS_Slots: {
23
23
  badges?: (props: {}) => any;
24
+ } & {
25
+ control?: (props: {}) => any;
24
26
  } & {
25
27
  default?: (props: {}) => any;
26
28
  };
@@ -0,0 +1,109 @@
1
+ import { r as e } from "./fieldName-DBygJJfe.js";
2
+ import { a as t, i as n, s as r } from "./glyphs-CS3VBARx.js";
3
+ import { Fragment as i, Teleport as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, mergeModels as p, mergeProps as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, useId as b, useModel as x } from "vue";
4
+ import { MULTI_SELECT_SEARCH_AFTER as S, MULTI_SELECT_TEXT as C, multiSelectMatches as w, multiSelectSearches as T, multiSelectWithout as E, pageDir as D, portalTarget as O } from "@glimstone/core";
5
+ import { normalizeProps as k, useMachine as A } from "@zag-js/vue";
6
+ import * as j from "@zag-js/combobox";
7
+ // src/MultiSelect.vue?vue&type=script&setup=true&lang.ts
8
+ var M = { class: "glim-tag" }, N = { class: "glim-tag-text" }, P = [
9
+ "disabled",
10
+ "aria-label",
11
+ "onClick"
12
+ ], F = ["readonly", "placeholder"], I = ["aria-label"], L = ["data-state"], R = {
13
+ key: 0,
14
+ class: "glim-select-empty"
15
+ }, z = /* @__PURE__ */ f({
16
+ __name: "MultiSelect",
17
+ props: /*@__PURE__*/ p({
18
+ label: {},
19
+ hideLabel: {
20
+ type: Boolean,
21
+ default: !1
22
+ },
23
+ options: {},
24
+ placeholder: {},
25
+ searchAfter: {},
26
+ disabled: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ text: {}
31
+ }, {
32
+ modelValue: { required: !0 },
33
+ modelModifiers: {}
34
+ }),
35
+ emits: ["update:modelValue"],
36
+ setup(f) {
37
+ let p = f, z = x(f, "modelValue"), B = e(() => p.label), V = o(() => ({
38
+ ...C,
39
+ ...p.text
40
+ })), H = o(() => T(p.options.length, p.searchAfter ?? S)), U = g(""), W = o(() => H.value ? w(p.options, U.value) : p.options), G = g(null), K = b(), q = A(j.machine, o(() => ({
41
+ id: K,
42
+ dir: D(),
43
+ collection: j.collection({
44
+ items: W.value,
45
+ itemToValue: (e) => e.value,
46
+ itemToString: (e) => e.label,
47
+ isItemDisabled: (e) => !!e.disabled
48
+ }),
49
+ value: z.value,
50
+ multiple: !0,
51
+ disabled: p.disabled,
52
+ openOnClick: !0,
53
+ selectionBehavior: "clear",
54
+ positioning: {
55
+ sameWidth: !0,
56
+ gutter: 6
57
+ },
58
+ onOpenChange: ({ open: e }) => {
59
+ e || (U.value = "");
60
+ },
61
+ onInputValueChange: ({ inputValue: e }) => U.value = e,
62
+ onValueChange: (e) => z.value = e.value
63
+ }))), J = o(() => j.connect(q, k)), Y = (e) => p.options.find((t) => t.value === e)?.label ?? e, X = o(() => {
64
+ let { onKeydown: e, ...t } = J.value.getInputProps();
65
+ return {
66
+ rest: t,
67
+ onKeydown: e
68
+ };
69
+ }), Z = o(() => z.value.length === 0 ? p.placeholder : H.value ? V.value.search : void 0);
70
+ function Q(e) {
71
+ e.key === "Backspace" && J.value.inputValue === "" && z.value.length > 0 ? (e.preventDefault(), z.value = z.value.slice(0, -1)) : !H.value && e.key === " " ? (e.preventDefault(), J.value.open ? J.value.highlightedValue && J.value.selectValue(J.value.highlightedValue) : J.value.setOpen(!0)) : X.value.onKeydown?.(e);
72
+ }
73
+ function $(e) {
74
+ z.value = E(z.value, e), G.value?.focus();
75
+ }
76
+ return (e, o) => (h(), l("div", m({ "data-glim": "MultiSelect" }, J.value.getRootProps(), { class: "glim-tags" }), [
77
+ u("label", m(J.value.getLabelProps(), { class: f.hideLabel || f.label === void 0 ? "glim-sr-only" : "glim-field-label" }), v(y(B)), 17),
78
+ u("div", m(J.value.getControlProps(), { class: H.value ? "glim-tags-control" : "glim-tags-control glim-tags-control--pick" }), [
79
+ (h(!0), l(i, null, _(z.value, (e) => (h(), l("span", {
80
+ key: e,
81
+ class: "glim-tag-item"
82
+ }, [u("span", M, [u("span", N, v(Y(e)), 1), u("button", {
83
+ type: "button",
84
+ disabled: f.disabled,
85
+ "aria-label": V.value.remove(Y(e)),
86
+ class: "glim-tag-remove",
87
+ onClick: (t) => $(e)
88
+ }, [d(y(t))], 8, P)])]))), 128)),
89
+ u("input", m(X.value.rest, {
90
+ ref_key: "field",
91
+ ref: G,
92
+ readonly: !H.value,
93
+ placeholder: Z.value,
94
+ class: "glim-tags-input",
95
+ onKeydown: Q
96
+ }), null, 16, F),
97
+ u("button", m(J.value.getTriggerProps(), {
98
+ "aria-label": V.value.toggle,
99
+ class: "glim-combobox-toggle"
100
+ }), [u("span", {
101
+ class: "glim-select-indicator",
102
+ "data-state": J.value.open ? "open" : "closed"
103
+ }, [d(y(r))], 8, L)], 16, I)
104
+ ], 16),
105
+ (h(), s(a, { to: y(O)() }, [u("div", m(J.value.getPositionerProps(), { class: "glim-select-positioner" }), [u("ul", m(J.value.getContentProps(), { class: "glim-select-content" }), [W.value.length === 0 ? (h(), l("li", R, v(V.value.empty), 1)) : c("", !0), (h(!0), l(i, null, _(W.value, (e) => (h(), l("li", m({ key: e.value }, { ref_for: !0 }, J.value.getItemProps({ item: e }), { class: "glim-select-item" }), [u("span", m({ ref_for: !0 }, J.value.getItemTextProps({ item: e })), v(e.label), 17), u("span", m({ ref_for: !0 }, J.value.getItemIndicatorProps({ item: e }), { class: "glim-select-check" }), [d(y(n))], 16)], 16))), 128))], 16)], 16)], 8, ["to"]))
106
+ ], 16));
107
+ }
108
+ });
109
+ export { z as MultiSelect };
@@ -0,0 +1,28 @@
1
+ import { type MultiSelectText } from "@glimstone/core";
2
+ import type { SelectOption } from "./selectParts";
3
+ type __VLS_Props = {
4
+ label?: string;
5
+ hideLabel?: boolean;
6
+ options: SelectOption[];
7
+ /** Shown while nothing is picked. */
8
+ placeholder?: string;
9
+ /** How many choices the list shows before the field takes a search, seven unless given. */
10
+ searchAfter?: number;
11
+ disabled?: boolean;
12
+ text?: Partial<MultiSelectText>;
13
+ };
14
+ type __VLS_ModelProps = {
15
+ /** The picked values, in the order they were picked. */
16
+ modelValue: string[];
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string[]) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
23
+ }>, {
24
+ disabled: boolean;
25
+ hideLabel: boolean;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { type Catalog, type NotifyApi, type NotifyCardLabelKeys, type NotifyCardText, type NotifyChoice, type NotifyKind, type ToastSeverity } from "@glimstone/core";
2
+ type __VLS_Props = {
3
+ /** Loads, saves and tests the channels in the kit's notify format. */
4
+ api: NotifyApi;
5
+ /** The card's words, `notifyCardText(lang)` or the app's own. */
6
+ text: NotifyCardText;
7
+ /** The app's name, for the sentences that say it. */
8
+ app: string;
9
+ /** The interface language, which sorts the picker. */
10
+ lang: string;
11
+ /** The notification catalog, `NOTIFY_PROVIDERS`. */
12
+ providers: Catalog;
13
+ /** The kinds the app sends to, every kind of the kit by default. */
14
+ kinds?: readonly NotifyKind[];
15
+ /** The event kinds the app sends, which each channel can choose among. */
16
+ events?: readonly NotifyChoice[];
17
+ /** The keys a Healthchecks channel can give a check of their own, such as a job. */
18
+ checks?: readonly NotifyChoice[];
19
+ /** Kinds that send nothing where the app runs, with the sentence that says why. */
20
+ unavailable?: Partial<Record<NotifyKind, string>>;
21
+ /** Puts what a change did, or why it failed, into the app's toasts. */
22
+ notify?: (message: string, severity: ToastSeverity) => void;
23
+ /** The card's rainbow position. */
24
+ hueIndex?: number;
25
+ labelKeys?: Partial<NotifyCardLabelKeys>;
26
+ };
27
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
28
+ checks: readonly NotifyChoice[];
29
+ events: readonly NotifyChoice[];
30
+ kinds: readonly NotifyKind[];
31
+ unavailable: Partial<Record<NotifyKind, string>>;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { type NotifyCardFlow, type NotifyCardLabelKeys, type NotifyCardState, type NotifyCardText, type NotifyForm } from "@glimstone/core";
2
+ type __VLS_Props = {
3
+ form: NotifyForm;
4
+ state: NotifyCardState;
5
+ flow: NotifyCardFlow;
6
+ text: NotifyCardText;
7
+ keys: NotifyCardLabelKeys;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { type Component } from "vue";
2
+ import { type Catalog, type NotifyCardFlow, type NotifyCardLabelKeys, type NotifyCardState, type NotifyCardText, type NotifyChoice, type NotifyKind } from "@glimstone/core";
3
+ type __VLS_Props = {
4
+ state: NotifyCardState;
5
+ flow: NotifyCardFlow;
6
+ text: NotifyCardText;
7
+ app: string;
8
+ lang: string;
9
+ providers: Catalog;
10
+ kinds: readonly NotifyKind[];
11
+ events: readonly NotifyChoice[];
12
+ checks: readonly NotifyChoice[];
13
+ unavailable: Partial<Record<NotifyKind, string>>;
14
+ keys: NotifyCardLabelKeys;
15
+ mark: (kind: NotifyKind) => Component;
16
+ };
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
@@ -1,13 +1,13 @@
1
1
  import { t as e } from "./Button-CZHmbNOm.js";
2
2
  import { d as t, t as n } from "./glyphs-CS3VBARx.js";
3
- import { Fragment as r, computed as i, createElementBlock as a, createVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, openBlock as u, renderList as d, toDisplayString as f, unref as p, useId as m, useModel as h } from "vue";
4
- import { PAGINATION_TEXT as g, pageDir as _ } from "@glimstone/core";
5
- import { normalizeProps as v, useMachine as y } from "@zag-js/vue";
6
- import * as b from "@zag-js/pagination";
7
- // src/Pagination.vue
8
- var x = /* @__PURE__ */ s({
3
+ import { Fragment as r, computed as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, mergeModels as l, mergeProps as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, useId as v, useModel as y } from "vue";
4
+ import { PAGINATION_TEXT as b, pageDir as x, watchPaginationFit as S } from "@glimstone/core";
5
+ import { normalizeProps as C, useMachine as w } from "@zag-js/vue";
6
+ import * as T from "@zag-js/pagination";
7
+ // src/Pagination.vue?vue&type=script&setup=true&lang.ts
8
+ var E = { class: "glim-page-status glim-num" }, D = { "aria-hidden": "true" }, O = { class: "glim-sr-only" }, k = /* @__PURE__ */ c({
9
9
  __name: "Pagination",
10
- props: /*@__PURE__*/ c({
10
+ props: /*@__PURE__*/ l({
11
11
  count: {},
12
12
  pageSize: { default: 10 },
13
13
  siblingCount: { default: 1 },
@@ -17,50 +17,83 @@ var x = /* @__PURE__ */ s({
17
17
  pageModifiers: {}
18
18
  }),
19
19
  emits: ["update:page"],
20
- setup(s) {
21
- let c = s, x = h(s, "page"), S = i(() => ({
22
- ...g,
23
- ...c.text
24
- })), C = m(), w = y(b.machine, i(() => ({
25
- id: C,
26
- dir: _(),
27
- count: c.count,
28
- pageSize: c.pageSize,
29
- siblingCount: c.siblingCount,
30
- page: x.value ?? 1,
31
- onPageChange: (e) => x.value = e.page,
20
+ setup(c) {
21
+ let l = c, k = y(c, "page"), A = i(() => ({
22
+ ...b,
23
+ ...l.text
24
+ })), j = v(), M = w(T.machine, i(() => ({
25
+ id: j,
26
+ dir: x(),
27
+ count: l.count,
28
+ pageSize: l.pageSize,
29
+ siblingCount: l.siblingCount,
30
+ page: k.value ?? 1,
31
+ onPageChange: (e) => k.value = e.page,
32
32
  translations: {
33
- rootLabel: S.value.label,
34
- itemLabel: (e) => S.value.page(e.page, e.totalPages)
33
+ rootLabel: A.value.label,
34
+ itemLabel: (e) => A.value.page(e.page, e.totalPages)
35
35
  }
36
- }))), T = i(() => b.connect(w, v));
37
- return (i, s) => (u(), a("nav", l({ "data-glim": "Pagination" }, T.value.getRootProps(), { class: "glim-pagination" }), [
38
- o(e, {
39
- label: S.value.previous,
36
+ }))), N = i(() => T.connect(M, C)), P = m(), F = () => {};
37
+ return f(() => F = S(P.value)), d(() => F()), (i, c) => (p(), a("nav", u({
38
+ ref_key: "nav",
39
+ ref: P,
40
+ "data-glim": "Pagination"
41
+ }, N.value.getRootProps(), { class: "glim-pagination" }), [
42
+ s(e, {
43
+ class: "glim-page-step",
44
+ label: A.value.previous,
40
45
  "label-key": null,
41
- glyph: p(n),
46
+ glyph: _(n),
42
47
  variant: "icon",
43
- disabled: T.value.previousPage === null,
44
- onClick: s[0] ||= (e) => T.value.goToPrevPage()
48
+ disabled: N.value.previousPage === null,
49
+ onClick: c[0] ||= (e) => N.value.goToPrevPage()
45
50
  }, null, 8, [
46
51
  "label",
47
52
  "glyph",
48
53
  "disabled"
49
54
  ]),
50
- (u(!0), a(r, null, d(T.value.pages, (e, t) => (u(), a(r, { key: e.type === "page" ? e.value : `gap-${t}` }, [e.type === "page" ? (u(), a("button", l({
55
+ s(e, {
56
+ class: "glim-page-step-short",
57
+ label: A.value.previous,
58
+ "label-key": null,
59
+ glyph: _(n),
60
+ compact: "",
61
+ disabled: N.value.previousPage === null,
62
+ onClick: c[1] ||= (e) => N.value.goToPrevPage()
63
+ }, null, 8, [
64
+ "label",
65
+ "glyph",
66
+ "disabled"
67
+ ]),
68
+ (p(!0), a(r, null, h(N.value.pages, (e, t) => (p(), a(r, { key: e.type === "page" ? e.value : `gap-${t}` }, [e.type === "page" ? (p(), a("button", u({
51
69
  key: 0,
52
70
  ref_for: !0
53
- }, T.value.getItemProps(e), { class: "glim-page glim-num" }), f(e.value), 17)) : (u(), a("span", l({
71
+ }, N.value.getItemProps(e), { class: "glim-page glim-num" }), g(e.value), 17)) : (p(), a("span", u({
54
72
  key: 1,
55
73
  ref_for: !0
56
- }, T.value.getEllipsisProps({ index: t }), { class: "glim-page-gap" }), "…", 16))], 64))), 128)),
57
- o(e, {
58
- label: S.value.next,
74
+ }, N.value.getEllipsisProps({ index: t }), { class: "glim-page-gap" }), "…", 16))], 64))), 128)),
75
+ o("span", E, [o("span", D, g(A.value.status(N.value.page, N.value.totalPages)), 1), o("span", O, g(A.value.page(N.value.page, N.value.totalPages)), 1)]),
76
+ s(e, {
77
+ class: "glim-page-step",
78
+ label: A.value.next,
59
79
  "label-key": null,
60
- glyph: p(t),
80
+ glyph: _(t),
61
81
  variant: "icon",
62
- disabled: T.value.nextPage === null,
63
- onClick: s[1] ||= (e) => T.value.goToNextPage()
82
+ disabled: N.value.nextPage === null,
83
+ onClick: c[2] ||= (e) => N.value.goToNextPage()
84
+ }, null, 8, [
85
+ "label",
86
+ "glyph",
87
+ "disabled"
88
+ ]),
89
+ s(e, {
90
+ class: "glim-page-step-short",
91
+ label: A.value.next,
92
+ "label-key": null,
93
+ glyph: _(t),
94
+ compact: "",
95
+ disabled: N.value.nextPage === null,
96
+ onClick: c[3] ||= (e) => N.value.goToNextPage()
64
97
  }, null, 8, [
65
98
  "label",
66
99
  "glyph",
@@ -69,4 +102,4 @@ var x = /* @__PURE__ */ s({
69
102
  ], 16));
70
103
  }
71
104
  });
72
- export { x as Pagination };
105
+ export { k as Pagination };
@@ -0,0 +1,2 @@
1
+ export { default as MultiSelect } from "../MultiSelect.vue";
2
+ export type { MultiSelectText } from "@glimstone/core";
package/dist/index.d.ts CHANGED
@@ -56,6 +56,7 @@ export { default as Sheet } from "./Sheet.vue";
56
56
  export { default as SignInCard } from "./SignInCard.vue";
57
57
  export { default as SignInReauthWindow } from "./SignInReauthWindow.vue";
58
58
  export { default as SignInTile } from "./SignInTile.vue";
59
+ export { default as NotifyCard } from "./NotifyCard.vue";
59
60
  export { default as SkeletonRow } from "./SkeletonRow.vue";
60
61
  export { default as SignInField } from "./SignInField.vue";
61
62
  export { default as SubCard } from "./SubCard.vue";
@@ -81,7 +82,7 @@ export type { InfoAboutCardProps, InfoComponentsCardProps, InfoHelpCardProps, In
81
82
  export type { SelectEntry, SelectGroup, SelectOption, SelectSubmenu } from "./selectParts";
82
83
  export type { SelectorItem } from "./selectorItem";
83
84
  export type { ConnectionAction, MenuBarMenu, MenuEntry, MenuHead, MenuItem, PickerItem, TreeNode, WindowAction } from "./windowParts";
84
- export type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest, PickBadge, PickGroup, PickerText, ResetAnswer, SignInAnswer, SignInCardService, SignInReauthText, SignInText, SignInTileCard, SignInTileLabelKeys, SignInTileText, TileMark } from "@glimstone/core";
85
+ export type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest, NotifyCardLabelKeys, NotifyCardText, PickBadge, PickGroup, PickerText, ResetAnswer, SignInAnswer, SignInCardService, SignInReauthText, SignInText, SignInTileCard, SignInTileLabelKeys, SignInTileText, TileMark } from "@glimstone/core";
85
86
  export type { ChangeAnswer, FortressAnswer, FortressApp, FortressInstance, FortressLogLine, FortressPermission, FortressStatusReport, FortressText, PhraseAnswer } from "@glimstone/core";
86
87
  export type { BadgeShape, BadgeSize, BadgeTone, ButtonTone, ButtonVariant, CryptoCoin, CryptoNetwork, FortressLabelKeys, InstanceFigure, MenuBarHandle, NotchInset, ReadmeBrand, ReadmePart } from "@glimstone/core";
87
88
  export type { SelectMode, SelectSize, SelectWidth, SelectorActivation, SelectorOrientation, SelectorSize, SelectorVariant, SidebarCount, SignInLabelKeys, ToastViewportEntry, UpdateCheck, VersionRow } from "@glimstone/core";