@widgetstools/react-dock-manager 0.1.0 → 0.1.2

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/index.cjs CHANGED
@@ -4047,9 +4047,8 @@ var UnpinnedStripView = class {
4047
4047
  this.stripEl.removeEventListener("click", this.boundStripClick);
4048
4048
  this.boundStripClick = null;
4049
4049
  }
4050
- if (this.element.parentNode) {
4051
- this.element.parentNode.removeChild(this.element);
4052
- }
4050
+ this.stripEl.remove();
4051
+ this.element.remove();
4053
4052
  }
4054
4053
  // ── Private: Event delegation ──────────────────────────────────
4055
4054
  /** Set up event delegation on stripEl for all tab interactions */
@@ -4269,328 +4268,166 @@ function applyTheme(container, theme) {
4269
4268
  container.style.setProperty("--dock-scrollbar-thumb", colors.textMuted);
4270
4269
  container.style.setProperty("--dock-scrollbar-track", "transparent");
4271
4270
  }
4272
- var vsCodeLight = {
4273
- name: "VS Code Light",
4274
- mode: "light",
4275
- colors: {
4276
- bg: "220 20% 96%",
4277
- surface: "0 0% 100%",
4278
- surfaceAlt: "220 14% 95%",
4279
- panelHeader: "220 14% 92%",
4280
- tabBar: "220 14% 93%",
4281
- tabActive: "0 0% 100%",
4282
- tabText: "0 0% 38%",
4283
- tabTextActive: "217 91% 50%",
4284
- text: "0 0% 15%",
4285
- textSecondary: "0 0% 35%",
4286
- textMuted: "0 0% 50%",
4287
- border: "220 13% 82%",
4288
- splitter: "220 13% 87%",
4289
- splitterHover: "217 91% 60%",
4290
- hover: "220 14% 93%",
4291
- primary: "217 91% 50%",
4292
- floatShadow: "0 0% 0%"
4293
- }
4294
- };
4295
- var githubLight = {
4296
- name: "GitHub Light",
4297
- mode: "light",
4298
- colors: {
4299
- bg: "210 20% 97%",
4300
- surface: "0 0% 100%",
4301
- surfaceAlt: "210 18% 96%",
4302
- panelHeader: "210 18% 92%",
4303
- tabBar: "210 15% 94%",
4304
- tabActive: "0 0% 100%",
4305
- tabText: "210 10% 35%",
4306
- tabTextActive: "212 92% 45%",
4307
- text: "210 12% 16%",
4308
- textSecondary: "210 10% 32%",
4309
- textMuted: "210 8% 48%",
4310
- border: "210 14% 80%",
4311
- splitter: "210 14% 89%",
4312
- splitterHover: "212 92% 55%",
4313
- hover: "210 15% 94%",
4314
- primary: "212 92% 45%",
4315
- floatShadow: "210 20% 20%"
4271
+ var hsl = (h, s, l) => `${h} ${s}% ${l}%`;
4272
+ function createTheme(name, mode, base, accent, overrides) {
4273
+ const { hue: h, sat: s } = base;
4274
+ const { hue: ah, sat: as_ } = accent;
4275
+ let colors;
4276
+ if (mode === "light") {
4277
+ const bl = base.light ?? 96;
4278
+ const al = accent.light ?? 50;
4279
+ const ts = Math.max(s - 6, 0);
4280
+ colors = {
4281
+ bg: hsl(h, s, bl),
4282
+ surface: hsl(h, Math.max(s - 5, 0), Math.min(bl + 3, 100)),
4283
+ surfaceAlt: hsl(h, Math.max(s - 2, 0), bl - 1),
4284
+ panelHeader: hsl(h, Math.max(s - 2, 0), bl - 4),
4285
+ tabBar: hsl(h, Math.max(s - 5, 0), bl - 3),
4286
+ tabActive: hsl(h, Math.max(s - 5, 0), Math.min(bl + 3, 100)),
4287
+ tabText: hsl(h - 10, Math.max(ts - 8, 0), 35),
4288
+ tabTextActive: hsl(ah, as_, al),
4289
+ text: hsl(h - 10, Math.max(ts - 2, 0), 15),
4290
+ textSecondary: hsl(h - 10, Math.max(ts - 8, 0), 32),
4291
+ textMuted: hsl(h - 10, Math.max(ts - 12, 0), 48),
4292
+ border: hsl(h, Math.max(s - 6, 0), 80),
4293
+ splitter: hsl(h, Math.max(s - 6, 0), 87),
4294
+ splitterHover: hsl(ah, as_, al + 8),
4295
+ hover: hsl(h, Math.max(s - 5, 0), bl - 3),
4296
+ primary: hsl(ah, as_, al),
4297
+ floatShadow: hsl(h, Math.max(s, 0), 15)
4298
+ };
4299
+ } else {
4300
+ const bl = base.light ?? 10;
4301
+ const al = accent.light ?? 65;
4302
+ const ts = Math.round(s * 0.5);
4303
+ colors = {
4304
+ bg: hsl(h, s, bl),
4305
+ surface: hsl(h, s, bl + 3),
4306
+ surfaceAlt: hsl(h, Math.max(s - 2, 0), bl + 5),
4307
+ panelHeader: hsl(h, Math.max(s - 2, 0), bl + 8),
4308
+ tabBar: hsl(h, s, bl + 1),
4309
+ tabActive: hsl(h, s, bl + 3),
4310
+ tabText: hsl(h - 5, Math.max(ts, 8), 65),
4311
+ tabTextActive: hsl(ah, as_, al),
4312
+ text: hsl(h - 5, Math.round(s * 0.8), 90),
4313
+ textSecondary: hsl(h - 5, Math.max(ts, 8), 68),
4314
+ textMuted: hsl(h - 5, Math.max(ts - 3, 6), 50),
4315
+ border: hsl(h, Math.max(s - 2, 0), bl + 14),
4316
+ splitter: hsl(h, Math.max(s - 2, 0), bl + 10),
4317
+ splitterHover: hsl(ah, as_, al - 8),
4318
+ hover: hsl(h, Math.max(s - 2, 0), bl + 8),
4319
+ primary: hsl(ah, as_, al),
4320
+ floatShadow: hsl(h, Math.min(s + 5, 100), Math.max(bl - 7, 0))
4321
+ };
4316
4322
  }
4317
- };
4318
- var warmLight = {
4319
- name: "Warm Light",
4320
- mode: "light",
4321
- colors: {
4322
- bg: "40 30% 96%",
4323
- surface: "40 20% 99%",
4324
- surfaceAlt: "40 25% 95%",
4325
- panelHeader: "40 25% 91%",
4326
- tabBar: "40 20% 93%",
4327
- tabActive: "40 20% 99%",
4328
- tabText: "30 10% 35%",
4329
- tabTextActive: "25 80% 45%",
4330
- text: "30 15% 15%",
4331
- textSecondary: "30 10% 32%",
4332
- textMuted: "30 8% 48%",
4333
- border: "35 15% 80%",
4334
- splitter: "35 15% 87%",
4335
- splitterHover: "25 80% 55%",
4336
- hover: "40 20% 93%",
4337
- primary: "25 80% 45%",
4338
- floatShadow: "30 20% 15%"
4323
+ if (overrides) {
4324
+ Object.assign(colors, overrides);
4339
4325
  }
4340
- };
4341
- var solarizedLight = {
4342
- name: "Solarized Light",
4343
- mode: "light",
4344
- colors: {
4345
- bg: "44 87% 94%",
4346
- surface: "44 87% 97%",
4347
- surfaceAlt: "44 60% 93%",
4348
- panelHeader: "44 60% 89%",
4349
- tabBar: "44 50% 91%",
4350
- tabActive: "44 87% 97%",
4326
+ return { name, mode, colors };
4327
+ }
4328
+ var vsCodeLight = createTheme(
4329
+ "VS Code Light",
4330
+ "light",
4331
+ { hue: 220, sat: 20 },
4332
+ { hue: 217, sat: 91, light: 50 },
4333
+ { floatShadow: "0 0% 0%" }
4334
+ );
4335
+ var githubLight = createTheme(
4336
+ "GitHub Light",
4337
+ "light",
4338
+ { hue: 210, sat: 20, light: 97 },
4339
+ { hue: 212, sat: 92, light: 45 },
4340
+ { floatShadow: "210 20% 20%" }
4341
+ );
4342
+ var warmLight = createTheme(
4343
+ "Warm Light",
4344
+ "light",
4345
+ { hue: 40, sat: 30 },
4346
+ { hue: 25, sat: 80, light: 45 }
4347
+ );
4348
+ var solarizedLight = createTheme(
4349
+ "Solarized Light",
4350
+ "light",
4351
+ { hue: 44, sat: 87, light: 94 },
4352
+ { hue: 175, sat: 59, light: 35 },
4353
+ {
4351
4354
  tabText: "194 14% 35%",
4352
- tabTextActive: "175 59% 35%",
4353
4355
  text: "192 81% 14%",
4354
4356
  textSecondary: "194 14% 32%",
4355
4357
  textMuted: "180 8% 48%",
4356
- border: "44 30% 80%",
4357
- splitter: "44 30% 85%",
4358
- splitterHover: "175 59% 45%",
4359
- hover: "44 50% 91%",
4360
- primary: "175 59% 35%",
4361
4358
  floatShadow: "44 20% 30%"
4362
4359
  }
4363
- };
4364
- var sepiaLight = {
4365
- name: "Sepia",
4366
- mode: "light",
4367
- colors: {
4368
- bg: "35 35% 94%",
4369
- surface: "35 30% 97%",
4370
- surfaceAlt: "35 28% 93%",
4371
- panelHeader: "35 28% 88%",
4372
- tabBar: "35 25% 90%",
4373
- tabActive: "35 30% 97%",
4374
- tabText: "25 12% 35%",
4375
- tabTextActive: "18 60% 42%",
4376
- text: "25 20% 18%",
4377
- textSecondary: "25 12% 32%",
4378
- textMuted: "25 8% 48%",
4379
- border: "30 18% 80%",
4380
- splitter: "30 18% 85%",
4381
- splitterHover: "18 60% 50%",
4382
- hover: "35 25% 91%",
4383
- primary: "18 60% 42%",
4384
- floatShadow: "25 15% 25%"
4385
- }
4386
- };
4387
- var mintLight = {
4388
- name: "Mint",
4389
- mode: "light",
4390
- colors: {
4391
- bg: "150 20% 96%",
4392
- surface: "150 15% 99%",
4393
- surfaceAlt: "150 18% 95%",
4394
- panelHeader: "150 18% 90%",
4395
- tabBar: "150 15% 92%",
4396
- tabActive: "150 15% 99%",
4397
- tabText: "160 10% 35%",
4398
- tabTextActive: "162 63% 35%",
4399
- text: "160 18% 14%",
4400
- textSecondary: "160 10% 32%",
4401
- textMuted: "155 8% 48%",
4402
- border: "150 14% 80%",
4403
- splitter: "150 14% 87%",
4404
- splitterHover: "162 63% 45%",
4405
- hover: "150 15% 93%",
4406
- primary: "162 63% 35%",
4407
- floatShadow: "155 15% 20%"
4408
- }
4409
- };
4410
- var lavenderLight = {
4411
- name: "Lavender",
4412
- mode: "light",
4413
- colors: {
4414
- bg: "260 20% 96%",
4415
- surface: "260 15% 99%",
4416
- surfaceAlt: "260 16% 95%",
4417
- panelHeader: "260 16% 90%",
4418
- tabBar: "260 14% 92%",
4419
- tabActive: "260 15% 99%",
4420
- tabText: "265 10% 35%",
4421
- tabTextActive: "262 52% 50%",
4422
- text: "265 18% 16%",
4423
- textSecondary: "265 10% 32%",
4424
- textMuted: "260 8% 48%",
4425
- border: "260 14% 80%",
4426
- splitter: "260 14% 87%",
4427
- splitterHover: "262 52% 58%",
4428
- hover: "260 14% 93%",
4429
- primary: "262 52% 50%",
4430
- floatShadow: "260 15% 22%"
4431
- }
4432
- };
4433
- var vsCodeDark = {
4434
- name: "VS Code Dark",
4435
- mode: "dark",
4436
- colors: {
4437
- bg: "222 47% 7%",
4438
- surface: "222 47% 10%",
4439
- surfaceAlt: "222 47% 12%",
4440
- panelHeader: "222 47% 15%",
4441
- tabBar: "222 47% 11%",
4442
- tabActive: "222 47% 10%",
4443
- tabText: "215 20% 65%",
4444
- tabTextActive: "217 91% 70%",
4445
- text: "210 40% 96%",
4446
- textSecondary: "215 20% 68%",
4447
- textMuted: "215 15% 50%",
4448
- border: "217 33% 24%",
4449
- splitter: "217 33% 20%",
4450
- splitterHover: "217 91% 60%",
4451
- hover: "217 33% 16%",
4452
- primary: "217 91% 70%",
4453
- floatShadow: "0 0% 0%"
4454
- }
4455
- };
4456
- var draculaDark = {
4457
- name: "Dracula Dark",
4458
- mode: "dark",
4459
- colors: {
4460
- bg: "231 15% 14%",
4461
- surface: "231 15% 17%",
4462
- surfaceAlt: "231 15% 19%",
4463
- panelHeader: "231 15% 22%",
4464
- tabBar: "231 15% 16%",
4465
- tabActive: "231 15% 17%",
4466
- tabText: "225 15% 65%",
4467
- tabTextActive: "265 90% 72%",
4468
- text: "60 30% 92%",
4469
- textSecondary: "225 15% 68%",
4470
- textMuted: "225 12% 50%",
4471
- border: "231 15% 28%",
4472
- splitter: "231 15% 24%",
4473
- splitterHover: "265 90% 60%",
4474
- hover: "231 15% 22%",
4475
- primary: "265 90% 72%",
4476
- floatShadow: "231 20% 5%"
4477
- }
4478
- };
4479
- var nordDark = {
4480
- name: "Nord Dark",
4481
- mode: "dark",
4482
- colors: {
4483
- bg: "220 16% 16%",
4484
- surface: "220 16% 20%",
4485
- surfaceAlt: "220 16% 22%",
4486
- panelHeader: "220 16% 25%",
4487
- tabBar: "220 16% 19%",
4488
- tabActive: "220 16% 20%",
4489
- tabText: "219 14% 65%",
4490
- tabTextActive: "193 43% 60%",
4491
- text: "219 28% 88%",
4492
- textSecondary: "219 14% 68%",
4493
- textMuted: "219 12% 50%",
4494
- border: "220 16% 30%",
4495
- splitter: "220 16% 26%",
4496
- splitterHover: "193 43% 50%",
4497
- hover: "220 16% 24%",
4498
- primary: "193 43% 60%",
4499
- floatShadow: "220 20% 8%"
4500
- }
4501
- };
4502
- var solarizedDark = {
4503
- name: "Solarized Dark",
4504
- mode: "dark",
4505
- colors: {
4506
- bg: "192 81% 8%",
4507
- surface: "192 81% 11%",
4508
- surfaceAlt: "192 60% 13%",
4509
- panelHeader: "192 60% 16%",
4510
- tabBar: "192 70% 10%",
4511
- tabActive: "192 81% 11%",
4360
+ );
4361
+ var sepiaLight = createTheme(
4362
+ "Sepia",
4363
+ "light",
4364
+ { hue: 35, sat: 35, light: 94 },
4365
+ { hue: 18, sat: 60, light: 42 }
4366
+ );
4367
+ var mintLight = createTheme(
4368
+ "Mint",
4369
+ "light",
4370
+ { hue: 150, sat: 20 },
4371
+ { hue: 162, sat: 63, light: 35 }
4372
+ );
4373
+ var lavenderLight = createTheme(
4374
+ "Lavender",
4375
+ "light",
4376
+ { hue: 260, sat: 20 },
4377
+ { hue: 262, sat: 52, light: 50 }
4378
+ );
4379
+ var vsCodeDark = createTheme(
4380
+ "VS Code Dark",
4381
+ "dark",
4382
+ { hue: 222, sat: 47, light: 7 },
4383
+ { hue: 217, sat: 91, light: 70 },
4384
+ { text: "210 40% 96%", floatShadow: "0 0% 0%" }
4385
+ );
4386
+ var draculaDark = createTheme(
4387
+ "Dracula Dark",
4388
+ "dark",
4389
+ { hue: 231, sat: 15, light: 14 },
4390
+ { hue: 265, sat: 90, light: 72 },
4391
+ { text: "60 30% 92%" }
4392
+ );
4393
+ var nordDark = createTheme(
4394
+ "Nord Dark",
4395
+ "dark",
4396
+ { hue: 220, sat: 16, light: 16 },
4397
+ { hue: 193, sat: 43, light: 60 },
4398
+ { text: "219 28% 88%" }
4399
+ );
4400
+ var solarizedDark = createTheme(
4401
+ "Solarized Dark",
4402
+ "dark",
4403
+ { hue: 192, sat: 81, light: 8 },
4404
+ { hue: 175, sat: 59, light: 55 },
4405
+ {
4512
4406
  tabText: "180 8% 65%",
4513
- tabTextActive: "175 59% 55%",
4514
4407
  text: "44 87% 94%",
4515
4408
  textSecondary: "180 8% 68%",
4516
4409
  textMuted: "194 14% 50%",
4517
- border: "192 50% 24%",
4518
- splitter: "192 50% 16%",
4519
- splitterHover: "175 59% 50%",
4520
- hover: "192 60% 15%",
4521
- primary: "175 59% 55%",
4522
4410
  floatShadow: "192 60% 3%"
4523
4411
  }
4524
- };
4525
- var midnightDark = {
4526
- name: "Midnight Blue",
4527
- mode: "dark",
4528
- colors: {
4529
- bg: "225 30% 10%",
4530
- surface: "225 28% 13%",
4531
- surfaceAlt: "225 26% 15%",
4532
- panelHeader: "225 26% 18%",
4533
- tabBar: "225 28% 12%",
4534
- tabActive: "225 28% 13%",
4535
- tabText: "220 15% 65%",
4536
- tabTextActive: "210 60% 65%",
4537
- text: "220 25% 90%",
4538
- textSecondary: "220 15% 68%",
4539
- textMuted: "220 12% 50%",
4540
- border: "225 25% 24%",
4541
- splitter: "225 25% 20%",
4542
- splitterHover: "210 60% 55%",
4543
- hover: "225 26% 18%",
4544
- primary: "210 60% 65%",
4545
- floatShadow: "225 30% 4%"
4546
- }
4547
- };
4548
- var forestDark = {
4549
- name: "Forest Dark",
4550
- mode: "dark",
4551
- colors: {
4552
- bg: "160 18% 9%",
4553
- surface: "160 16% 12%",
4554
- surfaceAlt: "160 14% 14%",
4555
- panelHeader: "160 14% 17%",
4556
- tabBar: "160 16% 11%",
4557
- tabActive: "160 16% 12%",
4558
- tabText: "155 10% 65%",
4559
- tabTextActive: "152 50% 55%",
4560
- text: "150 15% 90%",
4561
- textSecondary: "155 10% 68%",
4562
- textMuted: "155 8% 50%",
4563
- border: "160 14% 24%",
4564
- splitter: "160 14% 18%",
4565
- splitterHover: "152 50% 48%",
4566
- hover: "160 14% 16%",
4567
- primary: "152 50% 55%",
4568
- floatShadow: "160 18% 3%"
4569
- }
4570
- };
4571
- var slateDark = {
4572
- name: "Slate Dark",
4573
- mode: "dark",
4574
- colors: {
4575
- bg: "215 12% 11%",
4576
- surface: "215 10% 14%",
4577
- surfaceAlt: "215 9% 16%",
4578
- panelHeader: "215 9% 19%",
4579
- tabBar: "215 10% 13%",
4580
- tabActive: "215 10% 14%",
4581
- tabText: "210 8% 65%",
4582
- tabTextActive: "205 40% 62%",
4583
- text: "210 15% 90%",
4584
- textSecondary: "210 8% 68%",
4585
- textMuted: "210 6% 50%",
4586
- border: "215 9% 24%",
4587
- splitter: "215 9% 20%",
4588
- splitterHover: "205 40% 52%",
4589
- hover: "215 9% 18%",
4590
- primary: "205 40% 62%",
4591
- floatShadow: "215 12% 4%"
4592
- }
4593
- };
4412
+ );
4413
+ var midnightDark = createTheme(
4414
+ "Midnight Blue",
4415
+ "dark",
4416
+ { hue: 225, sat: 30 },
4417
+ { hue: 210, sat: 60, light: 65 }
4418
+ );
4419
+ var forestDark = createTheme(
4420
+ "Forest Dark",
4421
+ "dark",
4422
+ { hue: 160, sat: 18, light: 9 },
4423
+ { hue: 152, sat: 50, light: 55 }
4424
+ );
4425
+ var slateDark = createTheme(
4426
+ "Slate Dark",
4427
+ "dark",
4428
+ { hue: 215, sat: 12, light: 11 },
4429
+ { hue: 205, sat: 40, light: 62 }
4430
+ );
4594
4431
  var themes = {
4595
4432
  // Light
4596
4433
  vsCodeLight,
@@ -5610,9 +5447,11 @@ var DockManagerCore = react.forwardRef(
5610
5447
  function DockManagerCore2(props, ref) {
5611
5448
  const {
5612
5449
  initialState,
5450
+ widgets,
5613
5451
  renderPanel,
5614
5452
  renderTab,
5615
5453
  renderHeaderActions,
5454
+ onReady,
5616
5455
  onStateChange,
5617
5456
  onWillClose,
5618
5457
  onWillDrop,
@@ -5625,26 +5464,12 @@ var DockManagerCore = react.forwardRef(
5625
5464
  const dockRef = react.useRef(null);
5626
5465
  const [portals, setPortals] = react.useState(/* @__PURE__ */ new Map());
5627
5466
  const [, forceUpdate] = react.useState(0);
5628
- const renderPanelRef = react.useRef(renderPanel);
5629
- renderPanelRef.current = renderPanel;
5630
- const renderTabRef = react.useRef(renderTab);
5631
- renderTabRef.current = renderTab;
5632
- const renderHeaderActionsRef = react.useRef(renderHeaderActions);
5633
- renderHeaderActionsRef.current = renderHeaderActions;
5634
- const onStateChangeRef = react.useRef(onStateChange);
5635
- onStateChangeRef.current = onStateChange;
5636
- const onWillCloseRef = react.useRef(onWillClose);
5637
- onWillCloseRef.current = onWillClose;
5638
- const onWillDropRef = react.useRef(onWillDrop);
5639
- onWillDropRef.current = onWillDrop;
5467
+ const callbackRefs = react.useRef({ renderPanel, renderTab, renderHeaderActions, onStateChange, onWillClose, onWillDrop, onReady, widgets });
5468
+ callbackRefs.current = { renderPanel, renderTab, renderHeaderActions, onStateChange, onWillClose, onWillDrop, onReady, widgets };
5640
5469
  react.useEffect(() => {
5641
5470
  if (!containerRef.current) return;
5642
5471
  const addPortal = (key, entry) => {
5643
- setPortals((prev) => {
5644
- const next = new Map(prev);
5645
- next.set(key, entry);
5646
- return next;
5647
- });
5472
+ setPortals((prev) => new Map(prev).set(key, entry));
5648
5473
  };
5649
5474
  const removePortal = (key) => {
5650
5475
  setPortals((prev) => {
@@ -5662,37 +5487,32 @@ var DockManagerCore = react.forwardRef(
5662
5487
  createContent: (panelId, container, api) => {
5663
5488
  const key = `content:${panelId}:${++portalCounter}`;
5664
5489
  addPortal(key, { container, panelId, type: "content", api });
5665
- return {
5666
- dispose: () => removePortal(key)
5667
- };
5490
+ return { dispose: () => removePortal(key) };
5668
5491
  },
5669
5492
  createTab: renderTab ? (panelId, container, isActive) => {
5670
5493
  const key = `tab:${panelId}:${++portalCounter}`;
5671
5494
  addPortal(key, { container, panelId, type: "tab", isActive });
5672
- return {
5673
- dispose: () => removePortal(key)
5674
- };
5495
+ return { dispose: () => removePortal(key) };
5675
5496
  } : void 0,
5676
5497
  createHeaderActions: renderHeaderActions ? (slot, tabGroupId, container) => {
5677
5498
  const key = `header:${slot}:${tabGroupId}:${++portalCounter}`;
5678
5499
  addPortal(key, { container, panelId: "", type: "headerAction", slot, tabGroupId });
5679
- return {
5680
- dispose: () => removePortal(key)
5681
- };
5500
+ return { dispose: () => removePortal(key) };
5682
5501
  } : void 0,
5683
5502
  onStateChange: (state2) => {
5684
- onStateChangeRef.current?.(state2);
5503
+ callbackRefs.current.onStateChange?.(state2);
5685
5504
  forceUpdate((n) => n + 1);
5686
5505
  },
5687
5506
  onWillClose: (event, panelId) => {
5688
- onWillCloseRef.current?.(event, panelId);
5507
+ callbackRefs.current.onWillClose?.(event, panelId);
5689
5508
  },
5690
5509
  onWillDrop: (event, sourceId, targetId, position) => {
5691
- onWillDropRef.current?.(event, sourceId, targetId, position);
5510
+ callbackRefs.current.onWillDrop?.(event, sourceId, targetId, position);
5692
5511
  }
5693
5512
  };
5694
5513
  const dock = new DockviewComponent(containerRef.current, options);
5695
5514
  dockRef.current = dock;
5515
+ callbackRefs.current.onReady?.(dock.api);
5696
5516
  return () => {
5697
5517
  dock.dispose();
5698
5518
  dockRef.current = null;
@@ -5701,18 +5521,13 @@ var DockManagerCore = react.forwardRef(
5701
5521
  }, []);
5702
5522
  const themeKey = typeof theme === "object" ? theme.name : theme;
5703
5523
  react.useEffect(() => {
5704
- dockRef.current?.updateOptions({ theme });
5705
- }, [themeKey]);
5706
- react.useEffect(() => {
5707
- if (allowRootDock !== void 0) {
5708
- dockRef.current?.updateOptions({ allowRootDock });
5709
- }
5710
- }, [allowRootDock]);
5711
- react.useEffect(() => {
5712
- if (resourceStrings !== void 0) {
5713
- dockRef.current?.updateOptions({ resourceStrings });
5714
- }
5715
- }, [resourceStrings]);
5524
+ if (!dockRef.current) return;
5525
+ dockRef.current.updateOptions({
5526
+ ...theme !== void 0 && { theme },
5527
+ ...allowRootDock !== void 0 && { allowRootDock },
5528
+ ...resourceStrings !== void 0 && { resourceStrings }
5529
+ });
5530
+ }, [themeKey, allowRootDock, resourceStrings]);
5716
5531
  react.useImperativeHandle(ref, () => ({
5717
5532
  dispatch: (action) => dockRef.current?.dispatch(action),
5718
5533
  getState: () => dockRef.current?.getState() ?? initialState,
@@ -5721,26 +5536,33 @@ var DockManagerCore = react.forwardRef(
5721
5536
  }));
5722
5537
  const portalElements = [];
5723
5538
  const state = dockRef.current?.getState();
5539
+ const cbs = callbackRefs.current;
5724
5540
  portals.forEach((entry, key) => {
5725
5541
  let content = null;
5726
5542
  switch (entry.type) {
5727
5543
  case "content": {
5728
5544
  const panel = state?.panels[entry.panelId];
5729
5545
  if (panel && entry.api) {
5730
- content = renderPanelRef.current(entry.panelId, panel, entry.api);
5546
+ const widgetType = panel.widgetType || "";
5547
+ const Widget = cbs.widgets?.[widgetType];
5548
+ if (Widget) {
5549
+ content = /* @__PURE__ */ jsxRuntime.jsx(Widget, { panelId: entry.panelId, panel, api: entry.api });
5550
+ } else if (cbs.renderPanel) {
5551
+ content = cbs.renderPanel(entry.panelId, panel, entry.api);
5552
+ }
5731
5553
  }
5732
5554
  break;
5733
5555
  }
5734
5556
  case "tab": {
5735
5557
  const panel = state?.panels[entry.panelId];
5736
- if (panel && renderTabRef.current) {
5737
- content = renderTabRef.current(entry.panelId, panel, entry.isActive ?? false);
5558
+ if (panel && cbs.renderTab) {
5559
+ content = cbs.renderTab(entry.panelId, panel, entry.isActive ?? false);
5738
5560
  }
5739
5561
  break;
5740
5562
  }
5741
5563
  case "headerAction": {
5742
- if (renderHeaderActionsRef.current && entry.slot && entry.tabGroupId) {
5743
- content = renderHeaderActionsRef.current(entry.slot, entry.tabGroupId);
5564
+ if (cbs.renderHeaderActions && entry.slot && entry.tabGroupId) {
5565
+ content = cbs.renderHeaderActions(entry.slot, entry.tabGroupId);
5744
5566
  }
5745
5567
  break;
5746
5568
  }
@@ -5811,6 +5633,7 @@ exports.DockviewComponent = DockviewComponent;
5811
5633
  exports.EventEmitter = EventEmitter;
5812
5634
  exports.clearLocalStorage = clearLocalStorage;
5813
5635
  exports.createDefaultState = createDefaultState;
5636
+ exports.createTheme = createTheme;
5814
5637
  exports.deserialize = deserialize;
5815
5638
  exports.dockReducer = dockReducer;
5816
5639
  exports.draculaDark = draculaDark;