@burger-editor/local 4.0.0-alpha.12 → 4.0.0-alpha.13

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.
Files changed (38) hide show
  1. package/dist/client.js +149 -136
  2. package/dist/client.js.map +1 -1
  3. package/package.json +10 -10
  4. package/server/helpers/$upload.d.ts +12 -6
  5. package/server/helpers/$upload.js +22 -22
  6. package/server/helpers/client-path-validation.d.ts +1 -1
  7. package/server/helpers/client-path-validation.js +7 -7
  8. package/server/helpers/debug.d.ts +1 -1
  9. package/server/helpers/edit-content.d.ts +12 -5
  10. package/server/helpers/edit-content.js +50 -51
  11. package/server/helpers/file-name.d.ts +5 -5
  12. package/server/helpers/file-name.js +28 -28
  13. package/server/helpers/pagination.d.ts +14 -10
  14. package/server/helpers/pagination.js +33 -33
  15. package/server/index.d.ts +1 -1
  16. package/server/index.js +6 -5
  17. package/server/model/default-config.d.ts +5 -5
  18. package/server/model/default-config.js +4 -4
  19. package/server/model/file-list-manager.d.ts +20 -11
  20. package/server/model/file-list-manager.js +176 -163
  21. package/server/model/file-tree.d.ts +10 -7
  22. package/server/model/file-tree.js +26 -25
  23. package/server/model/get-user-config.d.ts +1 -1
  24. package/server/model/get-user-config.d.ts.map +1 -1
  25. package/server/model/get-user-config.js +77 -69
  26. package/server/route.d.ts +270 -258
  27. package/server/route.d.ts.map +1 -1
  28. package/server/route.js +271 -211
  29. package/server/types.d.ts +23 -18
  30. package/server/types.d.ts.map +1 -1
  31. package/server/view/app.d.ts +11 -6
  32. package/server/view/app.js +28 -2
  33. package/server/view/layout.d.ts +6 -3
  34. package/server/view/layout.js +23 -2
  35. package/server/view/nav-tree.d.ts +6 -4
  36. package/server/view/nav-tree.js +19 -2
  37. package/server/view/nav.d.ts +6 -4
  38. package/server/view/nav.js +46 -3
package/dist/client.js CHANGED
@@ -32493,7 +32493,7 @@ var style$a = "/* No Styling */\n";
32493
32493
  var template$C = "<a href=\"\" data-bgi-button-kind=\"link\" data-bge=\"link:href, target:target, kind:data-bgi-button-kind\">\n\t<div>\n\t\t<span data-bge=\"text\">ボタン</span>\n\t</div>\n</a>\n";
32494
32494
 
