@nordcraft/runtime 1.0.57 → 1.0.59
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/components/createComponent.js +12 -13
- package/dist/components/createComponent.js.map +1 -1
- package/dist/components/createElement.js +9 -7
- package/dist/components/createElement.js.map +1 -1
- package/dist/components/createNode.js.map +1 -1
- package/dist/custom-element.main.esm.js +27 -27
- package/dist/custom-element.main.esm.js.map +4 -4
- package/dist/editor/input.d.ts +1 -0
- package/dist/editor/input.js +16 -0
- package/dist/editor/input.js.map +1 -0
- package/dist/editor/links.d.ts +6 -0
- package/dist/editor/links.js +15 -0
- package/dist/editor/links.js.map +1 -0
- package/dist/editor/overlay.d.ts +12 -0
- package/dist/editor/overlay.js +20 -0
- package/dist/editor/overlay.js.map +1 -0
- package/dist/editor/types.d.ts +254 -0
- package/dist/editor/types.js +42 -0
- package/dist/editor/types.js.map +1 -0
- package/dist/editor-preview.main.js +147 -198
- package/dist/editor-preview.main.js.map +1 -1
- package/dist/page.main.esm.js +3 -3
- package/dist/page.main.esm.js.map +4 -4
- package/dist/page.main.js +20 -0
- package/dist/page.main.js.map +1 -1
- package/dist/styles/CustomPropertyStyleSheet.test.js +12 -3
- package/dist/styles/CustomPropertyStyleSheet.test.js.map +1 -1
- package/package.json +4 -4
- package/src/components/createComponent.ts +27 -20
- package/src/components/createElement.ts +29 -21
- package/src/components/createNode.ts +0 -1
- package/src/editor/input.ts +17 -0
- package/src/editor/links.ts +16 -0
- package/src/editor/overlay.ts +21 -0
- package/src/editor/types.ts +271 -0
- package/src/editor-preview.main.ts +180 -411
- package/src/page.main.ts +23 -0
- package/src/styles/CustomPropertyStyleSheet.test.ts +12 -3
- package/src/editor/types.d.ts +0 -36
package/src/page.main.ts
CHANGED
|
@@ -175,6 +175,29 @@ export const createRoot = (domNode: HTMLElement) => {
|
|
|
175
175
|
]),
|
|
176
176
|
})
|
|
177
177
|
|
|
178
|
+
const langFormula = component.route?.info?.language?.formula
|
|
179
|
+
const dynamicLang = langFormula && langFormula.type !== 'value'
|
|
180
|
+
if (dynamicLang) {
|
|
181
|
+
dataSignal
|
|
182
|
+
.map<string | null>(() =>
|
|
183
|
+
component
|
|
184
|
+
? applyFormula(langFormula, {
|
|
185
|
+
data: dataSignal.get(),
|
|
186
|
+
component,
|
|
187
|
+
root: document,
|
|
188
|
+
package: undefined,
|
|
189
|
+
toddle: window.toddle,
|
|
190
|
+
env,
|
|
191
|
+
})
|
|
192
|
+
: null,
|
|
193
|
+
)
|
|
194
|
+
.subscribe((newLang) => {
|
|
195
|
+
if (isDefined(newLang) && document.documentElement.lang !== newLang) {
|
|
196
|
+
document.documentElement.setAttribute('lang', newLang)
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
|
|
178
201
|
// Handle dynamic updates of <head> elements (title, og:image etc.)
|
|
179
202
|
const titleFormula = component.route?.info?.title?.formula
|
|
180
203
|
const dynamicTitle = titleFormula && titleFormula.type !== 'value'
|
|
@@ -50,7 +50,10 @@ describe('CustomPropertyStyleSheet', () => {
|
|
|
50
50
|
})('256px')
|
|
51
51
|
expect(instance.getStyleSheet().cssRules.length).toBe(1)
|
|
52
52
|
expect(instance.getStyleSheet().cssRules[0].cssText).toBe(
|
|
53
|
-
|
|
53
|
+
`\
|
|
54
|
+
@media (max-width: 600px) {
|
|
55
|
+
.my-class { --my-property: 256px; }
|
|
56
|
+
}`,
|
|
54
57
|
)
|
|
55
58
|
})
|
|
56
59
|
|
|
@@ -87,7 +90,10 @@ describe('CustomPropertyStyleSheet', () => {
|
|
|
87
90
|
setter('256px')
|
|
88
91
|
expect(instance.getStyleSheet().cssRules.length).toBe(1)
|
|
89
92
|
expect(instance.getStyleSheet().cssRules[0].cssText).toBe(
|
|
90
|
-
|
|
93
|
+
`\
|
|
94
|
+
@media (max-width: 600px) {
|
|
95
|
+
.my-class-with-media { --my-property-with-media: 256px; }
|
|
96
|
+
}`,
|
|
91
97
|
)
|
|
92
98
|
|
|
93
99
|
instance.unregisterProperty(
|
|
@@ -98,7 +104,10 @@ describe('CustomPropertyStyleSheet', () => {
|
|
|
98
104
|
},
|
|
99
105
|
)
|
|
100
106
|
expect(instance.getStyleSheet().cssRules[0].cssText).toBe(
|
|
101
|
-
|
|
107
|
+
`\
|
|
108
|
+
@media (max-width: 600px) {
|
|
109
|
+
.my-class-with-media { }
|
|
110
|
+
}`,
|
|
102
111
|
)
|
|
103
112
|
})
|
|
104
113
|
})
|
package/src/editor/types.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type DragState = {
|
|
2
|
-
/**
|
|
3
|
-
* Dragging elements within the initial container is a reorder operation while dragging elements outside the initial container is an insert operation.
|
|
4
|
-
* While they share some common properties, we need to differentiate between the two to handle them differently.
|
|
5
|
-
*/
|
|
6
|
-
mode: 'reorder' | 'insert'
|
|
7
|
-
elementType: 'element' | 'component' | 'text'
|
|
8
|
-
copy?: HTMLElement
|
|
9
|
-
element: HTMLElement
|
|
10
|
-
repeatedNodes: HTMLElement[]
|
|
11
|
-
offset: Point
|
|
12
|
-
lastCursorPosition: Point
|
|
13
|
-
initialContainer: HTMLElement
|
|
14
|
-
initialNextSibling: Element | null
|
|
15
|
-
initialRect: DOMRect
|
|
16
|
-
reorderPermutations: Array<{
|
|
17
|
-
nextSibling: Node | null
|
|
18
|
-
rect: DOMRect
|
|
19
|
-
}>
|
|
20
|
-
isTransitioning: boolean
|
|
21
|
-
selectedInsertAreaIndex?: number
|
|
22
|
-
insertAreas?: Array<InsertArea>
|
|
23
|
-
destroying: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type InsertArea = {
|
|
27
|
-
layout: 'block' | 'inline'
|
|
28
|
-
parent: Element
|
|
29
|
-
index: number
|
|
30
|
-
center: Point
|
|
31
|
-
size: number
|
|
32
|
-
direction: 1 | -1
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type Point = { x: number; y: number }
|
|
36
|
-
export type Line = { x1: number; y1: number; x2: number; y2: number }
|