plggmatic 0.5.11 → 0.5.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"docChrome.d.ts","sourceRoot":"","sources":["../../../src/Shell/usecase/docChrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAapC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,UAClB,KAAK,KACX,OAAuC,CAAC;AAwgB3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UACvB,KAAK,KACX,OAKG,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,YAAY,UAChB,KAAK,KACX,OAmFF,CAAC"}
1
+ {"version":3,"file":"docChrome.d.ts","sourceRoot":"","sources":["../../../src/Shell/usecase/docChrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAapC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,UAClB,KAAK,KACX,OAAuC,CAAC;AA6kB3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UACvB,KAAK,KACX,OAKG,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,YAAY,UAChB,KAAK,KACX,OAoFF,CAAC"}
package/dist/index.es.js CHANGED
@@ -3058,6 +3058,10 @@ const dress = (c) => {
3058
3058
  sync();
3059
3059
  });
3060
3060
  drawer.addEventListener("change", sync);
3061
+ new MutationObserver(sync).observe(document.documentElement, {
3062
+ attributes: true,
3063
+ attributeFilter: [c.min],
3064
+ });
3061
3065
  desktop.addEventListener("change", sync);
3062
3066
  sync();
3063
3067
  }
@@ -3103,15 +3107,31 @@ const dress = (c) => {
3103
3107
  "]:not([" +
3104
3108
  c.leaving +
3105
3109
  "])"));
3110
+ const copyByCommand = (value) => {
3111
+ const field = document.createElement("textarea");
3112
+ field.value = value;
3113
+ field.setAttribute("readonly", "");
3114
+ field.style.position = "fixed";
3115
+ field.style.opacity = "0";
3116
+ document.body.append(field);
3117
+ field.select();
3118
+ const copied = document.execCommand("copy");
3119
+ field.remove();
3120
+ return copied;
3121
+ };
3106
3122
  const copy = (value, done) => {
3107
3123
  const fail = () => announce(label("クリップボードにコピーできませんでした。", "Could not copy to the clipboard."));
3108
- if (!navigator.clipboard) {
3109
- fail();
3124
+ const fallback = () => copyByCommand(value)
3125
+ ? announce(done)
3126
+ : fail();
3127
+ if (!navigator.clipboard ||
3128
+ !window.isSecureContext) {
3129
+ fallback();
3110
3130
  return;
3111
3131
  }
3112
3132
  navigator.clipboard
3113
3133
  .writeText(value)
3114
- .then(() => announce(done), fail);
3134
+ .then(() => announce(done), fallback);
3115
3135
  };
3116
3136
  const addActions = (col, mount) => {
3117
3137
  const menu = document.createElement("details");
@@ -3187,7 +3207,18 @@ const dress = (c) => {
3187
3207
  behavior: motion,
3188
3208
  });
3189
3209
  };
3210
+ let shownColumns = 0;
3211
+ let homeColumn = null;
3212
+ home.addEventListener("click", (event) => {
3213
+ if (homeColumn &&
3214
+ homeColumn.isConnected &&
3215
+ columns().length > 1) {
3216
+ event.preventDefault();
3217
+ bring(homeColumn);
3218
+ }
3219
+ });
3190
3220
  const sync = () => {
3221
+ homeColumn = null;
3191
3222
  room.style.width = "0px";
3192
3223
  const open = columns();
3193
3224
  const crumbs = [];
@@ -3213,6 +3244,10 @@ const dress = (c) => {
3213
3244
  close.hidden = !col.querySelector("." + c.fold);
3214
3245
  if (open.length < 2)
3215
3246
  return;
3247
+ if (hrefFor(col) === home.href) {
3248
+ homeColumn = col;
3249
+ return;
3250
+ }
3216
3251
  const item = document.createElement("li");
3217
3252
  const button = document.createElement("button");
3218
3253
  button.type = "button";
@@ -3223,6 +3258,14 @@ const dress = (c) => {
3223
3258
  item.append(button);
3224
3259
  crumbs.push(item);
3225
3260
  });
3261
+ if (open.length >= 3 &&
3262
+ shownColumns < 3 &&
3263
+ fold &&
3264
+ window.matchMedia("(min-width: 1024px)")
3265
+ .matches &&
3266
+ !document.documentElement.hasAttribute(c.min))
3267
+ fold.click();
3268
+ shownColumns = open.length;
3226
3269
  divider.hidden = crumbs.length === 0;
3227
3270
  path.replaceChildren(...crumbs);
3228
3271
  trail.scrollLeft = trail.scrollWidth;
@@ -3304,7 +3347,8 @@ const docChromeCss = (theme) => {
3304
3347
  `${C} .${p}-doc-trail li{display:flex;align-items:center;gap:.5rem;font-size:.875rem}`,
3305
3348
  `${C} .${p}-doc-trail li+li::before{content:"›";color:${v("muted")}}`,
3306
3349
  `${C} .${p}-doc-trail button{border:0;border-radius:.4rem;background:none;color:inherit;font:inherit;padding:.08rem .4rem;cursor:pointer;transition:background-color .15s ease}`,
3307
- `${C} .${p}-doc-trail button:is(:hover,:focus-visible),${C} .${p}-shell-bar-brand:is(:hover,:focus-visible){background:${tint(7)};color:${v("text")}}`,
3350
+ `${C} .${p}-doc-trail button:is(:hover,:focus-visible){background:${tint(7)};color:${v("text")}}`,
3351
+ `${C} .${p}-shell-bar-brand:is(:hover,:focus-visible){background:${v("text")};color:${v("surface")}}`,
3308
3352
  `${C} .${p}-shell-page .${p}-shell-head{position:relative;align-items:center;overflow:visible;padding:.65rem .85rem .25rem 1.25rem;height:auto;min-height:3rem;border-bottom:0;background:transparent}`,
3309
3353
  `${C} .${p}-shell-page .${p}-shell-head:has(details[open]){z-index:2}`,
3310
3354
  `${C} .${p}-shell-title{color:${v("text")};font-size:1.125rem;margin:0}`,
@@ -2401,6 +2401,10 @@ const dress = (c) => {
2401
2401
  sync();
2402
2402
  });
2403
2403
  drawer.addEventListener("change", sync);
2404
+ new MutationObserver(sync).observe(document.documentElement, {
2405
+ attributes: true,
2406
+ attributeFilter: [c.min],
2407
+ });
2404
2408
  desktop.addEventListener("change", sync);
2405
2409
  sync();
2406
2410
  }
