@jxsuite/runtime 7.0.0 → 7.1.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/runtime.js CHANGED
@@ -29,21 +29,11 @@ var cacheStringFunction = (fn) => {
29
29
  return hit || (cache[str] = fn(str));
30
30
  };
31
31
  };
32
- var camelizeRE = /-\w/g;
33
- var camelize = cacheStringFunction((str) => {
34
- return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
35
- });
36
- var hyphenateRE = /\B([A-Z])/g;
37
- var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
38
- var capitalize = cacheStringFunction((str) => {
32
+ var capitalize = /* @__PURE__ */ cacheStringFunction((str) => {
39
33
  return str.charAt(0).toUpperCase() + str.slice(1);
40
34
  });
41
- var toHandlerKey = cacheStringFunction((str) => {
42
- const s = str ? `on${capitalize(str)}` : ``;
43
- return s;
44
- });
45
35
  var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
46
- var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
36
+ var specialBooleanAttrs = `itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
47
37
  var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
48
38
 
49
39
  // ../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
@@ -179,7 +169,11 @@ function effectScope(detached) {
179
169
  }
180
170
  function onScopeDispose(fn, failSilently = false) {
181
171
  if (activeEffectScope) {
182
- activeEffectScope.cleanups.push(fn);
172
+ if (activeEffectScope.active) {
173
+ activeEffectScope.cleanups.push(fn);
174
+ } else {
175
+ fn();
176
+ }
183
177
  } else if (!failSilently) {
184
178
  warn(`onScopeDispose() is called when there is no active effect scope to be associated with.`);
185
179
  }
@@ -907,7 +901,7 @@ function noTracking(self2, method, args = []) {
907
901
  return res;
908
902
  }
909
903
  var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
910
- var builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
904
+ var builtInSymbols = /* @__PURE__ */ new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
911
905
  function hasOwnProperty2(key) {
912
906
  if (!isSymbol(key))
913
907
  key = String(key);
@@ -1899,6 +1893,13 @@ function cssRuleText(conditions, selector, declarations) {
1899
1893
  }
1900
1894
  return text;
1901
1895
  }
1896
+ function commentedRuleText(rule) {
1897
+ if (rule.description === undefined) {
1898
+ return rule.text;
1899
+ }
1900
+ return `/* ${rule.description.replaceAll("*/", "* /")} */
1901
+ ${rule.text}`;
1902
+ }
1902
1903
  function cssKeyframesText(conditions, name, blocks) {
1903
1904
  const body = blocks.map(({ selector, declarations }) => `${selector} { ${declarations.map(([property, value]) => `${property}: ${value}`).join("; ")} }`).join(" ");
1904
1905
  let text = `@keyframes ${name} { ${body} }`;
@@ -1978,6 +1979,7 @@ function buildStyleRules(style, options = {}) {
1978
1979
  }
1979
1980
  return declarations;
1980
1981
  };
1982
+ const describedBy = (description) => isString2(description) && description !== "" ? { description } : {};
1981
1983
  const emit = (conditions, selector, declarations, target, description) => {
1982
1984
  if (declarations.length === 0) {
1983
1985
  return;
@@ -1999,10 +2001,7 @@ function buildStyleRules(style, options = {}) {
1999
2001
  target,
2000
2002
  key: hashCss(text)
2001
2003
  };
2002
- if (isString2(description) && description !== "") {
2003
- rule.description = description;
2004
- }
2005
- rules.push(rule);
2004
+ rules.push({ ...rule, ...describedBy(description) });
2006
2005
  };
2007
2006
  const emitKeyframes = (atKey, block, conditions) => {
2008
2007
  const name = atKey.slice("@keyframes".length).trim();
@@ -2030,7 +2029,8 @@ function buildStyleRules(style, options = {}) {
2030
2029
  key: hashCss(text),
2031
2030
  selector: null,
2032
2031
  target: "unscoped",
2033
- text
2032
+ text,
2033
+ ...describedBy(block["$description"])
2034
2034
  });
2035
2035
  };
2036
2036
  const walkAt = (atKey, block, selector, conditions, target) => {
@@ -5500,6 +5500,9 @@ function isSignal(v) {
5500
5500
  }
5501
5501
  function absorbAttribute(state, name, value, defaults) {
5502
5502
  const camelKey = name.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
5503
+ if (defaults?.has(camelKey) && defaults.get(camelKey) === undefined) {
5504
+ return;
5505
+ }
5503
5506
  const current = state[camelKey];
5504
5507
  if (isBoolean(current)) {
5505
5508
  state[camelKey] = value !== null && value !== "false";
@@ -5515,12 +5518,20 @@ function absorbAttribute(state, name, value, defaults) {
5515
5518
  function declaredDefaults(def) {
5516
5519
  const out = new Map;
5517
5520
  for (const [key, entry] of Object.entries(def.state ?? {})) {
5518
- if (isNonNullObject(entry)) {
5521
+ if (isString2(entry) && isTemplateString(entry)) {
5522
+ out.set(key, undefined);
5523
+ continue;
5524
+ }
5525
+ if (isNonNullObject(entry) && !Array.isArray(entry)) {
5519
5526
  if ("default" in entry) {
5520
5527
  out.set(key, entry.default);
5521
5528
  continue;
5522
5529
  }
5523
5530
  if (COMPUTED_STATE_KEYS.some((marker) => (marker in entry))) {
5531
+ out.set(key, undefined);
5532
+ continue;
5533
+ }
5534
+ if (hasSchemaKeywords(entry)) {
5524
5535
  continue;
5525
5536
  }
5526
5537
  }
@@ -5803,9 +5814,10 @@ async function defineElement(source, baseUrl) {
5803
5814
  const def = withProjectFormulas(live.doc);
5804
5815
  const defBase = live.base;
5805
5816
  const state = await buildScope(def, {}, defBase, { base: defBase, media: null, root: this });
5817
+ const connectDefaults = declaredDefaults(def);
5806
5818
  for (const attr of observedAttrs) {
5807
5819
  if (this.hasAttribute(attr)) {
5808
- absorbAttribute(state, attr, this.getAttribute(attr));
5820
+ absorbAttribute(state, attr, this.getAttribute(attr), connectDefaults);
5809
5821
  supplied[attr] = this.getAttribute(attr);
5810
5822
  }
5811
5823
  }
@@ -5919,7 +5931,7 @@ async function defineElement(source, baseUrl) {
5919
5931
  return;
5920
5932
  }
5921
5933
  reportUnrendered(this, tagName, failure);
5922
- const inputs = [...declaredDefaults(def).keys()].filter((key) => !isPrivateStateKey(key));
5934
+ const inputs = Object.keys(def.state ?? {}).filter((key) => !isPrivateStateKey(key) && !(connectDefaults.has(key) && connectDefaults.get(key) === undefined));
5923
5935
  let lastMessage = failure.message;
5924
5936
  let queued = false;
5925
5937
  const watch = effect(() => {
@@ -6316,6 +6328,7 @@ export {
6316
6328
  SLOT_WHITESPACE,
6317
6329
  SUPPORTED_SCHEMA_VERSION,
6318
6330
  _resetPrivatePropWarnings,
6331
+ absorbAttribute,
6319
6332
  applyStyle,
6320
6333
  bodyNeedsEraser,
6321
6334
  booleanAttrValue,
@@ -6324,8 +6337,10 @@ export {
6324
6337
  camelToKebab,
6325
6338
  canvasStyleValue,
6326
6339
  captureSlotted,
6340
+ commentedRuleText,
6327
6341
  cssPropertyName,
6328
6342
  cssRuleText,
6343
+ declaredDefaults,
6329
6344
  defineElement,
6330
6345
  distributeSlots,
6331
6346
  documentStyleText,
@@ -6334,6 +6349,7 @@ export {
6334
6349
  evaluateTemplateValue,
6335
6350
  hasSchemaKeywords,
6336
6351
  hashCss,
6352
+ instanceSupplies,
6337
6353
  isDeclarationAtRule,
6338
6354
  isKeyframesAtRule,
6339
6355
  isNestedSelectorKey,
@@ -6387,5 +6403,5 @@ export {
6387
6403
  updateInstanceProps
6388
6404
  };
6389
6405
 
6390
- //# debugId=A3ACE1824EF1406664756E2164756E21
6406
+ //# debugId=00BEC97E8AE119E064756E2164756E21
6391
6407
  //# sourceMappingURL=runtime.js.map