@jxsuite/runtime 4.0.1 → 4.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/runtime",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "JSON-native reactive web component runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,8 +33,8 @@
33
33
  "upgrade": "bun update --latest && bun install"
34
34
  },
35
35
  "dependencies": {
36
- "@jxsuite/schema": "^2.2.0",
37
- "@vue/reactivity": "3.5.42"
36
+ "@jxsuite/schema": "^3.0.0",
37
+ "@vue/reactivity": "3.5.43"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@happy-dom/global-registrator": "^20.14.5"
package/src/runtime.ts CHANGED
@@ -1915,27 +1915,30 @@ const SCOPE_TOKEN = "jx-scope";
1915
1915
  * wholesale. Sweeping on `isConnected` instead would be wrong rather than merely redundant: an
1916
1916
  * element is routinely styled before it is inserted.
1917
1917
  *
1918
+ * Both call sites reach this only once an element is already IN `scratchOwners`, and the only place
1919
+ * that happens (`scratchOwners.set`, below) always opens `scratch` first — so it is never still
1920
+ * null here.
1921
+ *
1918
1922
  * @param {SheetState} state
1919
1923
  */
1920
1924
  function rewriteScratch(state: SheetState) {
1921
- if (!state.scratch) {
1922
- return;
1923
- }
1924
- state.scratch.replaceAll([...state.scratchOwners.values()].flat());
1925
+ state.scratch!.replaceAll([...state.scratchOwners.values()].flat());
1925
1926
  }
1926
1927
 
1927
1928
  /**
1928
1929
  * Drop one reference to an interned rule set, removing its rules when the last one goes.
1929
1930
  *
1931
+ * `key` always names an entry `retainInterned` already created: {@link releaseElementStyles}'s two
1932
+ * call sites pass back exactly the `entry.interned`/`entry.hoisted` keys it was handed at
1933
+ * `retainInterned` time, and a stale `state` (one `resetDocumentStyles` already replaced) is turned
1934
+ * away before either call site is reached.
1935
+ *
1930
1936
  * @param {SheetState} state
1931
1937
  * @param {Map<string, InternEntry>} table
1932
1938
  * @param {string} key
1933
1939
  */
1934
1940
  function releaseInterned(state: SheetState, table: Map<string, InternEntry>, key: string) {
1935
- const entry = table.get(key);
1936
- if (!entry) {
1937
- return;
1938
- }
1941
+ const entry = table.get(key)!;
1939
1942
  entry.refs -= 1;
1940
1943
  if (entry.refs <= 0) {
1941
1944
  table.delete(key);
@@ -3131,6 +3134,9 @@ async function importAndInstantiate(def: JxScope, src: string, exportName: strin
3131
3134
  * Resolve a .class.json schema-defined class. Fetches the schema, follows $implementation if
3132
3135
  * hybrid, or constructs dynamically if self-contained.
3133
3136
  *
3137
+ * Its one caller, {@link resolveExternalPrototype}, already rejects a missing `$src` before this
3138
+ * runs, so `def.$src` is never empty here.
3139
+ *
3134
3140
  * @param {JxPrototypeDef} def
3135
3141
  * @param {JxScope} state
3136
3142
  * @param {string} key
@@ -3138,10 +3144,7 @@ async function importAndInstantiate(def: JxScope, src: string, exportName: strin
3138
3144
  * @returns {Promise<unknown>}
3139
3145
  */
3140
3146
  async function resolveClassJson(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {
3141
- const src = def.$src;
3142
- if (!src) {
3143
- throw new Error(`Jx: class entry '${key}' has no $src`);
3144
- }
3147
+ const src = def.$src!;
3145
3148
  let classDef: JxClassDef;
3146
3149
 
3147
3150
  // Bare specifiers (package references like @scope/pkg/file) can't be fetched directly —