32495
32495
  var button = createItem({
32496
- version: "4.0.0-alpha.11",
32496
+ version: "4.0.0-alpha.12",
32497
32497
  name: "button",
32498
32498
  template: template$C,
32499
32499
  style: style$a,
@@ -32507,7 +32507,7 @@ var style$9 = "/* No Styling */\n";
32507
32507
  var template$B = "<details data-bge=\"open:open\">\n\t<summary data-bge=\"summary\">折りたたみコンテンツ</summary>\n\t<div data-bge=\"content\"><p>内容を入力してください</p></div>\n</details>\n";
32508
32508
 
32509
32509
  var details = createItem({
32510
- version: "4.0.0-alpha.11",
32510
+ version: "4.0.0-alpha.12",
32511
32511
  name: "details",
32512
32512
  template: template$B,
32513
32513
  style: style$9,
@@ -32521,7 +32521,7 @@ var style$8 = "[data-bgi='download-file'] {\n\t[data-bge*='size'] {\n\t\t&::befo
32521
32521
  var template$A = "<a href=\"./files/bgeditor/bg-sample.pdf\" target=\"_blank\" data-bge=\"path:href, download:download\">\n\t<div>\n\t\t<span data-bge=\"name\">サンプルダウンロードファイル</span>\n\t\t<span data-bge=\"formated-size, size:data-size\" data-size=\"138158\">134.92kB</span>\n\t</div>\n</a>\n";
32522
32522
 
32523
32523
  var downloadFile = createItem({
32524
- version: "4.0.0-alpha.11",
32524
+ version: "4.0.0-alpha.12",
32525
32525
  name: "download-file",
32526
32526
  template: template$A,
32527
32527
  style: style$8,
@@ -32560,7 +32560,7 @@ var style$7 = "[data-bgi='google-maps'] {\n\tdiv {\n\t\tinline-size: 100%;\n\t\t
32560
32560
  var template$z = "<div data-lat=\"35.681382\" data-lng=\"139.766084\" data-zoom=\"16\" data-bge=\"lat:data-lat, lng:data-lng, zoom:data-zoom\">\n\t<img data-bge=\"img:src\" src=\"https://maps.google.com/maps/api/staticmap?center=35.681382,139.766084&amp;zoom=16&amp;size=640x400&amp;markers=color:red|color:red|35.681382,139.766084&amp;scale=2&amp;key=%googleMapsApiKey%\" width=\"8\" height=\"5\" alt=\"Google Maps\" />\n</div>\n<a href=\"https://maps.apple.com/?q=35.681382,139.766084\" data-bge=\"url:href\" target=\"_blank\"><span>アプリで開く</span></a>\n";
32561
32561
 
32562
32562
  var googleMaps = createItem({
32563
- version: "4.0.0-alpha.11",
32563
+ version: "4.0.0-alpha.12",
32564
32564
  name: "google-maps",
32565
32565
  template: template$z,
32566
32566
  style: style$7,
@@ -32695,7 +32695,7 @@ var style$6 = "[data-bgi='hr'] {\n\t--inline-size: 100%;\n\t--border-color: #000
32695
32695
  var template$y = "<div data-bgi-hr-kind=\"primary\" data-bge=\"kind:data-bgi-hr-kind\">\n\t<hr />\n</div>\n";
32696
32696
 
32697
32697
  var hr = createItem({
32698
- version: "4.0.0-alpha.11",
32698
+ version: "4.0.0-alpha.12",
32699
32699
  name: "hr",
32700
32700
  template: template$y,
32701
32701
  style: style$6,
@@ -32710,7 +32710,7 @@ var template$x = "<div data-bge=\":style, :scale, :scale-type, :aspect-ratio\" d
32710
32710
 
32711
32711
  const ORIGIN = "__org";
32712
32712
  var image = createItem({
32713
- version: "4.0.0-alpha.11",
32713
+ version: "4.0.0-alpha.12",
32714
32714
  name: "image",
32715
32715
  template: template$x,
32716
32716
  style: style$5,
@@ -32876,7 +32876,7 @@ var style$4 = "/* No Styling */\n";
32876
32876
  var template$w = "<table>\n\t<caption data-bge=\"caption\">\n\t\tキャプションを入力してください\n\t</caption>\n\t<tbody data-bge-list>\n\t\t<tr>\n\t\t\t<th data-bge=\"th\">表組の見出し</th>\n\t\t\t<td data-bge=\"td\">表組の内容を入力してください</td>\n\t\t</tr>\n\t</tbody>\n</table>\n";
32877
32877
 
32878
32878
  var table = createItem({
32879
- version: "4.0.0-alpha.11",
32879
+ version: "4.0.0-alpha.12",
32880
32880
  name: "table",
32881
32881
  template: template$w,
32882
32882
  style: style$4,
@@ -32904,7 +32904,7 @@ var style$3 = "/* No Styling */\n";
32904
32904
  var template$v = "<h2 data-bge=\"title-h2\">見出しを入力してください</h2>\n";
32905
32905
 
32906
32906
  var titleH2 = createItem({
32907
- version: "4.0.0-alpha.11",
32907
+ version: "4.0.0-alpha.12",
32908
32908
  name: "title-h2",
32909
32909
  template: template$v,
32910
32910
  style: style$3,
@@ -32918,7 +32918,7 @@ var style$2 = "/* No Styling */\n";
32918
32918
  var template$u = "<h3 data-bge=\"title-h3\">見出しを入力してください</h3>\n";
32919
32919
 
32920
32920
  var titleH3 = createItem({
32921
- version: "4.0.0-alpha.11",
32921
+ version: "4.0.0-alpha.12",
32922
32922
  name: "title-h3",
32923
32923
  template: template$u,
32924
32924
  style: style$2,
@@ -32932,7 +32932,7 @@ var style$1 = "/* No Styling */\n";
32932
32932
  var template$t = "<div data-bge=\"wysiwyg\"><p>本文を入力してください</p></div>\n";
32933
32933
 
32934
32934
  var wysiwyg = createItem({
32935
- version: "4.0.0-alpha.11",
32935
+ version: "4.0.0-alpha.12",
32936
32936
  name: "wysiwyg",
32937
32937
  template: template$t,
32938
32938
  style: style$1,
@@ -32947,7 +32947,7 @@ var template$s = "<div data-id=\"3KtWfp0UopM\" data-title=\"YouTube動画\" data
32947
32947
 
32948
32948
  const FALLBACK_TITLE = "YouTube\u52D5\u753B";
32949
32949
  var youtube = createItem({
32950
- version: "4.0.0-alpha.11",
32950
+ version: "4.0.0-alpha.12",
32951
32951
  name: "youtube",
32952
32952
  template: template$s,
32953
32953
  style: style$b,
@@ -68933,6 +68933,93 @@ function clear_text_content(node) {
68933
68933
  node.textContent = '';
68934
68934
  }
68935
68935
 
68936
+ /**
68937
+ * @param {HTMLElement} dom
68938
+ * @param {boolean} value
68939
+ * @returns {void}
68940
+ */
68941
+ function autofocus(dom, value) {
68942
+ if (value) {
68943
+ const body = document.body;
68944
+ dom.autofocus = true;
68945
+
68946
+ queue_micro_task(() => {
68947
+ if (document.activeElement === body) {
68948
+ dom.focus();
68949
+ }
68950
+ });
68951
+ }
68952
+ }
68953
+
68954
+ let listening_to_form_reset = false;
68955
+
68956
+ function add_form_reset_listener() {
68957
+ if (!listening_to_form_reset) {
68958
+ listening_to_form_reset = true;
68959
+ document.addEventListener(
68960
+ 'reset',
68961
+ (evt) => {
68962
+ // Needs to happen one tick later or else the dom properties of the form
68963
+ // elements have not updated to their reset values yet
68964
+ Promise.resolve().then(() => {
68965
+ if (!evt.defaultPrevented) {
68966
+ for (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {
68967
+ // @ts-expect-error
68968
+ e.__on_r?.();
68969
+ }
68970
+ }
68971
+ });
68972
+ },
68973
+ // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
68974
+ { capture: true }
68975
+ );
68976
+ }
68977
+ }
68978
+
68979
+ /**
68980
+ * @template T
68981
+ * @param {() => T} fn
68982
+ */
68983
+ function without_reactive_context(fn) {
68984
+ var previous_reaction = active_reaction;
68985
+ var previous_effect = active_effect;
68986
+ set_active_reaction(null);
68987
+ set_active_effect(null);
68988
+ try {
68989
+ return fn();
68990
+ } finally {
68991
+ set_active_reaction(previous_reaction);
68992
+ set_active_effect(previous_effect);
68993
+ }
68994
+ }
68995
+
68996
+ /**
68997
+ * Listen to the given event, and then instantiate a global form reset listener if not already done,
68998
+ * to notify all bindings when the form is reset
68999
+ * @param {HTMLElement} element
69000
+ * @param {string} event
69001
+ * @param {(is_reset?: true) => void} handler
69002
+ * @param {(is_reset?: true) => void} [on_reset]
69003
+ */
69004
+ function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
69005
+ element.addEventListener(event, () => without_reactive_context(handler));
69006
+ // @ts-expect-error
69007
+ const prev = element.__on_r;
69008
+ if (prev) {
69009
+ // special case for checkbox that can have multiple binds (group & checked)
69010
+ // @ts-expect-error
69011
+ element.__on_r = () => {
69012
+ prev();
69013
+ on_reset(true);
69014
+ };
69015
+ } else {
69016
+ // @ts-expect-error
69017
+ element.__on_r = () => on_reset(true);
69018
+ }
69019
+
69020
+ add_form_reset_listener();
69021
+ }
69022
+
68936
69023
  /** @import { ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
68937
69024
 
68938
69025
  /**
@@ -69246,7 +69333,13 @@ function destroy_effect_children(signal, remove_dom = false) {
69246
69333
  signal.first = signal.last = null;
69247
69334
 
69248
69335
  while (effect !== null) {
69249
- effect.ac?.abort(STALE_REACTION);
69336
+ const controller = effect.ac;
69337
+
69338
+ if (controller !== null) {
69339
+ without_reactive_context(() => {
69340
+ controller.abort(STALE_REACTION);
69341
+ });
69342
+ }
69250
69343
 
69251
69344
  var next = effect.next;
69252
69345
 
@@ -69755,13 +69848,17 @@ function update_reaction(reaction) {
69755
69848
  update_version = ++read_version;
69756
69849
 
69757
69850
  if (reaction.ac !== null) {
69758
- reaction.ac.abort(STALE_REACTION);
69851
+ without_reactive_context(() => {
69852
+ /** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);
69853
+ });
69854
+
69759
69855
  reaction.ac = null;
69760
69856
  }
69761
69857
 
69762
69858
  try {
69763
69859
  reaction.f |= REACTION_IS_UPDATING;
69764
- var result = /** @type {Function} */ (0, reaction.fn)();
69860
+ var fn = /** @type {Function} */ (reaction.fn);
69861
+ var result = fn();
69765
69862
  var deps = reaction.deps;
69766
69863
 
69767
69864
  if (new_deps !== null) {
@@ -70187,93 +70284,6 @@ function deep_read(value, visited = new Set()) {
70187
70284
  }
70188
70285
  }
70189
70286
 
70190
- /**
70191
- * @param {HTMLElement} dom
70192
- * @param {boolean} value
70193
- * @returns {void}
70194
- */
70195
- function autofocus(dom, value) {
70196
- if (value) {
70197
- const body = document.body;
70198
- dom.autofocus = true;
70199
-
70200
- queue_micro_task(() => {
70201
- if (document.activeElement === body) {
70202
- dom.focus();
70203
- }
70204
- });
70205
- }
70206
- }
70207
-
70208
- let listening_to_form_reset = false;
70209
-
70210
- function add_form_reset_listener() {
70211
- if (!listening_to_form_reset) {
70212
- listening_to_form_reset = true;
70213
- document.addEventListener(
70214
- 'reset',
70215
- (evt) => {
70216
- // Needs to happen one tick later or else the dom properties of the form
70217
- // elements have not updated to their reset values yet
70218
- Promise.resolve().then(() => {
70219
- if (!evt.defaultPrevented) {
70220
- for (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {
70221
- // @ts-expect-error
70222
- e.__on_r?.();
70223
- }
70224
- }
70225
- });
70226
- },
70227
- // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
70228
- { capture: true }
70229
- );
70230
- }
70231
- }
70232
-
70233
- /**
70234
- * @template T
70235
- * @param {() => T} fn
70236
- */
70237
- function without_reactive_context(fn) {
70238
- var previous_reaction = active_reaction;
70239
- var previous_effect = active_effect;
70240
- set_active_reaction(null);
70241
- set_active_effect(null);
70242
- try {
70243
- return fn();
70244
- } finally {
70245
- set_active_reaction(previous_reaction);
70246
- set_active_effect(previous_effect);
70247
- }
70248
- }
70249
-
70250
- /**
70251
- * Listen to the given event, and then instantiate a global form reset listener if not already done,
70252
- * to notify all bindings when the form is reset
70253
- * @param {HTMLElement} element
70254
- * @param {string} event
70255
- * @param {(is_reset?: true) => void} handler
70256
- * @param {(is_reset?: true) => void} [on_reset]
70257
- */
70258
- function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
70259
- element.addEventListener(event, () => without_reactive_context(handler));
70260
- // @ts-expect-error
70261
- const prev = element.__on_r;
70262
- if (prev) {
70263
- // special case for checkbox that can have multiple binds (group & checked)
70264
- // @ts-expect-error
70265
- element.__on_r = () => {
70266
- prev();
70267
- on_reset(true);
70268
- };
70269
- } else {
70270
- // @ts-expect-error
70271
- element.__on_r = () => on_reset(true);
70272
- }
70273
-
70274
- add_form_reset_listener();
70275
- }
70276
-
70277
70287
  /** @type {Set<string>} */
70278
70288
  const all_registered_events = new Set();
70279
70289
 
@@ -70819,6 +70829,7 @@ const document_listeners = new Map();
70819
70829
  function _mount(Component, { target, anchor, props = {}, events, context, intro = true }) {
70820
70830
  init_operations();
70821
70831
 
70832
+ /** @type {Set<string>} */
70822
70833
  var registered_events = new Set();
70823
70834
 
70824
70835
  /** @param {Array<string>} events */
@@ -71037,7 +71048,7 @@ function if_block(node, fn, elseif = false) {
71037
71048
  /** @type {Effect | null} */
71038
71049
  var alternate_effect = null;
71039
71050
 
71040
- /** @type {UNINITIALIZED | boolean | null} */
71051
+ /** @type {typeof UNINITIALIZED | boolean | null} */
71041
71052
  var condition = UNINITIALIZED;
71042
71053
 
71043
71054
  var flags = elseif ? EFFECT_TRANSPARENT : 0;
@@ -71229,7 +71240,7 @@ function each(node, flags, get_collection, get_key, render_fn, fallback_fn = nul
71229
71240
  // store a reference to the effect so that we can update the start/end nodes in reconciliation
71230
71241
  each_effect ??= /** @type {Effect} */ (active_effect);
71231
71242
 
71232
- array = get(each_array);
71243
+ array = /** @type {V[]} */ (get(each_array));
71233
71244
  var length = array.length;
71234
71245
 
71235
71246
  if (was_empty && length === 0) {
@@ -72946,8 +72957,7 @@ function legacy_rest_props(props, exclude) {
72946
72957
  * The proxy handler for spread props. Handles the incoming array of props
72947
72958
  * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps
72948
72959
  * them so that the whole thing is passed to the component as the `$$props` argument.
72949
- * @template {Record<string | symbol, unknown>} T
72950
- * @type {ProxyHandler<{ props: Array<T | (() => T)> }>}}
72960
+ * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}
72951
72961
  */
72952
72962
  const spread_props_handler = {
72953
72963
  get(target, key) {
@@ -73124,22 +73134,23 @@ function prop(props, key, flags, fallback) {
73124
73134
  // means we can just call `$$props.foo = value` directly
73125
73135
  if (setter) {
73126
73136
  var legacy_parent = props.$$legacy;
73137
+ return /** @type {() => V} */ (
73138
+ function (/** @type {V} */ value, /** @type {boolean} */ mutation) {
73139
+ if (arguments.length > 0) {
73140
+ // We don't want to notify if the value was mutated and the parent is in runes mode.
73141
+ // In that case the state proxy (if it exists) should take care of the notification.
73142
+ // If the parent is not in runes mode, we need to notify on mutation, too, that the prop
73143
+ // has changed because the parent will not be able to detect the change otherwise.
73144
+ if (!runes || !mutation || legacy_parent || is_store_sub) {
73145
+ /** @type {Function} */ (setter)(mutation ? getter() : value);
73146
+ }
73127
73147
 
73128
- return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
73129
- if (arguments.length > 0) {
73130
- // We don't want to notify if the value was mutated and the parent is in runes mode.
73131
- // In that case the state proxy (if it exists) should take care of the notification.
73132
- // If the parent is not in runes mode, we need to notify on mutation, too, that the prop
73133
- // has changed because the parent will not be able to detect the change otherwise.
73134
- if (!runes || !mutation || legacy_parent || is_store_sub) {
73135
- /** @type {Function} */ (setter)(mutation ? getter() : value);
73148
+ return value;
73136
73149
  }
73137
73150
 
73138
- return value;
73151
+ return getter();
73139
73152
  }
73140
-
73141
- return getter();
73142
- };
73153
+ );
73143
73154
  }
73144
73155
 
73145
73156
  // Either prop is written to, but there's no binding, which means we
@@ -73158,31 +73169,33 @@ function prop(props, key, flags, fallback) {
73158
73169
 
73159
73170
  var parent_effect = /** @type {Effect} */ (active_effect);
73160
73171
 
73161
- return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
73162
- if (arguments.length > 0) {
73163
- const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
73172
+ return /** @type {() => V} */ (
73173
+ function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
73174
+ if (arguments.length > 0) {
73175
+ const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
73176
+
73177
+ set(d, new_value);
73178
+ overridden = true;
73164
73179
 
73165
- set(d, new_value);
73166
- overridden = true;
73180
+ if (fallback_value !== undefined) {
73181
+ fallback_value = new_value;
73182
+ }
73167
73183
 
73168
- if (fallback_value !== undefined) {
73169
- fallback_value = new_value;
73184
+ return value;
73170
73185
  }
73171
73186
 
73172
- return value;
73173
- }
73187
+ // special case — avoid recalculating the derived if we're in a
73188
+ // teardown function and the prop was overridden locally, or the
73189
+ // component was already destroyed (this latter part is necessary
73190
+ // because `bind:this` can read props after the component has
73191
+ // been destroyed. TODO simplify `bind:this`
73192
+ if ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {
73193
+ return d.v;
73194
+ }
73174
73195
 
73175
- // special case — avoid recalculating the derived if we're in a
73176
- // teardown function and the prop was overridden locally, or the
73177
- // component was already destroyed (this latter part is necessary
73178
- // because `bind:this` can read props after the component has
73179
- // been destroyed. TODO simplify `bind:this`
73180
- if ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {
73181
- return d.v;
73196
+ return get(d);
73182
73197
  }
73183
-
73184
- return get(d);
73185
- };
73198
+ );
73186
73199
  }
73187
73200
 
73188
73201
  var root_4$3 = from_html(`<img alt="" loading="lazy" class="svelte-zdu8xx"/>`);