@superblocksteam/library-shared 2.0.3-next.46
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.txt +87 -0
- package/dist/apis.d.ts +2 -0
- package/dist/apis.d.ts.map +1 -0
- package/dist/apis.js +4 -0
- package/dist/apis.js.map +1 -0
- package/dist/bindings.d.ts +8 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +16 -0
- package/dist/bindings.js.map +1 -0
- package/dist/computed.d.ts +7 -0
- package/dist/computed.d.ts.map +1 -0
- package/dist/computed.js +11 -0
- package/dist/computed.js.map +1 -0
- package/dist/helper.d.ts +2 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/helper.js +2 -0
- package/dist/helper.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +19 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +53 -0
- package/dist/layout.js.map +1 -0
- package/dist/mobx-sync/apply-patch.d.ts +6 -0
- package/dist/mobx-sync/apply-patch.d.ts.map +1 -0
- package/dist/mobx-sync/apply-patch.js +93 -0
- package/dist/mobx-sync/apply-patch.js.map +1 -0
- package/dist/mobx-sync/index.d.ts +4 -0
- package/dist/mobx-sync/index.d.ts.map +1 -0
- package/dist/mobx-sync/index.js +4 -0
- package/dist/mobx-sync/index.js.map +1 -0
- package/dist/mobx-sync/to-patch.d.ts +6 -0
- package/dist/mobx-sync/to-patch.d.ts.map +1 -0
- package/dist/mobx-sync/to-patch.js +48 -0
- package/dist/mobx-sync/to-patch.js.map +1 -0
- package/dist/mobx-sync/utils.d.ts +5 -0
- package/dist/mobx-sync/utils.d.ts.map +1 -0
- package/dist/mobx-sync/utils.js +20 -0
- package/dist/mobx-sync/utils.js.map +1 -0
- package/dist/pages.d.ts +52 -0
- package/dist/pages.d.ts.map +1 -0
- package/dist/pages.js +13 -0
- package/dist/pages.js.map +1 -0
- package/dist/props/helpers.d.ts +21 -0
- package/dist/props/helpers.d.ts.map +1 -0
- package/dist/props/helpers.js +155 -0
- package/dist/props/helpers.js.map +1 -0
- package/dist/props/prop-types.d.ts +52 -0
- package/dist/props/prop-types.d.ts.map +1 -0
- package/dist/props/prop-types.js +14 -0
- package/dist/props/prop-types.js.map +1 -0
- package/dist/props/properties-panel.d.ts +163 -0
- package/dist/props/properties-panel.d.ts.map +1 -0
- package/dist/props/properties-panel.js +15 -0
- package/dist/props/properties-panel.js.map +1 -0
- package/dist/props.d.ts +4 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +4 -0
- package/dist/props.js.map +1 -0
- package/dist/scope.d.ts +2 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +5 -0
- package/dist/scope.js.map +1 -0
- package/dist/types/apis.d.ts +28 -0
- package/dist/types/apis.d.ts.map +1 -0
- package/dist/types/apis.js +2 -0
- package/dist/types/apis.js.map +1 -0
- package/dist/types/common.d.ts +16 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/edit-operations.d.ts +204 -0
- package/dist/types/edit-operations.d.ts.map +1 -0
- package/dist/types/edit-operations.js +9 -0
- package/dist/types/edit-operations.js.map +1 -0
- package/dist/types/entities.d.ts +59 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entities.js +10 -0
- package/dist/types/entities.js.map +1 -0
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +2 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/events.d.ts +45 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +21 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mobx-patch.d.ts +22 -0
- package/dist/types/mobx-patch.d.ts.map +1 -0
- package/dist/types/mobx-patch.js +5 -0
- package/dist/types/mobx-patch.js.map +1 -0
- package/dist/types/mobx-shared-state.d.ts +9 -0
- package/dist/types/mobx-shared-state.d.ts.map +1 -0
- package/dist/types/mobx-shared-state.js +2 -0
- package/dist/types/mobx-shared-state.js.map +1 -0
- package/dist/types/parent-messages.d.ts +52 -0
- package/dist/types/parent-messages.d.ts.map +1 -0
- package/dist/types/parent-messages.js +2 -0
- package/dist/types/parent-messages.js.map +1 -0
- package/dist/types/scope.d.ts +22 -0
- package/dist/types/scope.d.ts.map +1 -0
- package/dist/types/scope.js +2 -0
- package/dist/types/scope.js.map +1 -0
- package/dist/types/socket.d.ts +108 -0
- package/dist/types/socket.d.ts.map +1 -0
- package/dist/types/socket.js +2 -0
- package/dist/types/socket.js.map +1 -0
- package/dist/types/theme.d.ts +302 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/theme.js +8 -0
- package/dist/types/theme.js.map +1 -0
- package/dist/utils/dotted-paths.d.ts +10 -0
- package/dist/utils/dotted-paths.d.ts.map +1 -0
- package/dist/utils/dotted-paths.js +85 -0
- package/dist/utils/dotted-paths.js.map +1 -0
- package/dist/utils/name-generator.d.ts +3 -0
- package/dist/utils/name-generator.d.ts.map +1 -0
- package/dist/utils/name-generator.js +22 -0
- package/dist/utils/name-generator.js.map +1 -0
- package/dist/utils/properties.d.ts +20 -0
- package/dist/utils/properties.d.ts.map +1 -0
- package/dist/utils/properties.js +60 -0
- package/dist/utils/properties.js.map +1 -0
- package/dist/utils/strings.d.ts +2 -0
- package/dist/utils/strings.d.ts.map +1 -0
- package/dist/utils/strings.js +7 -0
- package/dist/utils/strings.js.map +1 -0
- package/package.json +54 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Superblocks Community Software License
|
|
2
|
+
|
|
3
|
+
This Superblocks Community License Agreement (the “Agreement”) sets forth the terms on which DayZero
|
|
4
|
+
Software, Inc. d/b/a Superblocks (“Superblocks”) makes available certain software made available by Superblocks
|
|
5
|
+
under this Agreement (the “Software”). BY INSTALLING, DOWNLOADING, ACCESSING, USING OR
|
|
6
|
+
DISTRIBUTING ANY OF THE SOFTWARE, YOU AGREE TO THE TERMS AND CONDITIONS OF THIS
|
|
7
|
+
AGREEMENT.IF YOU DO NOT AGREE TO SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE
|
|
8
|
+
SOFTWARE. IF YOU ARE RECEIVING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU
|
|
9
|
+
REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL AUTHORITY TO AGREE TO THE
|
|
10
|
+
TERMS AND CONDITIONS OF THIS AGREEMENT ON BEHALF OF SUCH ENTITY. “Licensee” means you,
|
|
11
|
+
an individual, or the entity on whose behalf you are receiving the Software.
|
|
12
|
+
|
|
13
|
+
1. LICENSE GRANT AND CONDITIONS.
|
|
14
|
+
|
|
15
|
+
1.1 License. Subject to the terms and conditions of this Agreement, Superblocks hereby grants to Licensee a
|
|
16
|
+
non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this
|
|
17
|
+
Agreement to: (a) use the Software; (b) prepare modifications and derivative works of the Software; (c)
|
|
18
|
+
distribute the Software (including without limitation in source code or object code form); and (d) reproduce
|
|
19
|
+
copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the
|
|
20
|
+
License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means making
|
|
21
|
+
available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other similar online
|
|
22
|
+
service that competes with Superblocks’ products or services.
|
|
23
|
+
|
|
24
|
+
1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the
|
|
25
|
+
following conditions:
|
|
26
|
+
|
|
27
|
+
a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee
|
|
28
|
+
modified the Software.
|
|
29
|
+
b. On each Software copy, Licensee shall reproduce and not remove or alter all Superblocks or third party
|
|
30
|
+
copyright or other proprietary notices contained in the Software, and Licensee must provide the notice
|
|
31
|
+
below with each copy.
|
|
32
|
+
|
|
33
|
+
“This software is made available by DayZero Software, Inc. d/b/a Superblocks, under the terms of the
|
|
34
|
+
Superblocks Community License Agreement. © 2022 DayZero Software, Inc.”
|
|
35
|
+
|
|
36
|
+
1.3 Licensee Modifications. Licensee may add its own copyright notices to modifications made by Licensee
|
|
37
|
+
and may provide additional or different license terms and conditions for use, reproduction, or distribution of
|
|
38
|
+
Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to
|
|
39
|
+
offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not
|
|
40
|
+
Superblocks, will be responsible for any such obligations.
|
|
41
|
+
|
|
42
|
+
1.4 No Sublicensing. The License does not include the right to sublicense the Software, however, each recipient
|
|
43
|
+
to which Licensee provides the Software may exercise the Licenses so long as such recipient agrees to the terms
|
|
44
|
+
and conditions of this Agreement.
|
|
45
|
+
|
|
46
|
+
2. TERM AND TERMINATION. This Agreement will continue unless and until earlier terminated as set forth
|
|
47
|
+
herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will
|
|
48
|
+
terminate automatically and the License will terminate automatically and permanently.
|
|
49
|
+
|
|
50
|
+
3. INTELLECTUAL PROPERTY. As between the parties, Superblocks will retain all right, title, and interest in
|
|
51
|
+
the Software, and all intellectual property rights therein. Superblocks hereby reserves all rights not expressly
|
|
52
|
+
granted to Licensee in this Agreement. Superblocks hereby reserves all rights in its trademarks and service
|
|
53
|
+
marks, and no licenses therein are granted in this Agreement.
|
|
54
|
+
|
|
55
|
+
4. DISCLAIMER. SUPERBLOCKS HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND
|
|
56
|
+
CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY
|
|
57
|
+
DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
|
|
58
|
+
PURPOSE, WITH RESPECT TO THE SOFTWARE.
|
|
59
|
+
|
|
60
|
+
5. LIMITATION OF LIABILITY. SUPERBLOCKS WILL NOT BE LIABLE FOR ANY DAMAGES OF
|
|
61
|
+
ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL,
|
|
62
|
+
SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY
|
|
63
|
+
THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO
|
|
64
|
+
THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
65
|
+
|
|
66
|
+
6. GENERAL.
|
|
67
|
+
|
|
68
|
+
6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the
|
|
69
|
+
state of California, without reference to its conflict of laws principles. If Licensee is located within the United
|
|
70
|
+
States, all disputes arising out of this Agreement are subject to the exclusive jurisdiction of courts located in San
|
|
71
|
+
Mateo County, California. USA. If Licensee is located outside of the United States, any dispute, controversy or
|
|
72
|
+
claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in
|
|
73
|
+
accordance with the JAMS International Arbitration Rules. The tribunal will consist of one neutral arbitrator.
|
|
74
|
+
The place of arbitration will be Palo Alto, California. The language to be used in the arbitral proceedings will be
|
|
75
|
+
English. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction
|
|
76
|
+
thereof.
|
|
77
|
+
|
|
78
|
+
6.2. Assignment. Licensee may not assign its rights under this Agreement to any third party. Superblocks may
|
|
79
|
+
freely assign its rights under this Agreement to any third party.
|
|
80
|
+
|
|
81
|
+
6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof.
|
|
82
|
+
No amendment or modification of this Agreement will be valid or binding upon the parties unless made in
|
|
83
|
+
writing and signed by the duly authorized representatives of both parties. In the event that any provision,
|
|
84
|
+
including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and
|
|
85
|
+
all licenses and rights granted hereunder will immediately terminate. Waiver by Superblocks of a breach of any
|
|
86
|
+
provision of this Agreement or the failure by Superblocks to exercise any right hereunder will not be construed
|
|
87
|
+
as a waiver of any subsequent breach of that right or as a waiver of any other right.
|
package/dist/apis.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,WAE/D,CAAC"}
|
package/dist/apis.js
ADDED
package/dist/apis.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,QAAgB,EAAE,EAAE;IAClE,OAAO,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type BindingString = {
|
|
2
|
+
__binding: true;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function isBindingString(value: unknown): value is BindingString;
|
|
6
|
+
export declare function isBindingEqual(a: BindingString, b: BindingString): boolean;
|
|
7
|
+
export declare function SB(strings: TemplateStringsArray): BindingString;
|
|
8
|
+
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAMtE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAE1E;AAED,wBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAM/D"}
|
package/dist/bindings.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function isBindingString(value) {
|
|
2
|
+
return (typeof value === "object" &&
|
|
3
|
+
value != null &&
|
|
4
|
+
value.__binding === true);
|
|
5
|
+
}
|
|
6
|
+
export function isBindingEqual(a, b) {
|
|
7
|
+
return a.value === b.value;
|
|
8
|
+
}
|
|
9
|
+
export function SB(strings) {
|
|
10
|
+
const fullString = strings.join("");
|
|
11
|
+
return {
|
|
12
|
+
__binding: true,
|
|
13
|
+
value: fullString,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,IAAI,IAAI;QACZ,KAAuB,CAAC,SAAS,KAAK,IAAI,CAC5C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAAgB,EAAE,CAAgB;IAC/D,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,OAA6B;IAC9C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,OAAO;QACL,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,UAAU;KACM,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ComputedProperty<T> = {
|
|
2
|
+
__isComputedProperty: true;
|
|
3
|
+
value: (scope: any, ...args: any[]) => T | undefined;
|
|
4
|
+
};
|
|
5
|
+
export declare function isComputedProperty(value: unknown): value is ComputedProperty<unknown>;
|
|
6
|
+
export declare function isComputedExpression(value: unknown): boolean;
|
|
7
|
+
//# sourceMappingURL=computed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../src/computed.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,oBAAoB,EAAE,IAAI,CAAC;IAC3B,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;CACtD,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAMpC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM5D"}
|
package/dist/computed.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function isComputedProperty(value) {
|
|
2
|
+
return (typeof value === "object" &&
|
|
3
|
+
value !== null &&
|
|
4
|
+
value.__isComputedProperty === true);
|
|
5
|
+
}
|
|
6
|
+
export function isComputedExpression(value) {
|
|
7
|
+
return (typeof value === "string" &&
|
|
8
|
+
value.startsWith("sbComputed(() =>") &&
|
|
9
|
+
value.endsWith(")"));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=computed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computed.js","sourceRoot":"","sources":["../src/computed.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,kBAAkB,CAChC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAmC,CAAC,oBAAoB,KAAK,IAAI,CACnE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC;QACpC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CACpB,CAAC;AACJ,CAAC"}
|
package/dist/helper.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,GAChE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,KAAK,CAAC"}
|
package/dist/helper.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./helper.js";
|
|
2
|
+
export * from "./utils/dotted-paths.js";
|
|
3
|
+
export * from "./utils/name-generator.js";
|
|
4
|
+
export * from "./utils/properties.js";
|
|
5
|
+
export * from "./utils/strings.js";
|
|
6
|
+
export * from "./layout.js";
|
|
7
|
+
export * from "./pages.js";
|
|
8
|
+
export * from "./apis.js";
|
|
9
|
+
export * from "./mobx-sync/index.js";
|
|
10
|
+
export * from "./props/helpers.js";
|
|
11
|
+
export * from "./bindings.js";
|
|
12
|
+
export * from "./computed.js";
|
|
13
|
+
export * from "./scope.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./helper.js";
|
|
2
|
+
export * from "./utils/dotted-paths.js";
|
|
3
|
+
export * from "./utils/name-generator.js";
|
|
4
|
+
export * from "./utils/properties.js";
|
|
5
|
+
export * from "./utils/strings.js";
|
|
6
|
+
export * from "./layout.js";
|
|
7
|
+
export * from "./pages.js";
|
|
8
|
+
export * from "./apis.js";
|
|
9
|
+
export * from "./mobx-sync/index.js";
|
|
10
|
+
export * from "./props/helpers.js";
|
|
11
|
+
export * from "./bindings.js";
|
|
12
|
+
export * from "./computed.js";
|
|
13
|
+
export * from "./scope.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type DimModes = "px" | "fit" | "fill" | "%" | "columns" | "rows";
|
|
2
|
+
export declare const isDimension: (value: unknown) => value is Dim<DimModes>;
|
|
3
|
+
export type Dim<T extends DimModes = DimModes> = {
|
|
4
|
+
mode: T;
|
|
5
|
+
value?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare namespace Dim {
|
|
8
|
+
function isEqual(a: Dim, b: Dim): boolean;
|
|
9
|
+
function build<Mode extends DimModes>(value: number | undefined, mode: Mode): Dim<Mode>;
|
|
10
|
+
function fit(): Dim<"fit">;
|
|
11
|
+
function fill(value?: number): Dim<"fill">;
|
|
12
|
+
function px(value: number): Dim<"px">;
|
|
13
|
+
function percent(value: number): Dim<"%">;
|
|
14
|
+
function columns(value: number): Dim<"columns">;
|
|
15
|
+
function col(value: number): Dim<"columns">;
|
|
16
|
+
function rows(value: number): Dim<"rows">;
|
|
17
|
+
function row(value: number): Dim<"rows">;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;AAExE,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,GAAG,CAAC,QAAQ,CAUjE,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAAI;IAC/C,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,yBAAiB,GAAG,CAAC;IACnB,SAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE/C;IAED,SAAgB,KAAK,CAAC,IAAI,SAAS,QAAQ,EACzC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,IAAI,GACT,GAAG,CAAC,IAAI,CAAC,CAGX;IAED,SAAgB,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAEhC;IAED,SAAgB,IAAI,CAAC,KAAK,GAAE,MAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAEnD;IAED,SAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAE3C;IAED,SAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAE/C;IAED,SAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAErD;IAED,SAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAEjD;IAED,SAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAE/C;IAED,SAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAE9C;CACF"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const isDimension = (value) => {
|
|
2
|
+
return (typeof value === "object" &&
|
|
3
|
+
value !== null &&
|
|
4
|
+
"mode" in value &&
|
|
5
|
+
["px", "fit", "fill", "%", "columns", "rows"].includes(value.mode) &&
|
|
6
|
+
(value.mode === "fit" || "value" in value));
|
|
7
|
+
};
|
|
8
|
+
export var Dim;
|
|
9
|
+
(function (Dim) {
|
|
10
|
+
function isEqual(a, b) {
|
|
11
|
+
return a.mode === b.mode && a.value === b.value;
|
|
12
|
+
}
|
|
13
|
+
Dim.isEqual = isEqual;
|
|
14
|
+
function build(value, mode) {
|
|
15
|
+
if (mode === "fit")
|
|
16
|
+
return { mode };
|
|
17
|
+
return { mode, value: value };
|
|
18
|
+
}
|
|
19
|
+
Dim.build = build;
|
|
20
|
+
function fit() {
|
|
21
|
+
return Dim.build(undefined, "fit");
|
|
22
|
+
}
|
|
23
|
+
Dim.fit = fit;
|
|
24
|
+
function fill(value = 1) {
|
|
25
|
+
return Dim.build(value, "fill");
|
|
26
|
+
}
|
|
27
|
+
Dim.fill = fill;
|
|
28
|
+
function px(value) {
|
|
29
|
+
return Dim.build(value, "px");
|
|
30
|
+
}
|
|
31
|
+
Dim.px = px;
|
|
32
|
+
function percent(value) {
|
|
33
|
+
return Dim.build(value, "%");
|
|
34
|
+
}
|
|
35
|
+
Dim.percent = percent;
|
|
36
|
+
function columns(value) {
|
|
37
|
+
return Dim.build(value, "columns");
|
|
38
|
+
}
|
|
39
|
+
Dim.columns = columns;
|
|
40
|
+
function col(value) {
|
|
41
|
+
return Dim.build(value, "columns");
|
|
42
|
+
}
|
|
43
|
+
Dim.col = col;
|
|
44
|
+
function rows(value) {
|
|
45
|
+
return Dim.build(value, "rows");
|
|
46
|
+
}
|
|
47
|
+
Dim.rows = rows;
|
|
48
|
+
function row(value) {
|
|
49
|
+
return Dim.build(value, "rows");
|
|
50
|
+
}
|
|
51
|
+
Dim.row = row;
|
|
52
|
+
})(Dim || (Dim = {}));
|
|
53
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAA0B,EAAE;IACpE,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CACpD,KAAK,CAAC,IAAc,CACrB;QACD,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,CAC3C,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,KAAW,GAAG,CA4CnB;AA5CD,WAAiB,GAAG;IAClB,SAAgB,OAAO,CAAC,CAAM,EAAE,CAAM;QACpC,OAAO,CAAC,CAAC,IAAI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e,QAAI,OAEnB,CAAA;IAED,SAAgB,GAAG,CAAC,KAAa;QAC/B,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAFe,OAAG,MAElB,CAAA;AACH,CAAC,EA5CgB,GAAG,KAAH,GAAG,QA4CnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-patch.d.ts","sourceRoot":"","sources":["../../src/mobx-sync/apply-patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,GAC7B,IAAI,CASN"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const removeSymbol = Symbol("patch-delete");
|
|
2
|
+
/**
|
|
3
|
+
* Applies a patch to update an object in place
|
|
4
|
+
*/
|
|
5
|
+
export function applyMobXPatch(data, patch) {
|
|
6
|
+
const arrayDelQueue = [];
|
|
7
|
+
if (Array.isArray(patch)) {
|
|
8
|
+
patch.forEach((p) => applyMobXPatchSingle(data, p, arrayDelQueue));
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
applyMobXPatchSingle(data, patch, arrayDelQueue);
|
|
12
|
+
}
|
|
13
|
+
arrayDelQueue.forEach((fn) => fn());
|
|
14
|
+
}
|
|
15
|
+
function applyMobXPatchSingle(data, patch, arrayDelQueue) {
|
|
16
|
+
try {
|
|
17
|
+
// Find the target object to update
|
|
18
|
+
let current = data;
|
|
19
|
+
let parent = null;
|
|
20
|
+
let lastKey = null;
|
|
21
|
+
// Navigate the path until we reach the target location
|
|
22
|
+
for (let i = 0; i < patch.path.length; i++) {
|
|
23
|
+
const key = patch.path[i];
|
|
24
|
+
if (i === patch.path.length - 1) {
|
|
25
|
+
// We're at the last key in the path
|
|
26
|
+
parent = current;
|
|
27
|
+
lastKey = key ?? null;
|
|
28
|
+
}
|
|
29
|
+
else if (key !== undefined) {
|
|
30
|
+
// Move to the next level
|
|
31
|
+
current = current[key];
|
|
32
|
+
if (!current) {
|
|
33
|
+
console.error(`Path segment ${key} not found in current object`);
|
|
34
|
+
return; // Exit early
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Apply the operation
|
|
39
|
+
if ((patch.op === "add" || patch.op === "update") && "value" in patch) {
|
|
40
|
+
if (parent && lastKey !== null) {
|
|
41
|
+
parent[lastKey] = patch.value;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Root level update
|
|
45
|
+
Object.assign(data, patch.value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (patch.op === "remove" && parent && lastKey !== null) {
|
|
49
|
+
if (Array.isArray(parent)) {
|
|
50
|
+
parent.splice(lastKey, 1, removeSymbol);
|
|
51
|
+
arrayDelQueue.push(() => {
|
|
52
|
+
// Remove all removeSymbols in place
|
|
53
|
+
for (let i = parent.length - 1; i >= 0; i--) {
|
|
54
|
+
if (parent[i] === removeSymbol) {
|
|
55
|
+
parent.splice(i, 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
delete parent[lastKey];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (patch.op === "splice" && parent && lastKey !== null) {
|
|
65
|
+
// Handle array splice operations
|
|
66
|
+
const array = parent[lastKey];
|
|
67
|
+
if (Array.isArray(array)) {
|
|
68
|
+
// For splice operations, first remove and then add
|
|
69
|
+
const index = patch.path.length > 0 &&
|
|
70
|
+
typeof patch.path[patch.path.length - 1] === "number"
|
|
71
|
+
? patch.path[patch.path.length - 1]
|
|
72
|
+
: 0;
|
|
73
|
+
if ("removedCount" in patch &&
|
|
74
|
+
patch.removedCount &&
|
|
75
|
+
patch.removedCount > 0) {
|
|
76
|
+
// Remove items at specified index
|
|
77
|
+
array.splice(index, patch.removedCount);
|
|
78
|
+
}
|
|
79
|
+
if ("added" in patch && patch.added && patch.added.length > 0) {
|
|
80
|
+
// Add items at the same index
|
|
81
|
+
array.splice(index, 0, ...patch.added);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.error("Cannot apply splice operation to non-array:", array);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error(`Error applying patch:`, error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=apply-patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-patch.js","sourceRoot":"","sources":["../../src/mobx-sync/apply-patch.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAO,EACP,KAA8B;IAE9B,MAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;IACrE,CAAC;SAAM,CAAC;QACN,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IACD,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAO,EACP,KAAgB,EAChB,aAA6B;IAE7B,IAAI,CAAC;QACH,mCAAmC;QACnC,IAAI,OAAO,GAAqC,IAG/C,CAAC;QACF,IAAI,MAAM,GAA4C,IAAI,CAAC;QA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AAC;gBAC1C,CAAC;gBAED,IAAI,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC9D,8BAA8B;oBAC9B,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mobx-sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mobx-sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DeepObserveChange, MobXPatch } from "../types/mobx-patch.js";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a MobX deep observe change to our patch format
|
|
4
|
+
*/
|
|
5
|
+
export declare function toMobXPatch(change: DeepObserveChange, pathStr: string): MobXPatch;
|
|
6
|
+
//# sourceMappingURL=to-patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-patch.d.ts","sourceRoot":"","sources":["../../src/mobx-sync/to-patch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,GACd,SAAS,CA4CX"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { pathStringToArray } from "./utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a MobX deep observe change to our patch format
|
|
4
|
+
*/
|
|
5
|
+
export function toMobXPatch(change, pathStr) {
|
|
6
|
+
// Convert path string to array
|
|
7
|
+
const pathToObject = pathStringToArray(pathStr);
|
|
8
|
+
// Create full path including the property name from the change
|
|
9
|
+
const path = [...pathToObject];
|
|
10
|
+
if ("name" in change && change.name !== undefined) {
|
|
11
|
+
path.push(change.name);
|
|
12
|
+
}
|
|
13
|
+
// Map mobx-utils change types to our patch op and create appropriate patch
|
|
14
|
+
switch (change.type) {
|
|
15
|
+
case "splice":
|
|
16
|
+
return {
|
|
17
|
+
op: "splice",
|
|
18
|
+
path,
|
|
19
|
+
added: change.added || [],
|
|
20
|
+
addedCount: change.addedCount || 0,
|
|
21
|
+
removed: change.removed || [],
|
|
22
|
+
removedCount: change.removedCount || 0,
|
|
23
|
+
};
|
|
24
|
+
case "update":
|
|
25
|
+
return {
|
|
26
|
+
op: "update",
|
|
27
|
+
path,
|
|
28
|
+
value: "newValue" in change ? change.newValue : undefined,
|
|
29
|
+
};
|
|
30
|
+
case "add":
|
|
31
|
+
return {
|
|
32
|
+
op: "add",
|
|
33
|
+
path,
|
|
34
|
+
value: "newValue" in change ? change.newValue : undefined,
|
|
35
|
+
};
|
|
36
|
+
case "remove":
|
|
37
|
+
case "delete":
|
|
38
|
+
return {
|
|
39
|
+
op: "remove",
|
|
40
|
+
path,
|
|
41
|
+
};
|
|
42
|
+
default: {
|
|
43
|
+
const exhaustiveCheck = change;
|
|
44
|
+
throw new Error(`Unknown change type: ${exhaustiveCheck}`);
|
|
45
|
+
}
|
|
46
|
+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C,CAAC,CAAC,SAAS;aAC1D,CAAC;QACJ,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO;gBACL,EAAE,EAAE,QAAQ;gBACZ,IAAI;aACL,CAAC;QACJ,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,eAAe,GAAU,MAAM,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,wBAAwB,eAAe,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mobx-sync/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CActE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a path string from deepObserve to a path array
|
|
3
|
+
*/
|
|
4
|
+
export function pathStringToArray(pathStr) {
|
|
5
|
+
return pathStr
|
|
6
|
+
? pathStr.split("/").reduce((acc, segment) => {
|
|
7
|
+
// If segment is a numeric string like "0", convert to number
|
|
8
|
+
const parsed = parseInt(segment, 10);
|
|
9
|
+
if (!isNaN(parsed) && parsed.toString() === segment) {
|
|
10
|
+
acc.push(parsed);
|
|
11
|
+
}
|
|
12
|
+
else if (segment) {
|
|
13
|
+
// Only add non-empty segments
|
|
14
|
+
acc.push(segment);
|
|
15
|
+
}
|
|
16
|
+
return acc;
|
|
17
|
+
}, [])
|
|
18
|
+
: [];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/mobx-sync/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,OAAO;QACZ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;YAC9D,6DAA6D;YAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,OAAO,EAAE,CAAC;gBACpD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC;iBAAM,IAAI,OAAO,EAAE,CAAC;gBACnB,8BAA8B;gBAC9B,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC;QACR,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
|
package/dist/pages.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PropertyInfo as PropertyInfoOperation } from "./types/edit-operations.js";
|
|
2
|
+
import type { ValidStepDef, WidgetTypes } from "@superblocksteam/shared";
|
|
3
|
+
export type PropertyInfo<V = unknown | {
|
|
4
|
+
mode: string;
|
|
5
|
+
value?: number;
|
|
6
|
+
} | ValidStepDef[]> = PropertyInfoOperation<V>;
|
|
7
|
+
export type Properties = Record<string, PropertyInfo<{
|
|
8
|
+
mode: string;
|
|
9
|
+
value?: number;
|
|
10
|
+
} | ValidStepDef[] | Record<string, PropertyInfo> | unknown>>;
|
|
11
|
+
export declare const NodeType: {
|
|
12
|
+
readonly RootNode: "RootNode";
|
|
13
|
+
readonly WidgetNode: "WidgetNode";
|
|
14
|
+
readonly HTMLElementNode: "HTMLElementNode";
|
|
15
|
+
};
|
|
16
|
+
export type NodeType = keyof typeof NodeType;
|
|
17
|
+
export interface BaseNode {
|
|
18
|
+
id: string;
|
|
19
|
+
type: NodeType;
|
|
20
|
+
name: string;
|
|
21
|
+
isConditional?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface HTMLElementNode extends BaseNode {
|
|
24
|
+
type: "HTMLElementNode";
|
|
25
|
+
properties: Properties;
|
|
26
|
+
children?: Node[];
|
|
27
|
+
tagName: string;
|
|
28
|
+
reference?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WidgetNode extends BaseNode {
|
|
31
|
+
type: "WidgetNode";
|
|
32
|
+
widgetType: WidgetTypes;
|
|
33
|
+
properties: Properties;
|
|
34
|
+
children?: Node[];
|
|
35
|
+
tagName: string;
|
|
36
|
+
}
|
|
37
|
+
type RootNodeKind = "page" | "component";
|
|
38
|
+
export interface RootNode extends BaseNode {
|
|
39
|
+
type: "RootNode";
|
|
40
|
+
root: Node;
|
|
41
|
+
kind: RootNodeKind;
|
|
42
|
+
}
|
|
43
|
+
export type Node = RootNode | WidgetNode | HTMLElementNode;
|
|
44
|
+
export declare const isRootNode: (node: Node) => node is RootNode;
|
|
45
|
+
export declare const isWidgetNode: (node: Node) => node is WidgetNode;
|
|
46
|
+
export declare const isHTMLElementNode: (node: Node) => node is HTMLElementNode;
|
|
47
|
+
export declare const WIDGET_SOURCE_ID_ATTRIBUTE = "data-sb-id";
|
|
48
|
+
export declare const WIDGET_INSTANCE_ID_ATTRIBUTE = "data-sb-instance-id";
|
|
49
|
+
export declare const ROOT_WIDGET_ATTRIBUTE = "data-sb-root";
|
|
50
|
+
export declare const PROCESSED_TRANSACTIONS_ATTRIBUTE = "data-sb-processed-transactions";
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEzE,MAAM,MAAM,YAAY,CACtB,CAAC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pB;AAED,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,eAAe,CAAC;AAE3D,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,QACf,CAAC;AAElC,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,UACf,CAAC;AAEpC,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,eACf,CAAC;AAEzC,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,eAAO,MAAM,gCAAgC,mCACX,CAAC"}
|
package/dist/pages.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const NodeType = {
|
|
2
|
+
RootNode: "RootNode",
|
|
3
|
+
WidgetNode: "WidgetNode",
|
|
4
|
+
HTMLElementNode: "HTMLElementNode",
|
|
5
|
+
};
|
|
6
|
+
export const isRootNode = (node) => node.type === NodeType.RootNode;
|
|
7
|
+
export const isWidgetNode = (node) => node.type === NodeType.WidgetNode;
|
|
8
|
+
export const isHTMLElementNode = (node) => node.type === NodeType.HTMLElementNode;
|
|
9
|
+
export const WIDGET_SOURCE_ID_ATTRIBUTE = "data-sb-id";
|
|
10
|
+
export const WIDGET_INSTANCE_ID_ATTRIBUTE = "data-sb-instance-id";
|
|
11
|
+
export const ROOT_WIDGET_ATTRIBUTE = "data-sb-root";
|
|
12
|
+
export const PROCESSED_TRANSACTIONS_ATTRIBUTE = "data-sb-processed-transactions";
|
|
13
|
+
//# sourceMappingURL=pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,eAAe,EAAE,iBAAiB;CAC1B,CAAC;AAoCX,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAoB,EAAE,CACzD,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAsB,EAAE,CAC7D,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,UAAU,CAAC;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAA2B,EAAE,CACvE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEpD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,gCAAgC,CAAC"}
|