@pacem/pacem-core 2.0.0-chebyshev → 2.0.0-euler
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
|
@@ -19282,7 +19282,7 @@
|
|
|
19282
19282
|
},
|
|
19283
19283
|
{
|
|
19284
19284
|
"kind": "Content",
|
|
19285
|
-
"text": "{\n tagName: string;\n options?: {\n extends: string;\n };\n template?: string;\n templateUrl?: string;\n shadow?: boolean;\n}"
|
|
19285
|
+
"text": "{\n tagName: string;\n options?: {\n extends: string;\n };\n template?: string;\n templateUrl?: string;\n shadow?: boolean;\n modifiers?: string[];\n}"
|
|
19286
19286
|
},
|
|
19287
19287
|
{
|
|
19288
19288
|
"kind": "Content",
|
|
@@ -39939,7 +39939,7 @@
|
|
|
39939
39939
|
{
|
|
39940
39940
|
"kind": "Function",
|
|
39941
39941
|
"canonicalReference": "@pacem/pacem-core!ViewChild:function(1)",
|
|
39942
|
-
"docComment": "/**\n * Property decorator that turns a class field into a lazily-resolved, cached reference to a descendant element matching `selector`. Resolution happens on first read (via `shadowRoot.querySelectorAll` when available, falling back to the element itself), and only nodes whose `INSTANCE_HOST_VAR` points back at `this` are considered — this keeps the lookup scoped to the current element's own template output, skipping over descendants that belong to a nested custom element's own template. The cache is reset whenever the host element reconnects to the DOM (`connectedCallback`, see the {@link CustomElement} decorator).\n *\n * @param selector - CSS selector identifying the child element to bind to.\n *\n * @returns A property decorator to apply to the view-child field (read-only; no setter is defined).\n */\n",
|
|
39942
|
+
"docComment": "/**\n * Property decorator that turns a class field into a lazily-resolved, cached reference to a descendant element matching `selector`. Resolution happens on first read (via `shadowRoot.querySelectorAll` when available, falling back to the element itself), and only nodes whose `INSTANCE_HOST_VAR` points back at `this` are considered — this keeps the lookup scoped to the current element's own template output, skipping over descendants that belong to a nested custom element's own template. The cache is reset whenever the host element reconnects to the DOM (`connectedCallback`, see the {@link CustomElement} decorator).\n *\n * @param selector - CSS selector identifying the child element to bind to.\n *\n * @param face - Helps identifying actual surface for theming purposes.\n *\n * @param content - Helps identifying actual surface content for theming purposes, if different from face.\n *\n * @returns A property decorator to apply to the view-child field (read-only; no setter is defined).\n */\n",
|
|
39943
39943
|
"excerptTokens": [
|
|
39944
39944
|
{
|
|
39945
39945
|
"kind": "Content",
|
|
@@ -39949,22 +39949,99 @@
|
|
|
39949
39949
|
"kind": "Content",
|
|
39950
39950
|
"text": "string"
|
|
39951
39951
|
},
|
|
39952
|
+
{
|
|
39953
|
+
"kind": "Content",
|
|
39954
|
+
"text": ", face?: "
|
|
39955
|
+
},
|
|
39956
|
+
{
|
|
39957
|
+
"kind": "Content",
|
|
39958
|
+
"text": "string | boolean"
|
|
39959
|
+
},
|
|
39960
|
+
{
|
|
39961
|
+
"kind": "Content",
|
|
39962
|
+
"text": ", content?: "
|
|
39963
|
+
},
|
|
39964
|
+
{
|
|
39965
|
+
"kind": "Content",
|
|
39966
|
+
"text": "string | boolean"
|
|
39967
|
+
},
|
|
39952
39968
|
{
|
|
39953
39969
|
"kind": "Content",
|
|
39954
39970
|
"text": "): "
|
|
39955
39971
|
},
|
|
39956
39972
|
{
|
|
39957
39973
|
"kind": "Content",
|
|
39958
|
-
"text": "
|
|
39974
|
+
"text": "any"
|
|
39975
|
+
},
|
|
39976
|
+
{
|
|
39977
|
+
"kind": "Content",
|
|
39978
|
+
"text": ";"
|
|
39979
|
+
}
|
|
39980
|
+
],
|
|
39981
|
+
"fileUrlPath": "dist/types/decorators.d.ts",
|
|
39982
|
+
"returnTypeTokenRange": {
|
|
39983
|
+
"startIndex": 7,
|
|
39984
|
+
"endIndex": 8
|
|
39985
|
+
},
|
|
39986
|
+
"releaseTag": "Public",
|
|
39987
|
+
"overloadIndex": 1,
|
|
39988
|
+
"parameters": [
|
|
39989
|
+
{
|
|
39990
|
+
"parameterName": "selector",
|
|
39991
|
+
"parameterTypeTokenRange": {
|
|
39992
|
+
"startIndex": 1,
|
|
39993
|
+
"endIndex": 2
|
|
39994
|
+
},
|
|
39995
|
+
"isOptional": false
|
|
39996
|
+
},
|
|
39997
|
+
{
|
|
39998
|
+
"parameterName": "face",
|
|
39999
|
+
"parameterTypeTokenRange": {
|
|
40000
|
+
"startIndex": 3,
|
|
40001
|
+
"endIndex": 4
|
|
40002
|
+
},
|
|
40003
|
+
"isOptional": true
|
|
40004
|
+
},
|
|
40005
|
+
{
|
|
40006
|
+
"parameterName": "content",
|
|
40007
|
+
"parameterTypeTokenRange": {
|
|
40008
|
+
"startIndex": 5,
|
|
40009
|
+
"endIndex": 6
|
|
40010
|
+
},
|
|
40011
|
+
"isOptional": true
|
|
40012
|
+
}
|
|
40013
|
+
],
|
|
40014
|
+
"name": "ViewChild"
|
|
40015
|
+
},
|
|
40016
|
+
{
|
|
40017
|
+
"kind": "Function",
|
|
40018
|
+
"canonicalReference": "@pacem/pacem-core!ViewChild:function(2)",
|
|
40019
|
+
"docComment": "",
|
|
40020
|
+
"excerptTokens": [
|
|
40021
|
+
{
|
|
40022
|
+
"kind": "Content",
|
|
40023
|
+
"text": "export declare function ViewChild(selector: "
|
|
40024
|
+
},
|
|
40025
|
+
{
|
|
40026
|
+
"kind": "Content",
|
|
40027
|
+
"text": "string"
|
|
40028
|
+
},
|
|
40029
|
+
{
|
|
40030
|
+
"kind": "Content",
|
|
40031
|
+
"text": ", config?: "
|
|
39959
40032
|
},
|
|
39960
40033
|
{
|
|
39961
40034
|
"kind": "Reference",
|
|
39962
|
-
"text": "
|
|
39963
|
-
"canonicalReference": "
|
|
40035
|
+
"text": "ViewChildConfig",
|
|
40036
|
+
"canonicalReference": "@pacem/pacem-core!~ViewChildConfig:type"
|
|
39964
40037
|
},
|
|
39965
40038
|
{
|
|
39966
40039
|
"kind": "Content",
|
|
39967
|
-
"text": ")
|
|
40040
|
+
"text": "): "
|
|
40041
|
+
},
|
|
40042
|
+
{
|
|
40043
|
+
"kind": "Content",
|
|
40044
|
+
"text": "any"
|
|
39968
40045
|
},
|
|
39969
40046
|
{
|
|
39970
40047
|
"kind": "Content",
|
|
@@ -39973,11 +40050,11 @@
|
|
|
39973
40050
|
],
|
|
39974
40051
|
"fileUrlPath": "dist/types/decorators.d.ts",
|
|
39975
40052
|
"returnTypeTokenRange": {
|
|
39976
|
-
"startIndex":
|
|
40053
|
+
"startIndex": 5,
|
|
39977
40054
|
"endIndex": 6
|
|
39978
40055
|
},
|
|
39979
40056
|
"releaseTag": "Public",
|
|
39980
|
-
"overloadIndex":
|
|
40057
|
+
"overloadIndex": 2,
|
|
39981
40058
|
"parameters": [
|
|
39982
40059
|
{
|
|
39983
40060
|
"parameterName": "selector",
|
|
@@ -39986,6 +40063,14 @@
|
|
|
39986
40063
|
"endIndex": 2
|
|
39987
40064
|
},
|
|
39988
40065
|
"isOptional": false
|
|
40066
|
+
},
|
|
40067
|
+
{
|
|
40068
|
+
"parameterName": "config",
|
|
40069
|
+
"parameterTypeTokenRange": {
|
|
40070
|
+
"startIndex": 3,
|
|
40071
|
+
"endIndex": 4
|
|
40072
|
+
},
|
|
40073
|
+
"isOptional": true
|
|
39989
40074
|
}
|
|
39990
40075
|
],
|
|
39991
40076
|
"name": "ViewChild"
|
package/dist/esm/adapter.js
CHANGED
package/dist/esm/command.js
CHANGED
package/dist/esm/comparers.js
CHANGED
package/dist/esm/converters.js
CHANGED
package/dist/esm/decorators.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem-core v2.0.0-
|
|
2
|
+
* @pacem/pacem-core v2.0.0-euler (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -23,12 +23,19 @@ const WATCH_VERS_PROP = 'pacem:version';
|
|
|
23
23
|
const WATCH_BIND_PREFIX = 'pacem:binding:';
|
|
24
24
|
//const WATCH_THROTTLE_PREFIX: string = 'pacem:throttle:';
|
|
25
25
|
const INSTANCE_CHILDREN_VAR = 'pacem:view-children';
|
|
26
|
+
const VIEWCHILD_SURFACES_VAR = 'pacem:view-children:surface';
|
|
26
27
|
const HAS_BIND_PREFIX = 'pacem:has-binding:';
|
|
27
28
|
const HAS_TEMPLATE_VAR = 'pacem:custom-element:has-template';
|
|
28
29
|
const HASBEEN_TEMPLATED_VAR = 'pacem:custom-element:has-templated';
|
|
29
30
|
const INSTANCE_PROMISE_VAR = 'pacem:custom-element:promise';
|
|
30
31
|
const INSTANCE_READY_VAR = 'pacem:custom-element:ready';
|
|
31
32
|
const INSTANCE_ONREADY_VAR = 'pacem:custom-element:startup';
|
|
33
|
+
const SURFACETHEME_FACE_ATTR = 'surface-face';
|
|
34
|
+
const SURFACETHEME_CONTENT_ATTR = 'surface-content';
|
|
35
|
+
const SURFACETHEME_MODIFIER_ATTR = 'surface-modifier';
|
|
36
|
+
/** the modifier of a host that is its own face */
|
|
37
|
+
const SURFACETHEME_FACE_MODIFIER = 'face';
|
|
38
|
+
const SURFACETHEME_CONTENT_MODIFIER = 'content';
|
|
32
39
|
//const TYPE_OPTIONS_VAR = 'pacem:custom-element:options';
|
|
33
40
|
function processBinding(element, property, binding) {
|
|
34
41
|
var _this = element;
|
|
@@ -69,8 +76,8 @@ function processBinding(element, property, binding) {
|
|
|
69
76
|
//cancelAnimationFrame(_this[handleName]);
|
|
70
77
|
//_this[handleName] = requestAnimationFrame(() => {
|
|
71
78
|
_this[prop] = value.evaluate /*Async*/() /*.then(val => {
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
_this[prop] = val;
|
|
80
|
+
})*/;
|
|
74
81
|
//});
|
|
75
82
|
}
|
|
76
83
|
}
|
|
@@ -202,6 +209,23 @@ export const CustomElement = (config) => {
|
|
|
202
209
|
//console.log(`${_this.localName} connected.`);
|
|
203
210
|
_this.setAttribute('pacem', '');
|
|
204
211
|
_this.setAttribute('cloak', '');
|
|
212
|
+
const faces = GET_VAL(proto, VIEWCHILD_SURFACES_VAR) ?? [];
|
|
213
|
+
if (!Utils.isNullOrEmpty(config.modifiers)
|
|
214
|
+
// if any surface face gets declared then the host must be spotted as a **surface** host, even if empty in modifiers
|
|
215
|
+
|| !Utils.isNullOrEmpty(faces)) {
|
|
216
|
+
const currentModifiers = _this.getAttribute(SURFACETHEME_MODIFIER_ATTR)?.split(/\s+/) ?? [];
|
|
217
|
+
const ownModifiers = (config.modifiers ?? []).slice(0);
|
|
218
|
+
if (!faces.some(f => f.face)) {
|
|
219
|
+
// no faces declared: the host is its own face
|
|
220
|
+
ownModifiers.push(SURFACETHEME_FACE_MODIFIER);
|
|
221
|
+
}
|
|
222
|
+
if (!faces.some(f => f.content)) {
|
|
223
|
+
// no contents declared: the host is its own content
|
|
224
|
+
ownModifiers.push(SURFACETHEME_CONTENT_MODIFIER);
|
|
225
|
+
}
|
|
226
|
+
const modifiers = currentModifiers.union(ownModifiers);
|
|
227
|
+
_this.setAttribute(SURFACETHEME_MODIFIER_ATTR, modifiers.join(' ').trim().replace(/\s+/g, ' '));
|
|
228
|
+
}
|
|
205
229
|
// reset INSTANCE_CHILDREN_VAR at connectedCallback
|
|
206
230
|
DEL_VAL(_this, INSTANCE_CHILDREN_VAR);
|
|
207
231
|
// ready to fire
|
|
@@ -324,6 +348,33 @@ export const CustomElement = (config) => {
|
|
|
324
348
|
if (!Utils.isNull(deferred))
|
|
325
349
|
deferred.resolve();
|
|
326
350
|
};
|
|
351
|
+
// apply surface face attributes
|
|
352
|
+
for (let item of faces) {
|
|
353
|
+
const element = _this[item.ref];
|
|
354
|
+
if (Utils.isNull(element)) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
// shadow dom
|
|
358
|
+
if (config.shadow) {
|
|
359
|
+
if (item.content) {
|
|
360
|
+
const part = typeof item.content === 'string' ? item.content : 'content';
|
|
361
|
+
Utils.addPart(element, part);
|
|
362
|
+
}
|
|
363
|
+
if (item.face) {
|
|
364
|
+
const part = typeof item.face === 'string' ? item.face : 'face';
|
|
365
|
+
Utils.addPart(element, part);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// non shadow dom
|
|
370
|
+
if (item.content) {
|
|
371
|
+
element.setAttribute(SURFACETHEME_CONTENT_ATTR, item.content.toString());
|
|
372
|
+
}
|
|
373
|
+
if (item.face) {
|
|
374
|
+
element.setAttribute(SURFACETHEME_FACE_ATTR, item.face.toString());
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
327
378
|
_this.removeAttribute('cloak');
|
|
328
379
|
//...now that the document is ready:
|
|
329
380
|
// fire original viewActivatedCallback
|
|
@@ -454,7 +505,7 @@ export const CustomElement = (config) => {
|
|
|
454
505
|
// put proved to have relevant attribute empty. (e.g. some widget utils like `PacemWidgetFetchParameterElement` need this)
|
|
455
506
|
|| Utils.isNullOrEmpty(attr)) {
|
|
456
507
|
var config;
|
|
457
|
-
if (val
|
|
508
|
+
if (Utils.isNull(val)) {
|
|
458
509
|
_this.removeAttribute(attrName);
|
|
459
510
|
}
|
|
460
511
|
else if (property && (config = property.config) && typeof config.converter.convertBack === 'function') {
|
|
@@ -637,19 +688,23 @@ export function Watch(config) {
|
|
|
637
688
|
}
|
|
638
689
|
};
|
|
639
690
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
691
|
+
export function ViewChild(selector, faceOrObj = false, content) {
|
|
692
|
+
let face;
|
|
693
|
+
// content falls back to face's truthy value when not provided.
|
|
694
|
+
if (typeof faceOrObj === 'object') {
|
|
695
|
+
const { face: face0, content: content0 } = faceOrObj;
|
|
696
|
+
face = face0;
|
|
697
|
+
content = content0 ?? (!!face0);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
face = faceOrObj;
|
|
701
|
+
content ??= (!!face);
|
|
702
|
+
}
|
|
652
703
|
return (target, prop, descriptor) => {
|
|
704
|
+
if (face || content) {
|
|
705
|
+
const faces = GET_VAL(target, VIEWCHILD_SURFACES_VAR, []);
|
|
706
|
+
faces.push({ ref: prop, face, content });
|
|
707
|
+
}
|
|
653
708
|
const key = `${prop}_${Utils.uniqueCode()}`;
|
|
654
709
|
function findElement() {
|
|
655
710
|
const _this = this, nodelist = (_this.shadowRoot || _this).querySelectorAll(selector);
|
|
@@ -665,7 +720,7 @@ export function ViewChild(selector) {
|
|
|
665
720
|
const _this = this;
|
|
666
721
|
// reset INSTANCE_CHILDREN_VAR on connectedCallback!
|
|
667
722
|
const dict = GET_VAL(_this, INSTANCE_CHILDREN_VAR, {});
|
|
668
|
-
return dict[key]
|
|
723
|
+
return dict[key] ??= findElement.call(_this);
|
|
669
724
|
}
|
|
670
725
|
if (delete target[prop]) {
|
|
671
726
|
Object.defineProperty(target, prop, {
|
package/dist/esm/defaults.js
CHANGED
package/dist/esm/events.js
CHANGED
package/dist/esm/eventtarget.js
CHANGED
package/dist/esm/expression.js
CHANGED
package/dist/esm/index-iife.js
CHANGED
package/dist/esm/index-net.js
CHANGED
package/dist/esm/index-root.js
CHANGED
package/dist/esm/index-ui.js
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/logger.js
CHANGED
package/dist/esm/prefix.js
CHANGED
package/dist/esm/promise.js
CHANGED
package/dist/esm/regex.js
CHANGED
package/dist/esm/storage.js
CHANGED
package/dist/esm/template.js
CHANGED
package/dist/esm/transforms.js
CHANGED
package/dist/esm/types.js
CHANGED
package/dist/esm/utils.js
CHANGED
package/package.json
CHANGED
package/typings/index.d.ts
CHANGED
|
@@ -313,6 +313,8 @@ export declare type CustomElementConfig = {
|
|
|
313
313
|
templateUrl?: string;
|
|
314
314
|
/** if `true` and shadow DOM is natively available then the templated content is hosted in a ShadowRoot */
|
|
315
315
|
shadow?: boolean;
|
|
316
|
+
/** theme behavioral identifiers */
|
|
317
|
+
modifiers?: string[];
|
|
316
318
|
};
|
|
317
319
|
|
|
318
320
|
/** Minimal shape of the (native or polyfilled) `CustomElementRegistry` used by {@link Utils.customElements} to define and look up custom elements. */
|
|
@@ -1536,7 +1538,6 @@ declare class PacemElement extends PacemEventTarget implements Wai {
|
|
|
1536
1538
|
[name: string]: string;
|
|
1537
1539
|
});
|
|
1538
1540
|
get aria(): Aria;
|
|
1539
|
-
private _aria;
|
|
1540
1541
|
static get emittedEventTypes(): Readonly<string[]>;
|
|
1541
1542
|
connectedCallback(): void;
|
|
1542
1543
|
viewActivatedCallback(): void;
|
|
@@ -3476,9 +3477,18 @@ export declare class Utils {
|
|
|
3476
3477
|
* whenever the host element reconnects to the DOM (`connectedCallback`, see the {@link CustomElement} decorator).
|
|
3477
3478
|
*
|
|
3478
3479
|
* @param selector CSS selector identifying the child element to bind to.
|
|
3480
|
+
* @param face Helps identifying actual surface for theming purposes.
|
|
3481
|
+
* @param content Helps identifying actual surface content for theming purposes, if different from face.
|
|
3479
3482
|
* @returns A property decorator to apply to the view-child field (read-only; no setter is defined).
|
|
3480
3483
|
*/
|
|
3481
|
-
export declare function ViewChild(selector: string
|
|
3484
|
+
export declare function ViewChild(selector: string, face?: string | boolean, content?: string | boolean): any;
|
|
3485
|
+
|
|
3486
|
+
export declare function ViewChild(selector: string, config?: ViewChildConfig): any;
|
|
3487
|
+
|
|
3488
|
+
declare type ViewChildConfig = {
|
|
3489
|
+
face: string | boolean;
|
|
3490
|
+
content?: string | boolean;
|
|
3491
|
+
};
|
|
3482
3492
|
|
|
3483
3493
|
declare interface Wai {
|
|
3484
3494
|
readonly aria: Aria;
|