@_unit/unit 1.0.25 → 1.0.26
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/build/web.js +8 -8
- package/lib/API.d.ts +3 -1
- package/lib/client/makeEventListener.js +1 -1
- package/lib/client/platform/web/api/document.js +0 -16
- package/lib/client/platform/web/api/document.js.map +1 -1
- package/lib/client/platform/web/api/theme.d.ts +3 -0
- package/lib/client/platform/web/api/theme.js +26 -0
- package/lib/client/platform/web/api/theme.js.map +1 -0
- package/lib/client/platform/web/boot.js +4 -0
- package/lib/client/platform/web/boot.js.map +1 -1
- package/lib/host/none.js +5 -3
- package/lib/host/none.js.map +1 -1
- package/lib/system/_specs.js +1 -1
- package/lib/system/_specs.js.map +1 -1
- package/lib/system/platform/component/app/GUI/Component.js +1 -1
- package/lib/system/platform/component/app/GUI/Component.js.map +1 -1
- package/lib/system/platform/method/value/Write/index.js.map +1 -1
- package/package.json +1 -1
- package/public/_worker.js +1 -1
- package/public/_worker.js.map +2 -2
- package/public/build.json +1 -1
- package/public/index.js +8 -8
- package/public/index.js.map +4 -4
- package/src/API.ts +3 -1
- package/src/client/makeEventListener.ts +1 -1
- package/src/client/platform/web/api/document.ts +0 -6
- package/src/client/platform/web/api/theme.ts +19 -0
- package/src/client/platform/web/boot.ts +5 -0
- package/src/host/none.ts +5 -3
- package/src/system/platform/component/app/GUI/Component.ts +1 -1
- package/src/system/platform/method/value/Write/index.ts +0 -1
package/src/API.ts
CHANGED
|
@@ -218,7 +218,6 @@ export type API = {
|
|
|
218
218
|
getSelection(): Selection
|
|
219
219
|
createRange(): Range
|
|
220
220
|
exitPictureInPicture(): Promise<void>
|
|
221
|
-
setTheme(theme: Theme): Promise<void>
|
|
222
221
|
MutationObserver: IMutationObserverConstructor
|
|
223
222
|
PositionObserver: IPositionObserverCostructor
|
|
224
223
|
ResizeObserver: IResizeObserverConstructor
|
|
@@ -234,4 +233,7 @@ export type API = {
|
|
|
234
233
|
worker: {
|
|
235
234
|
start(): Worker
|
|
236
235
|
}
|
|
236
|
+
theme: {
|
|
237
|
+
setTheme(theme: Theme): Promise<void>
|
|
238
|
+
}
|
|
237
239
|
}
|
|
@@ -4,7 +4,6 @@ import { PositionObserver } from '../../../PositionObserver'
|
|
|
4
4
|
import { NoopIntersectionObserver } from '../../../noop/IntersectionObserver'
|
|
5
5
|
import { NoopMutationObserver } from '../../../noop/MutationObserver'
|
|
6
6
|
import { NoopResizeObserver } from '../../../noop/ResizeObserver'
|
|
7
|
-
import { Theme, themeBackgroundColor } from '../../../theme'
|
|
8
7
|
|
|
9
8
|
export function webDocument(
|
|
10
9
|
window: Window,
|
|
@@ -58,11 +57,6 @@ export function webDocument(
|
|
|
58
57
|
ResizeObserver: ResizeObserver,
|
|
59
58
|
PositionObserver: PositionObserver,
|
|
60
59
|
IntersectionObserver: IntersectionObserver,
|
|
61
|
-
setTheme: async function (theme: Theme): Promise<void> {
|
|
62
|
-
const color = themeBackgroundColor(theme)
|
|
63
|
-
|
|
64
|
-
document.body.style.backgroundColor = color
|
|
65
|
-
},
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
return _document
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { API } from '../../../../API'
|
|
2
|
+
import { BootOpt } from '../../../../system'
|
|
3
|
+
import { Theme, themeBackgroundColor } from '../../../theme'
|
|
4
|
+
|
|
5
|
+
export function webTheme(
|
|
6
|
+
window: Window,
|
|
7
|
+
root: HTMLElement,
|
|
8
|
+
opt: BootOpt
|
|
9
|
+
): API['theme'] {
|
|
10
|
+
const theme: API['theme'] = {
|
|
11
|
+
setTheme: async function (theme: Theme): Promise<void> {
|
|
12
|
+
const color = themeBackgroundColor(theme)
|
|
13
|
+
|
|
14
|
+
root.style.backgroundColor = color
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return theme
|
|
19
|
+
}
|
|
@@ -37,6 +37,7 @@ import { webSelection } from './api/selection'
|
|
|
37
37
|
import { webSpeech } from './api/speech'
|
|
38
38
|
import { webStorage } from './api/storage'
|
|
39
39
|
import { webText } from './api/text'
|
|
40
|
+
import { webTheme } from './api/theme'
|
|
40
41
|
import { webURI } from './api/uri'
|
|
41
42
|
import { webURL } from './api/url'
|
|
42
43
|
import { webWindow } from './api/window'
|
|
@@ -92,6 +93,7 @@ export function webBoot(
|
|
|
92
93
|
const _window = webWindow(window, opt)
|
|
93
94
|
const navigator = webNavigator(window, opt)
|
|
94
95
|
const layout = webLayout(window, opt)
|
|
96
|
+
const theme = webTheme(window, _root, opt)
|
|
95
97
|
|
|
96
98
|
const api: API = {
|
|
97
99
|
alert,
|
|
@@ -121,6 +123,7 @@ export function webBoot(
|
|
|
121
123
|
uri,
|
|
122
124
|
window: _window,
|
|
123
125
|
navigator,
|
|
126
|
+
theme,
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
const system = boot(null, api, opt)
|
|
@@ -129,6 +132,8 @@ export function webBoot(
|
|
|
129
132
|
|
|
130
133
|
system.root = _root
|
|
131
134
|
|
|
135
|
+
theme.setTheme(system.theme)
|
|
136
|
+
|
|
132
137
|
attachSprite(system)
|
|
133
138
|
attachStyle(system)
|
|
134
139
|
attachApp(system)
|
package/src/host/none.ts
CHANGED
|
@@ -225,9 +225,6 @@ export function noHost(): API {
|
|
|
225
225
|
exitPictureInPicture() {
|
|
226
226
|
throw new MethodNotImplementedError()
|
|
227
227
|
},
|
|
228
|
-
setTheme: function (theme: Theme): Promise<void> {
|
|
229
|
-
throw new MethodNotImplementedError()
|
|
230
|
-
},
|
|
231
228
|
MutationObserver: null,
|
|
232
229
|
PositionObserver: null,
|
|
233
230
|
ResizeObserver: null,
|
|
@@ -317,6 +314,11 @@ export function noHost(): API {
|
|
|
317
314
|
throw new MethodNotImplementedError()
|
|
318
315
|
},
|
|
319
316
|
},
|
|
317
|
+
theme: {
|
|
318
|
+
setTheme: function (theme: Theme): Promise<void> {
|
|
319
|
+
throw new MethodNotImplementedError()
|
|
320
|
+
},
|
|
321
|
+
},
|
|
320
322
|
}
|
|
321
323
|
|
|
322
324
|
return api
|