@stonecrop/stonecrop 0.11.7 → 0.11.9

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 (43) hide show
  1. package/dist/{composables → src/composables}/lazy-link.js +1 -1
  2. package/dist/src/registry.d.ts.map +1 -1
  3. package/dist/{registry.js → src/registry.js} +6 -4
  4. package/dist/src/stonecrop.d.ts.map +1 -1
  5. package/dist/src/stonecrop.js +565 -0
  6. package/dist/{stores → src/stores}/hst.js +1 -1
  7. package/dist/src/stores/operation-log.d.ts.map +1 -1
  8. package/dist/{stores → src/stores}/operation-log.js +1 -1
  9. package/dist/src/types/doctype.d.ts +2 -2
  10. package/dist/src/types/doctype.d.ts.map +1 -1
  11. package/dist/stonecrop.d.ts +2 -1
  12. package/dist/stonecrop.js +17 -10
  13. package/dist/stonecrop.js.map +1 -1
  14. package/dist/stonecrop.tsbuildinfo +1 -1
  15. package/dist/tsdoc-metadata.json +1 -1
  16. package/package.json +23 -23
  17. package/src/composables/lazy-link.ts +1 -1
  18. package/src/composables/stonecrop.ts +1 -1
  19. package/src/field-triggers.ts +1 -1
  20. package/src/registry.ts +10 -7
  21. package/src/stonecrop.ts +0 -1
  22. package/src/stores/hst.ts +1 -1
  23. package/src/stores/operation-log.ts +11 -9
  24. package/src/types/doctype.ts +2 -2
  25. /package/dist/{composables → src/composables}/operation-log.js +0 -0
  26. /package/dist/{composables → src/composables}/stonecrop.js +0 -0
  27. /package/dist/{doctype.js → src/doctype.js} +0 -0
  28. /package/dist/{exceptions.js → src/exceptions.js} +0 -0
  29. /package/dist/{field-triggers.js → src/field-triggers.js} +0 -0
  30. /package/dist/{index.js → src/index.js} +0 -0
  31. /package/dist/{plugins → src/plugins}/index.js +0 -0
  32. /package/dist/{schema-validator.js → src/schema-validator.js} +0 -0
  33. /package/dist/{stores → src/stores}/index.js +0 -0
  34. /package/dist/{types → src/types}/composable.js +0 -0
  35. /package/dist/{types → src/types}/doctype.js +0 -0
  36. /package/dist/{types → src/types}/field-triggers.js +0 -0
  37. /package/dist/{types → src/types}/hst.js +0 -0
  38. /package/dist/{types → src/types}/index.js +0 -0
  39. /package/dist/{types → src/types}/operation-log.js +0 -0
  40. /package/dist/{types → src/types}/plugin.js +0 -0
  41. /package/dist/{types → src/types}/registry.js +0 -0
  42. /package/dist/{types → src/types}/schema-validator.js +0 -0
  43. /package/dist/{types → src/types}/stonecrop.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { SchemaTypes } from '@stonecrop/aform';
2
- import type { LinkDeclaration, WorkflowMeta } from '@stonecrop/schema';
2
+ import type { FieldMeta, LinkDeclaration, WorkflowMeta } from '@stonecrop/schema';
3
3
  import { List, Map } from 'immutable';
4
4
  import type { AnyStateNodeConfig, UnknownMachineConfig } from 'xstate';
5
5
  /**
@@ -43,7 +43,7 @@ export type DoctypeConfig = {
43
43
  /** Database table name */
44
44
  tableName?: string;
45
45
  /** Field definitions (including link fields with fieldtype: 'Link') */
46
- fields?: SchemaTypes[];
46
+ fields?: (SchemaTypes | FieldMeta)[];
47
47
  /** Relationship links to other doctypes */
48
48
  links?: Record<string, LinkDeclaration>;
49
49
  /** Workflow configuration (XState format or simple WorkflowMeta) */
