@nordcraft/core 2.0.6 → 2.0.8
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/api/LegacyToddleApi.d.ts +1 -0
- package/dist/api/LegacyToddleApi.js +3 -0
- package/dist/api/LegacyToddleApi.js.map +1 -1
- package/dist/api/ToddleApiV2.d.ts +2 -1
- package/dist/api/ToddleApiV2.js +3 -0
- package/dist/api/ToddleApiV2.js.map +1 -1
- package/dist/api/api.d.ts +2 -4
- package/dist/api/api.js +1 -42
- package/dist/api/api.js.map +1 -1
- package/dist/api/apiTypes.d.ts +2 -0
- package/dist/api/apiTypes.js.map +1 -1
- package/dist/component/ToddleComponent.d.ts +1 -3
- package/dist/component/ToddleComponent.js +22 -24
- package/dist/component/ToddleComponent.js.map +1 -1
- package/dist/component/component.types.d.ts +3 -1
- package/dist/component/component.types.js.map +1 -1
- package/dist/component/schemas/api-schema.js +5 -0
- package/dist/component/schemas/api-schema.js.map +1 -1
- package/dist/styling/className.d.ts +4 -1
- package/dist/styling/className.js +4 -1
- package/dist/styling/className.js.map +1 -1
- package/dist/styling/style.css.js +4 -1
- package/dist/styling/style.css.js.map +1 -1
- package/package.json +1 -1
- package/src/api/LegacyToddleApi.ts +3 -0
- package/src/api/ToddleApiV2.ts +5 -1
- package/src/api/api.test.ts +47 -0
- package/src/api/api.ts +3 -63
- package/src/api/apiTypes.ts +2 -0
- package/src/component/ToddleComponent.subComponents.test.ts +219 -0
- package/src/component/ToddleComponent.ts +25 -59
- package/src/component/component.types.ts +6 -1
- package/src/component/schemas/api-schema.ts +5 -0
- package/src/styling/className.test.ts +16 -1
- package/src/styling/className.ts +15 -2
- package/src/styling/style.css.ts +6 -4
- package/src/component/ToddleComponent.actionReferences.test.ts +0 -112
package/src/styling/style.css.ts
CHANGED
|
@@ -270,6 +270,9 @@ export const createStylesheet = (
|
|
|
270
270
|
return
|
|
271
271
|
}
|
|
272
272
|
Object.entries(component.nodes).forEach(([id, node]) => {
|
|
273
|
+
if (!isDefined(node)) {
|
|
274
|
+
return
|
|
275
|
+
}
|
|
273
276
|
if (node.type === 'component') {
|
|
274
277
|
const childComponent = components.find(
|
|
275
278
|
(c) =>
|
|
@@ -281,11 +284,10 @@ export const createStylesheet = (
|
|
|
281
284
|
if (childComponent) {
|
|
282
285
|
insertComponentStyles(childComponent, node.package ?? package_name)
|
|
283
286
|
stylesheet += getNodeStyles(
|
|
284
|
-
node
|
|
287
|
+
node,
|
|
285
288
|
toValidClassName(`${component.name}:${id}`, true),
|
|
286
289
|
animationHashes,
|
|
287
290
|
)
|
|
288
|
-
|
|
289
291
|
return
|
|
290
292
|
}
|
|
291
293
|
}
|
|
@@ -297,7 +299,7 @@ export const createStylesheet = (
|
|
|
297
299
|
return ''
|
|
298
300
|
}
|
|
299
301
|
hashes.add(classHash)
|
|
300
|
-
stylesheet += getNodeStyles(node
|
|
302
|
+
stylesheet += getNodeStyles(node, classHash, animationHashes)
|
|
301
303
|
})
|
|
302
304
|
}
|
|
303
305
|
insertComponentStyles(root)
|
|
@@ -310,7 +312,7 @@ export const getAllFonts = (components: Component[]) => {
|
|
|
310
312
|
components
|
|
311
313
|
.flatMap((component) => {
|
|
312
314
|
return Object.values(component.nodes ?? {}).flatMap((node) => {
|
|
313
|
-
if (node
|
|
315
|
+
if (node?.type === 'element') {
|
|
314
316
|
return [
|
|
315
317
|
node.style?.fontFamily,
|
|
316
318
|
node.style?.['font-family'],
|
|
@@ -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
|
-
})
|