@public-ui/hydrate 2.0.0-rc.0 → 2.0.0-rc.1

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.
Files changed (2) hide show
  1. package/dist/index.js +80 -37
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  /*!
9
- Stencil Mock Doc v4.3.0 | MIT Licensed | https://stenciljs.com
9
+ Stencil Mock Doc v4.5.0 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  const CONTENT_REF_ID = 'r';
12
12
  const ORG_LOCATION_ID = 'o';
@@ -1626,6 +1626,14 @@ class MockNodeList {
1626
1626
  }
1627
1627
  }
1628
1628
  class MockElement extends MockNode {
1629
+ attachInternals() {
1630
+ return new Proxy({}, {
1631
+ get: function (_target, prop, _receiver) {
1632
+ console.error(`NOTE: Property ${String(prop)} was accessed on ElementInternals, but this property is not implemented.
1633
+ Testing components with ElementInternals is fully supported in e2e tests.`);
1634
+ },
1635
+ });
1636
+ }
1629
1637
  constructor(ownerDocument, nodeName) {
1630
1638
  super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
1631
1639
  this.namespaceURI = null;
@@ -4953,7 +4961,7 @@ function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResu
4953
4961
 
4954
4962
 
4955
4963
  const NAMESPACE = 'kolibri';
4956
- const BUILD = /* kolibri */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: true, observeAttribute: true, patchPseudoShadowDom: false, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
4964
+ const BUILD = /* kolibri */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: true, observeAttribute: true, patchPseudoShadowDom: false, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
4957
4965
 
4958
4966
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4959
4967
 
@@ -5756,7 +5764,8 @@ class Translator extends EventEmitter {
5756
5764
  usedKey: key,
5757
5765
  exactUsedKey: key,
5758
5766
  usedLng: lng,
5759
- usedNS: namespace
5767
+ usedNS: namespace,
5768
+ usedParams: this.getUsedParamsDetails(options)
5760
5769
  };
5761
5770
  }
5762
5771
  return `${namespace}${nsSeparator}${key}`;
@@ -5767,7 +5776,8 @@ class Translator extends EventEmitter {
5767
5776
  usedKey: key,
5768
5777
  exactUsedKey: key,
5769
5778
  usedLng: lng,
5770
- usedNS: namespace
5779
+ usedNS: namespace,
5780
+ usedParams: this.getUsedParamsDetails(options)
5771
5781
  };
5772
5782
  }
5773
5783
  return key;
@@ -5792,6 +5802,7 @@ class Translator extends EventEmitter {
5792
5802
  }) : `key '${key} (${this.language})' returned an object instead of string.`;
5793
5803
  if (returnDetails) {
5794
5804
  resolved.res = r;
5805
+ resolved.usedParams = this.getUsedParamsDetails(options);
5795
5806
  return resolved;
5796
5807
  }
5797
5808
  return r;
@@ -5892,6 +5903,7 @@ class Translator extends EventEmitter {
5892
5903
  }
5893
5904
  if (returnDetails) {
5894
5905
  resolved.res = res;
5906
+ resolved.usedParams = this.getUsedParamsDetails(options);
5895
5907
  return resolved;
5896
5908
  }
5897
5909
  return res;
@@ -6041,6 +6053,30 @@ class Translator extends EventEmitter {
6041
6053
  if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
6042
6054
  return this.resourceStore.getResource(code, ns, key, options);
6043
6055
  }
