@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.
Files changed (56) hide show
  1. package/dist/registry.js +0 -37
  2. package/dist/src/registry.d.ts +1 -24
  3. package/dist/src/registry.d.ts.map +1 -1
  4. package/dist/stonecrop.d.ts +0 -24
  5. package/dist/stonecrop.js +0 -36
  6. package/dist/stonecrop.js.map +1 -1
  7. package/package.json +5 -5
  8. package/src/registry.ts +1 -39
  9. package/dist/composable.js +0 -1
  10. package/dist/composables/use-lazy-link-state.js +0 -125
  11. package/dist/composables/use-stonecrop.js +0 -476
  12. package/dist/operation-log-DB-dGNT9.js +0 -593
  13. package/dist/operation-log-DB-dGNT9.js.map +0 -1
  14. package/dist/src/composable.d.ts +0 -11
  15. package/dist/src/composable.d.ts.map +0 -1
  16. package/dist/src/composable.js +0 -477
  17. package/dist/src/composables/operation-log.js +0 -224
  18. package/dist/src/composables/stonecrop.js +0 -574
  19. package/dist/src/composables/use-lazy-link-state.d.ts +0 -25
  20. package/dist/src/composables/use-lazy-link-state.d.ts.map +0 -1
  21. package/dist/src/composables/use-stonecrop.d.ts +0 -93
  22. package/dist/src/composables/use-stonecrop.d.ts.map +0 -1
  23. package/dist/src/composables/useNestedSchema.d.ts +0 -110
  24. package/dist/src/composables/useNestedSchema.d.ts.map +0 -1
  25. package/dist/src/composables/useNestedSchema.js +0 -155
  26. package/dist/src/doctype.js +0 -234
  27. package/dist/src/exceptions.js +0 -16
  28. package/dist/src/field-triggers.js +0 -567
  29. package/dist/src/index.js +0 -23
  30. package/dist/src/plugins/index.js +0 -96
  31. package/dist/src/registry.js +0 -246
  32. package/dist/src/schema-validator.js +0 -315
  33. package/dist/src/stonecrop.js +0 -339
  34. package/dist/src/stores/data.d.ts +0 -11
  35. package/dist/src/stores/data.d.ts.map +0 -1
  36. package/dist/src/stores/hst.js +0 -495
  37. package/dist/src/stores/index.js +0 -12
  38. package/dist/src/stores/operation-log.js +0 -568
  39. package/dist/src/stores/xstate.d.ts +0 -31
  40. package/dist/src/stores/xstate.d.ts.map +0 -1
  41. package/dist/src/tsdoc-metadata.json +0 -11
  42. package/dist/src/types/field-triggers.js +0 -4
  43. package/dist/src/types/index.js +0 -4
  44. package/dist/src/types/operation-log.js +0 -0
  45. package/dist/src/types/registry.js +0 -0
  46. package/dist/src/utils.d.ts +0 -24
  47. package/dist/src/utils.d.ts.map +0 -1
  48. package/dist/stonecrop.css +0 -1
  49. package/dist/stonecrop.umd.cjs +0 -6
  50. package/dist/stonecrop.umd.cjs.map +0 -1
  51. package/dist/stores/data.js +0 -7
  52. package/dist/stores/xstate.js +0 -29
  53. package/dist/tests/setup.d.ts +0 -5
  54. package/dist/tests/setup.d.ts.map +0 -1
  55. package/dist/tests/setup.js +0 -15
  56. package/dist/utils.js +0 -46
@@ -1,7 +0,0 @@
1
- import { defineStore } from 'pinia';
2
- import { ref } from 'vue';
3
- export const useDataStore = defineStore('data', () => {
4
- const records = ref([]);
5
- const record = ref({});
6
- return { records, record };
7
- });
@@ -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));
@@ -1,5 +0,0 @@
1
- /**
2
- * Vitest setup file
3
- * Runs before all test files
4
- */
5
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../tests/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -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
- }