@lovince/ui-vue 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@ effects run through [`@lovince/ui-dom`](../ui-dom). This package subscribes to
6
6
  the machine, feeds props in, and renders what `connect()` returns. It holds no
7
7
  behaviour of its own.
8
8
 
9
- > **Status: `0.5.0`, experimental.** The API may change before `1.0`.
9
+ > **Status: `0.6.0`, experimental.** The API may change before `1.0`.
10
10
 
11
11
  ```bash
12
12
  bun add @lovince/ui-vue
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { Orientation } from '@lovince/ui-headless';
2
+ import { Orientation, TimelineAlign } from '@lovince/ui-headless';
3
3
  export declare const LvTimeline: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
4
  as: {
5
5
  default: string;
@@ -13,6 +13,11 @@ export declare const LvTimeline: import('vue').DefineComponent<import('vue').Ext
13
13
  type: PropType<Orientation>;
14
14
  default: string;
15
15
  };
16
+ /** Which side of the rail content sits on; `alternate` zig-zags. Horizontal timelines put content below. */
17
+ align: {
18
+ type: PropType<TimelineAlign>;
19
+ default: string;
20
+ };
16
21
  reveal: {
17
22
  type: BooleanConstructor;
18
23
  default: boolean;
@@ -36,6 +41,11 @@ export declare const LvTimeline: import('vue').DefineComponent<import('vue').Ext
36
41
  type: PropType<Orientation>;
37
42
  default: string;
38
43
  };
44
+ /** Which side of the rail content sits on; `alternate` zig-zags. Horizontal timelines put content below. */
45
+ align: {
46
+ type: PropType<TimelineAlign>;
47
+ default: string;
48
+ };
39
49
  reveal: {
40
50
  type: BooleanConstructor;
41
51
  default: boolean;
@@ -50,6 +60,7 @@ export declare const LvTimeline: import('vue').DefineComponent<import('vue').Ext
50
60
  orientation: Orientation;
51
61
  reveal: boolean;
52
62
  current: number;
63
+ align: "start" | "end" | "alternate";
53
64
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
54
65
  export declare const LvTimelineItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
55
66
  as: {
@@ -195,6 +195,113 @@ export declare const LvPaginationNext: import('vue').DefineComponent<import('vue
195
195
  asChild: boolean;
196
196
  label: string;
197
197
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
198
+ export declare const LvPaginationFirst: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
199
+ label: {
200
+ type: StringConstructor;
201
+ default: string;
202
+ };
203
+ as: {
204
+ readonly default: "button";
205
+ readonly type: import('vue').PropType<string | import('vue').Component>;
206
+ };
207
+ asChild: {
208
+ readonly type: BooleanConstructor;
209
+ readonly default: false;
210
+ };
211
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
212
+ [key: string]: any;
213
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
214
+ label: {
215
+ type: StringConstructor;
216
+ default: string;
217
+ };
218
+ as: {
219
+ readonly default: "button";
220
+ readonly type: import('vue').PropType<string | import('vue').Component>;
221
+ };
222
+ asChild: {
223
+ readonly type: BooleanConstructor;
224
+ readonly default: false;
225
+ };
226
+ }>> & Readonly<{}>, {
227
+ as: string | import('vue').Component;
228
+ asChild: boolean;
229
+ label: string;
230
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
231
+ export declare const LvPaginationLast: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
232
+ label: {
233
+ type: StringConstructor;
234
+ default: string;
235
+ };
236
+ as: {
237
+ readonly default: "button";
238
+ readonly type: import('vue').PropType<string | import('vue').Component>;
239
+ };
240
+ asChild: {
241
+ readonly type: BooleanConstructor;
242
+ readonly default: false;
243
+ };
244
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
245
+ [key: string]: any;
246
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
247
+ label: {
248
+ type: StringConstructor;
249
+ default: string;
250
+ };
251
+ as: {
252
+ readonly default: "button";
253
+ readonly type: import('vue').PropType<string | import('vue').Component>;
254
+ };
255
+ asChild: {
256
+ readonly type: BooleanConstructor;
257
+ readonly default: false;
258
+ };
259
+ }>> & Readonly<{}>, {
260
+ as: string | import('vue').Component;
261
+ asChild: boolean;
262
+ label: string;
263
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
264
+ /** A page field for long lists: typing edits a draft, Enter or blur goes to that page. */
265
+ export declare const LvPaginationInput: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
266
+ label: {
267
+ type: StringConstructor;
268
+ default: string;
269
+ };
270
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
271
+ [key: string]: any;
272
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
273
+ label: {
274
+ type: StringConstructor;
275
+ default: string;
276
+ };
277
+ }>> & Readonly<{}>, {
278
+ label: string;
279
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
280
+ /** Announces the page politely when it changes. Defaults to "Page 4 of 12". */
281
+ export declare const LvPaginationStatus: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
282
+ as: {
283
+ default: string;
284
+ type: import('vue').PropType<string | import('vue').Component>;
285
+ };
286
+ asChild: {
287
+ readonly type: BooleanConstructor;
288
+ readonly default: false;
289
+ };
290
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
291
+ [key: string]: any;
292
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
293
+ as: {
294
+ default: string;
295
+ type: import('vue').PropType<string | import('vue').Component>;
296
+ };
297
+ asChild: {
298
+ readonly type: BooleanConstructor;
299
+ readonly default: false;
300
+ };
301
+ }>> & Readonly<{}>, {
302
+ as: string | import('vue').Component;
303
+ asChild: boolean;
304
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
198
305
  export declare const LvPaginationEllipsis: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
199
306
  as: {
200
307
  default: string;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { IconFlip, IconName } from '@lovince/icons';
2
+ import { IconAnimation, IconFlip, IconName, IconTrigger } from '@lovince/icons';
3
3
  export declare const LvIcon: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
4
  name: {
5
5
  type: PropType<IconName>;
@@ -33,6 +33,21 @@ export declare const LvIcon: import('vue').DefineComponent<import('vue').Extract
33
33
  type: StringConstructor;
34
34
  default: undefined;
35
35
  };
36
+ /** Motion from `@lovince/icons/style.css`. Omit for a still icon. */
37
+ animation: {
38
+ type: PropType<IconAnimation>;
39
+ default: undefined;
40
+ };
41
+ /** When it plays; each animation has a sensible default. */
42
+ trigger: {
43
+ type: PropType<IconTrigger>;
44
+ default: undefined;
45
+ };
46
+ /** `active` trigger: plays each time this turns true. `loop`: pauses while false. */
47
+ active: {
48
+ type: BooleanConstructor;
49
+ default: undefined;
50
+ };
36
51
  }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
37
52
  [key: string]: any;
38
53
  }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -68,12 +83,30 @@ export declare const LvIcon: import('vue').DefineComponent<import('vue').Extract
68
83
  type: StringConstructor;
69
84
  default: undefined;
70
85
  };
86
+ /** Motion from `@lovince/icons/style.css`. Omit for a still icon. */
87
+ animation: {
88
+ type: PropType<IconAnimation>;
89
+ default: undefined;
90
+ };
91
+ /** When it plays; each animation has a sensible default. */
92
+ trigger: {
93
+ type: PropType<IconTrigger>;
94
+ default: undefined;
95
+ };
96
+ /** `active` trigger: plays each time this turns true. `loop`: pauses while false. */
97
+ active: {
98
+ type: BooleanConstructor;
99
+ default: undefined;
100
+ };
71
101
  }>> & Readonly<{}>, {
72
102
  fill: number | boolean;
73
103
  size: string | number;
74
104
  label: string;
105
+ active: boolean;
106
+ trigger: "loop" | "active" | "hover" | "group-hover" | "press" | "in-view" | "mount";
75
107
  flip: IconFlip;
76
108
  rotate: string | number;
77
109
  strokeWidth: string | number;
78
110
  absoluteStrokeWidth: boolean;
111
+ animation: "pop" | "spin" | "pulse" | "bounce" | "wiggle" | "ring" | "nudge" | "draw";
79
112
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
package/dist/icon.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { LvIcon } from './components/primitives/icon';
2
- export type { IconFlip, IconName } from '@lovince/icons';
2
+ export type { IconAnimation, IconFlip, IconName, IconTrigger } from '@lovince/icons';
package/dist/icon.js CHANGED
@@ -1,7 +1,7 @@
1
- import { computed as e, defineComponent as t, h as n } from "vue";
2
- import { CANVAS as r, paths as i, resolveFill as a, resolveGeometry as o } from "@lovince/icons";
1
+ import { computed as e, defineComponent as t, h as n, onBeforeUnmount as r, ref as i, watch as a } from "vue";
2
+ import { CANVAS as o, iconMotionAttrs as s, iconPathLength as c, observeInView as l, paths as u, resolveFill as d, resolveGeometry as f, resolveIconTrigger as p } from "@lovince/icons";
3
3
  //#region src/components/primitives/icon.ts
4
- var s = t({
4
+ var m = t({
5
5
  name: "LvIcon",
6
6
  inheritAttrs: !1,
7
7
  props: {
@@ -36,10 +36,31 @@ var s = t({
36
36
  label: {
37
37
  type: String,
38
38
  default: void 0
39
+ },
40
+ animation: {
41
+ type: String,
42
+ default: void 0
43
+ },
44
+ trigger: {
45
+ type: String,
46
+ default: void 0
47
+ },
48
+ active: {
49
+ type: Boolean,
50
+ default: void 0
39
51
  }
40
52
  },
41
- setup: (t, { attrs: s }) => {
42
- let c = e(() => o({
53
+ setup: (t, { attrs: m }) => {
54
+ let h = i(null), g = i(!1), _ = null, v = () => {
55
+ _?.(), _ = null;
56
+ };
57
+ a([h, () => p({
58
+ animation: t.animation,
59
+ trigger: t.trigger
60
+ })], ([e, t]) => {
61
+ v(), e !== null && t === "in-view" && !g.value && (_ = l(e, () => g.value = !0));
62
+ }, { flush: "post" }), r(v);
63
+ let y = e(() => f({
43
64
  size: t.size,
44
65
  strokeWidth: t.strokeWidth,
45
66
  absoluteStrokeWidth: t.absoluteStrokeWidth,
@@ -47,30 +68,38 @@ var s = t({
47
68
  flip: t.flip
48
69
  }));
49
70
  return () => {
50
- let e = i[t.name] ?? [], o = a(t.fill), l = t.label === void 0 || t.label.length === 0;
71
+ let e = u[t.name] ?? [], r = d(t.fill), i = t.label === void 0 || t.label.length === 0, a = {
72
+ animation: t.animation,
73
+ trigger: t.trigger,
74
+ active: t.active,
75
+ inView: g.value
76
+ }, l = c(a);
51
77
  return n("svg", {
52
- ...s,
53
- class: ["lovince-icon", s.class],
78
+ ...m,
79
+ ...s(a),
80
+ ref: h,
81
+ class: ["lovince-icon", m.class],
54
82
  "data-icon": t.name,
55
83
  xmlns: "http://www.w3.org/2000/svg",
56
- width: c.value.size,
57
- height: c.value.size,
58
- viewBox: `0 0 ${r} ${r}`,
84
+ width: y.value.size,
85
+ height: y.value.size,
86
+ viewBox: `0 0 ${o} ${o}`,
59
87
  fill: "none",
60
88
  stroke: "currentColor",
61
- "stroke-width": c.value.strokeWidth,
89
+ "stroke-width": y.value.strokeWidth,
62
90
  "stroke-linecap": "round",
63
91
  "stroke-linejoin": "round",
64
- "aria-hidden": l ? "true" : void 0,
65
- role: l ? void 0 : "img",
66
- "aria-label": l ? void 0 : t.label
67
- }, [n("g", { transform: c.value.transform }, e.map((e) => n("path", {
92
+ "aria-hidden": i ? "true" : void 0,
93
+ role: i ? void 0 : "img",
94
+ "aria-label": i ? void 0 : t.label
95
+ }, [n("g", { transform: y.value.transform }, e.map((e) => n("path", {
68
96
  d: e,
69
- fill: o > 0 ? "currentColor" : "none",
70
- "fill-opacity": o > 0 ? o : void 0
97
+ pathLength: l,
98
+ fill: r > 0 ? "currentColor" : "none",
99
+ "fill-opacity": r > 0 ? r : void 0
71
100
  })))]);
72
101
  };
73
102
  }
74
103
  });
75
104
  //#endregion
76
- export { s as LvIcon };
105
+ export { m as LvIcon };