6056
+ getUsedParamsDetails() {
6057
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6058
+ const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
6059
+ const useOptionsReplaceForData = options.replace && typeof options.replace !== 'string';
6060
+ let data = useOptionsReplaceForData ? options.replace : options;
6061
+ if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
6062
+ data.count = options.count;
6063
+ }
6064
+ if (this.options.interpolation.defaultVariables) {
6065
+ data = {
6066
+ ...this.options.interpolation.defaultVariables,
6067
+ ...data
6068
+ };
6069
+ }
6070
+ if (!useOptionsReplaceForData) {
6071
+ data = {
6072
+ ...data
6073
+ };
6074
+ for (const key of optionsKeys) {
6075
+ delete data[key];
6076
+ }
6077
+ }
6078
+ return data;
6079
+ }
6044
6080
  static hasDefaultValue(options) {
6045
6081
  const prefix = 'defaultValue';
6046
6082
  for (const option in options) {
@@ -7810,7 +7846,7 @@ const initKoliBri = () => {
7810
7846
  | . ' | .-. | | | ,--. | .-. \\ | .--' ,--.
7811
7847
  | |\\ \\ | '-' | | | | | | '--' / | | | |
7812
7848
  \`--' \`--´ \`---´ \`--' \`--' \`------´ \`--' \`--'
7813
- 🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 2.0.0-rc.0
7849
+ 🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 2.0.0-rc.1
7814
7850
  `, {
7815
7851
  forceLog: true,
7816
7852
  });
@@ -8279,36 +8315,42 @@ const createElm = (e, t, o, n) => {
8279
8315
  isSvgMode && "svg" === l && (isSvgMode = !1));
8280
8316
  }, updateFallbackSlotVisibility = e => {
8281
8317
  const t = e.childNodes;
8282
- let o, n, s, l, a, r;
8283
- for (n = 0, s = t.length; n < s; n++) if (o = t[n], 1 === o.nodeType) {
8284
- if (o["s-sr"]) for (a = o["s-sn"], o.hidden = !1, l = 0; l < s; l++) if (r = t[l].nodeType,
8285
- t[l]["s-hn"] !== o["s-hn"] || "" !== a) {
8286
- if (1 === r && a === t[l].getAttribute("slot")) {
8287
- o.hidden = !0;
8318
+ for (const e of t) if (1 === e.nodeType) {
8319
+ if (e["s-sr"]) {
8320
+ const o = e["s-sn"];
8321
+ e.hidden = !1;
8322
+ for (const n of t) if (n["s-hn"] !== e["s-hn"] || "" !== o) {
8323
+ if (1 === n.nodeType && o === n.getAttribute("slot")) {
8324
+ e.hidden = !0;
8325
+ break;
8326
+ }
8327
+ } else if (1 === n.nodeType || 3 === n.nodeType && "" !== n.textContent.trim()) {
8328
+ e.hidden = !0;
8288
8329
  break;
8289
8330
  }
8290
- } else if (1 === r || 3 === r && "" !== t[l].textContent.trim()) {
8291
- o.hidden = !0;
8292
- break;
8293
8331
  }
8294
- updateFallbackSlotVisibility(o);
8332
+ updateFallbackSlotVisibility(e);
8295
8333
  }
8296
- }, relocateNodes = [], relocateSlotContent = e => {
8297
- let t, o, n, s, l, a, r = 0;
8298
- const i = e.childNodes, d = i.length;
8299
- for (;r < d; r++) {
8300
- if (t = i[r], t["s-sr"] && (o = t["s-cr"]) && o.parentNode) for (n = o.parentNode.childNodes,
8301
- s = t["s-sn"], a = n.length - 1; a >= 0; a--) o = n[a], o["s-cn"] || o["s-nr"] || o["s-hn"] === t["s-hn"] || (isNodeLocatedInSlot(o, s) ? (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
8302
- checkSlotFallbackVisibility = !0, o["s-sn"] = o["s-sn"] || s, l ? l.$slotRefNode$ = t : relocateNodes.push({
8303
- $slotRefNode$: t,
8304
- $nodeToRelocate$: o
8305
- }), o["s-sr"] && relocateNodes.map((e => {
8306
- isNodeLocatedInSlot(e.$nodeToRelocate$, o["s-sn"]) && (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
8307
- l && !e.$slotRefNode$ && (e.$slotRefNode$ = l.$slotRefNode$));
8308
- }))) : relocateNodes.some((e => e.$nodeToRelocate$ === o)) || relocateNodes.push({
8309
- $nodeToRelocate$: o
8310
- }));
8311
- 1 === t.nodeType && relocateSlotContent(t);
8334
+ }, relocateNodes = [], markSlotContentForRelocation = e => {
8335
+ let t, o, n;
8336
+ for (const s of e.childNodes) {
8337
+ if (s["s-sr"] && (t = s["s-cr"]) && t.parentNode) {
8338
+ o = t.parentNode.childNodes;
8339
+ const e = s["s-sn"];
8340
+ for (n = o.length - 1; n >= 0; n--) if (t = o[n], !t["s-cn"] && !t["s-nr"] && t["s-hn"] !== s["s-hn"]) if (isNodeLocatedInSlot(t, e)) {
8341
+ let o = relocateNodes.find((e => e.$nodeToRelocate$ === t));
8342
+ checkSlotFallbackVisibility = !0, t["s-sn"] = t["s-sn"] || e, o ? o.$slotRefNode$ = s : relocateNodes.push({
8343
+ $slotRefNode$: s,
8344
+ $nodeToRelocate$: t
8345
+ }), t["s-sr"] && relocateNodes.map((e => {
8346
+ isNodeLocatedInSlot(e.$nodeToRelocate$, t["s-sn"]) && (o = relocateNodes.find((e => e.$nodeToRelocate$ === t)),
8347
+ o && !e.$slotRefNode$ && (e.$slotRefNode$ = o.$slotRefNode$));
8348
+ }));
8349
+ } else relocateNodes.some((e => e.$nodeToRelocate$ === t)) || relocateNodes.push({
8350
+ $nodeToRelocate$: t
8351
+ });
8352
+ }
8353
+ 1 === s.nodeType && markSlotContentForRelocation(s);
8312
8354
  }
8313
8355
  }, isNodeLocatedInSlot = (e, t) => 1 === e.nodeType ? null === e.getAttribute("slot") && "" === t || e.getAttribute("slot") === t : e["s-sn"] === t || "" === t, nullifyVNodeRefs = e => {
8314
8356
  (e.$attrs$ && e.$attrs$.ref && e.$attrs$.ref(null), e.$children$ && e.$children$.map(nullifyVNodeRefs));
@@ -8323,7 +8365,7 @@ const createElm = (e, t, o, n) => {
8323
8365
  BUILD.slotRelocation) {
8324
8366
  if (plt.$flags$ |= 1, checkSlotRelocate) {
8325
8367
  let e, t, o, n, s, l;
8326
- relocateSlotContent(a.$elm$);
8368
+ markSlotContentForRelocation(a.$elm$);
8327
8369
  let r = 0;
8328
8370
  for (;r < relocateNodes.length; r++) e = relocateNodes[r], t = e.$nodeToRelocate$,
8329
8371
  t["s-ol"] || (o = originalLocationDebugNode(t) ,
@@ -8387,9 +8429,9 @@ const callRender = (e, t, o, n) => {
8387
8429
  (safeCall(s, "componentDidRender"),
8388
8430
  BUILD.isDev ), 64 & e.$flags$ ? (n()) : (e.$flags$ |= 64, addHydratedFlag(o),
8389
8431
  (safeCall(s, "componentDidLoad"),
8390
- BUILD.isDev ), n(), (e.$onReadyResolve$(o), l || appDidLoad())), e.$onInstanceResolve$(o), (e.$onRenderResolve$ && (e.$onRenderResolve$(),
8391
- e.$onRenderResolve$ = void 0), 512 & e.$flags$ && nextTick((() => scheduleUpdate(e, !1))),
8392
- e.$flags$ &= -517);
8432
+ BUILD.isDev ), n(), (e.$onReadyResolve$(o), l || appDidLoad())), e.$onInstanceResolve$(o),
8433
+ (e.$onRenderResolve$ && (e.$onRenderResolve$(), e.$onRenderResolve$ = void 0),
8434
+ 512 & e.$flags$ && nextTick((() => scheduleUpdate(e, !1))), e.$flags$ &= -517);
8393
8435
  }, appDidLoad = e => {
8394
8436
  addHydratedFlag(doc.documentElement), nextTick((() => emitEvent(win, "appload", {
8395
8437
  detail: {
@@ -8477,10 +8519,11 @@ const callRender = (e, t, o, n) => {
8477
8519
  }
8478
8520
  }
8479
8521
  return e;
8480
- }, initializeComponent = async (e, t, o, n, s) => {
8522
+ }, initializeComponent = async (e, t, o, n) => {
8523
+ let s;
8481
8524
  if (0 == (32 & t.$flags$)) {
8482
8525
  if (t.$flags$ |= 32, BUILD.lazyLoad ) {
8483
- if ((s = loadModule(o)).then) {
8526
+ if (s = loadModule(o), s.then) {
8484
8527
  const e = (() => {});
8485
8528
  s = await s, e();
8486
8529
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/hydrate",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.1",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": "https://github.com/public-ui/kolibri",
@@ -42,11 +42,11 @@
42
42
  "hydrate"
43
43
  ],
44
44
  "devDependencies": {
45
- "@public-ui/components": "2.0.0-rc.0",
45
+ "@public-ui/components": "2.0.0-rc.1",
46
46
  "rimraf": "3.0.2"
47
47
  },
48
48
  "peerDependencies": {
49
- "@public-ui/components": "2.0.0-rc.0"
49
+ "@public-ui/components": "2.0.0-rc.1"
50
50
  },
51
51
  "sideEffects": false,
52
52
  "type": "commonjs",