dou-ui 0.1.0-alpha.12 → 0.1.0-alpha.13

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.
Files changed (41) hide show
  1. package/dist/components/button/button.js.map +1 -1
  2. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js +29 -17
  3. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js +8 -1
  5. package/dist/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/chat-input/chat-input2.js.map +1 -1
  7. package/dist/components/check-tag/check-tag.vue_vue_type_script_setup_true_lang.js +8 -5
  8. package/dist/components/check-tag/check-tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/check-tag/check-tag2.js.map +1 -1
  10. package/dist/components/command/command-dialog.js.map +1 -1
  11. package/dist/components/command/command-dialog.vue_vue_type_script_setup_true_lang.js +7 -1
  12. package/dist/components/command/command-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/command/command.js.map +1 -1
  14. package/dist/components/command/command.vue_vue_type_script_setup_true_lang.js +65 -12
  15. package/dist/components/command/command.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/command/command2.js.map +1 -1
  17. package/dist/components/link/link.js.map +1 -1
  18. package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js +6 -4
  19. package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/menu/menu-actions.js +3 -13
  21. package/dist/components/menu/menu-actions.js.map +1 -1
  22. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js +3 -11
  23. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js.map +1 -1
  24. package/dist/components/status-dot/status-dot2.js.map +1 -1
  25. package/dist/components/tag/tag.js.map +1 -1
  26. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js +9 -6
  27. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/composables/use-grouped-window.js +4 -1
  29. package/dist/composables/use-grouped-window.js.map +1 -1
  30. package/dist/composables/use-measured-sizes.js +6 -5
  31. package/dist/composables/use-measured-sizes.js.map +1 -1
  32. package/dist/style.css +1 -1
  33. package/dist/types/components/command/command-dialog.vue.d.ts +1 -0
  34. package/dist/types/components/command/command.d.ts +7 -1
  35. package/dist/types/components/command/index.d.ts +3 -0
  36. package/dist/types/composables/use-grouped-window.d.ts +1 -0
  37. package/dist/types/composables/use-measured-sizes.d.ts +6 -0
  38. package/dist/types/utils/slot.d.ts +19 -0
  39. package/dist/utils/slot.js +36 -0
  40. package/dist/utils/slot.js.map +1 -0
  41. package/package.json +3 -3
@@ -15,6 +15,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
15
15
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
16
16
  "onUpdate:query"?: ((value: string) => any) | undefined;
