horizon-layout 1.0.0 → 1.0.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.
@@ -300,9 +300,17 @@
300
300
  // If it changes during a drag operation, the drag is cancelled
301
301
  // and the new config is applied immediately.
302
302
  $effect(() => {
303
- const inputConfig = config;
303
+ // Validation-time inputs are read on every run
304
+ // so that changing them revalidates the config.
305
+ void minWidthRatio;
306
+ void minHeightRatio;
307
+ void skipValidation;
308
+ void views;
304
309
 
305
- if (untrack(() => internalConfig && areConfigsEquivalent(internalConfig, inputConfig))) {
310
+ const external = $state.snapshot(config);
311
+ const internal = untrack(() => internalConfig && $state.snapshot(internalConfig));
312
+
313
+ if (internal && areConfigsEquivalent(internal, external)) {
306
314
  return;
307
315
  }
308
316
 
@@ -310,19 +318,16 @@
310
318
  dragData = null;
311
319
  }
312
320
 
313
- internalConfig = createInternalConfig(inputConfig);
321
+ internalConfig = createInternalConfig(external);
314
322
  });
315
323
 
316
324
  // Propagate internalConfig changes → external config binding.
317
325
  // Skipped while a drag is in progress to avoid propagating temporary intermediate states.
318
326
  $effect(() => {
319
327
  if (dragData || !internalConfig) return;
320
- if (
321
- !areConfigsEquivalent(
322
- internalConfig,
323
- untrack(() => config)
324
- )
325
- ) {
328
+
329
+ const external = untrack(() => $state.snapshot(config));
330
+ if (!areConfigsEquivalent(internalConfig, external)) {
326
331
  config = cloneConfig(internalConfig);
327
332
  }
328
333
  });
@@ -406,11 +411,11 @@
406
411
  const directionAxis = direction === 'left' || direction === 'right' ? 'horizontal' : 'vertical';
407
412
  const isDirectionLeftOrUp = direction === 'left' || direction === 'up';
408
413
 
409
- const edgeTabGroup = (root: NodeConfig, direction: Direction): TabGroupConfig => {
414
+ const edgeTabGroup = (root: NodeConfig): TabGroupConfig => {
410
415
  if (nodeConfigType(root) === 'tabGroup') return root as TabGroupConfig;
411
416
  const split = root as SplitConfig;
412
417
  const index = isDirectionLeftOrUp ? split.views.length - 1 : 0;
413
- return edgeTabGroup(split.views[index]!, direction);
418
+ return edgeTabGroup(split.views[index]!);
414
419
  };
415
420
 
416
421
  const findClosestTabGroupAndMoveTab = (child: NodeConfig) => {
@@ -427,10 +432,7 @@
427
432
  return findClosestTabGroupAndMoveTab(parentData.parent);
428
433
  }
429
434
 
430
- moveActiveTabToTabGroup(
431
- tabGroup,
432
- edgeTabGroup(parentData.parent.views[targetIndex]!, direction)
433
- );
435
+ moveActiveTabToTabGroup(tabGroup, edgeTabGroup(parentData.parent.views[targetIndex]!));
434
436
  };
435
437
 
436
438
  findClosestTabGroupAndMoveTab(tabGroup);
@@ -629,7 +631,7 @@
629
631
  const wanted = new Set(internalConfig.popouts ?? []);
630
632
 
631
633
  // Close any popouts that are no longer in the config.
632
- for (const id of [...popouts.keys()]) {
634
+ for (const id of popouts.keys()) {
633
635
  if (!wanted.has(id)) cleanupPopout(id, true);
634
636
  }
635
637
 
@@ -651,14 +653,14 @@
651
653
 
652
654
  // Close all popout windows when the base window closes or the component is unmounted.
653
655
  function closeAllPopouts() {
654
- for (const id of [...popouts.keys()]) {
656
+ for (const id of popouts.keys()) {
655
657
  cleanupPopout(id, true);
656
658
  }
657
659
  }
658
660
 
659
661
  function retryPendingPopouts() {
660
662
  const now = Date.now();
661
- for (const [id, since] of [...pendingPopouts.entries()]) {
663
+ for (const [id, since] of pendingPopouts.entries()) {
662
664
  if (now - since >= POPOUT_BLOCKED_TIMEOUT_MS) {
663
665
  pendingPopouts.delete(id);
664
666
  handleBlockedPopout(id);
package/package.json CHANGED
@@ -1,59 +1,58 @@
1
1
  {
2
- "name": "horizon-layout",
3
- "version": "1.0.0",
4
- "files": [
5
- "dist",
6
- "!dist/**/*.test.*",
7
- "!dist/**/*.spec.*"
8
- ],
9
- "sideEffects": [
10
- "**/*.css"
11
- ],
12
- "svelte": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "type": "module",
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "svelte": "./dist/index.js"
19
- },
20
- "./horizon-layout.css": "./dist/horizon-layout.css"
21
- },
22
- "peerDependencies": {
23
- "svelte": "^5.0.0"
24
- },
25
- "devDependencies": {
26
- "@eslint/compat": "^2.1.0",
27
- "@eslint/js": "^10.0.1",
28
- "@sveltejs/adapter-auto": "^7.0.1",
29
- "@sveltejs/kit": "^2.65.0",
30
- "@sveltejs/package": "^2.5.8",
31
- "@sveltejs/vite-plugin-svelte": "^7.1.2",
32
- "@types/node": "^25.9.3",
33
- "eslint": "^10.4.1",
34
- "eslint-config-prettier": "^10.1.8",
35
- "eslint-plugin-svelte": "^3.19.0",
36
- "globals": "^17.6.0",
37
- "prettier": "^3.8.4",
38
- "prettier-plugin-svelte": "^3.5.2",
39
- "publint": "^0.3.21",
40
- "svelte": "^5.56.3",
41
- "svelte-check": "^4.6.0",
42
- "typescript": "^6.0.3",
43
- "typescript-eslint": "^8.61.0",
44
- "vite": "^8.0.16"
45
- },
46
- "keywords": [
47
- "svelte"
48
- ],
49
- "license": "MIT",
50
- "scripts": {
51
- "dev": "vite dev",
52
- "build": "vite build && npm run prepack",
53
- "preview": "vite preview",
54
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
55
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
56
- "lint": "prettier --check . && eslint .",
57
- "format": "prettier --write ."
58
- }
59
- }
2
+ "name": "horizon-layout",
3
+ "version": "1.0.1",
4
+ "keywords": [
5
+ "svelte"
6
+ ],
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/play-horizon/horizon-layout"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "!dist/**/*.test.*",
15
+ "!dist/**/*.spec.*"
16
+ ],
17
+ "type": "module",
18
+ "sideEffects": [
19
+ "**/*.css"
20
+ ],
21
+ "types": "./dist/index.d.ts",
22
+ "svelte": "./dist/index.js",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "svelte": "./dist/index.js"
27
+ },
28
+ "./horizon-layout.css": "./dist/horizon-layout.css"
29
+ },
30
+ "scripts": {
31
+ "dev": "vite dev",
32
+ "build": "vite build && npm run prepack",
33
+ "preview": "vite preview",
34
+ "prepare": "svelte-kit sync || echo ''",
35
+ "prepack": "svelte-kit sync && svelte-package && publint",
36
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
37
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
38
+ "lint": "oxlint . && oxfmt --check .",
39
+ "format": "oxfmt ."
40
+ },
41
+ "devDependencies": {
42
+ "@sveltejs/adapter-auto": "^7.0.1",
43
+ "@sveltejs/kit": "^2.70.3",
44
+ "@sveltejs/package": "^2.5.8",
45
+ "@sveltejs/vite-plugin-svelte": "^7.3.0",
46
+ "@types/node": "^26.6.2",
47
+ "oxfmt": "^0.68.0",
48
+ "oxlint": "^1.83.0",
49
+ "publint": "^0.3.24",
50
+ "svelte": "^5.57.1",
51
+ "svelte-check": "^4.7.6",
52
+ "typescript": "^6.0.3",
53
+ "vite": "^8.3.0"
54
+ },
55
+ "peerDependencies": {
56
+ "svelte": "^5.0.0"
57
+ }
58
+ }