@@ -2446,15 +2450,31 @@ const dress = (c) => {
2446
2450
  "]:not([" +
2447
2451
  c.leaving +
2448
2452
  "])"));
2453
+ const copyByCommand = (value) => {
2454
+ const field = document.createElement("textarea");
2455
+ field.value = value;
2456
+ field.setAttribute("readonly", "");
2457
+ field.style.position = "fixed";
2458
+ field.style.opacity = "0";
2459
+ document.body.append(field);
2460
+ field.select();
2461
+ const copied = document.execCommand("copy");
2462
+ field.remove();
2463
+ return copied;
2464
+ };
2449
2465
  const copy = (value, done) => {
2450
2466
  const fail = () => announce(label("クリップボードにコピーできませんでした。", "Could not copy to the clipboard."));
2451
- if (!navigator.clipboard) {
2452
- fail();
2467
+ const fallback = () => copyByCommand(value)
2468
+ ? announce(done)
2469
+ : fail();
2470
+ if (!navigator.clipboard ||
2471
+ !window.isSecureContext) {
2472
+ fallback();
2453
2473
  return;
2454
2474
  }
2455
2475
  navigator.clipboard
2456
2476
  .writeText(value)
2457
- .then(() => announce(done), fail);
2477
+ .then(() => announce(done), fallback);
2458
2478
  };
2459
2479
  const addActions = (col, mount) => {
2460
2480
  const menu = document.createElement("details");
@@ -2530,7 +2550,18 @@ const dress = (c) => {
2530
2550
  behavior: motion,
2531
2551
  });
2532
2552
  };
2553
+ let shownColumns = 0;
2554
+ let homeColumn = null;
2555
+ home.addEventListener("click", (event) => {
2556
+ if (homeColumn &&
2557
+ homeColumn.isConnected &&
2558
+ columns().length > 1) {
2559
+ event.preventDefault();
2560
+ bring(homeColumn);
2561
+ }
2562
+ });
2533
2563
  const sync = () => {
2564
+ homeColumn = null;
2534
2565
  room.style.width = "0px";
2535
2566
  const open = columns();
2536
2567
  const crumbs = [];
@@ -2556,6 +2587,10 @@ const dress = (c) => {
2556
2587
  close.hidden = !col.querySelector("." + c.fold);
2557
2588
  if (open.length < 2)
2558
2589
  return;
2590
+ if (hrefFor(col) === home.href) {
2591
+ homeColumn = col;
2592
+ return;
2593
+ }
2559
2594
  const item = document.createElement("li");
2560
2595
  const button = document.createElement("button");
2561
2596
  button.type = "button";
@@ -2566,6 +2601,14 @@ const dress = (c) => {
2566
2601
  item.append(button);
2567
2602
  crumbs.push(item);
2568
2603
  });
2604
+ if (open.length >= 3 &&
2605
+ shownColumns < 3 &&
2606
+ fold &&
2607
+ window.matchMedia("(min-width: 1024px)")
2608
+ .matches &&
2609
+ !document.documentElement.hasAttribute(c.min))
2610
+ fold.click();
2611
+ shownColumns = open.length;
2569
2612
  divider.hidden = crumbs.length === 0;
2570
2613
  path.replaceChildren(...crumbs);
2571
2614
  trail.scrollLeft = trail.scrollWidth;
@@ -2647,7 +2690,8 @@ const docChromeCss = (theme) => {
2647
2690
  `${C} .${p}-doc-trail li{display:flex;align-items:center;gap:.5rem;font-size:.875rem}`,
2648
2691
  `${C} .${p}-doc-trail li+li::before{content:"›";color:${v("muted")}}`,
2649
2692
  `${C} .${p}-doc-trail button{border:0;border-radius:.4rem;background:none;color:inherit;font:inherit;padding:.08rem .4rem;cursor:pointer;transition:background-color .15s ease}`,
2650
- `${C} .${p}-doc-trail button:is(:hover,:focus-visible),${C} .${p}-shell-bar-brand:is(:hover,:focus-visible){background:${tint(7)};color:${v("text")}}`,
2693
+ `${C} .${p}-doc-trail button:is(:hover,:focus-visible){background:${tint(7)};color:${v("text")}}`,
2694
+ `${C} .${p}-shell-bar-brand:is(:hover,:focus-visible){background:${v("text")};color:${v("surface")}}`,
2651
2695
  `${C} .${p}-shell-page .${p}-shell-head{position:relative;align-items:center;overflow:visible;padding:.65rem .85rem .25rem 1.25rem;height:auto;min-height:3rem;border-bottom:0;background:transparent}`,
2652
2696
  `${C} .${p}-shell-page .${p}-shell-head:has(details[open]){z-index:2}`,
2653
2697
  `${C} .${p}-shell-title{color:${v("text")};font-size:1.125rem;margin:0}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plggmatic",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "A column-oriented UI design framework on the plgg family: pane alignment, a typed light/dark color scheme, and fundamental components as pure functions returning plgg-view Html",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",