@destyler/qr-code 0.0.5 → 0.0.7-beta.1
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/dist/index.cjs +106 -1189
- package/dist/index.d.cts +68 -120
- package/dist/index.d.mts +68 -120
- package/dist/index.d.ts +68 -120
- package/dist/index.mjs +102 -1186
- package/package.json +10 -16
- package/README.md +0 -7
- package/dist/component.cjs +0 -14
- package/dist/component.d.cts +0 -4
- package/dist/component.d.mts +0 -4
- package/dist/component.d.ts +0 -4
- package/dist/component.mjs +0 -5
- package/dist/resolver.cjs +0 -21
- package/dist/resolver.d.cts +0 -6
- package/dist/resolver.d.mts +0 -6
- package/dist/resolver.d.ts +0 -6
- package/dist/resolver.mjs +0 -18
package/dist/index.d.cts
CHANGED
|
@@ -1,123 +1,71 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
2
|
+
import { RequiredBy, DirectionProperty, CommonProperties, PropTypes, NormalizeProps } from '@zag-js/types';
|
|
3
|
+
import * as _zag_js_core from '@zag-js/core';
|
|
4
|
+
import { StateMachine } from '@zag-js/core';
|
|
5
|
+
import { DataUrlType } from '@zag-js/dom-query';
|
|
6
|
+
import { QrCodeGenerateOptions, QrCodeGenerateResult } from 'uqr';
|
|
5
7
|
|
|
6
|
-
declare const
|
|
7
|
-
readonly size: {
|
|
8
|
-
readonly type: PropType<number>;
|
|
9
|
-
readonly default: 100;
|
|
10
|
-
};
|
|
11
|
-
readonly foregroundColor: {
|
|
12
|
-
readonly type: PropType<string>;
|
|
13
|
-
readonly default: "#000";
|
|
14
|
-
};
|
|
15
|
-
readonly backgroundColor: {
|
|
16
|
-
readonly type: PropType<string>;
|
|
17
|
-
readonly default: "#FFF";
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type QrCodeItemProps = ExtractPublicPropTypes<typeof qrCodeItemProps>;
|
|
21
|
-
declare const QrCodeItem: vue.DefineComponent<{
|
|
22
|
-
readonly size: {
|
|
23
|
-
readonly type: PropType<number>;
|
|
24
|
-
readonly default: 100;
|
|
25
|
-
};
|
|
26
|
-
readonly foregroundColor: {
|
|
27
|
-
readonly type: PropType<string>;
|
|
28
|
-
readonly default: "#000";
|
|
29
|
-
};
|
|
30
|
-
readonly backgroundColor: {
|
|
31
|
-
readonly type: PropType<string>;
|
|
32
|
-
readonly default: "#FFF";
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
36
|
-
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
37
|
-
readonly size: {
|
|
38
|
-
readonly type: PropType<number>;
|
|
39
|
-
readonly default: 100;
|
|
40
|
-
};
|
|
41
|
-
readonly foregroundColor: {
|
|
42
|
-
readonly type: PropType<string>;
|
|
43
|
-
readonly default: "#000";
|
|
44
|
-
};
|
|
45
|
-
readonly backgroundColor: {
|
|
46
|
-
readonly type: PropType<string>;
|
|
47
|
-
readonly default: "#FFF";
|
|
48
|
-
};
|
|
49
|
-
}>>, {
|
|
50
|
-
readonly size: number;
|
|
51
|
-
readonly foregroundColor: string;
|
|
52
|
-
readonly backgroundColor: string;
|
|
53
|
-
}, {}>;
|
|
8
|
+
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "frame" | "pattern" | "overlay">;
|
|
54
9
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
109
|
-
readonly required: false;
|
|
110
|
-
readonly default: "div";
|
|
111
|
-
};
|
|
112
|
-
readonly asChild: {
|
|
113
|
-
readonly type: PropType<boolean>;
|
|
114
|
-
readonly required: false;
|
|
115
|
-
readonly default: false;
|
|
116
|
-
};
|
|
117
|
-
}>>, {
|
|
118
|
-
readonly ErrorCorrectionLevel: "L" | "M" | "Q" | "H";
|
|
119
|
-
readonly as: _destyler_primitive.AsTag | vue.Component;
|
|
120
|
-
readonly asChild: boolean;
|
|
121
|
-
}, {}>;
|
|
10
|
+
type ElementIds = Partial<{
|
|
11
|
+
root: string;
|
|
12
|
+
frame: string;
|
|
13
|
+
}>;
|
|
14
|
+
interface PublicContext extends DirectionProperty, CommonProperties {
|
|
15
|
+
/**
|
|
16
|
+
* The value to encode.
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* The element ids.
|
|
21
|
+
*/
|
|
22
|
+
ids?: ElementIds | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The qr code encoding options.
|
|
25
|
+
*/
|
|
26
|
+
encoding?: QrCodeGenerateOptions | undefined;
|
|
27
|
+
}
|
|
28
|
+
interface PrivateContext {
|
|
29
|
+
/**
|
|
30
|
+
* The pixel size of the qr code.
|
|
31
|
+
*/
|
|
32
|
+
pixelSize: number;
|
|
33
|
+
}
|
|
34
|
+
type ComputedContext = Readonly<{
|
|
35
|
+
encoded: QrCodeGenerateResult;
|
|
36
|
+
}>;
|
|
37
|
+
type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
|
|
38
|
+
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
|
|
39
|
+
}
|
|
40
|
+
interface MachineState {
|
|
41
|
+
value: 'idle';
|
|
42
|
+
}
|
|
43
|
+
type State = StateMachine.State<MachineContext, MachineState>;
|
|
44
|
+
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
45
|
+
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
46
|
+
/**
|
|
47
|
+
* The value to encode.
|
|
48
|
+
*/
|
|
49
|
+
value: string;
|
|
50
|
+
/**
|
|
51
|
+
* Set the value to encode.
|
|
52
|
+
*/
|
|
53
|
+
setValue: (value: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the data URL of the qr code.
|
|
56
|
+
*/
|
|
57
|
+
getDataUrl: (type: DataUrlType, quality?: number) => Promise<string>;
|
|
58
|
+
getRootProps: () => T['element'];
|
|
59
|
+
getFrameProps: () => T['svg'];
|
|
60
|
+
getPatternProps: () => T['path'];
|
|
61
|
+
getOverlayProps: () => T['element'];
|
|
62
|
+
}
|
|
122
63
|
|
|
123
|
-
|
|
64
|
+
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
|
|
65
|
+
|
|
66
|
+
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
67
|
+
|
|
68
|
+
declare const props: ("value" | "ids" | "encoding" | "id" | "dir" | "getRootNode")[];
|
|
69
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "ids" | "encoding" | "id" | "dir" | "getRootNode">];
|
|
70
|
+
|
|
71
|
+
export { type UserDefinedContext as Context, anatomy, connect, machine, props, splitProps };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,123 +1,71 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
2
|
+
import { RequiredBy, DirectionProperty, CommonProperties, PropTypes, NormalizeProps } from '@zag-js/types';
|
|
3
|
+
import * as _zag_js_core from '@zag-js/core';
|
|
4
|
+
import { StateMachine } from '@zag-js/core';
|
|
5
|
+
import { DataUrlType } from '@zag-js/dom-query';
|
|
6
|
+
import { QrCodeGenerateOptions, QrCodeGenerateResult } from 'uqr';
|
|
5
7
|
|
|
6
|
-
declare const
|
|
7
|
-
readonly size: {
|
|
8
|
-
readonly type: PropType<number>;
|
|
9
|
-
readonly default: 100;
|
|
10
|
-
};
|
|
11
|
-
readonly foregroundColor: {
|
|
12
|
-
readonly type: PropType<string>;
|
|
13
|
-
readonly default: "#000";
|
|
14
|
-
};
|
|
15
|
-
readonly backgroundColor: {
|
|
16
|
-
readonly type: PropType<string>;
|
|
17
|
-
readonly default: "#FFF";
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type QrCodeItemProps = ExtractPublicPropTypes<typeof qrCodeItemProps>;
|
|
21
|
-
declare const QrCodeItem: vue.DefineComponent<{
|
|
22
|
-
readonly size: {
|
|
23
|
-
readonly type: PropType<number>;
|
|
24
|
-
readonly default: 100;
|
|
25
|
-
};
|
|
26
|
-
readonly foregroundColor: {
|
|
27
|
-
readonly type: PropType<string>;
|
|
28
|
-
readonly default: "#000";
|
|
29
|
-
};
|
|
30
|
-
readonly backgroundColor: {
|
|
31
|
-
readonly type: PropType<string>;
|
|
32
|
-
readonly default: "#FFF";
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
36
|
-
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
37
|
-
readonly size: {
|
|
38
|
-
readonly type: PropType<number>;
|
|
39
|
-
readonly default: 100;
|
|
40
|
-
};
|
|
41
|
-
readonly foregroundColor: {
|
|
42
|
-
readonly type: PropType<string>;
|
|
43
|
-
readonly default: "#000";
|
|
44
|
-
};
|
|
45
|
-
readonly backgroundColor: {
|
|
46
|
-
readonly type: PropType<string>;
|
|
47
|
-
readonly default: "#FFF";
|
|
48
|
-
};
|
|
49
|
-
}>>, {
|
|
50
|
-
readonly size: number;
|
|
51
|
-
readonly foregroundColor: string;
|
|
52
|
-
readonly backgroundColor: string;
|
|
53
|
-
}, {}>;
|
|
8
|
+
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "frame" | "pattern" | "overlay">;
|
|
54
9
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
109
|
-
readonly required: false;
|
|
110
|
-
readonly default: "div";
|
|
111
|
-
};
|
|
112
|
-
readonly asChild: {
|
|
113
|
-
readonly type: PropType<boolean>;
|
|
114
|
-
readonly required: false;
|
|
115
|
-
readonly default: false;
|
|
116
|
-
};
|
|
117
|
-
}>>, {
|
|
118
|
-
readonly ErrorCorrectionLevel: "L" | "M" | "Q" | "H";
|
|
119
|
-
readonly as: _destyler_primitive.AsTag | vue.Component;
|
|
120
|
-
readonly asChild: boolean;
|
|
121
|
-
}, {}>;
|
|
10
|
+
type ElementIds = Partial<{
|
|
11
|
+
root: string;
|
|
12
|
+
frame: string;
|
|
13
|
+
}>;
|
|
14
|
+
interface PublicContext extends DirectionProperty, CommonProperties {
|
|
15
|
+
/**
|
|
16
|
+
* The value to encode.
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* The element ids.
|
|
21
|
+
*/
|
|
22
|
+
ids?: ElementIds | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The qr code encoding options.
|
|
25
|
+
*/
|
|
26
|
+
encoding?: QrCodeGenerateOptions | undefined;
|
|
27
|
+
}
|
|
28
|
+
interface PrivateContext {
|
|
29
|
+
/**
|
|
30
|
+
* The pixel size of the qr code.
|
|
31
|
+
*/
|
|
32
|
+
pixelSize: number;
|
|
33
|
+
}
|
|
34
|
+
type ComputedContext = Readonly<{
|
|
35
|
+
encoded: QrCodeGenerateResult;
|
|
36
|
+
}>;
|
|
37
|
+
type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
|
|
38
|
+
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
|
|
39
|
+
}
|
|
40
|
+
interface MachineState {
|
|
41
|
+
value: 'idle';
|
|
42
|
+
}
|
|
43
|
+
type State = StateMachine.State<MachineContext, MachineState>;
|
|
44
|
+
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
45
|
+
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
46
|
+
/**
|
|
47
|
+
* The value to encode.
|
|
48
|
+
*/
|
|
49
|
+
value: string;
|
|
50
|
+
/**
|
|
51
|
+
* Set the value to encode.
|
|
52
|
+
*/
|
|
53
|
+
setValue: (value: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the data URL of the qr code.
|
|
56
|
+
*/
|
|
57
|
+
getDataUrl: (type: DataUrlType, quality?: number) => Promise<string>;
|
|
58
|
+
getRootProps: () => T['element'];
|
|
59
|
+
getFrameProps: () => T['svg'];
|
|
60
|
+
getPatternProps: () => T['path'];
|
|
61
|
+
getOverlayProps: () => T['element'];
|
|
62
|
+
}
|
|
122
63
|
|
|
123
|
-
|
|
64
|
+
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
|
|
65
|
+
|
|
66
|
+
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
67
|
+
|
|
68
|
+
declare const props: ("value" | "ids" | "encoding" | "id" | "dir" | "getRootNode")[];
|
|
69
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "ids" | "encoding" | "id" | "dir" | "getRootNode">];
|
|
70
|
+
|
|
71
|
+
export { type UserDefinedContext as Context, anatomy, connect, machine, props, splitProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,123 +1,71 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
2
|
+
import { RequiredBy, DirectionProperty, CommonProperties, PropTypes, NormalizeProps } from '@zag-js/types';
|
|
3
|
+
import * as _zag_js_core from '@zag-js/core';
|
|
4
|
+
import { StateMachine } from '@zag-js/core';
|
|
5
|
+
import { DataUrlType } from '@zag-js/dom-query';
|
|
6
|
+
import { QrCodeGenerateOptions, QrCodeGenerateResult } from 'uqr';
|
|
5
7
|
|
|
6
|
-
declare const
|
|
7
|
-
readonly size: {
|
|
8
|
-
readonly type: PropType<number>;
|
|
9
|
-
readonly default: 100;
|
|
10
|
-
};
|
|
11
|
-
readonly foregroundColor: {
|
|
12
|
-
readonly type: PropType<string>;
|
|
13
|
-
readonly default: "#000";
|
|
14
|
-
};
|
|
15
|
-
readonly backgroundColor: {
|
|
16
|
-
readonly type: PropType<string>;
|
|
17
|
-
readonly default: "#FFF";
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type QrCodeItemProps = ExtractPublicPropTypes<typeof qrCodeItemProps>;
|
|
21
|
-
declare const QrCodeItem: vue.DefineComponent<{
|
|
22
|
-
readonly size: {
|
|
23
|
-
readonly type: PropType<number>;
|
|
24
|
-
readonly default: 100;
|
|
25
|
-
};
|
|
26
|
-
readonly foregroundColor: {
|
|
27
|
-
readonly type: PropType<string>;
|
|
28
|
-
readonly default: "#000";
|
|
29
|
-
};
|
|
30
|
-
readonly backgroundColor: {
|
|
31
|
-
readonly type: PropType<string>;
|
|
32
|
-
readonly default: "#FFF";
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
36
|
-
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
37
|
-
readonly size: {
|
|
38
|
-
readonly type: PropType<number>;
|
|
39
|
-
readonly default: 100;
|
|
40
|
-
};
|
|
41
|
-
readonly foregroundColor: {
|
|
42
|
-
readonly type: PropType<string>;
|
|
43
|
-
readonly default: "#000";
|
|
44
|
-
};
|
|
45
|
-
readonly backgroundColor: {
|
|
46
|
-
readonly type: PropType<string>;
|
|
47
|
-
readonly default: "#FFF";
|
|
48
|
-
};
|
|
49
|
-
}>>, {
|
|
50
|
-
readonly size: number;
|
|
51
|
-
readonly foregroundColor: string;
|
|
52
|
-
readonly backgroundColor: string;
|
|
53
|
-
}, {}>;
|
|
8
|
+
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "frame" | "pattern" | "overlay">;
|
|
54
9
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
109
|
-
readonly required: false;
|
|
110
|
-
readonly default: "div";
|
|
111
|
-
};
|
|
112
|
-
readonly asChild: {
|
|
113
|
-
readonly type: PropType<boolean>;
|
|
114
|
-
readonly required: false;
|
|
115
|
-
readonly default: false;
|
|
116
|
-
};
|
|
117
|
-
}>>, {
|
|
118
|
-
readonly ErrorCorrectionLevel: "L" | "M" | "Q" | "H";
|
|
119
|
-
readonly as: _destyler_primitive.AsTag | vue.Component;
|
|
120
|
-
readonly asChild: boolean;
|
|
121
|
-
}, {}>;
|
|
10
|
+
type ElementIds = Partial<{
|
|
11
|
+
root: string;
|
|
12
|
+
frame: string;
|
|
13
|
+
}>;
|
|
14
|
+
interface PublicContext extends DirectionProperty, CommonProperties {
|
|
15
|
+
/**
|
|
16
|
+
* The value to encode.
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* The element ids.
|
|
21
|
+
*/
|
|
22
|
+
ids?: ElementIds | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The qr code encoding options.
|
|
25
|
+
*/
|
|
26
|
+
encoding?: QrCodeGenerateOptions | undefined;
|
|
27
|
+
}
|
|
28
|
+
interface PrivateContext {
|
|
29
|
+
/**
|
|
30
|
+
* The pixel size of the qr code.
|
|
31
|
+
*/
|
|
32
|
+
pixelSize: number;
|
|
33
|
+
}
|
|
34
|
+
type ComputedContext = Readonly<{
|
|
35
|
+
encoded: QrCodeGenerateResult;
|
|
36
|
+
}>;
|
|
37
|
+
type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
|
|
38
|
+
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
|
|
39
|
+
}
|
|
40
|
+
interface MachineState {
|
|
41
|
+
value: 'idle';
|
|
42
|
+
}
|
|
43
|
+
type State = StateMachine.State<MachineContext, MachineState>;
|
|
44
|
+
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
45
|
+
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
46
|
+
/**
|
|
47
|
+
* The value to encode.
|
|
48
|
+
*/
|
|
49
|
+
value: string;
|
|
50
|
+
/**
|
|
51
|
+
* Set the value to encode.
|
|
52
|
+
*/
|
|
53
|
+
setValue: (value: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the data URL of the qr code.
|
|
56
|
+
*/
|
|
57
|
+
getDataUrl: (type: DataUrlType, quality?: number) => Promise<string>;
|
|
58
|
+
getRootProps: () => T['element'];
|
|
59
|
+
getFrameProps: () => T['svg'];
|
|
60
|
+
getPatternProps: () => T['path'];
|
|
61
|
+
getOverlayProps: () => T['element'];
|
|
62
|
+
}
|
|
122
63
|
|
|
123
|
-
|
|
64
|
+
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
|
|
65
|
+
|
|
66
|
+
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
67
|
+
|
|
68
|
+
declare const props: ("value" | "ids" | "encoding" | "id" | "dir" | "getRootNode")[];
|
|
69
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "ids" | "encoding" | "id" | "dir" | "getRootNode">];
|
|
70
|
+
|
|
71
|
+
export { type UserDefinedContext as Context, anatomy, connect, machine, props, splitProps };
|