@furystack/shades 6.0.4 → 6.0.7
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/component-factory.spec.js +8 -8
- package/dist/component-factory.spec.js.map +1 -1
- package/dist/components/index.js +17 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/lazy-load.spec.js +2 -4
- package/dist/components/lazy-load.spec.js.map +1 -1
- package/dist/components/route-link.spec.js +1 -2
- package/dist/components/route-link.spec.js.map +1 -1
- package/dist/components/router.js +8 -7
- package/dist/components/router.js.map +1 -1
- package/dist/components/router.spec.js +2 -2
- package/dist/components/router.spec.js.map +1 -1
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/jsx.js +0 -6
- package/dist/jsx.js.map +1 -1
- package/dist/models/index.js +19 -6
- package/dist/models/index.js.map +1 -1
- package/dist/services/index.js +16 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/location-service.js +11 -3
- package/dist/services/location-service.js.map +1 -1
- package/dist/services/screen-service.js +12 -4
- package/dist/services/screen-service.js.map +1 -1
- package/dist/shade-component.js +4 -4
- package/dist/shade-component.js.map +1 -1
- package/dist/shade.js +37 -35
- package/dist/shade.js.map +1 -1
- package/dist/shades.integration.spec.js +129 -6
- package/dist/shades.integration.spec.js.map +1 -1
- package/package.json +7 -8
- package/src/component-factory.spec.tsx +8 -8
- package/src/jsx.ts +3 -9
- package/src/models/partial-element.ts +5 -3
- package/src/models/render-options.ts +1 -1
- package/src/shade-component.ts +5 -5
- package/src/shade.ts +61 -41
- package/src/shades.integration.spec.tsx +188 -5
- package/types/components/route-link.d.ts +3 -1
- package/types/components/route-link.d.ts.map +1 -1
- package/types/jsx.d.ts +3 -5
- package/types/jsx.d.ts.map +1 -1
- package/types/models/partial-element.d.ts +3 -3
- package/types/models/partial-element.d.ts.map +1 -1
- package/types/models/render-options.d.ts +1 -1
- package/types/models/render-options.d.ts.map +1 -1
- package/types/shade-component.d.ts +2 -2
- package/types/shade-component.d.ts.map +1 -1
- package/types/shade.d.ts +8 -2
- package/types/shade.d.ts.map +1 -1
- package/dist/is-jsx-element.spec.js +0 -18
- package/dist/is-jsx-element.spec.js.map +0 -1
- package/src/is-jsx-element.spec.ts +0 -18
- package/types/is-jsx-element.spec.d.ts +0 -2
- package/types/is-jsx-element.spec.d.ts.map +0 -1
package/src/shade.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Disposable
|
|
1
|
+
import { Disposable } from '@furystack/utils'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import { ChildrenList, PartialElement, RenderOptions } from './models'
|
|
4
4
|
|
|
@@ -36,9 +36,15 @@ export type ShadeOptions<TProps, TState> = {
|
|
|
36
36
|
resources?: (options: RenderOptions<TProps, TState>) => Disposable[]
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* An optional method that checks the state for changes and returns true if the element should be rerendered.
|
|
39
|
+
* An optional method that checks the state for changes and returns true if the element should be rerendered. This will not be called if `skipRender` is set to true in the relevant `updateState()` call.
|
|
40
40
|
*/
|
|
41
|
-
compareState?: (
|
|
41
|
+
compareState?: (options: {
|
|
42
|
+
oldState: TState
|
|
43
|
+
newState: TState
|
|
44
|
+
props: TProps
|
|
45
|
+
element: HTMLElement
|
|
46
|
+
injector: Injector
|
|
47
|
+
}) => boolean
|
|
42
48
|
} & (unknown extends TState
|
|
43
49
|
? {}
|
|
44
50
|
: {
|
|
@@ -65,9 +71,9 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
65
71
|
class extends HTMLElement implements JSX.Element {
|
|
66
72
|
private compareState =
|
|
67
73
|
o.compareState ||
|
|
68
|
-
((oldState: TState
|
|
69
|
-
Object.entries(oldState).some(([key, value]) => value !== newState[key as keyof TState]) ||
|
|
70
|
-
Object.entries(newState).some(([key, value]) => value !== oldState[key as keyof TState]))
|
|
74
|
+
(({ oldState, newState }: { oldState: TState; newState: TState }) =>
|
|
75
|
+
Object.entries(oldState as object).some(([key, value]) => value !== newState[key as keyof TState]) ||
|
|
76
|
+
Object.entries(newState as object).some(([key, value]) => value !== oldState[key as keyof TState]))
|
|
71
77
|
|
|
72
78
|
public connectedCallback() {
|
|
73
79
|
o.onAttach && o.onAttach(this.getRenderOptions())
|
|
@@ -78,25 +84,22 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
78
84
|
o.onDetach && o.onDetach(this.getRenderOptions())
|
|
79
85
|
Object.values(this.resources).forEach((s) => s.dispose())
|
|
80
86
|
this.cleanup && this.cleanup()
|
|
81
|
-
this.shadeChildren.dispose()
|
|
82
|
-
this.props.dispose()
|
|
83
|
-
this.state.dispose()
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
/**
|
|
87
90
|
* Will be triggered when updating the external props object
|
|
88
91
|
*/
|
|
89
|
-
public props:
|
|
92
|
+
public props: TProps & { children?: JSX.Element[] }
|
|
90
93
|
|
|
91
94
|
/**
|
|
92
95
|
* Will be triggered on state update
|
|
93
96
|
*/
|
|
94
|
-
public state
|
|
97
|
+
public state!: TState
|
|
95
98
|
|
|
96
99
|
/**
|
|
97
100
|
* Will be updated when on children change
|
|
98
101
|
*/
|
|
99
|
-
public shadeChildren
|
|
102
|
+
public shadeChildren?: ChildrenList
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
105
|
* @param options Options for rendering the component
|
|
@@ -107,26 +110,44 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
107
110
|
/**
|
|
108
111
|
* @returns values for the current render options
|
|
109
112
|
*/
|
|
110
|
-
private getRenderOptions = () => {
|
|
111
|
-
const props = this.props
|
|
112
|
-
const getState = () => this.state
|
|
113
|
+
private getRenderOptions = (): RenderOptions<TProps, TState> => {
|
|
114
|
+
const props: TProps = { ...this.props }
|
|
115
|
+
const getState = () => ({ ...this.state })
|
|
113
116
|
const updateState = (stateChanges: PartialElement<TState>, skipRender?: boolean) => {
|
|
114
|
-
const
|
|
115
|
-
const newState = { ...
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
const oldState = { ...this.state }
|
|
118
|
+
const newState = { ...oldState, ...stateChanges }
|
|
119
|
+
|
|
120
|
+
this.state = newState
|
|
121
|
+
|
|
122
|
+
if (
|
|
123
|
+
!skipRender &&
|
|
124
|
+
this.compareState({
|
|
125
|
+
oldState,
|
|
126
|
+
newState,
|
|
127
|
+
props,
|
|
128
|
+
element: this,
|
|
129
|
+
injector: this.injector,
|
|
130
|
+
})
|
|
131
|
+
) {
|
|
132
|
+
this.updateComponent()
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
135
|
|
|
122
|
-
const returnValue
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
const returnValue = {
|
|
137
|
+
...{
|
|
138
|
+
props,
|
|
139
|
+
injector: this.injector,
|
|
140
|
+
|
|
141
|
+
children: this.shadeChildren,
|
|
142
|
+
element: this,
|
|
143
|
+
},
|
|
144
|
+
...((o as any).getInitialState
|
|
145
|
+
? {
|
|
146
|
+
getState,
|
|
147
|
+
updateState,
|
|
148
|
+
}
|
|
149
|
+
: {}),
|
|
150
|
+
} as any as RenderOptions<TProps, TState>
|
|
130
151
|
|
|
131
152
|
return returnValue
|
|
132
153
|
}
|
|
@@ -141,6 +162,10 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
141
162
|
public updateComponent() {
|
|
142
163
|
const renderResult = this.render(this.getRenderOptions())
|
|
143
164
|
|
|
165
|
+
if (renderResult === null) {
|
|
166
|
+
this.innerHTML = ''
|
|
167
|
+
}
|
|
168
|
+
|
|
144
169
|
if (typeof renderResult === 'string') {
|
|
145
170
|
this.innerHTML = renderResult
|
|
146
171
|
}
|
|
@@ -162,12 +187,8 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
162
187
|
* Finialize the component initialization after it gets the Props. Called by the framework internally
|
|
163
188
|
*/
|
|
164
189
|
public callConstructed() {
|
|
165
|
-
if (this.props.isDisposed) {
|
|
166
|
-
return
|
|
167
|
-
}
|
|
168
|
-
|
|
169
190
|
;(o as any).getInitialState &&
|
|
170
|
-
this.state
|
|
191
|
+
(this.state = (o as any).getInitialState({ props: { ...this.props }, injector: this.injector }))
|
|
171
192
|
|
|
172
193
|
this.updateComponent()
|
|
173
194
|
this.createResources()
|
|
@@ -199,12 +220,12 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
199
220
|
return this._injector
|
|
200
221
|
}
|
|
201
222
|
|
|
202
|
-
const fromState = (this.state
|
|
223
|
+
const fromState = (this.state as any)?.injector
|
|
203
224
|
if (fromState && fromState instanceof Injector) {
|
|
204
225
|
return fromState
|
|
205
226
|
}
|
|
206
227
|
|
|
207
|
-
const fromProps = (this.props
|
|
228
|
+
const fromProps = (this.props as any)?.injector
|
|
208
229
|
if (fromProps && fromProps instanceof Injector) {
|
|
209
230
|
return fromProps
|
|
210
231
|
}
|
|
@@ -224,10 +245,9 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
224
245
|
|
|
225
246
|
private resources: Disposable[] = []
|
|
226
247
|
|
|
227
|
-
constructor(_props: TProps) {
|
|
248
|
+
constructor(_props: TProps & { children?: JSX.Element[] }) {
|
|
228
249
|
super()
|
|
229
|
-
this.props =
|
|
230
|
-
this.state = new ObservableValue()
|
|
250
|
+
this.props = _props
|
|
231
251
|
}
|
|
232
252
|
} as any as CustomElementConstructor,
|
|
233
253
|
)
|
|
@@ -237,11 +257,11 @@ export const Shade = <TProps, TState = unknown>(o: ShadeOptions<TProps, TState>)
|
|
|
237
257
|
|
|
238
258
|
return (props: TProps, children: ChildrenList) => {
|
|
239
259
|
const el = document.createElement(customElementName, {
|
|
240
|
-
...props,
|
|
260
|
+
...(props as TProps & ElementCreationOptions),
|
|
241
261
|
}) as JSX.Element<TProps, TState>
|
|
242
|
-
el.props
|
|
262
|
+
el.props = props
|
|
243
263
|
|
|
244
|
-
el.shadeChildren
|
|
264
|
+
el.shadeChildren = children
|
|
245
265
|
return el as JSX.Element
|
|
246
266
|
}
|
|
247
267
|
}
|
|
@@ -7,7 +7,7 @@ global.TextDecoder = TextDecoder as any
|
|
|
7
7
|
|
|
8
8
|
import { initializeShadeRoot } from './initialize'
|
|
9
9
|
import { Shade } from './shade'
|
|
10
|
-
import { createComponent } from './shade-component'
|
|
10
|
+
import { createComponent, createFragment } from './shade-component'
|
|
11
11
|
|
|
12
12
|
describe('Shades integration tests', () => {
|
|
13
13
|
beforeEach(() => (document.body.innerHTML = '<div id="root"></div>'))
|
|
@@ -27,6 +27,115 @@ describe('Shades integration tests', () => {
|
|
|
27
27
|
expect(document.body.innerHTML).toBe('<div id="root"><shades-example><div>Hello</div></shades-example></div>')
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
+
it('Should mount a custom component with a string render result', () => {
|
|
31
|
+
const injector = new Injector()
|
|
32
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
33
|
+
|
|
34
|
+
const ExampleComponent = Shade({ render: () => 'Hello', shadowDomName: 'shades-string-render-result' })
|
|
35
|
+
|
|
36
|
+
initializeShadeRoot({
|
|
37
|
+
injector,
|
|
38
|
+
rootElement,
|
|
39
|
+
jsxElement: <ExampleComponent />,
|
|
40
|
+
})
|
|
41
|
+
expect(document.body.innerHTML).toBe(
|
|
42
|
+
'<div id="root"><shades-string-render-result>Hello</shades-string-render-result></div>',
|
|
43
|
+
)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('Should mount a custom component with null render result', () => {
|
|
47
|
+
const injector = new Injector()
|
|
48
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
49
|
+
|
|
50
|
+
const ExampleComponent = Shade({ render: () => null, shadowDomName: 'shades-null-render-result' })
|
|
51
|
+
|
|
52
|
+
initializeShadeRoot({
|
|
53
|
+
injector,
|
|
54
|
+
rootElement,
|
|
55
|
+
jsxElement: <ExampleComponent />,
|
|
56
|
+
})
|
|
57
|
+
expect(document.body.innerHTML).toBe('<div id="root"><shades-null-render-result></shades-null-render-result></div>')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('Should mount a custom component with a document fragment render result', () => {
|
|
61
|
+
const injector = new Injector()
|
|
62
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
63
|
+
|
|
64
|
+
const ExampleComponent = Shade({
|
|
65
|
+
render: () => (
|
|
66
|
+
<>
|
|
67
|
+
<p>1</p>
|
|
68
|
+
<p>2</p>
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
shadowDomName: 'shades-fragment-render-result',
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
initializeShadeRoot({
|
|
75
|
+
injector,
|
|
76
|
+
rootElement,
|
|
77
|
+
jsxElement: <ExampleComponent />,
|
|
78
|
+
})
|
|
79
|
+
expect(document.body.innerHTML).toBe(
|
|
80
|
+
'<div id="root"><shades-fragment-render-result><p>1</p><p>2</p></shades-fragment-render-result></div>',
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('Should mount a custom component with a nested document fragment render result', () => {
|
|
85
|
+
const injector = new Injector()
|
|
86
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
87
|
+
|
|
88
|
+
const ExampleComponent = Shade({
|
|
89
|
+
render: () => (
|
|
90
|
+
<p>
|
|
91
|
+
<>
|
|
92
|
+
<p>1</p>
|
|
93
|
+
<p>2</p>
|
|
94
|
+
</>
|
|
95
|
+
</p>
|
|
96
|
+
),
|
|
97
|
+
shadowDomName: 'shades-fragment-render-result-nested',
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
initializeShadeRoot({
|
|
101
|
+
injector,
|
|
102
|
+
rootElement,
|
|
103
|
+
jsxElement: <ExampleComponent />,
|
|
104
|
+
})
|
|
105
|
+
expect(document.body.innerHTML).toBe(
|
|
106
|
+
'<div id="root"><shades-fragment-render-result-nested><p><p>1</p><p>2</p></p></shades-fragment-render-result-nested></div>',
|
|
107
|
+
)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('Should mount a custom component with a document fragment that contains custom components', () => {
|
|
111
|
+
const injector = new Injector()
|
|
112
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
113
|
+
|
|
114
|
+
const CustomComponent = Shade({
|
|
115
|
+
shadowDomName: 'shades-fragment-test-custom-component',
|
|
116
|
+
render: () => <p>Hello</p>,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
const ExampleComponent = Shade({
|
|
120
|
+
render: () => (
|
|
121
|
+
<>
|
|
122
|
+
<CustomComponent />
|
|
123
|
+
<CustomComponent />
|
|
124
|
+
</>
|
|
125
|
+
),
|
|
126
|
+
shadowDomName: 'shades-fragment-render-result-2',
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
initializeShadeRoot({
|
|
130
|
+
injector,
|
|
131
|
+
rootElement,
|
|
132
|
+
jsxElement: <ExampleComponent />,
|
|
133
|
+
})
|
|
134
|
+
expect(document.body.innerHTML).toBe(
|
|
135
|
+
'<div id="root"><shades-fragment-render-result-2><shades-fragment-test-custom-component><p>Hello</p></shades-fragment-test-custom-component><shades-fragment-test-custom-component><p>Hello</p></shades-fragment-test-custom-component></shades-fragment-render-result-2></div>',
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
|
|
30
139
|
it('Should mount nested Shades components', () => {
|
|
31
140
|
const injector = new Injector()
|
|
32
141
|
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
@@ -134,15 +243,89 @@ describe('Shades integration tests', () => {
|
|
|
134
243
|
|
|
135
244
|
const plus = () => document.getElementById('plus')?.click()
|
|
136
245
|
const minus = () => document.getElementById('minus')?.click()
|
|
246
|
+
const expectCount = (count: number) => expect(document.body.innerHTML).toContain(`Count is ${count}`)
|
|
137
247
|
|
|
138
|
-
|
|
248
|
+
expectCount(0)
|
|
139
249
|
plus()
|
|
140
|
-
|
|
250
|
+
expectCount(1)
|
|
141
251
|
plus()
|
|
142
|
-
|
|
252
|
+
expectCount(2)
|
|
143
253
|
|
|
144
254
|
minus()
|
|
145
255
|
minus()
|
|
146
|
-
|
|
256
|
+
expectCount(0)
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
it('Should allow children update after unmount and remount', () => {
|
|
260
|
+
const injector = new Injector()
|
|
261
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
262
|
+
const Parent = Shade<unknown, { areChildrenVisible: boolean }>({
|
|
263
|
+
shadowDomName: 'shade-remount-parent',
|
|
264
|
+
getInitialState: () => ({ areChildrenVisible: true }),
|
|
265
|
+
render: ({ children, getState, updateState }) => (
|
|
266
|
+
<div>
|
|
267
|
+
<button
|
|
268
|
+
id="showHideChildren"
|
|
269
|
+
onclick={() => {
|
|
270
|
+
updateState({ areChildrenVisible: !getState().areChildrenVisible })
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
Toggle
|
|
274
|
+
</button>
|
|
275
|
+
{getState().areChildrenVisible ? children : <div />}
|
|
276
|
+
</div>
|
|
277
|
+
),
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
const Child = Shade({
|
|
281
|
+
shadowDomName: 'example-remount-child',
|
|
282
|
+
getInitialState: () => ({ count: 0 }),
|
|
283
|
+
render: ({ getState, updateState }) => {
|
|
284
|
+
const { count } = getState()
|
|
285
|
+
return (
|
|
286
|
+
<div>
|
|
287
|
+
Count is {getState().count.toString()}
|
|
288
|
+
<button id="plus" onclick={() => updateState({ count: count + 1 })}>
|
|
289
|
+
+
|
|
290
|
+
</button>
|
|
291
|
+
<button id="minus" onclick={() => updateState({ count: count - 1 })}>
|
|
292
|
+
-
|
|
293
|
+
</button>
|
|
294
|
+
</div>
|
|
295
|
+
)
|
|
296
|
+
},
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
initializeShadeRoot({
|
|
300
|
+
injector,
|
|
301
|
+
rootElement,
|
|
302
|
+
jsxElement: (
|
|
303
|
+
<Parent>
|
|
304
|
+
<Child />
|
|
305
|
+
</Parent>
|
|
306
|
+
),
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
const plus = () => document.getElementById('plus')?.click()
|
|
310
|
+
const minus = () => document.getElementById('minus')?.click()
|
|
311
|
+
const expectCount = (count: number) => expect(document.body.innerHTML).toContain(`Count is ${count}`)
|
|
312
|
+
const toggleChildren = () => document.getElementById('showHideChildren')?.click()
|
|
313
|
+
|
|
314
|
+
expectCount(0)
|
|
315
|
+
plus()
|
|
316
|
+
expectCount(1)
|
|
317
|
+
|
|
318
|
+
toggleChildren()
|
|
319
|
+
|
|
320
|
+
expect(document.getElementById('plus')).toBeNull()
|
|
321
|
+
|
|
322
|
+
toggleChildren()
|
|
323
|
+
expect(document.getElementById('plus')).toBeDefined()
|
|
324
|
+
|
|
325
|
+
// expectCount(0)
|
|
326
|
+
plus()
|
|
327
|
+
expectCount(1)
|
|
328
|
+
minus()
|
|
329
|
+
expectCount(0)
|
|
147
330
|
})
|
|
148
331
|
})
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PartialElement } from '../models';
|
|
2
2
|
export declare type RouteLinkProps = PartialElement<HTMLAnchorElement>;
|
|
3
|
-
export declare const RouteLink: (props:
|
|
3
|
+
export declare const RouteLink: (props: Omit<Partial<HTMLAnchorElement>, "style"> & {
|
|
4
|
+
style?: Partial<CSSStyleDeclaration> | undefined;
|
|
5
|
+
}, children: import("..").ChildrenList) => JSX.Element<any, any>;
|
|
4
6
|
//# sourceMappingURL=route-link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-link.d.ts","sourceRoot":"","sources":["../../src/components/route-link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAI1C,oBAAY,cAAc,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAA;AAE9D,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"route-link.d.ts","sourceRoot":"","sources":["../../src/components/route-link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAI1C,oBAAY,cAAc,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAA;AAE9D,eAAO,MAAM,SAAS;;gEAgBpB,CAAA"}
|
package/types/jsx.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ObservableValue } from '@furystack/utils';
|
|
2
1
|
import { Injector } from '@furystack/inject';
|
|
3
2
|
import { ChildrenList, PartialElement } from './models';
|
|
4
3
|
declare global {
|
|
5
4
|
export namespace JSX {
|
|
6
5
|
interface Element<TProps = any, TState = any> extends HTMLElement {
|
|
7
6
|
injector: Injector;
|
|
8
|
-
state:
|
|
9
|
-
props:
|
|
7
|
+
state: TState;
|
|
8
|
+
props: TProps;
|
|
10
9
|
updateComponent: () => void;
|
|
11
|
-
shadeChildren
|
|
10
|
+
shadeChildren?: ChildrenList;
|
|
12
11
|
callConstructed: () => void;
|
|
13
12
|
}
|
|
14
13
|
interface IntrinsicElements {
|
|
@@ -524,5 +523,4 @@ declare global {
|
|
|
524
523
|
}
|
|
525
524
|
}
|
|
526
525
|
}
|
|
527
|
-
export declare const isJsxElement: (obj: any) => obj is JSX.Element<any, any>;
|
|
528
526
|
//# sourceMappingURL=jsx.d.ts.map
|
package/types/jsx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,E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C;;;;;eAKG;YACH,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;YAElC;;;;;;;eAOG;YACH,EAAE,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAA;YAC9C;;;;eAIG;YACH,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;YAClC;;eAEG;YACH,IAAI,EAAE,cAAc,CAAC,eAAe,CAAC,CAAA;YACrC;;;eAGG;YACH,EAAE,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAA;YACvC;;;eAGG;YACH,KAAK,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACvC;;eAEG;YACH,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;YAC9B;;;eAGG;YACH,EAAE,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACpC;;eAEG;YACH,GAAG,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;YAChC;;eAEG;YACH,KAAK,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACvC;;;eAGG;YACH,GAAG,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;SACjC;KACF;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare type PartialElement<T extends {
|
|
1
|
+
export declare type PartialElement<T> = T extends {
|
|
2
2
|
style?: CSSStyleDeclaration;
|
|
3
|
-
}
|
|
3
|
+
} ? Omit<Partial<T>, 'style'> & {
|
|
4
4
|
style?: Partial<CSSStyleDeclaration>;
|
|
5
|
-
}
|
|
5
|
+
} : Partial<T>;
|
|
6
6
|
//# sourceMappingURL=partial-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial-element.d.ts","sourceRoot":"","sources":["../../src/models/partial-element.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,CAAC,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"partial-element.d.ts","sourceRoot":"","sources":["../../src/models/partial-element.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAAE,GACrE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CACrC,GACD,OAAO,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { ChildrenList } from './children-list';
|
|
|
4
4
|
export declare type RenderOptions<TProps, TState> = {
|
|
5
5
|
readonly props: TProps;
|
|
6
6
|
injector: Injector;
|
|
7
|
-
children
|
|
7
|
+
children?: ChildrenList;
|
|
8
8
|
element: JSX.Element<TProps, TState>;
|
|
9
9
|
} & (unknown extends TState ? {} : {
|
|
10
10
|
getState: () => TState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-options.d.ts","sourceRoot":"","sources":["../../src/models/render-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,oBAAY,aAAa,CAAC,MAAM,EAAE,MAAM,IAAI;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"render-options.d.ts","sourceRoot":"","sources":["../../src/models/render-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,oBAAY,aAAa,CAAC,MAAM,EAAE,MAAM,IAAI;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC,GAAG,CAAC,OAAO,SAAS,MAAM,GACvB,EAAE,GACF;IACE,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,WAAW,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CAC9E,CAAC,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { ChildrenList, ShadeComponent } from './models';
|
|
|
5
5
|
* @param el the root element
|
|
6
6
|
* @param children array of items to append
|
|
7
7
|
*/
|
|
8
|
-
export declare const appendChild: (el: HTMLElement, children: ChildrenList) => void;
|
|
8
|
+
export declare const appendChild: (el: HTMLElement | DocumentFragment, children: ChildrenList) => void;
|
|
9
9
|
export declare const hasStyle: (props: any) => props is {
|
|
10
10
|
style: Partial<CSSStyleDeclaration>;
|
|
11
11
|
};
|
|
@@ -24,5 +24,5 @@ export declare const attachDataAttributes: (el: HTMLElement, props: any) => void
|
|
|
24
24
|
* @returns the created JSX element
|
|
25
25
|
*/
|
|
26
26
|
export declare const createComponent: <TProps>(elementType: string | ShadeComponent<TProps>, props: TProps, ...children: ChildrenList) => HTMLElement | undefined;
|
|
27
|
-
export declare const createFragment: (_props: any,
|
|
27
|
+
export declare const createFragment: (_props: any, children: ChildrenList) => DocumentFragment;
|
|
28
28
|
//# sourceMappingURL=shade-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shade-component.d.ts","sourceRoot":"","sources":["../src/shade-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAA;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,OAAQ,WAAW,
|
|
1
|
+
{"version":3,"file":"shade-component.d.ts","sourceRoot":"","sources":["../src/shade-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAA;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,OAAQ,WAAW,GAAG,gBAAgB,iCAY7D,CAAA;AAED,eAAO,MAAM,QAAQ,UAAW,GAAG;WAAqB,QAAQ,mBAAmB,CAAC;CAEnF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,OAAQ,WAAW,SAAS,GAAG,SAOvD,CAAA;AAED,eAAO,MAAM,oBAAoB,OAAQ,WAAW,SAAS,GAAG,SAK/D,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,6HAsB3B,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,6CAIzC,CAAA"}
|
package/types/shade.d.ts
CHANGED
|
@@ -27,9 +27,15 @@ export declare type ShadeOptions<TProps, TState> = {
|
|
|
27
27
|
*/
|
|
28
28
|
resources?: (options: RenderOptions<TProps, TState>) => Disposable[];
|
|
29
29
|
/**
|
|
30
|
-
* An optional method that checks the state for changes and returns true if the element should be rerendered.
|
|
30
|
+
* An optional method that checks the state for changes and returns true if the element should be rerendered. This will not be called if `skipRender` is set to true in the relevant `updateState()` call.
|
|
31
31
|
*/
|
|
32
|
-
compareState?: (
|
|
32
|
+
compareState?: (options: {
|
|
33
|
+
oldState: TState;
|
|
34
|
+
newState: TState;
|
|
35
|
+
props: TProps;
|
|
36
|
+
element: HTMLElement;
|
|
37
|
+
injector: Injector;
|
|
38
|
+
}) => boolean;
|
|
33
39
|
} & (unknown extends TState ? {} : {
|
|
34
40
|
/**
|
|
35
41
|
* The initial state of the component
|
package/types/shade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shade.d.ts","sourceRoot":"","sources":["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ACb,OAAO,EAAE,WAAW,CAAA;QACpB,QAAQ,EAAE,QAAQ,CAAA;KACnB,KAAK,OAAO,CAAA;CACd,GAAG,CAAC,OAAO,SAAS,MAAM,GACvB,EAAE,GACF;IACE;;OAEG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAA;CAC5E,CAAC,CAAA;AAEN;;;;;GAKG;AACH,eAAO,MAAM,KAAK,iIA4MjB,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_1 = require("./jsx");
|
|
4
|
-
describe('isJsxElement', () => {
|
|
5
|
-
it('Should return false if element doesnt have state & props', () => {
|
|
6
|
-
expect((0, jsx_1.isJsxElement)({})).toBeFalsy();
|
|
7
|
-
});
|
|
8
|
-
it('Should return false if element doesnt have props', () => {
|
|
9
|
-
expect((0, jsx_1.isJsxElement)({ state: {} })).toBeFalsy();
|
|
10
|
-
});
|
|
11
|
-
it('Should return false if element doesnt have state', () => {
|
|
12
|
-
expect((0, jsx_1.isJsxElement)({ props: {} })).toBeFalsy();
|
|
13
|
-
});
|
|
14
|
-
it('Should return true if element has state & props', () => {
|
|
15
|
-
expect((0, jsx_1.isJsxElement)({ state: {}, props: {} })).toBeTruthy();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=is-jsx-element.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-jsx-element.spec.js","sourceRoot":"","sources":["../src/is-jsx-element.spec.ts"],"names":[],"mappings":";;AAAA,+BAAoC;AAEpC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CAAC,IAAA,kBAAY,EAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;IACtC,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,IAAA,kBAAY,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,IAAA,kBAAY,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,IAAA,kBAAY,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;IAC7D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { isJsxElement } from './jsx'
|
|
2
|
-
|
|
3
|
-
describe('isJsxElement', () => {
|
|
4
|
-
it('Should return false if element doesnt have state & props', () => {
|
|
5
|
-
expect(isJsxElement({})).toBeFalsy()
|
|
6
|
-
})
|
|
7
|
-
it('Should return false if element doesnt have props', () => {
|
|
8
|
-
expect(isJsxElement({ state: {} })).toBeFalsy()
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('Should return false if element doesnt have state', () => {
|
|
12
|
-
expect(isJsxElement({ props: {} })).toBeFalsy()
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('Should return true if element has state & props', () => {
|
|
16
|
-
expect(isJsxElement({ state: {}, props: {} })).toBeTruthy()
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-jsx-element.spec.d.ts","sourceRoot":"","sources":["../src/is-jsx-element.spec.ts"],"names":[],"mappings":""}
|