17
17
  }>, {
18
+ virtual: boolean;
18
19
  maxHeight: string | number;
19
20
  width: string | number;
20
21
  loop: boolean;
@@ -42,9 +42,15 @@ export interface CommandProps {
42
42
  maxHeight?: number | string;
43
43
  /**
44
44
  * Render only the items in view. By default this turns on by itself past
45
- * 100 items; pass `false` for items of differing heights.
45
+ * 100 items.
46
46
  */
47
47
  virtual?: boolean;
48
+ /**
49
+ * The height of a row in px while `virtual` is on, or a function giving
50
+ * each item's. Rows are exactly this tall then. Left out, rows grow to
51
+ * fit and are measured once rendered. Unused with `virtual` off.
52
+ */
53
+ itemSize?: number | ((item: CommandItem) => number);
48
54
  /** Names the search box when there is no visible label. */
49
55
  ariaLabel?: string;
50
56
  }
@@ -60,6 +60,7 @@ export declare const DouCommandDialog: import("../..").WithInstall<{
60
60
  "update:open": (value: boolean) => any;
61
61
  "update:query": (value: string) => any;
62
62
  }, import("vue").PublicProps, {
63
+ virtual: boolean;
63
64
  maxHeight: string | number;
64
65
  width: string | number;
65
66
  loop: boolean;
@@ -80,6 +81,7 @@ export declare const DouCommandDialog: import("../..").WithInstall<{
80
81
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
81
82
  "onUpdate:query"?: ((value: string) => any) | undefined;
82
83
  }>, {}, {}, {}, {}, {
84
+ virtual: boolean;
83
85
  maxHeight: string | number;
84
86
  width: string | number;
85
87
  loop: boolean;
@@ -101,6 +103,7 @@ export declare const DouCommandDialog: import("../..").WithInstall<{
101
103
  "update:open": (value: boolean) => any;
102
104
  "update:query": (value: string) => any;
103
105
  }, string, {
106
+ virtual: boolean;
104
107
  maxHeight: string | number;
105
108
  width: string | number;
106
109
  loop: boolean;
@@ -33,4 +33,5 @@ export declare function useGroupedWindow(options: UseGroupedWindowOptions): {
33
33
  windows: import("vue").ComputedRef<GroupWindow[]>;
34
34
  scrollToItem: (group: number, index: number) => void;
35
35
  measure: () => void;
36
+ startOf: (group: number, index: number) => number;
36
37
  };
@@ -7,6 +7,12 @@ export interface UseMeasuredSizesOptions<K> {
7
7
  estimate: (index: number) => number;
8
8
  /** The element that scrolls, kept steady while items above the view change height. */
9
9
  container: () => HTMLElement | null | undefined;
10
+ /**
11
+ * Where an item starts in the scrolled content, when items don't simply
12
+ * follow each other from the top, e.g. under group labels. Defaults to
13
+ * the sum of the sizes before it.
14
+ */
15
+ start?: (index: number) => number;
10
16
  }
11
17
  /**
12
18
  * Item offsets for a list whose items are measured once rendered.
@@ -0,0 +1,19 @@
1
+ import type { VNode } from 'vue';
2
+ /**
3
+ * Whether rendered slot content shows anything. Comments (what a false
4
+ * `v-if` leaves), blank text, booleans, `null`, `undefined` and fragments
5
+ * holding only those don't. A component counts: what it renders is known
6
+ * only once it renders, so a `v-if` that should empty the slot goes on the
7
+ * component itself.
8
+ */
9
+ export declare function rendersSomething(nodes: unknown): boolean;
10
+ /**
11
+ * Renders a slot once and hands back what it rendered, or `undefined` when
12
+ * it is not passed or renders nothing, so it counts as not passed. Call it
13
+ * while rendering: slot content can change from one render to the next.
14
+ */
15
+ export declare function filled<A extends unknown[]>(slot: ((...args: A) => unknown) | undefined, ...args: A): VNode[] | undefined;
16
+ /** Puts down slot content already rendered with `filled`. */
17
+ export declare const SlotNodes: (props: {
18
+ nodes: unknown;
19
+ }) => VNode[];
@@ -0,0 +1,36 @@
1
+ import { Comment, Fragment, Text, isVNode } from "vue";
2
+ // src/utils/slot.ts
3
+ /**
4
+ * Whether rendered slot content shows anything. Comments (what a false
5
+ * `v-if` leaves), blank text, booleans, `null`, `undefined` and fragments
6
+ * holding only those don't. A component counts: what it renders is known
7
+ * only once it renders, so a `v-if` that should empty the slot goes on the
8
+ * component itself.
9
+ */
10
+ function rendersSomething(nodes) {
11
+ return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => {
12
+ if (!isVNode(node)) {
13
+ if (typeof node === "string") return node.trim() !== "";
14
+ return typeof node === "number";
15
+ }
16
+ if (node.type === Comment) return false;
17
+ if (node.type === Text) return String(node.children ?? "").trim() !== "";
18
+ if (node.type === Fragment) return rendersSomething(node.children);
19
+ return true;
20
+ });
21
+ }
22
+ /**
23
+ * Renders a slot once and hands back what it rendered, or `undefined` when
24
+ * it is not passed or renders nothing, so it counts as not passed. Call it
25
+ * while rendering: slot content can change from one render to the next.
26
+ */
27
+ function filled(slot, ...args) {
28
+ if (!slot) return void 0;
29
+ const nodes = slot(...args);
30
+ return rendersSomething(nodes) ? nodes : void 0;
31
+ }
32
+ /** Puts down slot content already rendered with `filled`. */
33
+ var SlotNodes = (props) => props.nodes;
34
+ export { SlotNodes, filled, rendersSomething };
35
+
36
+ //# sourceMappingURL=slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.js","names":[],"sources":["../../src/utils/slot.ts"],"sourcesContent":["import { Comment, Fragment, Text, isVNode } from 'vue'\nimport type { VNode } from 'vue'\n\n/**\n * Whether rendered slot content shows anything. Comments (what a false\n * `v-if` leaves), blank text, booleans, `null`, `undefined` and fragments\n * holding only those don't. A component counts: what it renders is known\n * only once it renders, so a `v-if` that should empty the slot goes on the\n * component itself.\n */\nexport function rendersSomething(nodes: unknown): boolean {\n return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => {\n if (!isVNode(node)) {\n if (typeof node === 'string') return node.trim() !== ''\n return typeof node === 'number'\n }\n if (node.type === Comment) return false\n if (node.type === Text) return String(node.children ?? '').trim() !== ''\n if (node.type === Fragment) return rendersSomething(node.children)\n return true\n })\n}\n\n/**\n * Renders a slot once and hands back what it rendered, or `undefined` when\n * it is not passed or renders nothing, so it counts as not passed. Call it\n * while rendering: slot content can change from one render to the next.\n */\nexport function filled<A extends unknown[]>(\n slot: ((...args: A) => unknown) | undefined,\n ...args: A\n): VNode[] | undefined {\n if (!slot) return undefined\n const nodes = slot(...args)\n return rendersSomething(nodes) ? (nodes as VNode[]) : undefined\n}\n\n/** Puts down slot content already rendered with `filled`. */\nexport const SlotNodes = (props: { nodes: unknown }) => props.nodes as VNode[]\n"],"mappings":";;;;;;;;;AAUA,SAAgB,iBAAiB,OAAyB;CACxD,QAAQ,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAA,CAAG,MAAM,SAAS;EAC7D,IAAI,CAAC,QAAQ,IAAI,GAAG;GAClB,IAAI,OAAO,SAAS,UAAU,OAAO,KAAK,KAAK,MAAM;GACrD,OAAO,OAAO,SAAS;EACzB;EACA,IAAI,KAAK,SAAS,SAAS,OAAO;EAClC,IAAI,KAAK,SAAS,MAAM,OAAO,OAAO,KAAK,YAAY,EAAE,CAAC,CAAC,KAAK,MAAM;EACtE,IAAI,KAAK,SAAS,UAAU,OAAO,iBAAiB,KAAK,QAAQ;EACjE,OAAO;CACT,CAAC;AACH;;;;;;AAOA,SAAgB,OACd,MACA,GAAG,MACkB;CACrB,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,MAAM,QAAQ,KAAK,GAAG,IAAI;CAC1B,OAAO,iBAAiB,KAAK,IAAK,QAAoB,KAAA;AACxD;;AAGA,IAAa,aAAa,UAA8B,MAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dou-ui",
3
- "version": "0.1.0-alpha.12",
3
+ "version": "0.1.0-alpha.13",
4
4
  "description": "为自己打造的 Vue 3 组件库:简洁克制,样式与组件分离,内置无障碍支持",
5
5
  "keywords": [
6
6
  "vue",
@@ -49,8 +49,8 @@
49
49
  "vue": "^3.5.0"
50
50
  },
51
51
  "dependencies": {
52
- "@dou-ui/icons": "0.1.0-alpha.12",
53
- "@dou-ui/theme": "0.1.0-alpha.12"
52
+ "@dou-ui/icons": "0.1.0-alpha.13",
53
+ "@dou-ui/theme": "0.1.0-alpha.13"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"