@tko/binding.core 4.0.0-alpha8.0 → 4.0.0-beta1.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/dist/attr.js +36 -0
- package/dist/attr.js.map +7 -0
- package/dist/checked.js +94 -0
- package/dist/checked.js.map +7 -0
- package/dist/click.js +5 -0
- package/dist/click.js.map +7 -0
- package/dist/css.js +28 -0
- package/dist/css.js.map +7 -0
- package/dist/descendantsComplete.js +14 -0
- package/dist/descendantsComplete.js.map +7 -0
- package/dist/enableDisable.js +21 -0
- package/dist/enableDisable.js.map +7 -0
- package/dist/event.js +75 -0
- package/dist/event.js.map +7 -0
- package/dist/hasfocus.js +48 -0
- package/dist/hasfocus.js.map +7 -0
- package/dist/html.js +15 -0
- package/dist/html.js.map +7 -0
- package/dist/index.cjs +3956 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +50 -0
- package/dist/index.mjs.map +7 -0
- package/dist/let.js +12 -0
- package/dist/let.js.map +7 -0
- package/dist/options.js +130 -0
- package/dist/options.js.map +7 -0
- package/dist/selectedOptions.js +41 -0
- package/dist/selectedOptions.js.map +7 -0
- package/dist/style.js +30 -0
- package/dist/style.js.map +7 -0
- package/dist/submit.js +26 -0
- package/dist/submit.js.map +7 -0
- package/dist/test-helper.js +14 -0
- package/dist/test-helper.js.map +7 -0
- package/dist/text.js +13 -0
- package/dist/text.js.map +7 -0
- package/dist/textInput.js +151 -0
- package/dist/textInput.js.map +7 -0
- package/dist/uniqueName.js +13 -0
- package/dist/uniqueName.js.map +7 -0
- package/dist/using.js +12 -0
- package/dist/using.js.map +7 -0
- package/dist/value.js +103 -0
- package/dist/value.js.map +7 -0
- package/dist/visible.js +20 -0
- package/dist/visible.js.map +7 -0
- package/package.json +18 -28
- package/dist/binding.core.es6.js +0 -1044
- package/dist/binding.core.es6.js.map +0 -1
- package/dist/binding.core.js +0 -1143
- package/dist/binding.core.js.map +0 -1
package/dist/attr.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
setElementName,
|
|
4
|
+
objectForEach
|
|
5
|
+
} from "@tko/utils";
|
|
6
|
+
import {
|
|
7
|
+
unwrap
|
|
8
|
+
} from "@tko/observable";
|
|
9
|
+
export var attr = {
|
|
10
|
+
update: function(element, valueAccessor, allBindings) {
|
|
11
|
+
var value = unwrap(valueAccessor()) || {};
|
|
12
|
+
objectForEach(value, function(attrName, attrValue) {
|
|
13
|
+
attrValue = unwrap(attrValue);
|
|
14
|
+
var prefixLen = attrName.indexOf(":");
|
|
15
|
+
var namespace = prefixLen > 0 && element.lookupNamespaceURI(attrName.substr(0, prefixLen));
|
|
16
|
+
const toRemove = attrValue === false || attrValue === null || attrValue === void 0;
|
|
17
|
+
if (toRemove) {
|
|
18
|
+
if (namespace) {
|
|
19
|
+
element.removeAttributeNS(namespace, attrName);
|
|
20
|
+
} else {
|
|
21
|
+
element.removeAttribute(attrName);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
attrValue = attrValue.toString();
|
|
25
|
+
if (namespace) {
|
|
26
|
+
element.setAttributeNS(namespace, attrName, attrValue);
|
|
27
|
+
} else {
|
|
28
|
+
element.setAttribute(attrName, attrValue);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (attrName === "name") {
|
|
32
|
+
setElementName(element, toRemove ? "" : attrValue);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
package/dist/attr.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/attr.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n setElementName, objectForEach\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var attr = {\n update: function (element, valueAccessor, allBindings) {\n var value = unwrap(valueAccessor()) || {}\n objectForEach(value, function (attrName, attrValue) {\n attrValue = unwrap(attrValue)\n\n // Find the namespace of this attribute, if any.\n var prefixLen = attrName.indexOf(':')\n var namespace = prefixLen > 0 && element.lookupNamespaceURI(attrName.substr(0, prefixLen))\n\n // To cover cases like \"attr: { checked:someProp }\", we want to remove the attribute entirely\n // when someProp is a \"no value\"-like value (strictly null, false, or undefined)\n // (because the absence of the \"checked\" attr is how to mark an element as not checked, etc.)\n const toRemove = attrValue === false || attrValue === null || attrValue === undefined\n\n if (toRemove) {\n if (namespace) {\n element.removeAttributeNS(namespace, attrName)\n } else {\n element.removeAttribute(attrName)\n }\n } else {\n attrValue = attrValue.toString()\n if (namespace) {\n element.setAttributeNS(namespace, attrName, attrValue)\n } else {\n element.setAttribute(attrName, attrValue)\n }\n }\n\n // Treat \"name\" specially - although you can think of it as an attribute, it also needs\n // special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333)\n // Deliberately being case-sensitive here because XHTML would regard \"Name\" as a different thing\n // entirely, and there's no strong reason to allow for such casing in HTML.\n if (attrName === 'name') {\n setElementName(element, toRemove ? '' : attrValue)\n }\n })\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIO,WAAI,OAAO;AAAA,EAChB,QAAQ,SAAU,SAAS,eAAe,aAAa;AACrD,QAAI,QAAQ,OAAO,cAAc,CAAC,KAAK,CAAC;AACxC,kBAAc,OAAO,SAAU,UAAU,WAAW;AAClD,kBAAY,OAAO,SAAS;AAG5B,UAAI,YAAY,SAAS,QAAQ,GAAG;AACpC,UAAI,YAAY,YAAY,KAAK,QAAQ,mBAAmB,SAAS,OAAO,GAAG,SAAS,CAAC;AAKzF,YAAM,WAAW,cAAc,SAAS,cAAc,QAAQ,cAAc;AAE5E,UAAI,UAAU;AACZ,YAAI,WAAW;AACb,kBAAQ,kBAAkB,WAAW,QAAQ;AAAA,QAC/C,OAAO;AACL,kBAAQ,gBAAgB,QAAQ;AAAA,QAClC;AAAA,MACF,OAAO;AACL,oBAAY,UAAU,SAAS;AAC/B,YAAI,WAAW;AACb,kBAAQ,eAAe,WAAW,UAAU,SAAS;AAAA,QACvD,OAAO;AACL,kBAAQ,aAAa,UAAU,SAAS;AAAA,QAC1C;AAAA,MACF;AAMA,UAAI,aAAa,QAAQ;AACvB,uBAAe,SAAS,WAAW,KAAK,SAAS;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/checked.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
registerEventHandler,
|
|
4
|
+
arrayIndexOf,
|
|
5
|
+
addOrRemoveItem
|
|
6
|
+
} from "@tko/utils";
|
|
7
|
+
import {
|
|
8
|
+
unwrap,
|
|
9
|
+
dependencyDetection,
|
|
10
|
+
isWriteableObservable
|
|
11
|
+
} from "@tko/observable";
|
|
12
|
+
import {
|
|
13
|
+
computed,
|
|
14
|
+
pureComputed
|
|
15
|
+
} from "@tko/computed";
|
|
16
|
+
export var checked = {
|
|
17
|
+
after: ["value", "attr"],
|
|
18
|
+
init: function(element, valueAccessor, allBindings) {
|
|
19
|
+
var checkedValue2 = pureComputed(function() {
|
|
20
|
+
if (allBindings.has("checkedValue")) {
|
|
21
|
+
return unwrap(allBindings.get("checkedValue"));
|
|
22
|
+
} else if (useElementValue) {
|
|
23
|
+
if (allBindings.has("value")) {
|
|
24
|
+
return unwrap(allBindings.get("value"));
|
|
25
|
+
} else {
|
|
26
|
+
return element.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function updateModel() {
|
|
31
|
+
var isChecked = element.checked, elemValue = checkedValue2();
|
|
32
|
+
if (dependencyDetection.isInitial()) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!isChecked && (isRadio || dependencyDetection.getDependenciesCount())) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var modelValue = dependencyDetection.ignore(valueAccessor);
|
|
39
|
+
if (valueIsArray) {
|
|
40
|
+
var writableValue = rawValueIsNonArrayObservable ? modelValue.peek() : modelValue, saveOldValue = oldElemValue;
|
|
41
|
+
oldElemValue = elemValue;
|
|
42
|
+
if (saveOldValue !== elemValue) {
|
|
43
|
+
if (isChecked) {
|
|
44
|
+
addOrRemoveItem(writableValue, elemValue, true);
|
|
45
|
+
addOrRemoveItem(writableValue, saveOldValue, false);
|
|
46
|
+
}
|
|
47
|
+
oldElemValue = elemValue;
|
|
48
|
+
} else {
|
|
49
|
+
addOrRemoveItem(writableValue, elemValue, isChecked);
|
|
50
|
+
}
|
|
51
|
+
if (rawValueIsNonArrayObservable && isWriteableObservable(modelValue)) {
|
|
52
|
+
modelValue(writableValue);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
if (isCheckbox) {
|
|
56
|
+
if (elemValue === void 0) {
|
|
57
|
+
elemValue = isChecked;
|
|
58
|
+
} else if (!isChecked) {
|
|
59
|
+
elemValue = void 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
valueAccessor(elemValue, { onlyIfChanged: true });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
;
|
|
66
|
+
function updateView() {
|
|
67
|
+
var modelValue = modelValue = unwrap(valueAccessor());
|
|
68
|
+
var elemValue = checkedValue2();
|
|
69
|
+
if (valueIsArray) {
|
|
70
|
+
element.checked = arrayIndexOf(modelValue, elemValue) >= 0;
|
|
71
|
+
oldElemValue = elemValue;
|
|
72
|
+
} else if (isCheckbox && elemValue === void 0) {
|
|
73
|
+
element.checked = !!modelValue;
|
|
74
|
+
} else {
|
|
75
|
+
element.checked = checkedValue2() === modelValue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
;
|
|
79
|
+
var isCheckbox = element.type == "checkbox", isRadio = element.type == "radio";
|
|
80
|
+
if (!isCheckbox && !isRadio) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var rawValue = valueAccessor(), valueIsArray = isCheckbox && unwrap(rawValue) instanceof Array, rawValueIsNonArrayObservable = !(valueIsArray && rawValue.push && rawValue.splice), useElementValue = isRadio || valueIsArray, oldElemValue = valueIsArray ? checkedValue2() : void 0;
|
|
84
|
+
computed(updateModel, null, { disposeWhenNodeIsRemoved: element });
|
|
85
|
+
registerEventHandler(element, "click", updateModel);
|
|
86
|
+
computed(updateView, null, { disposeWhenNodeIsRemoved: element });
|
|
87
|
+
rawValue = void 0;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
export var checkedValue = {
|
|
91
|
+
update: function(element, valueAccessor) {
|
|
92
|
+
element.value = unwrap(valueAccessor());
|
|
93
|
+
}
|
|
94
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/checked.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n registerEventHandler, arrayIndexOf, addOrRemoveItem\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection, isWriteableObservable\n} from '@tko/observable'\n\nimport {\n computed, pureComputed\n} from '@tko/computed'\n\nexport var checked = {\n after: ['value', 'attr'],\n init: function (element, valueAccessor, allBindings) {\n var checkedValue = pureComputed(function () {\n // Treat \"value\" like \"checkedValue\" when it is included with \"checked\" binding\n if (allBindings.has('checkedValue')) {\n return unwrap(allBindings.get('checkedValue'))\n } else if (useElementValue) {\n if (allBindings.has('value')) {\n return unwrap(allBindings.get('value'))\n } else {\n return element.value\n }\n }\n })\n\n function updateModel () {\n // This updates the model value from the view value.\n // It runs in response to DOM events (click) and changes in checkedValue.\n var isChecked = element.checked,\n elemValue = checkedValue()\n\n // When we're first setting up this computed, don't change any model state.\n if (dependencyDetection.isInitial()) {\n return\n }\n\n // We can ignore unchecked radio buttons, because some other radio\n // button will be checked, and that one can take care of updating state.\n // button will be checked, and that one can take care of updating state\n if (!isChecked && (isRadio || dependencyDetection.getDependenciesCount())) {\n return\n }\n\n var modelValue = dependencyDetection.ignore(valueAccessor)\n if (valueIsArray) {\n var writableValue = rawValueIsNonArrayObservable ? modelValue.peek() : modelValue,\n saveOldValue = oldElemValue\n oldElemValue = elemValue\n\n if (saveOldValue !== elemValue) {\n // When we're responding to the checkedValue changing, and the element is\n // currently checked, replace the old elem value with the new elem value\n // in the model array.\n if (isChecked) {\n addOrRemoveItem(writableValue, elemValue, true)\n addOrRemoveItem(writableValue, saveOldValue, false)\n }\n\n oldElemValue = elemValue\n } else {\n // When we're responding to the user having checked/unchecked a checkbox,\n // add/remove the element value to the model array.\n addOrRemoveItem(writableValue, elemValue, isChecked)\n }\n if (rawValueIsNonArrayObservable && isWriteableObservable(modelValue)) {\n modelValue(writableValue)\n }\n } else {\n if (isCheckbox) {\n if (elemValue === undefined) {\n elemValue = isChecked\n } else if (!isChecked) {\n elemValue = undefined\n }\n }\n valueAccessor(elemValue, {onlyIfChanged: true})\n }\n };\n\n function updateView () {\n // This updates the view value from the model value.\n // It runs in response to changes in the bound (checked) value.\n var modelValue = modelValue = unwrap(valueAccessor())\n var elemValue = checkedValue()\n\n if (valueIsArray) {\n // When a checkbox is bound to an array, being checked represents its value being present in that array\n element.checked = arrayIndexOf(modelValue, elemValue) >= 0\n oldElemValue = elemValue\n } else if (isCheckbox && elemValue === undefined) {\n // When a checkbox is bound to any other value (not an array) and \"checkedValue\" is not defined,\n // being checked represents the value being trueish\n element.checked = !!modelValue\n } else {\n // Otherwise, being checked means that the checkbox or radio button's value corresponds to the model value\n element.checked = (checkedValue() === modelValue)\n }\n };\n\n var isCheckbox = element.type == 'checkbox',\n isRadio = element.type == 'radio'\n\n // Only bind to check boxes and radio buttons\n if (!isCheckbox && !isRadio) {\n return\n }\n\n var rawValue = valueAccessor(),\n valueIsArray = isCheckbox && (unwrap(rawValue) instanceof Array),\n rawValueIsNonArrayObservable = !(valueIsArray && rawValue.push && rawValue.splice),\n useElementValue = isRadio || valueIsArray,\n oldElemValue = valueIsArray ? checkedValue() : undefined\n\n // Set up two computeds to update the binding:\n\n // The first responds to changes in the checkedValue value and to element clicks\n computed(updateModel, null, { disposeWhenNodeIsRemoved: element })\n registerEventHandler(element, 'click', updateModel)\n\n // The second responds to changes in the model value (the one associated with the checked binding)\n computed(updateView, null, { disposeWhenNodeIsRemoved: element })\n\n rawValue = undefined\n }\n}\n\nexport var checkedValue = {\n update: function (element, valueAccessor) {\n element.value = unwrap(valueAccessor())\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAIO,WAAI,UAAU;AAAA,EACnB,OAAO,CAAC,SAAS,MAAM;AAAA,EACvB,MAAM,SAAU,SAAS,eAAe,aAAa;AACnD,QAAI,gBAAe,aAAa,WAAY;AAE1C,UAAI,YAAY,IAAI,cAAc,GAAG;AACnC,eAAO,OAAO,YAAY,IAAI,cAAc,CAAC;AAAA,MAC/C,WAAW,iBAAiB;AAC1B,YAAI,YAAY,IAAI,OAAO,GAAG;AAC5B,iBAAO,OAAO,YAAY,IAAI,OAAO,CAAC;AAAA,QACxC,OAAO;AACL,iBAAO,QAAQ;AAAA,QACjB;AAAA,MACF;AAAA,IACF,CAAC;AAED,2BAAwB;AAGtB,UAAI,YAAY,QAAQ,SACtB,YAAY,cAAa;AAG3B,UAAI,oBAAoB,UAAU,GAAG;AACnC;AAAA,MACF;AAKA,UAAI,CAAC,aAAc,YAAW,oBAAoB,qBAAqB,IAAI;AACzE;AAAA,MACF;AAEA,UAAI,aAAa,oBAAoB,OAAO,aAAa;AACzD,UAAI,cAAc;AAChB,YAAI,gBAAgB,+BAA+B,WAAW,KAAK,IAAI,YACrE,eAAe;AACjB,uBAAe;AAEf,YAAI,iBAAiB,WAAW;AAI9B,cAAI,WAAW;AACb,4BAAgB,eAAe,WAAW,IAAI;AAC9C,4BAAgB,eAAe,cAAc,KAAK;AAAA,UACpD;AAEA,yBAAe;AAAA,QACjB,OAAO;AAGL,0BAAgB,eAAe,WAAW,SAAS;AAAA,QACrD;AACA,YAAI,gCAAgC,sBAAsB,UAAU,GAAG;AACrE,qBAAW,aAAa;AAAA,QAC1B;AAAA,MACF,OAAO;AACL,YAAI,YAAY;AACd,cAAI,cAAc,QAAW;AAC3B,wBAAY;AAAA,UACd,WAAW,CAAC,WAAW;AACrB,wBAAY;AAAA,UACd;AAAA,QACF;AACA,sBAAc,WAAW,EAAC,eAAe,KAAI,CAAC;AAAA,MAChD;AAAA,IACF;AAAC;AAED,0BAAuB;AAGrB,UAAI,aAAa,aAAa,OAAO,cAAc,CAAC;AACpD,UAAI,YAAY,cAAa;AAE7B,UAAI,cAAc;AAEhB,gBAAQ,UAAU,aAAa,YAAY,SAAS,KAAK;AACzD,uBAAe;AAAA,MACjB,WAAW,cAAc,cAAc,QAAW;AAGhD,gBAAQ,UAAU,CAAC,CAAC;AAAA,MACtB,OAAO;AAEL,gBAAQ,UAAW,cAAa,MAAM;AAAA,MACxC;AAAA,IACF;AAAC;AAED,QAAI,aAAa,QAAQ,QAAQ,YAC/B,UAAU,QAAQ,QAAQ;AAG5B,QAAI,CAAC,cAAc,CAAC,SAAS;AAC3B;AAAA,IACF;AAEA,QAAI,WAAW,cAAc,GAC3B,eAAe,cAAe,OAAO,QAAQ,aAAa,OAC1D,+BAA+B,CAAE,iBAAgB,SAAS,QAAQ,SAAS,SAC3E,kBAAkB,WAAW,cAC7B,eAAe,eAAe,cAAa,IAAI;AAKjD,aAAS,aAAa,MAAM,EAAE,0BAA0B,QAAQ,CAAC;AACjE,yBAAqB,SAAS,SAAS,WAAW;AAGlD,aAAS,YAAY,MAAM,EAAE,0BAA0B,QAAQ,CAAC;AAEhE,eAAW;AAAA,EACb;AACF;AAEO,WAAI,eAAe;AAAA,EACxB,QAAQ,SAAU,SAAS,eAAe;AACxC,YAAQ,QAAQ,OAAO,cAAc,CAAC;AAAA,EACxC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/click.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/click.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n makeEventHandlerShortcut\n} from './event'\n\n// 'click' is just a shorthand for the usual full-length event:{click:handler}\nexport var click = makeEventHandlerShortcut('click')\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAKO,WAAI,QAAQ,yBAAyB,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/css.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
createSymbolOrString,
|
|
4
|
+
toggleDomNodeCssClass,
|
|
5
|
+
objectForEach,
|
|
6
|
+
stringTrim
|
|
7
|
+
} from "@tko/utils";
|
|
8
|
+
import {
|
|
9
|
+
unwrap
|
|
10
|
+
} from "@tko/observable";
|
|
11
|
+
export var css = {
|
|
12
|
+
aliases: ["class"],
|
|
13
|
+
update: function(element, valueAccessor) {
|
|
14
|
+
var value = unwrap(valueAccessor());
|
|
15
|
+
if (value !== null && typeof value === "object") {
|
|
16
|
+
objectForEach(value, function(className, shouldHaveClass) {
|
|
17
|
+
shouldHaveClass = unwrap(shouldHaveClass);
|
|
18
|
+
toggleDomNodeCssClass(element, className, shouldHaveClass);
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
value = stringTrim(String(value || ""));
|
|
22
|
+
toggleDomNodeCssClass(element, element[css.classesWrittenByBindingKey], false);
|
|
23
|
+
element[css.classesWrittenByBindingKey] = value;
|
|
24
|
+
toggleDomNodeCssClass(element, value, true);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
classesWrittenByBindingKey: createSymbolOrString("__ko__cssValue")
|
|
28
|
+
};
|
package/dist/css.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/css.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n createSymbolOrString, toggleDomNodeCssClass, objectForEach, stringTrim\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var css = {\n aliases: ['class'],\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor())\n if (value !== null && typeof value === 'object') {\n objectForEach(value, function (className, shouldHaveClass) {\n shouldHaveClass = unwrap(shouldHaveClass)\n toggleDomNodeCssClass(element, className, shouldHaveClass)\n })\n } else {\n value = stringTrim(String(value || '')) // Make sure we don't try to store or set a non-string value\n toggleDomNodeCssClass(element, element[css.classesWrittenByBindingKey], false)\n element[css.classesWrittenByBindingKey] = value\n toggleDomNodeCssClass(element, value, true)\n }\n },\n classesWrittenByBindingKey: createSymbolOrString('__ko__cssValue')\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIO,WAAI,MAAM;AAAA,EACf,SAAS,CAAC,OAAO;AAAA,EACjB,QAAQ,SAAU,SAAS,eAAe;AACxC,QAAI,QAAQ,OAAO,cAAc,CAAC;AAClC,QAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,oBAAc,OAAO,SAAU,WAAW,iBAAiB;AACzD,0BAAkB,OAAO,eAAe;AACxC,8BAAsB,SAAS,WAAW,eAAe;AAAA,MAC3D,CAAC;AAAA,IACH,OAAO;AACL,cAAQ,WAAW,OAAO,SAAS,EAAE,CAAC;AACtC,4BAAsB,SAAS,QAAQ,IAAI,6BAA6B,KAAK;AAC7E,cAAQ,IAAI,8BAA8B;AAC1C,4BAAsB,SAAS,OAAO,IAAI;AAAA,IAC5C;AAAA,EACF;AAAA,EACA,4BAA4B,qBAAqB,gBAAgB;AACnE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
BindingHandler
|
|
4
|
+
} from "@tko/bind";
|
|
5
|
+
export default class DescendantsCompleteHandler extends BindingHandler {
|
|
6
|
+
onDescendantsComplete() {
|
|
7
|
+
if (typeof this.value === "function") {
|
|
8
|
+
this.value(this.$element);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
static get allowVirtualElements() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/descendantsComplete.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * A simple callback binding.\n */\nimport {\n BindingHandler\n} from '@tko/bind'\n\nexport default class DescendantsCompleteHandler extends BindingHandler {\n onDescendantsComplete () {\n if (typeof this.value === 'function') {\n this.value(this.$element)\n }\n }\n\n static get allowVirtualElements () { return true }\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA;AAAA;AAIA,qBAAqB,mCAAmC,eAAe;AAAA,EACrE,wBAAyB;AACvB,QAAI,OAAO,KAAK,UAAU,YAAY;AACpC,WAAK,MAAM,KAAK,QAAQ;AAAA,IAC1B;AAAA,EACF;AAAA,aAEW,uBAAwB;AAAE,WAAO;AAAA,EAAK;AACnD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
unwrap
|
|
4
|
+
} from "@tko/observable";
|
|
5
|
+
export var enable = {
|
|
6
|
+
update: function(element, valueAccessor) {
|
|
7
|
+
var value = unwrap(valueAccessor());
|
|
8
|
+
if (value && element.disabled) {
|
|
9
|
+
element.removeAttribute("disabled");
|
|
10
|
+
} else if (!value && !element.disabled) {
|
|
11
|
+
element.disabled = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export var disable = {
|
|
16
|
+
update: function(element, valueAccessor) {
|
|
17
|
+
enable.update(element, function() {
|
|
18
|
+
return !unwrap(valueAccessor());
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/enableDisable.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var enable = {\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor())\n if (value && element.disabled) {\n element.removeAttribute('disabled')\n } else if ((!value) && (!element.disabled)) {\n element.disabled = true\n }\n }\n}\n\nexport var disable = {\n update: function (element, valueAccessor) {\n enable.update(element, function () { return !unwrap(valueAccessor()) })\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAIO,WAAI,SAAS;AAAA,EAClB,QAAQ,SAAU,SAAS,eAAe;AACxC,QAAI,QAAQ,OAAO,cAAc,CAAC;AAClC,QAAI,SAAS,QAAQ,UAAU;AAC7B,cAAQ,gBAAgB,UAAU;AAAA,IACpC,WAAY,CAAC,SAAW,CAAC,QAAQ,UAAW;AAC1C,cAAQ,WAAW;AAAA,IACrB;AAAA,EACF;AACF;AAEO,WAAI,UAAU;AAAA,EACnB,QAAQ,SAAU,SAAS,eAAe;AACxC,WAAO,OAAO,SAAS,WAAY;AAAE,aAAO,CAAC,OAAO,cAAc,CAAC;AAAA,IAAE,CAAC;AAAA,EACxE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/event.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
objectForEach,
|
|
4
|
+
registerEventHandler,
|
|
5
|
+
throttle as throttleFn,
|
|
6
|
+
debounce as debounceFn
|
|
7
|
+
} from "@tko/utils";
|
|
8
|
+
import {
|
|
9
|
+
unwrap
|
|
10
|
+
} from "@tko/observable";
|
|
11
|
+
export function makeEventHandlerShortcut(eventName) {
|
|
12
|
+
return {
|
|
13
|
+
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
|
14
|
+
var newValueAccessor = function() {
|
|
15
|
+
var result = {};
|
|
16
|
+
result[eventName] = valueAccessor();
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
eventHandler.init.call(this, element, newValueAccessor, allBindings, viewModel, bindingContext);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function makeDescriptor(handlerOrObject) {
|
|
24
|
+
return typeof handlerOrObject === "function" ? { handler: handlerOrObject } : handlerOrObject || {};
|
|
25
|
+
}
|
|
26
|
+
export const eventHandler = {
|
|
27
|
+
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
|
28
|
+
var eventsToHandle = valueAccessor() || {};
|
|
29
|
+
objectForEach(eventsToHandle, function(eventName, descriptor) {
|
|
30
|
+
const { passive, capture, once, debounce, throttle } = makeDescriptor(descriptor);
|
|
31
|
+
const eventOptions = (capture || passive || once) && { capture, passive, once };
|
|
32
|
+
let eventHandlerFn = (event, ...more) => {
|
|
33
|
+
var handlerReturnValue;
|
|
34
|
+
const { handler, passive: passive2, bubble, preventDefault } = makeDescriptor(valueAccessor()[eventName]);
|
|
35
|
+
try {
|
|
36
|
+
if (handler) {
|
|
37
|
+
const possiblyUpdatedViewModel = bindingContext.$data;
|
|
38
|
+
const argsForHandler = [possiblyUpdatedViewModel, event, ...more];
|
|
39
|
+
handlerReturnValue = handler.apply(possiblyUpdatedViewModel, argsForHandler);
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
if (preventDefault !== void 0) {
|
|
43
|
+
if (unwrap(preventDefault)) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
}
|
|
46
|
+
} else if (handlerReturnValue !== true) {
|
|
47
|
+
if (!passive2) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const bubbleMark = allBindings.get(eventName + "Bubble") !== false;
|
|
53
|
+
if (bubble === false || !bubbleMark) {
|
|
54
|
+
event.cancelBubble = true;
|
|
55
|
+
if (event.stopPropagation) {
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (debounce) {
|
|
61
|
+
eventHandlerFn = debounceFn(eventHandlerFn, debounce);
|
|
62
|
+
}
|
|
63
|
+
if (throttle) {
|
|
64
|
+
eventHandlerFn = throttleFn(eventHandlerFn, throttle);
|
|
65
|
+
}
|
|
66
|
+
registerEventHandler(element, eventName, eventHandlerFn, eventOptions || false);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
export const onHandler = {
|
|
71
|
+
init: eventHandler.init,
|
|
72
|
+
preprocess: function(value, key, addBinding) {
|
|
73
|
+
addBinding(key.replace("on.", ""), "=>" + value);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/event.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n objectForEach, registerEventHandler, makeArray,\n throttle as throttleFn, debounce as debounceFn\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\n// For certain common events (currently just 'click'), allow a simplified data-binding syntax\n// e.g. click:handler instead of the usual full-length event:{click:handler}\nexport function makeEventHandlerShortcut (eventName) {\n return {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n var newValueAccessor = function () {\n var result = {}\n result[eventName] = valueAccessor()\n return result\n }\n eventHandler.init.call(this, element, newValueAccessor, allBindings, viewModel, bindingContext)\n }\n }\n}\n\nfunction makeDescriptor (handlerOrObject) {\n return typeof handlerOrObject === 'function' ? { handler: handlerOrObject } : handlerOrObject || {}\n}\n\nexport const eventHandler = {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n var eventsToHandle = valueAccessor() || {}\n objectForEach(eventsToHandle, function (eventName, descriptor) {\n const {passive, capture, once, debounce, throttle} = makeDescriptor(descriptor)\n const eventOptions = (capture || passive || once) && {capture, passive, once}\n\n let eventHandlerFn = (event, ...more) => {\n var handlerReturnValue\n const {handler, passive, bubble, preventDefault} = makeDescriptor(valueAccessor()[eventName])\n\n try {\n // Take all the event args, and prefix with the viewmodel\n if (handler) {\n const possiblyUpdatedViewModel = bindingContext.$data\n const argsForHandler = [possiblyUpdatedViewModel, event, ...more]\n handlerReturnValue = handler.apply(possiblyUpdatedViewModel, argsForHandler)\n }\n } finally {\n // preventDefault in the descriptor takes precedent over the handler return value\n if (preventDefault !== undefined) {\n if (unwrap(preventDefault)) { event.preventDefault() }\n } else if (handlerReturnValue !== true) {\n // Normally we want to prevent default action. Developer can override this by explicitly returning true\n // preventDefault will throw an error if the event is passive.\n if (!passive) { event.preventDefault() }\n }\n }\n\n const bubbleMark = allBindings.get(eventName + 'Bubble') !== false\n if (bubble === false || !bubbleMark) {\n event.cancelBubble = true\n if (event.stopPropagation) { event.stopPropagation() }\n }\n }\n\n if (debounce) { eventHandlerFn = debounceFn(eventHandlerFn, debounce) }\n if (throttle) { eventHandlerFn = throttleFn(eventHandlerFn, throttle) }\n\n registerEventHandler(element, eventName, eventHandlerFn, eventOptions || false)\n })\n }\n}\n\nexport const onHandler = {\n init: eventHandler.init,\n preprocess: function (value, key, addBinding) {\n addBinding(key.replace('on.', ''), '=>' + value)\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAMO,yCAAmC,WAAW;AACnD,SAAO;AAAA,IACL,MAAM,SAAU,SAAS,eAAe,aAAa,WAAW,gBAAgB;AAC9E,UAAI,mBAAmB,WAAY;AACjC,YAAI,SAAS,CAAC;AACd,eAAO,aAAa,cAAc;AAClC,eAAO;AAAA,MACT;AACA,mBAAa,KAAK,KAAK,MAAM,SAAS,kBAAkB,aAAa,WAAW,cAAc;AAAA,IAChG;AAAA,EACF;AACF;AAEA,wBAAyB,iBAAiB;AACxC,SAAO,OAAO,oBAAoB,aAAa,EAAE,SAAS,gBAAgB,IAAI,mBAAmB,CAAC;AACpG;AAEO,aAAM,eAAe;AAAA,EAC1B,MAAM,SAAU,SAAS,eAAe,aAAa,WAAW,gBAAgB;AAC9E,QAAI,iBAAiB,cAAc,KAAK,CAAC;AACzC,kBAAc,gBAAgB,SAAU,WAAW,YAAY;AAC7D,YAAM,EAAC,SAAS,SAAS,MAAM,UAAU,aAAY,eAAe,UAAU;AAC9E,YAAM,eAAgB,YAAW,WAAW,SAAS,EAAC,SAAS,SAAS,KAAI;AAE5E,UAAI,iBAAiB,CAAC,UAAU,SAAS;AACvC,YAAI;AACJ,cAAM,EAAC,SAAS,mBAAS,QAAQ,mBAAkB,eAAe,cAAc,EAAE,UAAU;AAE5F,YAAI;AAEF,cAAI,SAAS;AACX,kBAAM,2BAA2B,eAAe;AAChD,kBAAM,iBAAiB,CAAC,0BAA0B,OAAO,GAAG,IAAI;AAChE,iCAAqB,QAAQ,MAAM,0BAA0B,cAAc;AAAA,UAC7E;AAAA,QACF,UAAE;AAEA,cAAI,mBAAmB,QAAW;AAChC,gBAAI,OAAO,cAAc,GAAG;AAAE,oBAAM,eAAe;AAAA,YAAE;AAAA,UACvD,WAAW,uBAAuB,MAAM;AAGtC,gBAAI,CAAC,UAAS;AAAE,oBAAM,eAAe;AAAA,YAAE;AAAA,UACzC;AAAA,QACF;AAEA,cAAM,aAAa,YAAY,IAAI,YAAY,QAAQ,MAAM;AAC7D,YAAI,WAAW,SAAS,CAAC,YAAY;AACnC,gBAAM,eAAe;AACrB,cAAI,MAAM,iBAAiB;AAAE,kBAAM,gBAAgB;AAAA,UAAE;AAAA,QACvD;AAAA,MACF;AAEA,UAAI,UAAU;AAAE,yBAAiB,WAAW,gBAAgB,QAAQ;AAAA,MAAE;AACtE,UAAI,UAAU;AAAE,yBAAiB,WAAW,gBAAgB,QAAQ;AAAA,MAAE;AAEtE,2BAAqB,SAAS,WAAW,gBAAgB,gBAAgB,KAAK;AAAA,IAChF,CAAC;AAAA,EACH;AACF;AAEO,aAAM,YAAY;AAAA,EACvB,MAAM,aAAa;AAAA,EACnB,YAAY,SAAU,OAAO,KAAK,YAAY;AAC5C,eAAW,IAAI,QAAQ,OAAO,EAAE,GAAG,OAAO,KAAK;AAAA,EACjD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/hasfocus.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
createSymbolOrString,
|
|
4
|
+
triggerEvent,
|
|
5
|
+
registerEventHandler
|
|
6
|
+
} from "@tko/utils";
|
|
7
|
+
import {
|
|
8
|
+
unwrap,
|
|
9
|
+
dependencyDetection
|
|
10
|
+
} from "@tko/observable";
|
|
11
|
+
var hasfocusUpdatingProperty = createSymbolOrString("__ko_hasfocusUpdating");
|
|
12
|
+
var hasfocusLastValue = createSymbolOrString("__ko_hasfocusLastValue");
|
|
13
|
+
export var hasfocus = {
|
|
14
|
+
init: function(element, valueAccessor) {
|
|
15
|
+
var handleElementFocusChange = function(isFocused) {
|
|
16
|
+
element[hasfocusUpdatingProperty] = true;
|
|
17
|
+
var ownerDoc = element.ownerDocument;
|
|
18
|
+
if ("activeElement" in ownerDoc) {
|
|
19
|
+
var active;
|
|
20
|
+
try {
|
|
21
|
+
active = ownerDoc.activeElement;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
active = ownerDoc.body;
|
|
24
|
+
}
|
|
25
|
+
isFocused = active === element;
|
|
26
|
+
}
|
|
27
|
+
valueAccessor(isFocused, { onlyIfChanged: true });
|
|
28
|
+
element[hasfocusLastValue] = isFocused;
|
|
29
|
+
element[hasfocusUpdatingProperty] = false;
|
|
30
|
+
};
|
|
31
|
+
var handleElementFocusIn = handleElementFocusChange.bind(null, true);
|
|
32
|
+
var handleElementFocusOut = handleElementFocusChange.bind(null, false);
|
|
33
|
+
registerEventHandler(element, "focus", handleElementFocusIn);
|
|
34
|
+
registerEventHandler(element, "focusin", handleElementFocusIn);
|
|
35
|
+
registerEventHandler(element, "blur", handleElementFocusOut);
|
|
36
|
+
registerEventHandler(element, "focusout", handleElementFocusOut);
|
|
37
|
+
},
|
|
38
|
+
update: function(element, valueAccessor) {
|
|
39
|
+
var value = !!unwrap(valueAccessor());
|
|
40
|
+
if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {
|
|
41
|
+
value ? element.focus() : element.blur();
|
|
42
|
+
if (!value && element[hasfocusLastValue]) {
|
|
43
|
+
element.ownerDocument.body.focus();
|
|
44
|
+
}
|
|
45
|
+
dependencyDetection.ignore(triggerEvent, null, [element, value ? "focusin" : "focusout"]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/hasfocus.ts"],
|
|
4
|
+
"sourcesContent": ["\nimport {\n createSymbolOrString, triggerEvent, registerEventHandler\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection\n} from '@tko/observable'\n\nvar hasfocusUpdatingProperty = createSymbolOrString('__ko_hasfocusUpdating')\nvar hasfocusLastValue = createSymbolOrString('__ko_hasfocusLastValue')\n\nexport var hasfocus = {\n init: function (element, valueAccessor /*, allBindings */) {\n var handleElementFocusChange = function (isFocused) {\n // Where possible, ignore which event was raised and determine focus state using activeElement,\n // as this avoids phantom focus/blur events raised when changing tabs in modern browsers.\n // However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,\n // prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus\n // from calling 'blur()' on the element when it loses focus.\n // Discussion at https://github.com/SteveSanderson/knockout/pull/352\n element[hasfocusUpdatingProperty] = true\n var ownerDoc = element.ownerDocument\n if ('activeElement' in ownerDoc) {\n var active\n try {\n active = ownerDoc.activeElement\n } catch (e) {\n // IE9 throws if you access activeElement during page load (see issue #703)\n active = ownerDoc.body\n }\n isFocused = (active === element)\n }\n // var modelValue = valueAccessor();\n valueAccessor(isFocused, {onlyIfChanged: true})\n\n // cache the latest value, so we can avoid unnecessarily calling focus/blur in the update function\n element[hasfocusLastValue] = isFocused\n element[hasfocusUpdatingProperty] = false\n }\n var handleElementFocusIn = handleElementFocusChange.bind(null, true)\n var handleElementFocusOut = handleElementFocusChange.bind(null, false)\n\n registerEventHandler(element, 'focus', handleElementFocusIn)\n registerEventHandler(element, 'focusin', handleElementFocusIn) // For IE\n registerEventHandler(element, 'blur', handleElementFocusOut)\n registerEventHandler(element, 'focusout', handleElementFocusOut) // For IE\n },\n update: function (element, valueAccessor) {\n var value = !!unwrap(valueAccessor())\n\n if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {\n value ? element.focus() : element.blur()\n\n // In IE, the blur method doesn't always cause the element to lose focus (for example, if the window is not in focus).\n // Setting focus to the body element does seem to be reliable in IE, but should only be used if we know that the current\n // element was focused already.\n if (!value && element[hasfocusLastValue]) {\n element.ownerDocument.body.focus()\n }\n\n // For IE, which doesn't reliably fire \"focus\" or \"blur\" events synchronously\n dependencyDetection.ignore(triggerEvent, null, [element, value ? 'focusin' : 'focusout'])\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAIA,IAAI,2BAA2B,qBAAqB,uBAAuB;AAC3E,IAAI,oBAAoB,qBAAqB,wBAAwB;AAE9D,WAAI,WAAW;AAAA,EACpB,MAAM,SAAU,SAAS,eAAkC;AACzD,QAAI,2BAA2B,SAAU,WAAW;AAOlD,cAAQ,4BAA4B;AACpC,UAAI,WAAW,QAAQ;AACvB,UAAI,mBAAmB,UAAU;AAC/B,YAAI;AACJ,YAAI;AACF,mBAAS,SAAS;AAAA,QACpB,SAAS,GAAP;AAEA,mBAAS,SAAS;AAAA,QACpB;AACA,oBAAa,WAAW;AAAA,MAC1B;AAEA,oBAAc,WAAW,EAAC,eAAe,KAAI,CAAC;AAG9C,cAAQ,qBAAqB;AAC7B,cAAQ,4BAA4B;AAAA,IACtC;AACA,QAAI,uBAAuB,yBAAyB,KAAK,MAAM,IAAI;AACnE,QAAI,wBAAwB,yBAAyB,KAAK,MAAM,KAAK;AAErE,yBAAqB,SAAS,SAAS,oBAAoB;AAC3D,yBAAqB,SAAS,WAAW,oBAAoB;AAC7D,yBAAqB,SAAS,QAAQ,qBAAqB;AAC3D,yBAAqB,SAAS,YAAY,qBAAqB;AAAA,EACjE;AAAA,EACA,QAAQ,SAAU,SAAS,eAAe;AACxC,QAAI,QAAQ,CAAC,CAAC,OAAO,cAAc,CAAC;AAEpC,QAAI,CAAC,QAAQ,6BAA6B,QAAQ,uBAAuB,OAAO;AAC9E,cAAQ,QAAQ,MAAM,IAAI,QAAQ,KAAK;AAKvC,UAAI,CAAC,SAAS,QAAQ,oBAAoB;AACxC,gBAAQ,cAAc,KAAK,MAAM;AAAA,MACnC;AAGA,0BAAoB,OAAO,cAAc,MAAM,CAAC,SAAS,QAAQ,YAAY,UAAU,CAAC;AAAA,IAC1F;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/html.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @tko/binding.core 🥊 4.0.0-beta1.0 ESM
|
|
2
|
+
import {
|
|
3
|
+
setHtml
|
|
4
|
+
} from "@tko/utils";
|
|
5
|
+
export var html = {
|
|
6
|
+
init: function() {
|
|
7
|
+
return {
|
|
8
|
+
"controlsDescendantBindings": true
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
update: function(element, valueAccessor) {
|
|
12
|
+
setHtml(element, valueAccessor());
|
|
13
|
+
},
|
|
14
|
+
allowVirtualElements: true
|
|
15
|
+
};
|
package/dist/html.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/html.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n setHtml, parseHtmlFragment, virtualElements\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var html = {\n init: function () {\n // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)\n return {\n 'controlsDescendantBindings': true\n }\n },\n //\n // Modify internal, per ko.punches and :\n // http://stackoverflow.com/a/15348139\n update: function (element, valueAccessor) {\n setHtml(element, valueAccessor())\n },\n allowVirtualElements: true\n}\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA;AAAA;AAQO,WAAI,OAAO;AAAA,EAChB,MAAM,WAAY;AAEhB,WAAO;AAAA,MACL,8BAA8B;AAAA,IAChC;AAAA,EACF;AAAA,EAIA,QAAQ,SAAU,SAAS,eAAe;AACxC,YAAQ,SAAS,cAAc,CAAC;AAAA,EAClC;AAAA,EACA,sBAAsB;AACxB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|