@pacem/pacem-core 2.0.0-chebyshev → 2.0.0-davinci
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/browser/pacem-core.js +79 -22
- package/dist/browser/pacem-core.js.map +1 -1
- package/dist/browser/pacem-core.min.js +2 -2
- package/dist/bundle/pacem-core.min.mjs +5 -5
- package/dist/bundle/pacem-core.mjs +66 -9
- package/dist/bundle/pacem-core.mjs.map +2 -2
- package/dist/docs/pacem-core.json +93 -8
- package/dist/esm/adapter.js +1 -1
- package/dist/esm/binding-parser.js +1 -1
- package/dist/esm/command.js +1 -1
- package/dist/esm/comparers.js +1 -1
- package/dist/esm/converters.js +1 -1
- package/dist/esm/decorators-next.js +1 -1
- package/dist/esm/decorators.js +72 -17
- package/dist/esm/defaults.js +1 -1
- package/dist/esm/events.js +1 -1
- package/dist/esm/eventtarget.js +1 -1
- package/dist/esm/expression.js +1 -1
- package/dist/esm/index-animations.js +1 -1
- package/dist/esm/index-behaviors.js +1 -1
- package/dist/esm/index-components.js +1 -1
- package/dist/esm/index-iife.js +1 -1
- package/dist/esm/index-logging.js +1 -1
- package/dist/esm/index-net.js +1 -1
- package/dist/esm/index-root.js +1 -1
- package/dist/esm/index-ui.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/logger.js +1 -1
- package/dist/esm/prefix.js +1 -1
- package/dist/esm/promise.js +1 -1
- package/dist/esm/regex.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/template.js +1 -1
- package/dist/esm/transforms.js +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils-customelement.js +1 -1
- package/dist/esm/utils-customevent.js +1 -1
- package/dist/esm/utils.js +1 -1
- package/package.json +1 -1
- package/typings/index.d.ts +12 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem-core v2.0.0-
|
|
2
|
+
* @pacem/pacem-core v2.0.0-davinci (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -2826,12 +2826,18 @@ var WATCH_PROP_PREFIX = "pacem:property:";
|
|
|
2826
2826
|
var WATCH_VERS_PROP = "pacem:version";
|
|
2827
2827
|
var WATCH_BIND_PREFIX = "pacem:binding:";
|
|
2828
2828
|
var INSTANCE_CHILDREN_VAR = "pacem:view-children";
|
|
2829
|
+
var VIEWCHILD_SURFACES_VAR = "pacem:view-children:surface";
|
|
2829
2830
|
var HAS_BIND_PREFIX = "pacem:has-binding:";
|
|
2830
2831
|
var HAS_TEMPLATE_VAR = "pacem:custom-element:has-template";
|
|
2831
2832
|
var HASBEEN_TEMPLATED_VAR = "pacem:custom-element:has-templated";
|
|
2832
2833
|
var INSTANCE_PROMISE_VAR = "pacem:custom-element:promise";
|
|
2833
2834
|
var INSTANCE_READY_VAR = "pacem:custom-element:ready";
|
|
2834
2835
|
var INSTANCE_ONREADY_VAR = "pacem:custom-element:startup";
|
|
2836
|
+
var SURFACETHEME_FACE_ATTR = "surface-face";
|
|
2837
|
+
var SURFACETHEME_CONTENT_ATTR = "surface-content";
|
|
2838
|
+
var SURFACETHEME_MODIFIER_ATTR = "surface-modifier";
|
|
2839
|
+
var SURFACETHEME_FACE_MODIFIER = "face";
|
|
2840
|
+
var SURFACETHEME_CONTENT_MODIFIER = "content";
|
|
2835
2841
|
function processBinding(element, property, binding) {
|
|
2836
2842
|
var _this = element;
|
|
2837
2843
|
const prop = property;
|
|
@@ -2955,6 +2961,19 @@ var CustomElement = (config) => {
|
|
|
2955
2961
|
const _this = this;
|
|
2956
2962
|
_this.setAttribute("pacem", "");
|
|
2957
2963
|
_this.setAttribute("cloak", "");
|
|
2964
|
+
const faces = GET_VAL2(proto, VIEWCHILD_SURFACES_VAR) ?? [];
|
|
2965
|
+
if (!Utils.isNullOrEmpty(config.modifiers) || !Utils.isNullOrEmpty(faces)) {
|
|
2966
|
+
const currentModifiers = _this.getAttribute(SURFACETHEME_MODIFIER_ATTR)?.split(/\s+/) ?? [];
|
|
2967
|
+
const ownModifiers = (config.modifiers ?? []).slice(0);
|
|
2968
|
+
if (!faces.some((f) => f.face)) {
|
|
2969
|
+
ownModifiers.push(SURFACETHEME_FACE_MODIFIER);
|
|
2970
|
+
}
|
|
2971
|
+
if (!faces.some((f) => f.content)) {
|
|
2972
|
+
ownModifiers.push(SURFACETHEME_CONTENT_MODIFIER);
|
|
2973
|
+
}
|
|
2974
|
+
const modifiers = currentModifiers.union(ownModifiers);
|
|
2975
|
+
_this.setAttribute(SURFACETHEME_MODIFIER_ATTR, modifiers.join(" ").trim().replace(/\s+/g, " "));
|
|
2976
|
+
}
|
|
2958
2977
|
DEL_VAL(_this, INSTANCE_CHILDREN_VAR);
|
|
2959
2978
|
if (originalConnectedCallback && originalConnectedCallback.value)
|
|
2960
2979
|
originalConnectedCallback.value.apply(_this, []);
|
|
@@ -3049,6 +3068,29 @@ var CustomElement = (config) => {
|
|
|
3049
3068
|
if (!Utils.isNull(deferred))
|
|
3050
3069
|
deferred.resolve();
|
|
3051
3070
|
};
|
|
3071
|
+
for (let item of faces) {
|
|
3072
|
+
const element = _this[item.ref];
|
|
3073
|
+
if (Utils.isNull(element)) {
|
|
3074
|
+
continue;
|
|
3075
|
+
}
|
|
3076
|
+
if (config.shadow) {
|
|
3077
|
+
if (item.content) {
|
|
3078
|
+
const part = typeof item.content === "string" ? item.content : "content";
|
|
3079
|
+
Utils.addPart(element, part);
|
|
3080
|
+
}
|
|
3081
|
+
if (item.face) {
|
|
3082
|
+
const part = typeof item.face === "string" ? item.face : "face";
|
|
3083
|
+
Utils.addPart(element, part);
|
|
3084
|
+
}
|
|
3085
|
+
} else {
|
|
3086
|
+
if (item.content) {
|
|
3087
|
+
element.setAttribute(SURFACETHEME_CONTENT_ATTR, item.content.toString());
|
|
3088
|
+
}
|
|
3089
|
+
if (item.face) {
|
|
3090
|
+
element.setAttribute(SURFACETHEME_FACE_ATTR, item.face.toString());
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3052
3094
|
_this.removeAttribute("cloak");
|
|
3053
3095
|
Promise.all(promises).then((_) => fireViewActivated());
|
|
3054
3096
|
});
|
|
@@ -3162,7 +3204,7 @@ ${e.message ?? e}`);
|
|
|
3162
3204
|
var attrName = CustomElementUtils.camelToKebab(name), attr = _this.attributes.getNamedItem(attrName);
|
|
3163
3205
|
if (ready || Utils.isNullOrEmpty(attr)) {
|
|
3164
3206
|
var config2;
|
|
3165
|
-
if (val
|
|
3207
|
+
if (Utils.isNull(val)) {
|
|
3166
3208
|
_this.removeAttribute(attrName);
|
|
3167
3209
|
} else if (property && (config2 = property.config) && typeof config2.converter.convertBack === "function") {
|
|
3168
3210
|
const sval = config2.converter.convertBack(val, _this);
|
|
@@ -3306,8 +3348,21 @@ function Watch(config) {
|
|
|
3306
3348
|
}
|
|
3307
3349
|
};
|
|
3308
3350
|
}
|
|
3309
|
-
function ViewChild(selector) {
|
|
3351
|
+
function ViewChild(selector, faceOrObj = false, content) {
|
|
3352
|
+
let face;
|
|
3353
|
+
if (typeof faceOrObj === "object") {
|
|
3354
|
+
const { face: face0, content: content0 } = faceOrObj;
|
|
3355
|
+
face = face0;
|
|
3356
|
+
content = content0 ?? !!face0;
|
|
3357
|
+
} else {
|
|
3358
|
+
face = faceOrObj;
|
|
3359
|
+
content ??= !!face;
|
|
3360
|
+
}
|
|
3310
3361
|
return (target, prop, descriptor) => {
|
|
3362
|
+
if (face || content) {
|
|
3363
|
+
const faces = GET_VAL2(target, VIEWCHILD_SURFACES_VAR, []);
|
|
3364
|
+
faces.push({ ref: prop, face, content });
|
|
3365
|
+
}
|
|
3311
3366
|
const key2 = `${prop}_${Utils.uniqueCode()}`;
|
|
3312
3367
|
function findElement() {
|
|
3313
3368
|
const _this = this, nodelist = (_this.shadowRoot || _this).querySelectorAll(selector);
|
|
@@ -3322,7 +3377,7 @@ function ViewChild(selector) {
|
|
|
3322
3377
|
function getter() {
|
|
3323
3378
|
const _this = this;
|
|
3324
3379
|
const dict = GET_VAL2(_this, INSTANCE_CHILDREN_VAR, {});
|
|
3325
|
-
return dict[key2]
|
|
3380
|
+
return dict[key2] ??= findElement.call(_this);
|
|
3326
3381
|
}
|
|
3327
3382
|
if (delete target[prop]) {
|
|
3328
3383
|
Object.defineProperty(target, prop, {
|
|
@@ -4568,12 +4623,13 @@ var PacemElement = class extends PacemEventTarget {
|
|
|
4568
4623
|
this.#parts = [];
|
|
4569
4624
|
this._tabIndex = -1;
|
|
4570
4625
|
this.behaviors = [];
|
|
4571
|
-
this
|
|
4626
|
+
this.#aria = new ElementAria(this, role, aria);
|
|
4572
4627
|
}
|
|
4573
4628
|
// #region ARIA
|
|
4574
4629
|
get aria() {
|
|
4575
|
-
return this
|
|
4630
|
+
return this.#aria;
|
|
4576
4631
|
}
|
|
4632
|
+
#aria;
|
|
4577
4633
|
// #endregion
|
|
4578
4634
|
static #stdEvtsMemoizer = null;
|
|
4579
4635
|
static get emittedEventTypes() {
|
|
@@ -4583,10 +4639,11 @@ var PacemElement = class extends PacemEventTarget {
|
|
|
4583
4639
|
#parts;
|
|
4584
4640
|
connectedCallback() {
|
|
4585
4641
|
super.connectedCallback();
|
|
4586
|
-
|
|
4587
|
-
|
|
4642
|
+
const aria = this.#aria;
|
|
4643
|
+
if (!Utils.isNullOrEmpty(aria.role)) {
|
|
4644
|
+
this.setAttribute("role", aria.role);
|
|
4588
4645
|
}
|
|
4589
|
-
let ariaAttrs =
|
|
4646
|
+
let ariaAttrs = aria.attributes.toObject();
|
|
4590
4647
|
if (!Utils.isNullOrEmpty(ariaAttrs)) {
|
|
4591
4648
|
for (let name in ariaAttrs) {
|
|
4592
4649
|
this.setAttribute("aria-" + name, ariaAttrs[name]);
|