@@ -1 +1 @@
1
- {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnC,QAAQ,CAAC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IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,CAAA;IACpC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACvC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,YAAY,CAAA;IAC9C,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
@@ -2,6 +2,7 @@ import type { AnyStateNodeConfig } from 'xstate';
2
2
  import { Component } from 'vue';
3
3
  import { ComputedRef } from 'vue';
4
4
  import type { DataClient } from '@stonecrop/schema';
5
+ import type { FieldMeta } from '@stonecrop/schema';
5
6
  import type { LinkDeclaration } from '@stonecrop/schema';
6
7
  import { List } from 'immutable';
7
8
  import { Map as Map_2 } from 'immutable';
@@ -320,7 +321,7 @@ export declare type DoctypeConfig = {
320
321
  /** Database table name */
321
322
  tableName?: string;
322
323
  /** Field definitions (including link fields with fieldtype: 'Link') */
323
- fields?: SchemaTypes[];
324
+ fields?: (SchemaTypes | FieldMeta)[];
324
325
  /** Relationship links to other doctypes */
325
326
  links?: Record<string, LinkDeclaration>;
326
327
  /** Workflow configuration (XState format or simple WorkflowMeta) */
package/dist/stonecrop.js CHANGED
@@ -355,13 +355,15 @@ const Ie = Li("hst-operation-log", () => {
355
355
  for (let v = r.value; v >= 0 && t.value[v]?.reversible; v--)
356
356
  _++;
357
357
  return _;
358
- }), c = G(() => t.value.length - 1 - r.value), f = G(() => ({
359
- canUndo: s.value,
360
- canRedo: a.value,
361
- undoCount: u.value,
362
- redoCount: c.value,
363
- currentIndex: r.value
364
- }));
358
+ }), c = G(() => t.value.length - 1 - r.value), f = G(
359
+ () => ({
360
+ canUndo: s.value,
361
+ canRedo: a.value,
362
+ undoCount: u.value,
363
+ redoCount: c.value,
364
+ currentIndex: r.value
365
+ })
366
+ );
365
367
  function h(_) {
366
368
  e.value = { ...e.value, ..._ }, e.value.enablePersistence && (Q(), xt()), e.value.enableCrossTabSync && ae();
367
369
  }
@@ -1058,7 +1060,7 @@ class Ue {
1058
1060
  constructor(t, r, n = "", i = null) {
1059
1061
  return this.target = t, this.ancestorPath = n, this.rootNode = i || this, this.doctype = r, this.hst = Kt.getInstance(), new Proxy(this, {
1060
1062
  get(o, s) {
1061
- if (s in o) return o[s];
1063
+ if (s in o) return Reflect.get(o, s);
1062
1064
  const a = String(s);
1063
1065
  return o.getNode(a);
1064
1066
  },
@@ -1710,7 +1712,7 @@ function hs(e, t, r) {
1710
1712
  `
1711
1713
  )(n, u(), a);
1712
1714
  } catch (d) {
1713
- throw new Error(`Custom handler failed: ${d instanceof Error ? d.message : String(d)}`);
1715
+ throw new Error(`Custom handler failed: ${d instanceof Error ? d.message : String(d)}`, { cause: d });
1714
1716
  }
1715
1717
  }, h = async () => {
1716
1718
  const p = c(), d = `${e.slug || e.doctype}.${t}`;
@@ -5563,7 +5565,12 @@ class me {
5563
5565
  if ("fieldtype" in u && u.fieldtype === "Link") {
5564
5566
  const c = s.get(u.fieldname);
5565
5567
  if (!c) {
5566
- a.push({ ...u });
5568
+ const S = typeof u.options == "string" ? u.options : void 0;
5569
+ a.push({
5570
+ ...u,
5571
+ component: "AFormLink",
5572
+ ...S !== void 0 ? { doctype: S } : {}
5573
+ });
5567
5574
  continue;
5568
5575
  }
5569
5576
  const f = this.registry[c.target];