@destyler/qr-code 0.0.6 → 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.d.cts CHANGED
@@ -1,123 +1,71 @@
1
- import * as vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { ExtractPublicPropTypes } from '@destyler/shared';
4
- import * as _destyler_primitive from '@destyler/primitive';
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 qrCodeItemProps: {
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
- declare const qrCodeRootProps: {
56
- readonly value: {
57
- readonly type: PropType<string>;
58
- readonly required: true;
59
- };
60
- readonly ErrorCorrectionLevel: {
61
- readonly type: PropType<"L" | "M" | "Q" | "H">;
62
- readonly required: false;
63
- readonly default: "M";
64
- };
65
- readonly as: {
66
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
67
- readonly required: false;
68
- readonly default: "div";
69
- };
70
- readonly asChild: {
71
- readonly type: PropType<boolean>;
72
- readonly required: false;
73
- readonly default: false;
74
- };
75
- };
76
- type QrCodeRootProps = ExtractPublicPropTypes<typeof qrCodeRootProps>;
77
- declare const QrCodeRoot: vue.DefineComponent<{
78
- readonly value: {
79
- readonly type: PropType<string>;
80
- readonly required: true;
81
- };
82
- readonly ErrorCorrectionLevel: {
83
- readonly type: PropType<"L" | "M" | "Q" | "H">;
84
- readonly required: false;
85
- readonly default: "M";
86
- };
87
- readonly as: {
88
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
89
- readonly required: false;
90
- readonly default: "div";
91
- };
92
- readonly asChild: {
93
- readonly type: PropType<boolean>;
94
- readonly required: false;
95
- readonly default: false;
96
- };
97
- }, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
98
- readonly value: {
99
- readonly type: PropType<string>;
100
- readonly required: true;
101
- };
102
- readonly ErrorCorrectionLevel: {
103
- readonly type: PropType<"L" | "M" | "Q" | "H">;
104
- readonly required: false;
105
- readonly default: "M";
106
- };
107
- readonly as: {
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
- export { QrCodeItem, type QrCodeItemProps, QrCodeRoot, type QrCodeRootProps, qrCodeItemProps, qrCodeRootProps };
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 vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { ExtractPublicPropTypes } from '@destyler/shared';
4
- import * as _destyler_primitive from '@destyler/primitive';
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 qrCodeItemProps: {
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
- declare const qrCodeRootProps: {
56
- readonly value: {
57
- readonly type: PropType<string>;
58
- readonly required: true;
59
- };
60
- readonly ErrorCorrectionLevel: {
61
- readonly type: PropType<"L" | "M" | "Q" | "H">;
62
- readonly required: false;
63
- readonly default: "M";
64
- };
65
- readonly as: {
66
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
67
- readonly required: false;
68
- readonly default: "div";
69
- };
70
- readonly asChild: {
71
- readonly type: PropType<boolean>;
72
- readonly required: false;
73
- readonly default: false;
74
- };
75
- };
76
- type QrCodeRootProps = ExtractPublicPropTypes<typeof qrCodeRootProps>;
77
- declare const QrCodeRoot: vue.DefineComponent<{
78
- readonly value: {
79
- readonly type: PropType<string>;
80
- readonly required: true;
81
- };
82
- readonly ErrorCorrectionLevel: {
83
- readonly type: PropType<"L" | "M" | "Q" | "H">;
84
- readonly required: false;
85
- readonly default: "M";
86
- };
87
- readonly as: {
88
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
89
- readonly required: false;
90
- readonly default: "div";
91
- };
92
- readonly asChild: {
93
- readonly type: PropType<boolean>;
94
- readonly required: false;
95
- readonly default: false;
96
- };
97
- }, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
98
- readonly value: {
99
- readonly type: PropType<string>;
100
- readonly required: true;
101
- };
102
- readonly ErrorCorrectionLevel: {
103
- readonly type: PropType<"L" | "M" | "Q" | "H">;
104
- readonly required: false;
105
- readonly default: "M";
106
- };
107
- readonly as: {
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
- export { QrCodeItem, type QrCodeItemProps, QrCodeRoot, type QrCodeRootProps, qrCodeItemProps, qrCodeRootProps };
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 vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { ExtractPublicPropTypes } from '@destyler/shared';
4
- import * as _destyler_primitive from '@destyler/primitive';
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 qrCodeItemProps: {
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
- declare const qrCodeRootProps: {
56
- readonly value: {
57
- readonly type: PropType<string>;
58
- readonly required: true;
59
- };
60
- readonly ErrorCorrectionLevel: {
61
- readonly type: PropType<"L" | "M" | "Q" | "H">;
62
- readonly required: false;
63
- readonly default: "M";
64
- };
65
- readonly as: {
66
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
67
- readonly required: false;
68
- readonly default: "div";
69
- };
70
- readonly asChild: {
71
- readonly type: PropType<boolean>;
72
- readonly required: false;
73
- readonly default: false;
74
- };
75
- };
76
- type QrCodeRootProps = ExtractPublicPropTypes<typeof qrCodeRootProps>;
77
- declare const QrCodeRoot: vue.DefineComponent<{
78
- readonly value: {
79
- readonly type: PropType<string>;
80
- readonly required: true;
81
- };
82
- readonly ErrorCorrectionLevel: {
83
- readonly type: PropType<"L" | "M" | "Q" | "H">;
84
- readonly required: false;
85
- readonly default: "M";
86
- };
87
- readonly as: {
88
- readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
89
- readonly required: false;
90
- readonly default: "div";
91
- };
92
- readonly asChild: {
93
- readonly type: PropType<boolean>;
94
- readonly required: false;
95
- readonly default: false;
96
- };
97
- }, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
98
- readonly value: {
99
- readonly type: PropType<string>;
100
- readonly required: true;
101
- };
102
- readonly ErrorCorrectionLevel: {
103
- readonly type: PropType<"L" | "M" | "Q" | "H">;
104
- readonly required: false;
105
- readonly default: "M";
106
- };
107
- readonly as: {
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
- export { QrCodeItem, type QrCodeItemProps, QrCodeRoot, type QrCodeRootProps, qrCodeItemProps, qrCodeRootProps };
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 };