web-toolkit-x 0.0.1 → 0.70.0
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/AUTHORS +3 -0
- package/LICENSE +1 -1
- package/NOTICE +7 -0
- package/README.md +162 -6
- package/dist/release/index.d.ts +650 -0
- package/dist/release/index.d.ts.map +1 -0
- package/dist/release/index.js +2831 -0
- package/dist/release/index.js.map +1 -0
- package/dist/release/toolkit-0.70.0.js +2834 -0
- package/dist/release/toolkit-0.70.0.js.map +1 -0
- package/package.json +71 -18
- package/src/core/bragi.ts +122 -0
- package/src/core/browser.ts +538 -0
- package/src/core/child-nodes.ts +77 -0
- package/src/core/comment.ts +24 -0
- package/src/core/component.ts +190 -0
- package/src/core/created-roots.ts +38 -0
- package/src/core/custom-element.ts +191 -0
- package/src/core/description.ts +241 -0
- package/src/core/diff.ts +590 -0
- package/src/core/dispatcher.ts +221 -0
- package/src/core/dom.ts +124 -0
- package/src/core/draft.ts +609 -0
- package/src/core/lifecycle.ts +301 -0
- package/src/core/nodes.ts +13 -0
- package/src/core/patch.ts +412 -0
- package/src/core/plugins.ts +231 -0
- package/src/core/reconciler.ts +185 -0
- package/src/core/renderer.ts +75 -0
- package/src/core/runtime.ts +36 -0
- package/src/core/sandbox.ts +128 -0
- package/src/core/service.ts +39 -0
- package/src/core/template.ts +472 -0
- package/src/core/text.ts +24 -0
- package/src/core/toolkit.ts +220 -0
- package/src/core/utils.ts +148 -0
- package/src/core/virtual-dom.ts +118 -0
- package/src/core/virtual-element.ts +72 -0
- package/src/core/virtual-node.ts +87 -0
- package/src/core/web-component.ts +285 -0
- package/src/globals.d.ts +10 -0
- package/src/index.ts +62 -0
- package/src/plugins/logger.ts +38 -0
- package/src/release.ts +3 -0
- package/index.js +0 -1
package/src/globals.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Component, Root, WebComponent } from './core/nodes.js'
|
|
2
|
+
import Service from './core/service.js'
|
|
3
|
+
import Toolkit, { toolkit } from './core/toolkit.js'
|
|
4
|
+
import utils from './core/utils.js'
|
|
5
|
+
|
|
6
|
+
/* The classes and helpers available on the Toolkit instance. */
|
|
7
|
+
type ToolkitClasses = {
|
|
8
|
+
Component: typeof Component
|
|
9
|
+
WebComponent: typeof WebComponent
|
|
10
|
+
Root: typeof Root
|
|
11
|
+
Service: typeof Service
|
|
12
|
+
utils: typeof utils
|
|
13
|
+
noop: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const classes: ToolkitClasses = {
|
|
17
|
+
Component,
|
|
18
|
+
WebComponent,
|
|
19
|
+
Root,
|
|
20
|
+
Service,
|
|
21
|
+
utils,
|
|
22
|
+
noop: () => {},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Object.assign(Toolkit.prototype, classes)
|
|
26
|
+
|
|
27
|
+
export type {
|
|
28
|
+
AttributeValue,
|
|
29
|
+
Child,
|
|
30
|
+
ClassName,
|
|
31
|
+
ComponentTemplate,
|
|
32
|
+
ComponentType,
|
|
33
|
+
ElementProps,
|
|
34
|
+
ElementTemplate,
|
|
35
|
+
EventListenerFor,
|
|
36
|
+
Listener,
|
|
37
|
+
PureComponent,
|
|
38
|
+
RenderResult,
|
|
39
|
+
Style,
|
|
40
|
+
TagName,
|
|
41
|
+
Template,
|
|
42
|
+
} from './core/bragi.js'
|
|
43
|
+
export type { AttributeName, EventName } from './core/browser.js'
|
|
44
|
+
export type { Props } from './core/description.js'
|
|
45
|
+
export type {
|
|
46
|
+
BoundCommands,
|
|
47
|
+
CommandMethod,
|
|
48
|
+
Commands,
|
|
49
|
+
CommandsAPI,
|
|
50
|
+
State,
|
|
51
|
+
} from './core/dispatcher.js'
|
|
52
|
+
export type { ComponentClass, Connectable } from './core/nodes.js'
|
|
53
|
+
export type { PluginManifest, PluginSandbox } from './core/plugins.js'
|
|
54
|
+
export type { Update } from './core/renderer.js'
|
|
55
|
+
export type { Options, Settings } from './core/toolkit.js'
|
|
56
|
+
|
|
57
|
+
export { Component, Root, Service, WebComponent, utils }
|
|
58
|
+
|
|
59
|
+
/* The Toolkit instance, with the classes and helpers assigned above. */
|
|
60
|
+
export type ToolkitAPI = Toolkit & ToolkitClasses
|
|
61
|
+
|
|
62
|
+
export default toolkit as ToolkitAPI
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { WebComponent } from '../core/nodes.js'
|
|
2
|
+
import type { PluginManifest } from '../core/plugins.js'
|
|
3
|
+
import type { Update } from '../core/renderer.js'
|
|
4
|
+
|
|
5
|
+
const RENDER_TIME = 'Render time'
|
|
6
|
+
const title = (update: Update) =>
|
|
7
|
+
`==> ${(update.root.constructor as typeof WebComponent).displayName} <==`
|
|
8
|
+
|
|
9
|
+
/* eslint-disable no-console */
|
|
10
|
+
|
|
11
|
+
const Logger: PluginManifest = {
|
|
12
|
+
name: 'logger',
|
|
13
|
+
permissions: ['listen-for-updates'],
|
|
14
|
+
|
|
15
|
+
onBeforeUpdate(update: Update) {
|
|
16
|
+
console.group(title(update))
|
|
17
|
+
console.log(
|
|
18
|
+
'Commands:',
|
|
19
|
+
update.commands.map(command => command.name),
|
|
20
|
+
)
|
|
21
|
+
console.time(RENDER_TIME)
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
onAfterUpdate(update: Update) {
|
|
25
|
+
if (update.patches!.length) {
|
|
26
|
+
console.log('%cPatches:', 'color: hsl(54, 70%, 45%)', update.patches)
|
|
27
|
+
} else {
|
|
28
|
+
console.log('%c=> No update', 'color: #07a707')
|
|
29
|
+
}
|
|
30
|
+
console.timeEnd(RENDER_TIME)
|
|
31
|
+
console.log('--------------------------------')
|
|
32
|
+
console.groupEnd()
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* eslint-enable no-console */
|
|
37
|
+
|
|
38
|
+
export default Logger
|
package/src/release.ts
ADDED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|