@iris-ui-kit/vue 0.1.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/LICENSE +21 -0
- package/dist/admin.cjs +1869 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +376 -0
- package/dist/admin.d.ts +376 -0
- package/dist/admin.js +10 -0
- package/dist/admin.js.map +1 -0
- package/dist/async.cjs +76 -0
- package/dist/async.cjs.map +1 -0
- package/dist/async.d.cts +59 -0
- package/dist/async.d.ts +59 -0
- package/dist/async.js +3 -0
- package/dist/async.js.map +1 -0
- package/dist/behaviors.cjs +659 -0
- package/dist/behaviors.cjs.map +1 -0
- package/dist/behaviors.d.cts +441 -0
- package/dist/behaviors.d.ts +441 -0
- package/dist/behaviors.js +3 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/chunk-3FJUCHCC.js +146 -0
- package/dist/chunk-3FJUCHCC.js.map +1 -0
- package/dist/chunk-3R3QDLJC.js +172 -0
- package/dist/chunk-3R3QDLJC.js.map +1 -0
- package/dist/chunk-4FLIW67H.js +137 -0
- package/dist/chunk-4FLIW67H.js.map +1 -0
- package/dist/chunk-4FQ7XF52.js +3 -0
- package/dist/chunk-4FQ7XF52.js.map +1 -0
- package/dist/chunk-72PZMU6R.js +99 -0
- package/dist/chunk-72PZMU6R.js.map +1 -0
- package/dist/chunk-75GSYEJS.js +17 -0
- package/dist/chunk-75GSYEJS.js.map +1 -0
- package/dist/chunk-7IOJADZC.js +38 -0
- package/dist/chunk-7IOJADZC.js.map +1 -0
- package/dist/chunk-CIZGSGXN.js +651 -0
- package/dist/chunk-CIZGSGXN.js.map +1 -0
- package/dist/chunk-F77KIPOH.js +103 -0
- package/dist/chunk-F77KIPOH.js.map +1 -0
- package/dist/chunk-FJBYAIL4.js +1318 -0
- package/dist/chunk-FJBYAIL4.js.map +1 -0
- package/dist/chunk-H7HVVPYR.js +66 -0
- package/dist/chunk-H7HVVPYR.js.map +1 -0
- package/dist/chunk-I6D5VXQK.js +167 -0
- package/dist/chunk-I6D5VXQK.js.map +1 -0
- package/dist/chunk-PPYNXNGZ.js +73 -0
- package/dist/chunk-PPYNXNGZ.js.map +1 -0
- package/dist/chunk-QLUIKEMJ.js +1197 -0
- package/dist/chunk-QLUIKEMJ.js.map +1 -0
- package/dist/chunk-ROJV6RON.js +3 -0
- package/dist/chunk-ROJV6RON.js.map +1 -0
- package/dist/chunk-S43IHHBU.js +82 -0
- package/dist/chunk-S43IHHBU.js.map +1 -0
- package/dist/chunk-TCAXRWT6.js +108 -0
- package/dist/chunk-TCAXRWT6.js.map +1 -0
- package/dist/chunk-TQB5LVOH.js +17 -0
- package/dist/chunk-TQB5LVOH.js.map +1 -0
- package/dist/chunk-VM2CXEUA.js +46 -0
- package/dist/chunk-VM2CXEUA.js.map +1 -0
- package/dist/chunk-W2JVHGFR.js +103 -0
- package/dist/chunk-W2JVHGFR.js.map +1 -0
- package/dist/chunk-WL67XCH5.js +59 -0
- package/dist/chunk-WL67XCH5.js.map +1 -0
- package/dist/chunk-XCNCIG2I.js +165 -0
- package/dist/chunk-XCNCIG2I.js.map +1 -0
- package/dist/chunk-XSLBANUV.js +16 -0
- package/dist/chunk-XSLBANUV.js.map +1 -0
- package/dist/chunk-ZY4NLITM.js +73 -0
- package/dist/chunk-ZY4NLITM.js.map +1 -0
- package/dist/data.cjs +59 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +46 -0
- package/dist/data.d.ts +46 -0
- package/dist/data.js +4 -0
- package/dist/data.js.map +1 -0
- package/dist/error-boundary.cjs +115 -0
- package/dist/error-boundary.cjs.map +1 -0
- package/dist/error-boundary.d.cts +60 -0
- package/dist/error-boundary.d.ts +60 -0
- package/dist/error-boundary.js +4 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/floating.cjs +149 -0
- package/dist/floating.cjs.map +1 -0
- package/dist/floating.d.cts +106 -0
- package/dist/floating.d.ts +106 -0
- package/dist/floating.js +4 -0
- package/dist/floating.js.map +1 -0
- package/dist/form.cjs +144 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +128 -0
- package/dist/form.d.ts +128 -0
- package/dist/form.js +3 -0
- package/dist/form.js.map +1 -0
- package/dist/i18n.cjs +112 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +99 -0
- package/dist/i18n.d.ts +99 -0
- package/dist/i18n.js +3 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +18673 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8087 -0
- package/dist/index.d.ts +8087 -0
- package/dist/index.js +13525 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.cjs +392 -0
- package/dist/layouts.cjs.map +1 -0
- package/dist/layouts.d.cts +406 -0
- package/dist/layouts.d.ts +406 -0
- package/dist/layouts.js +5 -0
- package/dist/layouts.js.map +1 -0
- package/dist/machine.cjs +19 -0
- package/dist/machine.cjs.map +1 -0
- package/dist/machine.d.cts +18 -0
- package/dist/machine.d.ts +18 -0
- package/dist/machine.js +4 -0
- package/dist/machine.js.map +1 -0
- package/dist/modal-utils.cjs +170 -0
- package/dist/modal-utils.cjs.map +1 -0
- package/dist/modal-utils.d.cts +43 -0
- package/dist/modal-utils.d.ts +43 -0
- package/dist/modal-utils.js +3 -0
- package/dist/modal-utils.js.map +1 -0
- package/dist/motion.cjs +88 -0
- package/dist/motion.cjs.map +1 -0
- package/dist/motion.d.cts +43 -0
- package/dist/motion.d.ts +43 -0
- package/dist/motion.js +3 -0
- package/dist/motion.js.map +1 -0
- package/dist/provider.cjs +272 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +130 -0
- package/dist/provider.d.ts +130 -0
- package/dist/provider.js +6 -0
- package/dist/provider.js.map +1 -0
- package/dist/resource.cjs +25 -0
- package/dist/resource.cjs.map +1 -0
- package/dist/resource.d.cts +17 -0
- package/dist/resource.d.ts +17 -0
- package/dist/resource.js +3 -0
- package/dist/resource.js.map +1 -0
- package/dist/skeletons.cjs +1659 -0
- package/dist/skeletons.cjs.map +1 -0
- package/dist/skeletons.d.cts +179 -0
- package/dist/skeletons.d.ts +179 -0
- package/dist/skeletons.js +7 -0
- package/dist/skeletons.js.map +1 -0
- package/dist/skins.cjs +138 -0
- package/dist/skins.cjs.map +1 -0
- package/dist/skins.d.cts +67 -0
- package/dist/skins.d.ts +67 -0
- package/dist/skins.js +3 -0
- package/dist/skins.js.map +1 -0
- package/dist/theme.cjs +106 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +103 -0
- package/dist/theme.d.ts +103 -0
- package/dist/theme.js +3 -0
- package/dist/theme.js.map +1 -0
- package/dist/undo.cjs +51 -0
- package/dist/undo.cjs.map +1 -0
- package/dist/undo.d.cts +48 -0
- package/dist/undo.d.ts +48 -0
- package/dist/undo.js +3 -0
- package/dist/undo.js.map +1 -0
- package/package.json +59 -0
package/dist/theme.d.cts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { Ref, ComputedRef, InjectionKey, PropType } from 'vue';
|
|
3
|
+
import { ThemeStore, Direction, ColorScheme } from '@iris-ui-kit/theme';
|
|
4
|
+
import { IrisTheme } from '@iris-ui-kit/tokens';
|
|
5
|
+
|
|
6
|
+
interface IrisThemeContext {
|
|
7
|
+
store: ThemeStore;
|
|
8
|
+
current: Ref<IrisTheme>;
|
|
9
|
+
dir: ComputedRef<Direction>;
|
|
10
|
+
}
|
|
11
|
+
declare const IrisThemeKey: InjectionKey<IrisThemeContext>;
|
|
12
|
+
/**
|
|
13
|
+
* Renderless provider that:
|
|
14
|
+
* 1. exposes the theme store to descendants via `provide`,
|
|
15
|
+
* 2. applies the current theme to a target element on mount and on change,
|
|
16
|
+
* 3. reverts the inline custom properties on unmount.
|
|
17
|
+
*
|
|
18
|
+
* `target` defaults to `document.documentElement`. Pass an element ref to
|
|
19
|
+
* scope a theme to a subtree.
|
|
20
|
+
*/
|
|
21
|
+
declare const ThemeProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
22
|
+
store: {
|
|
23
|
+
type: PropType<ThemeStore>;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
target: {
|
|
27
|
+
type: PropType<HTMLElement | null>;
|
|
28
|
+
default: null;
|
|
29
|
+
};
|
|
30
|
+
/** Writing direction; sets `dir` on the target for RTL. Default `'ltr'`. */
|
|
31
|
+
dir: {
|
|
32
|
+
type: PropType<Direction>;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
/** CSP nonce for injected inline stylesheets. */
|
|
36
|
+
cspNonce: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
43
|
+
store: {
|
|
44
|
+
type: PropType<ThemeStore>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
target: {
|
|
48
|
+
type: PropType<HTMLElement | null>;
|
|
49
|
+
default: null;
|
|
50
|
+
};
|
|
51
|
+
/** Writing direction; sets `dir` on the target for RTL. Default `'ltr'`. */
|
|
52
|
+
dir: {
|
|
53
|
+
type: PropType<Direction>;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
/** CSP nonce for injected inline stylesheets. */
|
|
57
|
+
cspNonce: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
}>> & Readonly<{}>, {
|
|
62
|
+
target: HTMLElement | null;
|
|
63
|
+
dir: Direction;
|
|
64
|
+
cspNonce: string;
|
|
65
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
declare function useThemeContext(): IrisThemeContext;
|
|
67
|
+
/**
|
|
68
|
+
* Current writing direction (`'ltr'` / `'rtl'`) from the nearest
|
|
69
|
+
* `<ThemeProvider>`, or a static `'ltr'` ref when there is none.
|
|
70
|
+
*/
|
|
71
|
+
declare function useDirection(): ComputedRef<Direction>;
|
|
72
|
+
|
|
73
|
+
interface UseThemeReturn {
|
|
74
|
+
/** Reactive ref to the active theme. */
|
|
75
|
+
theme: ComputedRef<IrisTheme>;
|
|
76
|
+
/** Switch by name or by passing a theme directly. */
|
|
77
|
+
setTheme: (target: string | IrisTheme) => void;
|
|
78
|
+
/** Map of all themes registered with the store. */
|
|
79
|
+
availableThemes: Record<string, IrisTheme>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Read and write the current theme from anywhere inside a <ThemeProvider>.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const { theme, setTheme } = useTheme()
|
|
86
|
+
* theme.value.colors['iris.primary']
|
|
87
|
+
* setTheme('dark')
|
|
88
|
+
*/
|
|
89
|
+
declare function useTheme(): UseThemeReturn;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reactive system color scheme (`'light'` / `'dark'`) from
|
|
93
|
+
* `prefers-color-scheme`. SSR-safe (reports `'light'` until matchMedia is
|
|
94
|
+
* available). Wire it to a theme store to auto-follow the system:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const scheme = useColorScheme()
|
|
98
|
+
* watch(scheme, (s) => store.setTheme(s === 'dark' ? 'dark' : 'light'), { immediate: true })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function useColorScheme(): Ref<ColorScheme>;
|
|
102
|
+
|
|
103
|
+
export { type IrisThemeContext, IrisThemeKey, ThemeProvider, type UseThemeReturn, useColorScheme, useDirection, useTheme, useThemeContext };
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { Ref, ComputedRef, InjectionKey, PropType } from 'vue';
|
|
3
|
+
import { ThemeStore, Direction, ColorScheme } from '@iris-ui-kit/theme';
|
|
4
|
+
import { IrisTheme } from '@iris-ui-kit/tokens';
|
|
5
|
+
|
|
6
|
+
interface IrisThemeContext {
|
|
7
|
+
store: ThemeStore;
|
|
8
|
+
current: Ref<IrisTheme>;
|
|
9
|
+
dir: ComputedRef<Direction>;
|
|
10
|
+
}
|
|
11
|
+
declare const IrisThemeKey: InjectionKey<IrisThemeContext>;
|
|
12
|
+
/**
|
|
13
|
+
* Renderless provider that:
|
|
14
|
+
* 1. exposes the theme store to descendants via `provide`,
|
|
15
|
+
* 2. applies the current theme to a target element on mount and on change,
|
|
16
|
+
* 3. reverts the inline custom properties on unmount.
|
|
17
|
+
*
|
|
18
|
+
* `target` defaults to `document.documentElement`. Pass an element ref to
|
|
19
|
+
* scope a theme to a subtree.
|
|
20
|
+
*/
|
|
21
|
+
declare const ThemeProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
22
|
+
store: {
|
|
23
|
+
type: PropType<ThemeStore>;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
target: {
|
|
27
|
+
type: PropType<HTMLElement | null>;
|
|
28
|
+
default: null;
|
|
29
|
+
};
|
|
30
|
+
/** Writing direction; sets `dir` on the target for RTL. Default `'ltr'`. */
|
|
31
|
+
dir: {
|
|
32
|
+
type: PropType<Direction>;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
/** CSP nonce for injected inline stylesheets. */
|
|
36
|
+
cspNonce: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
43
|
+
store: {
|
|
44
|
+
type: PropType<ThemeStore>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
target: {
|
|
48
|
+
type: PropType<HTMLElement | null>;
|
|
49
|
+
default: null;
|
|
50
|
+
};
|
|
51
|
+
/** Writing direction; sets `dir` on the target for RTL. Default `'ltr'`. */
|
|
52
|
+
dir: {
|
|
53
|
+
type: PropType<Direction>;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
/** CSP nonce for injected inline stylesheets. */
|
|
57
|
+
cspNonce: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
}>> & Readonly<{}>, {
|
|
62
|
+
target: HTMLElement | null;
|
|
63
|
+
dir: Direction;
|
|
64
|
+
cspNonce: string;
|
|
65
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
declare function useThemeContext(): IrisThemeContext;
|
|
67
|
+
/**
|
|
68
|
+
* Current writing direction (`'ltr'` / `'rtl'`) from the nearest
|
|
69
|
+
* `<ThemeProvider>`, or a static `'ltr'` ref when there is none.
|
|
70
|
+
*/
|
|
71
|
+
declare function useDirection(): ComputedRef<Direction>;
|
|
72
|
+
|
|
73
|
+
interface UseThemeReturn {
|
|
74
|
+
/** Reactive ref to the active theme. */
|
|
75
|
+
theme: ComputedRef<IrisTheme>;
|
|
76
|
+
/** Switch by name or by passing a theme directly. */
|
|
77
|
+
setTheme: (target: string | IrisTheme) => void;
|
|
78
|
+
/** Map of all themes registered with the store. */
|
|
79
|
+
availableThemes: Record<string, IrisTheme>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Read and write the current theme from anywhere inside a <ThemeProvider>.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const { theme, setTheme } = useTheme()
|
|
86
|
+
* theme.value.colors['iris.primary']
|
|
87
|
+
* setTheme('dark')
|
|
88
|
+
*/
|
|
89
|
+
declare function useTheme(): UseThemeReturn;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reactive system color scheme (`'light'` / `'dark'`) from
|
|
93
|
+
* `prefers-color-scheme`. SSR-safe (reports `'light'` until matchMedia is
|
|
94
|
+
* available). Wire it to a theme store to auto-follow the system:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const scheme = useColorScheme()
|
|
98
|
+
* watch(scheme, (s) => store.setTheme(s === 'dark' ? 'dark' : 'light'), { immediate: true })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function useColorScheme(): Ref<ColorScheme>;
|
|
102
|
+
|
|
103
|
+
export { type IrisThemeContext, IrisThemeKey, ThemeProvider, type UseThemeReturn, useColorScheme, useDirection, useTheme, useThemeContext };
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"theme.js"}
|
package/dist/undo.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var undo = require('@iris-ui-kit/core/undo');
|
|
5
|
+
|
|
6
|
+
// src/undo/useUndoStack.ts
|
|
7
|
+
function useUndoStack(options) {
|
|
8
|
+
const stack = undo.createUndoStack(options);
|
|
9
|
+
const state = vue.shallowRef({
|
|
10
|
+
canUndo: stack.canUndo(),
|
|
11
|
+
canRedo: stack.canRedo(),
|
|
12
|
+
depth: stack.depth,
|
|
13
|
+
index: stack.index
|
|
14
|
+
});
|
|
15
|
+
const sync = () => {
|
|
16
|
+
state.value = {
|
|
17
|
+
canUndo: stack.canUndo(),
|
|
18
|
+
canRedo: stack.canRedo(),
|
|
19
|
+
depth: stack.depth,
|
|
20
|
+
index: stack.index
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const push = (snapshot) => {
|
|
24
|
+
const result = stack.push(snapshot);
|
|
25
|
+
sync();
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
const undo$1 = () => {
|
|
29
|
+
const result = stack.undo();
|
|
30
|
+
if (result !== void 0) sync();
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
const redo = () => {
|
|
34
|
+
const result = stack.redo();
|
|
35
|
+
if (result !== void 0) sync();
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
const clear = () => {
|
|
39
|
+
stack.clear();
|
|
40
|
+
sync();
|
|
41
|
+
};
|
|
42
|
+
return { push, undo: undo$1, redo, clear, stack, state };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Object.defineProperty(exports, "createUndoStack", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return undo.createUndoStack; }
|
|
48
|
+
});
|
|
49
|
+
exports.useUndoStack = useUndoStack;
|
|
50
|
+
//# sourceMappingURL=undo.cjs.map
|
|
51
|
+
//# sourceMappingURL=undo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/undo/useUndoStack.ts"],"names":["createUndoStack","shallowRef","undo"],"mappings":";;;;;;AAgCO,SAAS,aAAgB,OAAA,EAa9B;AACA,EAAA,MAAM,KAAA,GAAQA,qBAAmB,OAAO,CAAA;AAExC,EAAA,MAAM,QAAQC,cAAA,CAAmC;AAAA,IAC/C,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,OAAO,KAAA,CAAM;AAAA,GACd,CAAA;AAED,EAAA,MAAM,OAAO,MAAM;AACjB,IAAA,KAAA,CAAM,KAAA,GAAQ;AAAA,MACZ,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,OAAO,KAAA,CAAM;AAAA,KACf;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,GAAO,CAAC,QAAA,KAAmB;AAC/B,IAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAClC,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAMC,SAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,KAAA,CAAM,KAAA,EAAM;AACZ,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AAEA,EAAA,OAAO,EAAE,IAAA,QAAMA,MAAA,EAAM,IAAA,EAAM,KAAA,EAAO,OAAO,KAAA,EAAM;AACjD","file":"undo.cjs","sourcesContent":["import { shallowRef, type ShallowRef } from 'vue'\nimport { createUndoStack, type UndoStack, type UndoStackOptions } from '@iris-ui-kit/core/undo'\n\n/**\n * Reactive snapshot metadata for the UndoStack: convenience booleans that\n * update on every push/undo/redo/clear for use in UI bindings (enable/disable\n * undo/redo buttons).\n */\nexport interface UndoStackReactiveState {\n canUndo: boolean\n canRedo: boolean\n depth: number\n index: number\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createUndoStack}.\n * Creates the stack once in `setup()` and returns a stable controller\n * plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for\n * easy UI binding.\n *\n * The returned `push`/`undo`/`redo`/`clear` automatically update the reactive\n * state — no manual `.value = ...` needed.\n *\n * @example\n * const { push, undo, redo, state } = useUndoStack({ initial: formValues })\n * // After mutation:\n * push(currentValues)\n * // In template:\n * <button :disabled=\"!state.canUndo\" @click=\"undo\">Undo</button>\n * <button :disabled=\"!state.canRedo\" @click=\"redo\">Redo</button>\n */\nexport function useUndoStack<T>(options?: UndoStackOptions<T>): {\n /** Push a new snapshot onto the stack. Returns the stored value. */\n push: (snapshot: T) => T\n /** Undo: returns the previous snapshot, or undefined if nothing to undo. */\n undo: () => T | undefined\n /** Redo: returns the next snapshot, or undefined if nothing to redo. */\n redo: () => T | undefined\n /** Clear all history. */\n clear: () => void\n /** The raw undo stack (stable reference, same across renders). */\n stack: UndoStack<T>\n /** Reactive metadata: canUndo, canRedo, depth, index. */\n state: ShallowRef<UndoStackReactiveState>\n} {\n const stack = createUndoStack<T>(options)\n\n const state = shallowRef<UndoStackReactiveState>({\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n })\n\n const sync = () => {\n state.value = {\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n }\n }\n\n const push = (snapshot: T): T => {\n const result = stack.push(snapshot)\n sync()\n return result\n }\n\n const undo = (): T | undefined => {\n const result = stack.undo()\n if (result !== undefined) sync()\n return result\n }\n\n const redo = (): T | undefined => {\n const result = stack.redo()\n if (result !== undefined) sync()\n return result\n }\n\n const clear = () => {\n stack.clear()\n sync()\n }\n\n return { push, undo, redo, clear, stack, state }\n}\n"]}
|
package/dist/undo.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
import { UndoStackOptions, UndoStack } from '@iris-ui-kit/core/undo';
|
|
3
|
+
export { UndoStack, UndoStackOptions, createUndoStack } from '@iris-ui-kit/core/undo';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reactive snapshot metadata for the UndoStack: convenience booleans that
|
|
7
|
+
* update on every push/undo/redo/clear for use in UI bindings (enable/disable
|
|
8
|
+
* undo/redo buttons).
|
|
9
|
+
*/
|
|
10
|
+
interface UndoStackReactiveState {
|
|
11
|
+
canUndo: boolean;
|
|
12
|
+
canRedo: boolean;
|
|
13
|
+
depth: number;
|
|
14
|
+
index: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Vue bridge over the framework-agnostic {@link createUndoStack}.
|
|
18
|
+
* Creates the stack once in `setup()` and returns a stable controller
|
|
19
|
+
* plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for
|
|
20
|
+
* easy UI binding.
|
|
21
|
+
*
|
|
22
|
+
* The returned `push`/`undo`/`redo`/`clear` automatically update the reactive
|
|
23
|
+
* state — no manual `.value = ...` needed.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const { push, undo, redo, state } = useUndoStack({ initial: formValues })
|
|
27
|
+
* // After mutation:
|
|
28
|
+
* push(currentValues)
|
|
29
|
+
* // In template:
|
|
30
|
+
* <button :disabled="!state.canUndo" @click="undo">Undo</button>
|
|
31
|
+
* <button :disabled="!state.canRedo" @click="redo">Redo</button>
|
|
32
|
+
*/
|
|
33
|
+
declare function useUndoStack<T>(options?: UndoStackOptions<T>): {
|
|
34
|
+
/** Push a new snapshot onto the stack. Returns the stored value. */
|
|
35
|
+
push: (snapshot: T) => T;
|
|
36
|
+
/** Undo: returns the previous snapshot, or undefined if nothing to undo. */
|
|
37
|
+
undo: () => T | undefined;
|
|
38
|
+
/** Redo: returns the next snapshot, or undefined if nothing to redo. */
|
|
39
|
+
redo: () => T | undefined;
|
|
40
|
+
/** Clear all history. */
|
|
41
|
+
clear: () => void;
|
|
42
|
+
/** The raw undo stack (stable reference, same across renders). */
|
|
43
|
+
stack: UndoStack<T>;
|
|
44
|
+
/** Reactive metadata: canUndo, canRedo, depth, index. */
|
|
45
|
+
state: ShallowRef<UndoStackReactiveState>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { type UndoStackReactiveState, useUndoStack };
|
package/dist/undo.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
import { UndoStackOptions, UndoStack } from '@iris-ui-kit/core/undo';
|
|
3
|
+
export { UndoStack, UndoStackOptions, createUndoStack } from '@iris-ui-kit/core/undo';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reactive snapshot metadata for the UndoStack: convenience booleans that
|
|
7
|
+
* update on every push/undo/redo/clear for use in UI bindings (enable/disable
|
|
8
|
+
* undo/redo buttons).
|
|
9
|
+
*/
|
|
10
|
+
interface UndoStackReactiveState {
|
|
11
|
+
canUndo: boolean;
|
|
12
|
+
canRedo: boolean;
|
|
13
|
+
depth: number;
|
|
14
|
+
index: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Vue bridge over the framework-agnostic {@link createUndoStack}.
|
|
18
|
+
* Creates the stack once in `setup()` and returns a stable controller
|
|
19
|
+
* plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for
|
|
20
|
+
* easy UI binding.
|
|
21
|
+
*
|
|
22
|
+
* The returned `push`/`undo`/`redo`/`clear` automatically update the reactive
|
|
23
|
+
* state — no manual `.value = ...` needed.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const { push, undo, redo, state } = useUndoStack({ initial: formValues })
|
|
27
|
+
* // After mutation:
|
|
28
|
+
* push(currentValues)
|
|
29
|
+
* // In template:
|
|
30
|
+
* <button :disabled="!state.canUndo" @click="undo">Undo</button>
|
|
31
|
+
* <button :disabled="!state.canRedo" @click="redo">Redo</button>
|
|
32
|
+
*/
|
|
33
|
+
declare function useUndoStack<T>(options?: UndoStackOptions<T>): {
|
|
34
|
+
/** Push a new snapshot onto the stack. Returns the stored value. */
|
|
35
|
+
push: (snapshot: T) => T;
|
|
36
|
+
/** Undo: returns the previous snapshot, or undefined if nothing to undo. */
|
|
37
|
+
undo: () => T | undefined;
|
|
38
|
+
/** Redo: returns the next snapshot, or undefined if nothing to redo. */
|
|
39
|
+
redo: () => T | undefined;
|
|
40
|
+
/** Clear all history. */
|
|
41
|
+
clear: () => void;
|
|
42
|
+
/** The raw undo stack (stable reference, same across renders). */
|
|
43
|
+
stack: UndoStack<T>;
|
|
44
|
+
/** Reactive metadata: canUndo, canRedo, depth, index. */
|
|
45
|
+
state: ShallowRef<UndoStackReactiveState>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { type UndoStackReactiveState, useUndoStack };
|
package/dist/undo.js
ADDED
package/dist/undo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"undo.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iris-ui-kit/vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue 3.5 adapter for Iris UI — full component set",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./*": {
|
|
17
|
+
"types": "./dist/*.d.ts",
|
|
18
|
+
"import": "./dist/*.js",
|
|
19
|
+
"require": "./dist/*.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@floating-ui/dom": "^1.7.6",
|
|
29
|
+
"@iris-ui-kit/core": "0.1.0",
|
|
30
|
+
"@iris-ui-kit/tokens": "0.1.0",
|
|
31
|
+
"@iris-ui-kit/theme": "0.1.0",
|
|
32
|
+
"@iris-ui-kit/skins": "0.0.1",
|
|
33
|
+
"@iris-ui-kit/icons": "0.1.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"vue": "^3.5.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@vue/server-renderer": "3.5.34",
|
|
40
|
+
"@vue/test-utils": "^2.4.6",
|
|
41
|
+
"jsdom": "^25.0.1",
|
|
42
|
+
"vue": "^3.5.13"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/nousresearch/iris-ui.git"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"lint": "eslint src",
|
|
57
|
+
"clean": "rm -rf dist .turbo"
|
|
58
|
+
}
|
|
59
|
+
}
|