treeloom 0.0.0-stage → 2.0.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/LICENSE +373 -0
- package/README.md +72 -2
- package/browser/treeloom.js +11006 -0
- package/browser/treeloom.min.js +1 -0
- package/browser/treeloomRenderOnly.js +10530 -0
- package/browser/treeloomRenderOnly.min.js +1 -0
- package/dist/deflate/domItemToJson.d.ts +14 -0
- package/dist/deflate/domItemToJson.js +43 -0
- package/dist/deflate/domItemToJson.min.js +1 -0
- package/dist/deflate/index.d.ts +7 -0
- package/dist/deflate/index.js +19 -0
- package/dist/deflate/index.min.js +1 -0
- package/dist/deflate/removeEmptyProperties.d.ts +8 -0
- package/dist/deflate/removeEmptyProperties.js +43 -0
- package/dist/deflate/removeEmptyProperties.min.js +1 -0
- package/dist/diff/createChangeList.d.ts +9 -0
- package/dist/diff/createChangeList.js +44 -0
- package/dist/diff/createChangeList.min.js +1 -0
- package/dist/diff/domItemChanges.d.ts +9 -0
- package/dist/diff/domItemChanges.js +154 -0
- package/dist/diff/domItemChanges.min.js +1 -0
- package/dist/diff/domItemHasAttribute.d.ts +11 -0
- package/dist/diff/domItemHasAttribute.js +63 -0
- package/dist/diff/domItemHasAttribute.min.js +1 -0
- package/dist/diff/elementChanges.d.ts +10 -0
- package/dist/diff/elementChanges.js +151 -0
- package/dist/diff/elementChanges.min.js +1 -0
- package/dist/diff/elementHasAttribute.d.ts +10 -0
- package/dist/diff/elementHasAttribute.js +70 -0
- package/dist/diff/elementHasAttribute.min.js +1 -0
- package/dist/diff/getAssignedStyles.d.ts +9 -0
- package/dist/diff/getAssignedStyles.js +22 -0
- package/dist/diff/getAssignedStyles.min.js +1 -0
- package/dist/diff/index.d.ts +9 -0
- package/dist/diff/index.js +27 -0
- package/dist/diff/index.min.js +1 -0
- package/dist/diff/types.d.ts +17 -0
- package/dist/diff/types.js +8 -0
- package/dist/diff/types.min.js +1 -0
- package/dist/domItem/index.d.ts +34 -0
- package/dist/domItem/index.js +81 -0
- package/dist/domItem/index.min.js +1 -0
- package/dist/domItem/objects/addDomItemProperties.d.ts +7 -0
- package/dist/domItem/objects/addDomItemProperties.js +27 -0
- package/dist/domItem/objects/addDomItemProperties.min.js +1 -0
- package/dist/domItem/objects/createCoreItem.d.ts +9 -0
- package/dist/domItem/objects/createCoreItem.js +53 -0
- package/dist/domItem/objects/createCoreItem.min.js +1 -0
- package/dist/domItem/objects/createDomItem.d.ts +10 -0
- package/dist/domItem/objects/createDomItem.js +40 -0
- package/dist/domItem/objects/createDomItem.min.js +1 -0
- package/dist/domItem/objects/documentDomItem.d.ts +12 -0
- package/dist/domItem/objects/documentDomItem.js +36 -0
- package/dist/domItem/objects/documentDomItem.min.js +1 -0
- package/dist/domItem/objects/documentItem.d.ts +18 -0
- package/dist/domItem/objects/documentItem.js +40 -0
- package/dist/domItem/objects/documentItem.min.js +1 -0
- package/dist/domItem/objects/initChildren.d.ts +6 -0
- package/dist/domItem/objects/initChildren.js +44 -0
- package/dist/domItem/objects/initChildren.min.js +1 -0
- package/dist/domItem/objects/initRoot.d.ts +9 -0
- package/dist/domItem/objects/initRoot.js +32 -0
- package/dist/domItem/objects/initRoot.min.js +1 -0
- package/dist/domItem/query/gatherChildItems.d.ts +12 -0
- package/dist/domItem/query/gatherChildItems.js +19 -0
- package/dist/domItem/query/gatherChildItems.min.js +1 -0
- package/dist/domItem/query/getChildTest.d.ts +8 -0
- package/dist/domItem/query/getChildTest.js +15 -0
- package/dist/domItem/query/getChildTest.min.js +1 -0
- package/dist/domItem/query/getChildrenByClass.d.ts +11 -0
- package/dist/domItem/query/getChildrenByClass.js +26 -0
- package/dist/domItem/query/getChildrenByClass.min.js +1 -0
- package/dist/domItem/query/getChildrenByName.d.ts +9 -0
- package/dist/domItem/query/getChildrenByName.js +23 -0
- package/dist/domItem/query/getChildrenByName.min.js +1 -0
- package/dist/domItem/query/getChildrenFromAttribute.d.ts +13 -0
- package/dist/domItem/query/getChildrenFromAttribute.js +28 -0
- package/dist/domItem/query/getChildrenFromAttribute.min.js +1 -0
- package/dist/domItem/query/getItemByElement.d.ts +11 -0
- package/dist/domItem/query/getItemByElement.js +29 -0
- package/dist/domItem/query/getItemByElement.min.js +1 -0
- package/dist/domItem/query/getParentsByClass.d.ts +12 -0
- package/dist/domItem/query/getParentsByClass.js +40 -0
- package/dist/domItem/query/getParentsByClass.min.js +1 -0
- package/dist/domItem/query/getParentsByName.d.ts +9 -0
- package/dist/domItem/query/getParentsByName.js +23 -0
- package/dist/domItem/query/getParentsByName.min.js +1 -0
- package/dist/domItem/query/getParentsByTagName.d.ts +9 -0
- package/dist/domItem/query/getParentsByTagName.js +23 -0
- package/dist/domItem/query/getParentsByTagName.min.js +1 -0
- package/dist/domItem/query/getParentsFromAttribute.d.ts +13 -0
- package/dist/domItem/query/getParentsFromAttribute.js +39 -0
- package/dist/domItem/query/getParentsFromAttribute.min.js +1 -0
- package/dist/domItem/traits/defineTrait.d.ts +10 -0
- package/dist/domItem/traits/defineTrait.js +26 -0
- package/dist/domItem/traits/defineTrait.min.js +1 -0
- package/dist/domItem/traits/definitions.d.ts +7 -0
- package/dist/domItem/traits/definitions.js +20 -0
- package/dist/domItem/traits/definitions.min.js +1 -0
- package/dist/domItem/traits/getNonSerializableKeys.d.ts +9 -0
- package/dist/domItem/traits/getNonSerializableKeys.js +25 -0
- package/dist/domItem/traits/getNonSerializableKeys.min.js +1 -0
- package/dist/domItem/traits/getTraitDefinition.d.ts +7 -0
- package/dist/domItem/traits/getTraitDefinition.js +20 -0
- package/dist/domItem/traits/getTraitDefinition.min.js +1 -0
- package/dist/domItem/traits/hasTrait.d.ts +8 -0
- package/dist/domItem/traits/hasTrait.js +15 -0
- package/dist/domItem/traits/hasTrait.min.js +1 -0
- package/dist/domItem/traits/hasTraits.d.ts +9 -0
- package/dist/domItem/traits/hasTraits.js +16 -0
- package/dist/domItem/traits/hasTraits.min.js +1 -0
- package/dist/domItem/traits/isDomItem.d.ts +8 -0
- package/dist/domItem/traits/isDomItem.js +21 -0
- package/dist/domItem/traits/isDomItem.min.js +1 -0
- package/dist/domItem/traits/withTrait.d.ts +11 -0
- package/dist/domItem/traits/withTrait.js +30 -0
- package/dist/domItem/traits/withTrait.min.js +1 -0
- package/dist/domItem/tree/appendChild.d.ts +8 -0
- package/dist/domItem/tree/appendChild.js +19 -0
- package/dist/domItem/tree/appendChild.min.js +1 -0
- package/dist/domItem/tree/getItemByPath.d.ts +10 -0
- package/dist/domItem/tree/getItemByPath.js +23 -0
- package/dist/domItem/tree/getItemByPath.min.js +1 -0
- package/dist/domItem/tree/getItemPath.d.ts +9 -0
- package/dist/domItem/tree/getItemPath.js +31 -0
- package/dist/domItem/tree/getItemPath.min.js +1 -0
- package/dist/domItem/tree/getTopParentItem.d.ts +8 -0
- package/dist/domItem/tree/getTopParentItem.js +29 -0
- package/dist/domItem/tree/getTopParentItem.min.js +1 -0
- package/dist/domItem/tree/insertChild.d.ts +11 -0
- package/dist/domItem/tree/insertChild.js +22 -0
- package/dist/domItem/tree/insertChild.min.js +1 -0
- package/dist/domItem/tree/itemIdIndex.d.ts +43 -0
- package/dist/domItem/tree/itemIdIndex.js +118 -0
- package/dist/domItem/tree/itemIdIndex.min.js +1 -0
- package/dist/domItem/tree/removeChild.d.ts +8 -0
- package/dist/domItem/tree/removeChild.js +21 -0
- package/dist/domItem/tree/removeChild.min.js +1 -0
- package/dist/domItem/tree/setParentItemReferences.d.ts +7 -0
- package/dist/domItem/tree/setParentItemReferences.js +24 -0
- package/dist/domItem/tree/setParentItemReferences.min.js +1 -0
- package/dist/domItem/types.d.ts +131 -0
- package/dist/domItem/types.js +8 -0
- package/dist/domItem/types.min.js +1 -0
- package/dist/events/functions/activateListener.d.ts +10 -0
- package/dist/events/functions/activateListener.js +45 -0
- package/dist/events/functions/activateListener.min.js +1 -0
- package/dist/events/functions/addEventListener.d.ts +23 -0
- package/dist/events/functions/addEventListener.js +54 -0
- package/dist/events/functions/addEventListener.min.js +1 -0
- package/dist/events/functions/applyActiveListeners.d.ts +9 -0
- package/dist/events/functions/applyActiveListeners.js +52 -0
- package/dist/events/functions/applyActiveListeners.min.js +1 -0
- package/dist/events/functions/assignListener.d.ts +12 -0
- package/dist/events/functions/assignListener.js +39 -0
- package/dist/events/functions/assignListener.min.js +1 -0
- package/dist/events/functions/bindAllListeners.d.ts +10 -0
- package/dist/events/functions/bindAllListeners.js +28 -0
- package/dist/events/functions/bindAllListeners.min.js +1 -0
- package/dist/events/functions/bindElementListeners.d.ts +7 -0
- package/dist/events/functions/bindElementListeners.js +34 -0
- package/dist/events/functions/bindElementListeners.min.js +1 -0
- package/dist/events/functions/bindListeners.d.ts +9 -0
- package/dist/events/functions/bindListeners.js +23 -0
- package/dist/events/functions/bindListeners.min.js +1 -0
- package/dist/events/functions/deactivateListener.d.ts +13 -0
- package/dist/events/functions/deactivateListener.js +58 -0
- package/dist/events/functions/deactivateListener.min.js +1 -0
- package/dist/events/functions/deactivateListeners.d.ts +7 -0
- package/dist/events/functions/deactivateListeners.js +22 -0
- package/dist/events/functions/deactivateListeners.min.js +1 -0
- package/dist/events/functions/findEventListener.d.ts +22 -0
- package/dist/events/functions/findEventListener.js +61 -0
- package/dist/events/functions/findEventListener.min.js +1 -0
- package/dist/events/functions/fullAddEventListener.d.ts +20 -0
- package/dist/events/functions/fullAddEventListener.js +45 -0
- package/dist/events/functions/fullAddEventListener.min.js +1 -0
- package/dist/events/functions/fullRemoveEventListener.d.ts +22 -0
- package/dist/events/functions/fullRemoveEventListener.js +37 -0
- package/dist/events/functions/fullRemoveEventListener.min.js +1 -0
- package/dist/events/functions/listenerOptions.d.ts +12 -0
- package/dist/events/functions/listenerOptions.js +31 -0
- package/dist/events/functions/listenerOptions.min.js +1 -0
- package/dist/events/functions/makeEventHandler.d.ts +10 -0
- package/dist/events/functions/makeEventHandler.js +23 -0
- package/dist/events/functions/makeEventHandler.min.js +1 -0
- package/dist/events/functions/makeForwardingListener.d.ts +11 -0
- package/dist/events/functions/makeForwardingListener.js +46 -0
- package/dist/events/functions/makeForwardingListener.min.js +1 -0
- package/dist/events/functions/receiveForwardedEvent.d.ts +23 -0
- package/dist/events/functions/receiveForwardedEvent.js +40 -0
- package/dist/events/functions/receiveForwardedEvent.min.js +1 -0
- package/dist/events/functions/registerListener.d.ts +11 -0
- package/dist/events/functions/registerListener.js +25 -0
- package/dist/events/functions/registerListener.min.js +1 -0
- package/dist/events/functions/registerListeners.d.ts +10 -0
- package/dist/events/functions/registerListeners.js +26 -0
- package/dist/events/functions/registerListeners.min.js +1 -0
- package/dist/events/functions/removeEventListener.d.ts +18 -0
- package/dist/events/functions/removeEventListener.js +42 -0
- package/dist/events/functions/removeEventListener.min.js +1 -0
- package/dist/events/functions/retrieveListener.d.ts +14 -0
- package/dist/events/functions/retrieveListener.js +39 -0
- package/dist/events/functions/retrieveListener.min.js +1 -0
- package/dist/events/functions/revokeActiveListeners.d.ts +12 -0
- package/dist/events/functions/revokeActiveListeners.js +54 -0
- package/dist/events/functions/revokeActiveListeners.min.js +1 -0
- package/dist/events/functions/setForwardEvents.d.ts +11 -0
- package/dist/events/functions/setForwardEvents.js +26 -0
- package/dist/events/functions/setForwardEvents.min.js +1 -0
- package/dist/events/functions/unassignListener.d.ts +12 -0
- package/dist/events/functions/unassignListener.js +32 -0
- package/dist/events/functions/unassignListener.min.js +1 -0
- package/dist/events/index.d.ts +37 -0
- package/dist/events/index.js +72 -0
- package/dist/events/index.min.js +1 -0
- package/dist/events/objects/createEventListener.d.ts +13 -0
- package/dist/events/objects/createEventListener.js +30 -0
- package/dist/events/objects/createEventListener.min.js +1 -0
- package/dist/events/objects/createEventProxy.d.ts +10 -0
- package/dist/events/objects/createEventProxy.js +48 -0
- package/dist/events/objects/createEventProxy.min.js +1 -0
- package/dist/events/objects/createEventResponder.d.ts +8 -0
- package/dist/events/objects/createEventResponder.js +27 -0
- package/dist/events/objects/createEventResponder.min.js +1 -0
- package/dist/events/objects/options/getListenerOptions.d.ts +6 -0
- package/dist/events/objects/options/getListenerOptions.js +22 -0
- package/dist/events/objects/options/getListenerOptions.min.js +1 -0
- package/dist/events/objects/options/numberToOptions.d.ts +8 -0
- package/dist/events/objects/options/numberToOptions.js +21 -0
- package/dist/events/objects/options/numberToOptions.min.js +1 -0
- package/dist/events/objects/options/optionsToNumber.d.ts +9 -0
- package/dist/events/objects/options/optionsToNumber.js +27 -0
- package/dist/events/objects/options/optionsToNumber.min.js +1 -0
- package/dist/events/objects/options.d.ts +6 -0
- package/dist/events/objects/options.js +24 -0
- package/dist/events/objects/options.min.js +1 -0
- package/dist/events/types.d.ts +87 -0
- package/dist/events/types.js +8 -0
- package/dist/events/types.min.js +1 -0
- package/dist/inflate/index.d.ts +4 -0
- package/dist/inflate/index.js +17 -0
- package/dist/inflate/index.min.js +1 -0
- package/dist/inflate/jsonToDomItem.d.ts +7 -0
- package/dist/inflate/jsonToDomItem.js +30 -0
- package/dist/inflate/jsonToDomItem.min.js +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +24 -0
- package/dist/main.min.js +1 -0
- package/dist/render/generateElement.d.ts +7 -0
- package/dist/render/generateElement.js +41 -0
- package/dist/render/generateElement.min.js +1 -0
- package/dist/render/index.d.ts +8 -0
- package/dist/render/index.js +25 -0
- package/dist/render/index.min.js +1 -0
- package/dist/render/renderHtml.d.ts +16 -0
- package/dist/render/renderHtml.js +57 -0
- package/dist/render/renderHtml.min.js +1 -0
- package/dist/render/updateChildNodes.d.ts +7 -0
- package/dist/render/updateChildNodes.js +56 -0
- package/dist/render/updateChildNodes.min.js +1 -0
- package/dist/render/updateElement.d.ts +14 -0
- package/dist/render/updateElement.js +110 -0
- package/dist/render/updateElement.min.js +1 -0
- package/dist/render/updateElements.d.ts +9 -0
- package/dist/render/updateElements.js +33 -0
- package/dist/render/updateElements.min.js +1 -0
- package/dist/renderOnly.d.ts +2 -0
- package/dist/renderOnly.js +27 -0
- package/dist/renderOnly.min.js +1 -0
- package/dist/sync/index.d.ts +6 -0
- package/dist/sync/index.js +21 -0
- package/dist/sync/index.min.js +1 -0
- package/dist/sync/updateChildren.d.ts +7 -0
- package/dist/sync/updateChildren.js +38 -0
- package/dist/sync/updateChildren.min.js +1 -0
- package/dist/sync/updateDomItem.d.ts +8 -0
- package/dist/sync/updateDomItem.js +49 -0
- package/dist/sync/updateDomItem.min.js +1 -0
- package/dist/sync/updateDomItems.d.ts +9 -0
- package/dist/sync/updateDomItems.js +33 -0
- package/dist/sync/updateDomItems.min.js +1 -0
- package/package.json +74 -4
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Core Virtual DOM (DomItem tree) management: building items, the traits they carry, and finding and changing
|
|
16
|
+
* items in a tree.
|
|
17
|
+
*/
|
|
18
|
+
const addDomItemProperties_1 = __importDefault(require("./objects/addDomItemProperties"));
|
|
19
|
+
const appendChild_1 = __importDefault(require("./tree/appendChild"));
|
|
20
|
+
const createCoreItem_1 = __importDefault(require("./objects/createCoreItem"));
|
|
21
|
+
const createDomItem_1 = __importDefault(require("./objects/createDomItem"));
|
|
22
|
+
const defineTrait_1 = __importDefault(require("./traits/defineTrait"));
|
|
23
|
+
const documentDomItem_1 = __importDefault(require("./objects/documentDomItem"));
|
|
24
|
+
const documentItem_1 = __importDefault(require("./objects/documentItem"));
|
|
25
|
+
const gatherChildItems_1 = __importDefault(require("./query/gatherChildItems"));
|
|
26
|
+
const getChildrenByClass_1 = __importDefault(require("./query/getChildrenByClass"));
|
|
27
|
+
const getChildrenByName_1 = __importDefault(require("./query/getChildrenByName"));
|
|
28
|
+
const getChildrenFromAttribute_1 = __importDefault(require("./query/getChildrenFromAttribute"));
|
|
29
|
+
const getChildTest_1 = __importDefault(require("./query/getChildTest"));
|
|
30
|
+
const getItemByElement_1 = __importDefault(require("./query/getItemByElement"));
|
|
31
|
+
const itemIdIndex_1 = require("./tree/itemIdIndex");
|
|
32
|
+
const getItemByPath_1 = __importDefault(require("./tree/getItemByPath"));
|
|
33
|
+
const getItemPath_1 = __importDefault(require("./tree/getItemPath"));
|
|
34
|
+
const getParentsByClass_1 = __importDefault(require("./query/getParentsByClass"));
|
|
35
|
+
const getParentsByName_1 = __importDefault(require("./query/getParentsByName"));
|
|
36
|
+
const getParentsByTagName_1 = __importDefault(require("./query/getParentsByTagName"));
|
|
37
|
+
const getParentsFromAttribute_1 = __importDefault(require("./query/getParentsFromAttribute"));
|
|
38
|
+
const getTopParentItem_1 = __importDefault(require("./tree/getTopParentItem"));
|
|
39
|
+
const getTraitDefinition_1 = __importDefault(require("./traits/getTraitDefinition"));
|
|
40
|
+
const hasTrait_1 = __importDefault(require("./traits/hasTrait"));
|
|
41
|
+
const hasTraits_1 = __importDefault(require("./traits/hasTraits"));
|
|
42
|
+
const initChildren_1 = __importDefault(require("./objects/initChildren"));
|
|
43
|
+
const initRoot_1 = __importDefault(require("./objects/initRoot"));
|
|
44
|
+
const insertChild_1 = __importDefault(require("./tree/insertChild"));
|
|
45
|
+
const isDomItem_1 = __importDefault(require("./traits/isDomItem"));
|
|
46
|
+
const removeChild_1 = __importDefault(require("./tree/removeChild"));
|
|
47
|
+
const setParentItemReferences_1 = __importDefault(require("./tree/setParentItemReferences"));
|
|
48
|
+
const withTrait_1 = __importDefault(require("./traits/withTrait"));
|
|
49
|
+
exports.default = {
|
|
50
|
+
addDomItemProperties: addDomItemProperties_1.default,
|
|
51
|
+
appendChild: appendChild_1.default,
|
|
52
|
+
createCoreItem: createCoreItem_1.default,
|
|
53
|
+
createDomItem: createDomItem_1.default,
|
|
54
|
+
defineTrait: defineTrait_1.default,
|
|
55
|
+
documentDomItem: documentDomItem_1.default,
|
|
56
|
+
getDocumentItem: documentItem_1.default,
|
|
57
|
+
gatherChildItems: gatherChildItems_1.default,
|
|
58
|
+
getChildrenByClass: getChildrenByClass_1.default,
|
|
59
|
+
getChildrenByName: getChildrenByName_1.default,
|
|
60
|
+
getChildrenFromAttribute: getChildrenFromAttribute_1.default,
|
|
61
|
+
getChildTest: getChildTest_1.default,
|
|
62
|
+
getItemByElement: getItemByElement_1.default,
|
|
63
|
+
getItemById: itemIdIndex_1.getItemById,
|
|
64
|
+
getItemByPath: getItemByPath_1.default,
|
|
65
|
+
getItemPath: getItemPath_1.default,
|
|
66
|
+
getParentsByClass: getParentsByClass_1.default,
|
|
67
|
+
getParentsByName: getParentsByName_1.default,
|
|
68
|
+
getParentsByTagName: getParentsByTagName_1.default,
|
|
69
|
+
getParentsFromAttribute: getParentsFromAttribute_1.default,
|
|
70
|
+
getTopParentItem: getTopParentItem_1.default,
|
|
71
|
+
getTraitDefinition: getTraitDefinition_1.default,
|
|
72
|
+
hasTrait: hasTrait_1.default,
|
|
73
|
+
hasTraits: hasTraits_1.default,
|
|
74
|
+
initChildren: initChildren_1.default,
|
|
75
|
+
initRoot: initRoot_1.default,
|
|
76
|
+
insertChild: insertChild_1.default,
|
|
77
|
+
isDomItem: isDomItem_1.default,
|
|
78
|
+
removeChild: removeChild_1.default,
|
|
79
|
+
setParentItemReferences: setParentItemReferences_1.default,
|
|
80
|
+
withTrait: withTrait_1.default
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const addDomItemProperties_1=__importDefault(require("./objects/addDomItemProperties")),appendChild_1=__importDefault(require("./tree/appendChild")),createCoreItem_1=__importDefault(require("./objects/createCoreItem")),createDomItem_1=__importDefault(require("./objects/createDomItem")),defineTrait_1=__importDefault(require("./traits/defineTrait")),documentDomItem_1=__importDefault(require("./objects/documentDomItem")),documentItem_1=__importDefault(require("./objects/documentItem")),gatherChildItems_1=__importDefault(require("./query/gatherChildItems")),getChildrenByClass_1=__importDefault(require("./query/getChildrenByClass")),getChildrenByName_1=__importDefault(require("./query/getChildrenByName")),getChildrenFromAttribute_1=__importDefault(require("./query/getChildrenFromAttribute")),getChildTest_1=__importDefault(require("./query/getChildTest")),getItemByElement_1=__importDefault(require("./query/getItemByElement")),itemIdIndex_1=require("./tree/itemIdIndex"),getItemByPath_1=__importDefault(require("./tree/getItemByPath")),getItemPath_1=__importDefault(require("./tree/getItemPath")),getParentsByClass_1=__importDefault(require("./query/getParentsByClass")),getParentsByName_1=__importDefault(require("./query/getParentsByName")),getParentsByTagName_1=__importDefault(require("./query/getParentsByTagName")),getParentsFromAttribute_1=__importDefault(require("./query/getParentsFromAttribute")),getTopParentItem_1=__importDefault(require("./tree/getTopParentItem")),getTraitDefinition_1=__importDefault(require("./traits/getTraitDefinition")),hasTrait_1=__importDefault(require("./traits/hasTrait")),hasTraits_1=__importDefault(require("./traits/hasTraits")),initChildren_1=__importDefault(require("./objects/initChildren")),initRoot_1=__importDefault(require("./objects/initRoot")),insertChild_1=__importDefault(require("./tree/insertChild")),isDomItem_1=__importDefault(require("./traits/isDomItem")),removeChild_1=__importDefault(require("./tree/removeChild")),setParentItemReferences_1=__importDefault(require("./tree/setParentItemReferences")),withTrait_1=__importDefault(require("./traits/withTrait"));exports.default={addDomItemProperties:addDomItemProperties_1.default,appendChild:appendChild_1.default,createCoreItem:createCoreItem_1.default,createDomItem:createDomItem_1.default,defineTrait:defineTrait_1.default,documentDomItem:documentDomItem_1.default,getDocumentItem:documentItem_1.default,gatherChildItems:gatherChildItems_1.default,getChildrenByClass:getChildrenByClass_1.default,getChildrenByName:getChildrenByName_1.default,getChildrenFromAttribute:getChildrenFromAttribute_1.default,getChildTest:getChildTest_1.default,getItemByElement:getItemByElement_1.default,getItemById:itemIdIndex_1.getItemById,getItemByPath:getItemByPath_1.default,getItemPath:getItemPath_1.default,getParentsByClass:getParentsByClass_1.default,getParentsByName:getParentsByName_1.default,getParentsByTagName:getParentsByTagName_1.default,getParentsFromAttribute:getParentsFromAttribute_1.default,getTopParentItem:getTopParentItem_1.default,getTraitDefinition:getTraitDefinition_1.default,hasTrait:hasTrait_1.default,hasTraits:hasTraits_1.default,initChildren:initChildren_1.default,initRoot:initRoot_1.default,insertChild:insertChild_1.default,isDomItem:isDomItem_1.default,removeChild:removeChild_1.default,setParentItemReferences:setParentItemReferences_1.default,withTrait:withTrait_1.default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DomItem, DomItemConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Ensure all basic properties of the DomItem are present.
|
|
4
|
+
* @param item - The object that will be formatted as a DomItem.
|
|
5
|
+
*/
|
|
6
|
+
declare const addDomItemProperties: (item: DomItemConfig) => DomItem;
|
|
7
|
+
export default addDomItemProperties;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const createDomItem_1 = __importDefault(require("./createDomItem"));
|
|
15
|
+
/**
|
|
16
|
+
* Ensure all basic properties of the DomItem are present.
|
|
17
|
+
* @param item - The object that will be formatted as a DomItem.
|
|
18
|
+
*/
|
|
19
|
+
const addDomItemProperties = item => {
|
|
20
|
+
if (typeof item.children !== 'undefined') {
|
|
21
|
+
item.children.forEach(child => {
|
|
22
|
+
addDomItemProperties(child);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return (0, createDomItem_1.default)(item);
|
|
26
|
+
};
|
|
27
|
+
exports.default = addDomItemProperties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const createDomItem_1=__importDefault(require("./createDomItem")),addDomItemProperties=e=>(void 0!==e.children&&e.children.forEach(e=>{addDomItemProperties(e)}),(0,createDomItem_1.default)(e));exports.default=addDomItemProperties;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CoreItem, DomItemConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create the generic item, without the render trait. Every property which is not given gets its default. The given
|
|
4
|
+
* object is completed and returned (it is not copied). Children which are plain objects are completed the same way, all
|
|
5
|
+
* the way down; a child which already has a has map is taken to be complete and is left alone.
|
|
6
|
+
* @param item - Item-like object to be formatted as a CoreItem
|
|
7
|
+
*/
|
|
8
|
+
declare const createCoreItem: (item?: DomItemConfig) => CoreItem;
|
|
9
|
+
export default createCoreItem;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const si_funciona_1 = __importDefault(require("si-funciona"));
|
|
15
|
+
const appendChild_1 = __importDefault(require("../tree/appendChild"));
|
|
16
|
+
const removeChild_1 = __importDefault(require("../tree/removeChild"));
|
|
17
|
+
const itemIdIndex_1 = require("../tree/itemIdIndex");
|
|
18
|
+
/**
|
|
19
|
+
* Create the generic item, without the render trait. Every property which is not given gets its default. The given
|
|
20
|
+
* object is completed and returned (it is not copied). Children which are plain objects are completed the same way, all
|
|
21
|
+
* the way down; a child which already has a has map is taken to be complete and is left alone.
|
|
22
|
+
* @param item - Item-like object to be formatted as a CoreItem
|
|
23
|
+
*/
|
|
24
|
+
const createCoreItem = (item = {}) => {
|
|
25
|
+
if (Array.isArray(item.children)) {
|
|
26
|
+
item.children.forEach(child => {
|
|
27
|
+
if (typeof child === 'object' && child !== null && !child.has) {
|
|
28
|
+
createCoreItem(child);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const newItem = si_funciona_1.default.reduceObject({
|
|
33
|
+
attributes: {},
|
|
34
|
+
children: [],
|
|
35
|
+
eventListeners: {},
|
|
36
|
+
has: {},
|
|
37
|
+
id: (0, itemIdIndex_1.generateItemId)(),
|
|
38
|
+
jsonExclusions: [],
|
|
39
|
+
nodeName: 'div',
|
|
40
|
+
nodeValue: null,
|
|
41
|
+
parentItem: null
|
|
42
|
+
}, (coreItem, defaultValue, prop) => {
|
|
43
|
+
if (!(prop in coreItem)) {
|
|
44
|
+
coreItem[prop] = defaultValue;
|
|
45
|
+
return coreItem;
|
|
46
|
+
}
|
|
47
|
+
return coreItem;
|
|
48
|
+
}, item);
|
|
49
|
+
newItem.appendChild = si_funciona_1.default.curry(appendChild_1.default)(newItem);
|
|
50
|
+
newItem.removeChild = si_funciona_1.default.curry(removeChild_1.default)(newItem);
|
|
51
|
+
return newItem;
|
|
52
|
+
};
|
|
53
|
+
exports.default = createCoreItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const si_funciona_1=__importDefault(require("si-funciona")),appendChild_1=__importDefault(require("../tree/appendChild")),removeChild_1=__importDefault(require("../tree/removeChild")),itemIdIndex_1=require("../tree/itemIdIndex"),createCoreItem=(e={})=>{Array.isArray(e.children)&&e.children.forEach(e=>{"object"!=typeof e||null===e||e.has||createCoreItem(e)});const r=si_funciona_1.default.reduceObject({attributes:{},children:[],eventListeners:{},has:{},id:(0,itemIdIndex_1.generateItemId)(),jsonExclusions:[],nodeName:"div",nodeValue:null,parentItem:null},(e,r,t)=>(t in e||(e[t]=r),e),e);return r.appendChild=si_funciona_1.default.curry(appendChild_1.default)(r),r.removeChild=si_funciona_1.default.curry(removeChild_1.default)(r),r};exports.default=createCoreItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DomItem, DomItemConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* This is the basic Object for representing a node in treeloom's Virtual DOM (DomItem tree): a generic item (see
|
|
4
|
+
* {@link createCoreItem}) with the render trait. All incoming attributes will be merged to the specified format, and the
|
|
5
|
+
* given object is completed and returned (it is not copied). Children which are plain objects are completed the same way,
|
|
6
|
+
* all the way down; a child which already has a has map is already an item, and is left alone.
|
|
7
|
+
* @param item - DomItem-like object to be formatted as DomItem
|
|
8
|
+
*/
|
|
9
|
+
declare const createDomItem: (item?: DomItemConfig) => DomItem;
|
|
10
|
+
export default createDomItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const createCoreItem_1 = __importDefault(require("./createCoreItem"));
|
|
15
|
+
const withTrait_1 = __importDefault(require("../traits/withTrait"));
|
|
16
|
+
/**
|
|
17
|
+
* A plain child is an object which is not an item yet (an item always has a has map).
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
const isPlainChild = child => typeof child === 'object' && child !== null && !child.has;
|
|
21
|
+
/**
|
|
22
|
+
* This is the basic Object for representing a node in treeloom's Virtual DOM (DomItem tree): a generic item (see
|
|
23
|
+
* {@link createCoreItem}) with the render trait. All incoming attributes will be merged to the specified format, and the
|
|
24
|
+
* given object is completed and returned (it is not copied). Children which are plain objects are completed the same way,
|
|
25
|
+
* all the way down; a child which already has a has map is already an item, and is left alone.
|
|
26
|
+
* @param item - DomItem-like object to be formatted as DomItem
|
|
27
|
+
*/
|
|
28
|
+
const createDomItem = (item = {}) => {
|
|
29
|
+
if (Array.isArray(item.children)) {
|
|
30
|
+
item.children.forEach(child => {
|
|
31
|
+
if (isPlainChild(child)) {
|
|
32
|
+
createDomItem(child);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return (0, withTrait_1.default)((0, createCoreItem_1.default)(item), 'render', {
|
|
37
|
+
element: item.element ?? null
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.default = createDomItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const createCoreItem_1=__importDefault(require("./createCoreItem")),withTrait_1=__importDefault(require("../traits/withTrait")),isPlainChild=e=>"object"==typeof e&&null!==e&&!e.has,createDomItem=(e={})=>(Array.isArray(e.children)&&e.children.forEach(e=>{isPlainChild(e)&&createDomItem(e)}),(0,withTrait_1.default)((0,createCoreItem_1.default)(e),"render",{element:e.element??null}));exports.default=createDomItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DomItemRoot } from '../types';
|
|
2
|
+
import type { ListenerFunction } from '../../events/types';
|
|
3
|
+
/**
|
|
4
|
+
* Return the root DomItem of a Virtual DOM (DomItem tree) for the document. The rootItem argument is a system
|
|
5
|
+
* variable and not necessary to implement.
|
|
6
|
+
* @param listeners - An object of all event
|
|
7
|
+
* listeners to be registered in the Dom
|
|
8
|
+
* @param rootItem - This is a
|
|
9
|
+
* reference to DomItemRoot which will be defaulted with {@link initRoot}
|
|
10
|
+
*/
|
|
11
|
+
declare const documentDomItem: (listeners?: Record<string, ListenerFunction>, rootItem?: DomItemRoot) => DomItemRoot;
|
|
12
|
+
export default documentDomItem;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const createDomItem_1 = __importDefault(require("./createDomItem"));
|
|
15
|
+
const initChildren_1 = __importDefault(require("./initChildren"));
|
|
16
|
+
const initRoot_1 = __importDefault(require("./initRoot"));
|
|
17
|
+
const updateDomItems_1 = __importDefault(require("../../sync/updateDomItems"));
|
|
18
|
+
/**
|
|
19
|
+
* Return the root DomItem of a Virtual DOM (DomItem tree) for the document. The rootItem argument is a system
|
|
20
|
+
* variable and not necessary to implement.
|
|
21
|
+
* @param listeners - An object of all event
|
|
22
|
+
* listeners to be registered in the Dom
|
|
23
|
+
* @param rootItem - This is a
|
|
24
|
+
* reference to DomItemRoot which will be defaulted with {@link initRoot}
|
|
25
|
+
*/
|
|
26
|
+
const documentDomItem = (listeners = {}, rootItem = (0, initRoot_1.default)((0, initChildren_1.default)(), listeners)) => {
|
|
27
|
+
rootItem.children = rootItem.children.map(child => (0, createDomItem_1.default)(child));
|
|
28
|
+
rootItem.children.map(child => {
|
|
29
|
+
child.parentItem = rootItem;
|
|
30
|
+
return child;
|
|
31
|
+
});
|
|
32
|
+
rootItem.head = rootItem.children[0];
|
|
33
|
+
rootItem.body = rootItem.children[1];
|
|
34
|
+
return (0, updateDomItems_1.default)((0, createDomItem_1.default)(rootItem));
|
|
35
|
+
};
|
|
36
|
+
exports.default = documentDomItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const createDomItem_1=__importDefault(require("./createDomItem")),initChildren_1=__importDefault(require("./initChildren")),initRoot_1=__importDefault(require("./initRoot")),updateDomItems_1=__importDefault(require("../../sync/updateDomItems")),documentDomItem=(e={},t=(0,initRoot_1.default)((0,initChildren_1.default)(),e))=>(t.children=t.children.map(e=>(0,createDomItem_1.default)(e)),t.children.map(e=>(e.parentItem=t,e)),t.head=t.children[0],t.body=t.children[1],(0,updateDomItems_1.default)((0,createDomItem_1.default)(t)));exports.default=documentDomItem;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DomItemRoot } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The shared root DomItem of the Virtual DOM (DomItem tree) for this environment's real document. It is built on the
|
|
4
|
+
* first call, not when treeloom loads, so treeloom can be required where there is no document (Node, a server) as
|
|
5
|
+
* long as nothing asks for it. Every later call returns the same root.
|
|
6
|
+
* @returns {DomItemRoot}
|
|
7
|
+
*/
|
|
8
|
+
declare const getDocumentItem: () => DomItemRoot;
|
|
9
|
+
/**
|
|
10
|
+
* Add the public `documentItem` property to an API object: a getter, so the root is still only built when it is first
|
|
11
|
+
* read. Added after the API is assembled, since Object.assign would read (and so build) it.
|
|
12
|
+
* @param api The assembled API object
|
|
13
|
+
* @returns {T & { readonly documentItem: DomItemRoot }} The same object
|
|
14
|
+
*/
|
|
15
|
+
export declare const withDocumentItem: <T extends object>(api: T) => T & {
|
|
16
|
+
readonly documentItem: DomItemRoot;
|
|
17
|
+
};
|
|
18
|
+
export default getDocumentItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.withDocumentItem = void 0;
|
|
15
|
+
const documentDomItem_1 = __importDefault(require("./documentDomItem"));
|
|
16
|
+
let existingItem = null;
|
|
17
|
+
/**
|
|
18
|
+
* The shared root DomItem of the Virtual DOM (DomItem tree) for this environment's real document. It is built on the
|
|
19
|
+
* first call, not when treeloom loads, so treeloom can be required where there is no document (Node, a server) as
|
|
20
|
+
* long as nothing asks for it. Every later call returns the same root.
|
|
21
|
+
* @returns {DomItemRoot}
|
|
22
|
+
*/
|
|
23
|
+
const getDocumentItem = () => {
|
|
24
|
+
if (existingItem === null) {
|
|
25
|
+
existingItem = (0, documentDomItem_1.default)();
|
|
26
|
+
}
|
|
27
|
+
return existingItem;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Add the public `documentItem` property to an API object: a getter, so the root is still only built when it is first
|
|
31
|
+
* read. Added after the API is assembled, since Object.assign would read (and so build) it.
|
|
32
|
+
* @param api The assembled API object
|
|
33
|
+
* @returns {T & { readonly documentItem: DomItemRoot }} The same object
|
|
34
|
+
*/
|
|
35
|
+
const withDocumentItem = api => Object.defineProperty(api, 'documentItem', {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: getDocumentItem
|
|
38
|
+
});
|
|
39
|
+
exports.withDocumentItem = withDocumentItem;
|
|
40
|
+
exports.default = getDocumentItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.withDocumentItem=void 0;const documentDomItem_1=__importDefault(require("./documentDomItem"));let existingItem=null;const getDocumentItem=()=>(null===existingItem&&(existingItem=(0,documentDomItem_1.default)()),existingItem),withDocumentItem=e=>Object.defineProperty(e,"documentItem",{enumerable:!0,get:getDocumentItem});exports.withDocumentItem=withDocumentItem,exports.default=getDocumentItem;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const createDomItem_1 = __importDefault(require("./createDomItem"));
|
|
15
|
+
const onBodyLoad_1 = __importDefault(require("si-funciona/dist/helpers/functions/onBodyLoad"));
|
|
16
|
+
/**
|
|
17
|
+
* Initiate the children of Root / DocumentItem. This is a helper for {@link documentDomItem}.
|
|
18
|
+
*/
|
|
19
|
+
const initChildren = () => {
|
|
20
|
+
const head = document.head;
|
|
21
|
+
const body = document.body;
|
|
22
|
+
const children = [(0, createDomItem_1.default)({
|
|
23
|
+
nodeName: 'head',
|
|
24
|
+
attributes: {},
|
|
25
|
+
element: head,
|
|
26
|
+
children: []
|
|
27
|
+
}), (0, createDomItem_1.default)({
|
|
28
|
+
nodeName: 'body',
|
|
29
|
+
attributes: {},
|
|
30
|
+
element: body,
|
|
31
|
+
children: []
|
|
32
|
+
})];
|
|
33
|
+
if (!head || !body) {
|
|
34
|
+
(0, onBodyLoad_1.default)(() => {
|
|
35
|
+
if (children[1].element === null) {
|
|
36
|
+
children[0].element = document.head;
|
|
37
|
+
children[1].element = document.body;
|
|
38
|
+
}
|
|
39
|
+
return children;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return children;
|
|
43
|
+
};
|
|
44
|
+
exports.default = initChildren;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const createDomItem_1=__importDefault(require("./createDomItem")),onBodyLoad_1=__importDefault(require("si-funciona/dist/helpers/functions/onBodyLoad")),initChildren=()=>{const e=document.head,t=document.body,o=[(0,createDomItem_1.default)({nodeName:"head",attributes:{},element:e,children:[]}),(0,createDomItem_1.default)({nodeName:"body",attributes:{},element:t,children:[]})];return e&&t||(0,onBodyLoad_1.default)(()=>(null===o[1].element&&(o[0].element=document.head,o[1].element=document.body),o)),o};exports.default=initChildren;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DomItem, DomItemRoot } from '../types';
|
|
2
|
+
import type { ListenerFunction } from '../../events/types';
|
|
3
|
+
/**
|
|
4
|
+
* Initiate the Root for DocumentItem. This is primary a helper for {@link documentDomItem}.
|
|
5
|
+
* @param children - Provide an array of Head and Body (usually via {@link initChildren})
|
|
6
|
+
* @param listeners - An object of all event listeners to be registered in the Dom
|
|
7
|
+
*/
|
|
8
|
+
declare const initRoot: (children?: DomItem[], listeners?: Record<string, ListenerFunction>) => DomItemRoot;
|
|
9
|
+
export default initRoot;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const createDomItem_1 = __importDefault(require("./createDomItem"));
|
|
15
|
+
/**
|
|
16
|
+
* Initiate the Root for DocumentItem. This is primary a helper for {@link documentDomItem}.
|
|
17
|
+
* @param children - Provide an array of Head and Body (usually via {@link initChildren})
|
|
18
|
+
* @param listeners - An object of all event listeners to be registered in the Dom
|
|
19
|
+
*/
|
|
20
|
+
const initRoot = (children = [{}, {}], listeners = {}) => (0, createDomItem_1.default)({
|
|
21
|
+
nodeName: '#document',
|
|
22
|
+
nodeValue: null,
|
|
23
|
+
attributes: {},
|
|
24
|
+
element: document,
|
|
25
|
+
eventActions: listeners,
|
|
26
|
+
eventListeners: {},
|
|
27
|
+
children,
|
|
28
|
+
parentItem: {},
|
|
29
|
+
head: children[0],
|
|
30
|
+
body: children[1]
|
|
31
|
+
});
|
|
32
|
+
exports.default = initRoot;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const createDomItem_1=__importDefault(require("./createDomItem")),initRoot=(e=[{},{}],t={})=>(0,createDomItem_1.default)({nodeName:"#document",nodeValue:null,attributes:{},element:document,eventActions:t,eventListeners:{},children:e,parentItem:{},head:e[0],body:e[1]});exports.default=initRoot;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChildTest, DomItem } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A selector function for retrieving existing child domGeneral.DomItems from the given parent item.
|
|
4
|
+
* This function will check all the children starting from and including item, and run the test function on each
|
|
5
|
+
* child encountered. The return array contains children returned from the test from all levels.
|
|
6
|
+
* WARNING: This is a recursive function.
|
|
7
|
+
* @param item - The DomItem which may have child items matching the attribute
|
|
8
|
+
* criteria
|
|
9
|
+
* @param test - Assess each child, and return the ones which qualify
|
|
10
|
+
*/
|
|
11
|
+
declare const gatherChildItems: (item: DomItem, test: ChildTest) => DomItem[];
|
|
12
|
+
export default gatherChildItems;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* A selector function for retrieving existing child domGeneral.DomItems from the given parent item.
|
|
11
|
+
* This function will check all the children starting from and including item, and run the test function on each
|
|
12
|
+
* child encountered. The return array contains children returned from the test from all levels.
|
|
13
|
+
* WARNING: This is a recursive function.
|
|
14
|
+
* @param item - The DomItem which may have child items matching the attribute
|
|
15
|
+
* criteria
|
|
16
|
+
* @param test - Assess each child, and return the ones which qualify
|
|
17
|
+
*/
|
|
18
|
+
const gatherChildItems = (item, test) => test(item, item.children.reduce((a, b) => a.concat(gatherChildItems(b, test)), []));
|
|
19
|
+
exports.default = gatherChildItems;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const gatherChildItems=(e,t)=>t(e,e.children.reduce((e,r)=>e.concat(gatherChildItems(r,t)),[]));exports.default=gatherChildItems;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChildTest } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve the {@link module:domGeneral~testChildItem} function by providing an attribute and value to check.
|
|
4
|
+
* @param attr - Provide the attribute name to be searched
|
|
5
|
+
* @param value - The attribute value to be compared
|
|
6
|
+
*/
|
|
7
|
+
declare const getChildTest: (attr: string, value: unknown) => ChildTest;
|
|
8
|
+
export default getChildTest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve the {@link module:domGeneral~testChildItem} function by providing an attribute and value to check.
|
|
11
|
+
* @param attr - Provide the attribute name to be searched
|
|
12
|
+
* @param value - The attribute value to be compared
|
|
13
|
+
*/
|
|
14
|
+
const getChildTest = (attr, value) => (item, gatheredResults) => item.attributes[attr] && item.attributes[attr] === value ? gatheredResults.concat([item]) : gatheredResults;
|
|
15
|
+
exports.default = getChildTest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const getChildTest=(t,e)=>(s,r)=>s.attributes[t]&&s.attributes[t]===e?r.concat([s]):r;exports.default=getChildTest;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DomItem } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper for getting all domGeneral.DomItems starting at item and carrying the given class, among possibly several
|
|
4
|
+
* space-separated classes on that item - the same membership check as the real DOM's classList.contains, not an
|
|
5
|
+
* exact match of the whole className attribute string (which getChildrenFromAttribute does, and which would miss
|
|
6
|
+
* an item that also carries other classes).
|
|
7
|
+
* @param className - The one class being searched for
|
|
8
|
+
* @param item - The DomItem which may have child items carrying the class
|
|
9
|
+
*/
|
|
10
|
+
declare const getChildrenByClass: (className: string, item?: DomItem) => DomItem[];
|
|
11
|
+
export default getChildrenByClass;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
require("core-js/modules/es.array.includes.js");
|
|
7
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
8
|
+
return mod && mod.__esModule ? mod : {
|
|
9
|
+
"default": mod
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
const documentItem_1 = __importDefault(require("../objects/documentItem"));
|
|
16
|
+
const gatherChildItems_1 = __importDefault(require("./gatherChildItems"));
|
|
17
|
+
/**
|
|
18
|
+
* Helper for getting all domGeneral.DomItems starting at item and carrying the given class, among possibly several
|
|
19
|
+
* space-separated classes on that item - the same membership check as the real DOM's classList.contains, not an
|
|
20
|
+
* exact match of the whole className attribute string (which getChildrenFromAttribute does, and which would miss
|
|
21
|
+
* an item that also carries other classes).
|
|
22
|
+
* @param className - The one class being searched for
|
|
23
|
+
* @param item - The DomItem which may have child items carrying the class
|
|
24
|
+
*/
|
|
25
|
+
const getChildrenByClass = (className, item = (0, documentItem_1.default)().body) => (0, gatherChildItems_1.default)(item, (child, gatheredResults) => (child.attributes.className ?? '').split(' ').includes(className) ? gatheredResults.concat([child]) : gatheredResults);
|
|
26
|
+
exports.default = getChildrenByClass;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("core-js/modules/es.array.includes.js");var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const documentItem_1=__importDefault(require("../objects/documentItem")),gatherChildItems_1=__importDefault(require("./gatherChildItems")),getChildrenByClass=(e,t=(0,documentItem_1.default)().body)=>(0,gatherChildItems_1.default)(t,(t,r)=>(t.attributes.className??"").split(" ").includes(e)?r.concat([t]):r);exports.default=getChildrenByClass;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DomItem } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper for getting all domGeneral.DomItems starting at parent and having specified name attribute
|
|
4
|
+
* @param name - The name searched for
|
|
5
|
+
* @param item - The DomItem which may have child items matching the attribute
|
|
6
|
+
* criteria
|
|
7
|
+
*/
|
|
8
|
+
declare const getChildrenByName: (name: string, item?: DomItem) => DomItem[];
|
|
9
|
+
export default getChildrenByName;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
6
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
7
|
+
return mod && mod.__esModule ? mod : {
|
|
8
|
+
"default": mod
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
const si_funciona_1 = __importDefault(require("si-funciona"));
|
|
15
|
+
const getChildrenFromAttribute_1 = __importDefault(require("./getChildrenFromAttribute"));
|
|
16
|
+
/**
|
|
17
|
+
* Helper for getting all domGeneral.DomItems starting at parent and having specified name attribute
|
|
18
|
+
* @param name - The name searched for
|
|
19
|
+
* @param item - The DomItem which may have child items matching the attribute
|
|
20
|
+
* criteria
|
|
21
|
+
*/
|
|
22
|
+
const getChildrenByName = si_funciona_1.default.curry(getChildrenFromAttribute_1.default)('name');
|
|
23
|
+
exports.default = getChildrenByName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const si_funciona_1=__importDefault(require("si-funciona")),getChildrenFromAttribute_1=__importDefault(require("./getChildrenFromAttribute")),getChildrenByName=si_funciona_1.default.curry(getChildrenFromAttribute_1.default)("name");exports.default=getChildrenByName;
|