arche 0.3.9 → 0.3.10
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/README.md +2 -0
- package/es.js +11 -1
- package/index.js +11 -1
- package/index.mjs +11 -1
- package/package.json +1 -1
- package/test.js +15 -0
package/README.md
CHANGED
|
@@ -94,6 +94,8 @@ import Arche from 'https://unpkg.com/arche/es.js'
|
|
|
94
94
|
|
|
95
95
|
# Syntax
|
|
96
96
|
```coffeescript [specscript]
|
|
97
|
+
Arche() -> DocumentElement
|
|
98
|
+
Arche(document Document) -> DocumentElement
|
|
97
99
|
Arche(React {
|
|
98
100
|
createElement: (type, props?, children?)=>ReactElement,
|
|
99
101
|
}, options? {
|
package/es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.10
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -237,6 +237,14 @@ const creatorCreateElement = function (creator, type, props, children) {
|
|
|
237
237
|
*/
|
|
238
238
|
|
|
239
239
|
const Arche = function (creator, options = {}) {
|
|
240
|
+
if (creator == null && typeof document != 'undefined') {
|
|
241
|
+
creator = document
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (creator == null) {
|
|
245
|
+
throw new TypeError('creator not defined')
|
|
246
|
+
}
|
|
247
|
+
|
|
240
248
|
const {
|
|
241
249
|
styled,
|
|
242
250
|
styledMemoizationCap = 1000,
|
|
@@ -310,6 +318,8 @@ const Arche = function (creator, options = {}) {
|
|
|
310
318
|
: originalRootElement(type)
|
|
311
319
|
)
|
|
312
320
|
|
|
321
|
+
rootElement.creator = creator
|
|
322
|
+
|
|
313
323
|
rootElement.A = rootElement('a')
|
|
314
324
|
rootElement.P = rootElement('p')
|
|
315
325
|
rootElement.B = rootElement('b')
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.10
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -243,6 +243,14 @@ const creatorCreateElement = function (creator, type, props, children) {
|
|
|
243
243
|
*/
|
|
244
244
|
|
|
245
245
|
const Arche = function (creator, options = {}) {
|
|
246
|
+
if (creator == null && typeof document != 'undefined') {
|
|
247
|
+
creator = document
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (creator == null) {
|
|
251
|
+
throw new TypeError('creator not defined')
|
|
252
|
+
}
|
|
253
|
+
|
|
246
254
|
const {
|
|
247
255
|
styled,
|
|
248
256
|
styledMemoizationCap = 1000,
|
|
@@ -316,6 +324,8 @@ const Arche = function (creator, options = {}) {
|
|
|
316
324
|
: originalRootElement(type)
|
|
317
325
|
)
|
|
318
326
|
|
|
327
|
+
rootElement.creator = creator
|
|
328
|
+
|
|
319
329
|
rootElement.A = rootElement('a')
|
|
320
330
|
rootElement.P = rootElement('p')
|
|
321
331
|
rootElement.B = rootElement('b')
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.10
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -237,6 +237,14 @@ const creatorCreateElement = function (creator, type, props, children) {
|
|
|
237
237
|
*/
|
|
238
238
|
|
|
239
239
|
const Arche = function (creator, options = {}) {
|
|
240
|
+
if (creator == null && typeof document != 'undefined') {
|
|
241
|
+
creator = document
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (creator == null) {
|
|
245
|
+
throw new TypeError('creator not defined')
|
|
246
|
+
}
|
|
247
|
+
|
|
240
248
|
const {
|
|
241
249
|
styled,
|
|
242
250
|
styledMemoizationCap = 1000,
|
|
@@ -310,6 +318,8 @@ const Arche = function (creator, options = {}) {
|
|
|
310
318
|
: originalRootElement(type)
|
|
311
319
|
)
|
|
312
320
|
|
|
321
|
+
rootElement.creator = creator
|
|
322
|
+
|
|
313
323
|
rootElement.A = rootElement('a')
|
|
314
324
|
rootElement.P = rootElement('p')
|
|
315
325
|
rootElement.B = rootElement('b')
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -3,6 +3,21 @@ const Arche = require('.')
|
|
|
3
3
|
|
|
4
4
|
describe('Arche', () => {
|
|
5
5
|
describe('unary creator.createElement - document', () => {
|
|
6
|
+
it('init', async () => {
|
|
7
|
+
assert.throws(
|
|
8
|
+
() => {
|
|
9
|
+
const E1 = Arche()
|
|
10
|
+
console.log(E1)
|
|
11
|
+
},
|
|
12
|
+
new TypeError('creator not defined'),
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
globalThis.document = { createElement() {} }
|
|
16
|
+
|
|
17
|
+
const E1 = Arche()
|
|
18
|
+
assert.equal(E1.creator, globalThis.document)
|
|
19
|
+
})
|
|
20
|
+
|
|
6
21
|
const mockEventListeners = new Map()
|
|
7
22
|
const mockDocument = {
|
|
8
23
|
createElement(type) {
|