@nordcraft/core 2.0.7 → 2.0.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 (36) hide show
  1. package/dist/api/LegacyToddleApi.d.ts +1 -0
  2. package/dist/api/LegacyToddleApi.js +3 -0
  3. package/dist/api/LegacyToddleApi.js.map +1 -1
  4. package/dist/api/ToddleApiV2.d.ts +2 -1
  5. package/dist/api/ToddleApiV2.js +3 -0
  6. package/dist/api/ToddleApiV2.js.map +1 -1
  7. package/dist/api/api.d.ts +2 -4
  8. package/dist/api/api.js +1 -42
  9. package/dist/api/api.js.map +1 -1
  10. package/dist/api/apiTypes.d.ts +2 -0
  11. package/dist/api/apiTypes.js.map +1 -1
  12. package/dist/component/ToddleComponent.d.ts +0 -2
  13. package/dist/component/ToddleComponent.js +7 -21
  14. package/dist/component/ToddleComponent.js.map +1 -1
  15. package/dist/component/component.types.d.ts +11 -2
  16. package/dist/component/component.types.js.map +1 -1
  17. package/dist/component/schemas/api-schema.js +5 -0
  18. package/dist/component/schemas/api-schema.js.map +1 -1
  19. package/dist/styling/className.d.ts +4 -1
  20. package/dist/styling/className.js +4 -1
  21. package/dist/styling/className.js.map +1 -1
  22. package/dist/styling/style.css.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/api/LegacyToddleApi.ts +3 -0
  25. package/src/api/ToddleApiV2.ts +5 -1
  26. package/src/api/api.test.ts +47 -0
  27. package/src/api/api.ts +3 -63
  28. package/src/api/apiTypes.ts +2 -0
  29. package/src/component/ToddleComponent.subComponents.test.ts +219 -0
  30. package/src/component/ToddleComponent.ts +10 -54
  31. package/src/component/component.types.ts +17 -2
  32. package/src/component/schemas/api-schema.ts +5 -0
  33. package/src/styling/className.test.ts +16 -1
  34. package/src/styling/className.ts +15 -2
  35. package/src/styling/style.css.ts +2 -3
  36. package/src/component/ToddleComponent.actionReferences.test.ts +0 -112
@@ -1,112 +0,0 @@
1
- import { describe, expect, test } from 'bun:test'
2
- import { ToddleComponent } from './ToddleComponent'
3
-
4
- describe('ToddleComponent.actionReferences', () => {
5
- test('it return custom actions used in the component', () => {
6
- const demo = new ToddleComponent({
7
- component: {
8
- name: 'demo',
9
- apis: {},
10
- attributes: {},
11
- nodes: {},
12
- variables: {},
13
- workflows: {
14
- '7XLoA3': {
15
- name: 'my-workflow',
16
- actions: [
17
- {
18
- type: 'Custom',
19
- name: 'MyCustomAction',
20
- },
21
- {
22
- name: 'MyLegacyCustomAction',
23
- },
24
- ],
25
- parameters: [],
26
- },
27
- },
28
- },
29
- getComponent: () => undefined,
30
- packageName: 'demo',
31
- globalFormulas: { formulas: {}, packages: {} },
32
- })
33
- const actions = Array.from(demo.actionReferences)
34
- expect(actions).toEqual(['MyCustomAction', 'MyLegacyCustomAction'])
35
- })
36
- test('it return custom actions referenced in workflow callbacks', () => {
37
- const demo = new ToddleComponent({
38
- component: {
39
- name: 'demo',
40
- apis: {},
41
- attributes: {},
42
- nodes: {},
43
- variables: {},
44
- onLoad: {
45
- trigger: 'onLoad',
46
- actions: [
47
- {
48
- type: 'TriggerWorkflow',
49
- callbacks: {
50
- 'test event': {
51
- actions: [
52
- {
53
- type: 'Custom',
54
- name: 'MyCustomAction',
55
- },
56
- ],
57
- },
58
- },
59
- workflow: 'AsqRCv',
60
- parameters: {},
61
- },
62
- ],
63
- },
64
- },
65
- getComponent: () => undefined,
66
- packageName: 'demo',
67
- globalFormulas: { formulas: {}, packages: {} },
68
- })
69
- const actions = Array.from(demo.actionReferences)
70
- expect(actions).toEqual(['MyCustomAction'])
71
- })
72
- test('it should not include non-custom actions', () => {
73
- const demo = new ToddleComponent({
74
- component: {
75
- name: 'demo',
76
- apis: {},
77
- attributes: {},
78
- nodes: {},
79
- variables: {},
80
- workflows: {
81
- '7XLoA3': {
82
- name: 'my-workflow',
83
- actions: [
84
- {
85
- type: 'SetVariable',
86
- data: {
87
- type: 'value',
88
- value: 'Hello World',
89
- },
90
- variable: 'my-variable',
91
- },
92
- {
93
- type: 'TriggerEvent',
94
- event: 'my-event',
95
- data: {
96
- type: 'value',
97
- value: 'Hello World',
98
- },
99
- },
100
- ],
101
- parameters: [],
102
- },
103
- },
104
- },
105
- getComponent: () => undefined,
106
- packageName: 'demo',
107
- globalFormulas: { formulas: {}, packages: {} },
108
- })
109
- const actions = Array.from(demo.actionReferences)
110
- expect(actions).toEqual([])
111
- })
112
- })