cotomy 0.3.4 → 0.3.5
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 +20 -20
- package/README.md +317 -307
- package/dist/browser/cotomy.js +13 -15
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/form.js +3 -3
- package/dist/esm/view.js +9 -11
- package/dist/esm/view.js.map +1 -1
- package/dist/types/view.d.ts +0 -2
- package/package.json +61 -61
package/dist/browser/cotomy.js
CHANGED
|
@@ -174,7 +174,7 @@ module.exports = cuid;
|
|
|
174
174
|
/***/ 826:
|
|
175
175
|
/***/ (function(module) {
|
|
176
176
|
|
|
177
|
-
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var
|
|
177
|
+
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t)};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)}}}));
|
|
178
178
|
|
|
179
179
|
/***/ })
|
|
180
180
|
|
|
@@ -916,7 +916,6 @@ class CotomyElement {
|
|
|
916
916
|
}
|
|
917
917
|
constructor(element) {
|
|
918
918
|
this._parentElement = null;
|
|
919
|
-
this._scopeId = null;
|
|
920
919
|
if (element instanceof HTMLElement) {
|
|
921
920
|
this._element = element;
|
|
922
921
|
}
|
|
@@ -944,7 +943,7 @@ class CotomyElement {
|
|
|
944
943
|
}
|
|
945
944
|
}
|
|
946
945
|
if (!this.instanceId) {
|
|
947
|
-
this.attribute("data-cotomy-instance",
|
|
946
|
+
this.attribute("data-cotomy-instance", cuid_default()());
|
|
948
947
|
this.removed(() => {
|
|
949
948
|
this._element = CotomyElement.createHTMLElement(`<div data-cotomy-invalidated style="display: none;"></div>`);
|
|
950
949
|
EventRegistry.instance.clear(this);
|
|
@@ -963,14 +962,10 @@ class CotomyElement {
|
|
|
963
962
|
return this.attribute("data-cotomy-instance");
|
|
964
963
|
}
|
|
965
964
|
get scopeId() {
|
|
966
|
-
if (!this.
|
|
967
|
-
this.
|
|
968
|
-
this.attribute(this._scopeId, "");
|
|
965
|
+
if (!this.hasAttribute("data-cotomy-scopeid")) {
|
|
966
|
+
this.attribute("data-cotomy-scopeid", cuid_default()());
|
|
969
967
|
}
|
|
970
|
-
return this.
|
|
971
|
-
}
|
|
972
|
-
get scopedSelector() {
|
|
973
|
-
return `[${this.scopeId}]`;
|
|
968
|
+
return this.attribute("data-cotomy-scopeid");
|
|
974
969
|
}
|
|
975
970
|
get stylable() {
|
|
976
971
|
return !["script", "style", "link", "meta"].includes(this.tagname);
|
|
@@ -983,7 +978,7 @@ class CotomyElement {
|
|
|
983
978
|
const cssid = this.scopedCssElementId;
|
|
984
979
|
CotomyElement.find(`#${cssid}`).forEach(e => e.remove());
|
|
985
980
|
const element = document.createElement("style");
|
|
986
|
-
const writeCss = css.replace(/\[scope\]/g, `[${this.scopeId}]`);
|
|
981
|
+
const writeCss = css.replace(/\[scope\]/g, `[data-cotomy-scopeid="${this.scopeId}"]`);
|
|
987
982
|
const node = document.createTextNode(writeCss);
|
|
988
983
|
element.appendChild(node);
|
|
989
984
|
element.id = cssid;
|
|
@@ -1014,7 +1009,10 @@ class CotomyElement {
|
|
|
1014
1009
|
}
|
|
1015
1010
|
clone(type) {
|
|
1016
1011
|
const ctor = (type ?? CotomyElement);
|
|
1017
|
-
|
|
1012
|
+
const cloned = new ctor(this.element.cloneNode(true));
|
|
1013
|
+
cloned.attribute("data-cotomy-scopeid", null);
|
|
1014
|
+
cloned.find("[data-cotomy-scopeid]").forEach(e => e.attribute("data-cotomy-scopeid", null));
|
|
1015
|
+
return cloned;
|
|
1018
1016
|
}
|
|
1019
1017
|
get tagname() {
|
|
1020
1018
|
return this.element.tagName.toLowerCase();
|
|
@@ -2720,7 +2718,7 @@ class CotomyEntityApiForm extends CotomyApiForm {
|
|
|
2720
2718
|
this.attribute("data-cotomy-entity-key", addedParts[0]);
|
|
2721
2719
|
}
|
|
2722
2720
|
else {
|
|
2723
|
-
const msg = `Location does not contain a single entity key segment.
|
|
2721
|
+
const msg = `Location does not contain a single entity key segment.
|
|
2724
2722
|
action="${baseAction}", location="${locPath}", added=["${addedParts.join('","')}"]`;
|
|
2725
2723
|
throw new Error(msg);
|
|
2726
2724
|
}
|
|
@@ -2810,8 +2808,8 @@ class CotomyEntityFillApiForm extends CotomyEntityApiForm {
|
|
|
2810
2808
|
}
|
|
2811
2809
|
}
|
|
2812
2810
|
applyValueToInputs(pname, value) {
|
|
2813
|
-
this.find(`input[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple]),
|
|
2814
|
-
textarea[name="${pname}" i]:not([data-cotomy-fill="false"]),
|
|
2811
|
+
this.find(`input[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple]),
|
|
2812
|
+
textarea[name="${pname}" i]:not([data-cotomy-fill="false"]),
|
|
2815
2813
|
select[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple])`).forEach(input => {
|
|
2816
2814
|
if (CotomyDebugSettings.isEnabled(CotomyDebugFeature.Fill)) {
|
|
2817
2815
|
console.debug(`Filling input[name="${pname}"] with value:`, value);
|