@stonecrop/stonecrop 0.11.0 → 0.11.2
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/registry.js +0 -37
- package/dist/src/registry.d.ts +1 -24
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +0 -24
- package/dist/stonecrop.js +0 -36
- package/dist/stonecrop.js.map +1 -1
- package/package.json +5 -5
- package/src/registry.ts +1 -39
- package/dist/composable.js +0 -1
- package/dist/composables/use-lazy-link-state.js +0 -125
- package/dist/composables/use-stonecrop.js +0 -476
- package/dist/operation-log-DB-dGNT9.js +0 -593
- package/dist/operation-log-DB-dGNT9.js.map +0 -1
- package/dist/src/composable.d.ts +0 -11
- package/dist/src/composable.d.ts.map +0 -1
- package/dist/src/composable.js +0 -477
- package/dist/src/composables/operation-log.js +0 -224
- package/dist/src/composables/stonecrop.js +0 -574
- package/dist/src/composables/use-lazy-link-state.d.ts +0 -25
- package/dist/src/composables/use-lazy-link-state.d.ts.map +0 -1
- package/dist/src/composables/use-stonecrop.d.ts +0 -93
- package/dist/src/composables/use-stonecrop.d.ts.map +0 -1
- package/dist/src/composables/useNestedSchema.d.ts +0 -110
- package/dist/src/composables/useNestedSchema.d.ts.map +0 -1
- package/dist/src/composables/useNestedSchema.js +0 -155
- package/dist/src/doctype.js +0 -234
- package/dist/src/exceptions.js +0 -16
- package/dist/src/field-triggers.js +0 -567
- package/dist/src/index.js +0 -23
- package/dist/src/plugins/index.js +0 -96
- package/dist/src/registry.js +0 -246
- package/dist/src/schema-validator.js +0 -315
- package/dist/src/stonecrop.js +0 -339
- package/dist/src/stores/data.d.ts +0 -11
- package/dist/src/stores/data.d.ts.map +0 -1
- package/dist/src/stores/hst.js +0 -495
- package/dist/src/stores/index.js +0 -12
- package/dist/src/stores/operation-log.js +0 -568
- package/dist/src/stores/xstate.d.ts +0 -31
- package/dist/src/stores/xstate.d.ts.map +0 -1
- package/dist/src/tsdoc-metadata.json +0 -11
- package/dist/src/types/field-triggers.js +0 -4
- package/dist/src/types/index.js +0 -4
- package/dist/src/types/operation-log.js +0 -0
- package/dist/src/types/registry.js +0 -0
- package/dist/src/utils.d.ts +0 -24
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/stonecrop.css +0 -1
- package/dist/stonecrop.umd.cjs +0 -6
- package/dist/stonecrop.umd.cjs.map +0 -1
- package/dist/stores/data.js +0 -7
- package/dist/stores/xstate.js +0 -29
- package/dist/tests/setup.d.ts +0 -5
- package/dist/tests/setup.d.ts.map +0 -1
- package/dist/tests/setup.js +0 -15
- package/dist/utils.js +0 -46
package/dist/stores/data.js
DELETED
package/dist/stores/xstate.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia';
|
|
2
|
-
import { xstate } from 'pinia-xstate';
|
|
3
|
-
import { createMachine } from 'xstate';
|
|
4
|
-
export const counterMachine = createMachine({
|
|
5
|
-
id: 'counter',
|
|
6
|
-
initial: 'active',
|
|
7
|
-
context: {
|
|
8
|
-
count: 0,
|
|
9
|
-
},
|
|
10
|
-
states: {
|
|
11
|
-
active: {
|
|
12
|
-
on: {
|
|
13
|
-
INC: { actions: 'increment' },
|
|
14
|
-
DEC: { actions: 'decrement' },
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
}, {
|
|
19
|
-
actions: {
|
|
20
|
-
increment: context => {
|
|
21
|
-
context.count = context.count + 1;
|
|
22
|
-
},
|
|
23
|
-
decrement: context => {
|
|
24
|
-
context.count = context.count - 1;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
// create a store using the xstate middleware
|
|
29
|
-
export const useCounterStore = defineStore(counterMachine.id, xstate(counterMachine));
|
package/dist/tests/setup.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../tests/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/tests/setup.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vitest setup file
|
|
3
|
-
* Runs before all test files
|
|
4
|
-
*/
|
|
5
|
-
// Remove Node.js's native BroadcastChannel to avoid conflicts with mocks
|
|
6
|
-
// Tests that need BroadcastChannel will mock it themselves
|
|
7
|
-
if (typeof global !== 'undefined' && 'BroadcastChannel' in global) {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
9
|
-
delete global.BroadcastChannel;
|
|
10
|
-
}
|
|
11
|
-
// Also remove from globalThis if it exists there
|
|
12
|
-
if (typeof globalThis !== 'undefined' && 'BroadcastChannel' in globalThis) {
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
14
|
-
delete globalThis.BroadcastChannel;
|
|
15
|
-
}
|
package/dist/utils.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { isDoctypeMany, } from '@stonecrop/aform';
|
|
2
|
-
/**
|
|
3
|
-
* Recursively collect nested data from HST using pre-resolved schemas.
|
|
4
|
-
*
|
|
5
|
-
* Walks through a resolved schema and collects all values from the HST store,
|
|
6
|
-
* including nested 1:1 Doctype fields and 1:many child arrays.
|
|
7
|
-
*
|
|
8
|
-
* @param resolvedSchema - The already-resolved schema (with nested schemas embedded)
|
|
9
|
-
* @param basePath - The base path in HST (e.g., "customer.123.address")
|
|
10
|
-
* @param hstStore - The HST store instance
|
|
11
|
-
* @returns The collected data object with all nested fields
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const addressSchema = registry.resolveSchema(addressDoctype.schema)
|
|
16
|
-
* const addressData = collectNestedData(addressSchema, 'customer.123.address', hstStore)
|
|
17
|
-
* // Returns: { street: '123 Main St', city: 'Portland', ... }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export function collectNestedData(resolvedSchema, basePath, hstStore) {
|
|
23
|
-
const data = hstStore.get(basePath) || {};
|
|
24
|
-
const payload = { ...data };
|
|
25
|
-
const doctypeFields = resolvedSchema.filter(field => 'fieldtype' in field &&
|
|
26
|
-
field.fieldtype === 'Doctype' &&
|
|
27
|
-
!isDoctypeMany(field) &&
|
|
28
|
-
'schema' in field &&
|
|
29
|
-
Array.isArray(field.schema));
|
|
30
|
-
for (const field of doctypeFields) {
|
|
31
|
-
const doctypeField = field;
|
|
32
|
-
const fieldPath = `${basePath}.${doctypeField.fieldname}`;
|
|
33
|
-
const nestedData = collectNestedData(doctypeField.schema, fieldPath, hstStore);
|
|
34
|
-
payload[doctypeField.fieldname] = nestedData;
|
|
35
|
-
}
|
|
36
|
-
const doctypeManyFields = resolvedSchema.filter(field => 'fieldtype' in field && field.fieldtype === 'Doctype' && isDoctypeMany(field));
|
|
37
|
-
for (const field of doctypeManyFields) {
|
|
38
|
-
const doctypeField = field;
|
|
39
|
-
const fieldPath = `${basePath}.${doctypeField.fieldname}`;
|
|
40
|
-
const arrayData = hstStore.get(fieldPath);
|
|
41
|
-
if (Array.isArray(arrayData)) {
|
|
42
|
-
payload[doctypeField.fieldname] = arrayData;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return payload;
|
|
46
|
-
}
|