@fuma-content/studio 1.1.0 → 2.0.0

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 (62) hide show
  1. package/build/client/assets/{app-sidebar-DmZmaTFZ.js → app-sidebar-pNmserEz.js} +1 -1
  2. package/build/client/assets/{client-DCkt8g_f.js → client-CiKaCnwt.js} +2 -2
  3. package/build/client/assets/{client-CEEVDnpu.js → client-DQSIY5Q2.js} +141 -141
  4. package/build/client/assets/client-DoI_730h.js +39 -0
  5. package/build/client/assets/{context-menu-BKCfyZyn.js → context-menu-DmqgkYYt.js} +1 -1
  6. package/build/client/assets/{cssMode-DLORRHDr.js → cssMode-Coi5O5zy.js} +1 -1
  7. package/build/client/assets/entry.rsc-Dg8bPYHW.js +1 -0
  8. package/build/client/assets/{freemarker2-DaJ0VeUL.js → freemarker2-1O7dsC5n.js} +1 -1
  9. package/build/client/assets/{handlebars-DLHw1EEJ.js → handlebars-CV8AX3NZ.js} +1 -1
  10. package/build/client/assets/{html-O04EC3MX.js → html-Blvbrx_-.js} +1 -1
  11. package/build/client/assets/{htmlMode-DQ7y7lfT.js → htmlMode-C2GytKxI.js} +1 -1
  12. package/build/client/assets/{index-C0ecV8RK.js → index-BJkIIQzT.js} +1 -1
  13. package/build/client/assets/{index-DyfAV_di.js → index-BYgxF2sp.js} +1 -1
  14. package/build/client/assets/{index-DYGF1SVj.js → index-DaIko2JM.js} +1 -1
  15. package/build/client/assets/{index-B6b4_3Hd.js → index-DcOHxMKV.js} +1 -1
  16. package/build/client/assets/{index-BO1u3G9x.js → index-MJySYuke.js} +1 -1
  17. package/build/client/assets/{index-pxp216Su.js → index-ShKFcMvP.js} +1 -1
  18. package/build/client/assets/{index-SdiO_PfY.js → index-oqTiWTgb.js} +1 -1
  19. package/build/client/assets/{javascript-CrGLGAoQ.js → javascript-Bl1Q_Nkx.js} +1 -1
  20. package/build/client/assets/{jsonMode-CF67c9TM.js → jsonMode-Wb-dBUwH.js} +1 -1
  21. package/build/client/assets/{layout-DFh-gM7Y.js → layout-BLEhq2Xc.js} +1 -1
  22. package/build/client/assets/{liquid-CLUvqbUj.js → liquid-CRXJh1mG.js} +1 -1
  23. package/build/client/assets/{lspLanguageFeatures-C4ogykLr.js → lspLanguageFeatures-CBxjayZZ.js} +1 -1
  24. package/build/client/assets/{mdx-I5c0PFNf.js → mdx-C5mACBRu.js} +1 -1
  25. package/build/client/assets/{page-Cnp0usS5.js → page-CDAXLFEn.js} +1 -1
  26. package/build/client/assets/{page-vw-b-9V8.js → page-DH_hjJdm.js} +1 -1
  27. package/build/client/assets/{popover-BTaeGuVq.js → popover-BeYx_kX_.js} +1 -1
  28. package/build/client/assets/{python-9pLFSYtk.js → python-WC2gRa53.js} +1 -1
  29. package/build/client/assets/{razor-C1F71AoJ.js → razor-DtDoIoVr.js} +1 -1
  30. package/build/client/assets/{react-H1IN5wR7.js → react-Dk3PRQ9V.js} +2 -2
  31. package/build/client/assets/root-Bxrr2p-9.js +1 -0
  32. package/build/client/assets/{root-CquYm4yb.js → root-OdV9Gcaa.js} +1 -1
  33. package/build/client/assets/route-DoJXbWq2.js +1 -0
  34. package/build/client/assets/{router-DNbvCK8g.js → router-Ccb8Hbb0.js} +1 -1
  35. package/build/client/assets/{separator-QmXXuyOl.js → separator-Sua3PhYj.js} +1 -1
  36. package/build/client/assets/{site-header-pChVNzpf.js → site-header-Cyiy71CX.js} +1 -1
  37. package/build/client/assets/{spinner-Cs2baDxX.js → spinner-C1xi9J1T.js} +1 -1
  38. package/build/client/assets/{suspense-DqXzPoi1.js → suspense-Be4bKxiB.js} +1 -1
  39. package/build/client/assets/{tsMode-C27O5pAT.js → tsMode-C-5dlAKI.js} +1 -1
  40. package/build/client/assets/{typescript-CdWDFqnx.js → typescript-DtZ3r-8F.js} +1 -1
  41. package/build/client/assets/{xml-CyqvPPRa.js → xml-2JwqkWbu.js} +1 -1
  42. package/build/client/assets/{yaml-BReIckoY.js → yaml-B7FthBd9.js} +3 -3
  43. package/build/client/assets/{yaml-CIgtTHvG.js → yaml-B8ielN8F.js} +1 -1
  44. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +100 -100
  45. package/build/server/__ssr_build/assets/{client-DZ7MH4ui.js → client-BbQZwY1s.js} +1 -1
  46. package/build/server/__ssr_build/assets/{client-DIrftxPs.js → client-Dm8-2ev7.js} +183 -167
  47. package/build/server/__ssr_build/assets/{client-CoRUI7H1.js → client-aUUPy-yC.js} +46 -27
  48. package/build/server/__ssr_build/assets/{route-r7ypDwBC.js → route-D3n8i03R.js} +1 -1
  49. package/build/server/__ssr_build/index.js +4 -4
  50. package/build/server/__vite_rsc_assets_manifest.js +100 -100
  51. package/build/server/assets/{route-Be37zvut.js → route-BDaI_mx5.js} +1 -1
  52. package/build/server/index.js +5 -5
  53. package/dist/bin/cli.mjs +1 -3
  54. package/dist/bin/hocuspocus.mjs +1 -3
  55. package/dist/bin.mjs +1 -3
  56. package/dist/lib/yjs/index.mjs +3 -5
  57. package/dist/package.mjs +2 -3
  58. package/package.json +26 -26
  59. package/build/client/assets/client-B1Ov3B6B.js +0 -39
  60. package/build/client/assets/entry.rsc-D-AmsoFy.js +0 -1
  61. package/build/client/assets/root-tlv37SRw.js +0 -1
  62. package/build/client/assets/route-C720h6ya.js +0 -1
@@ -26,17 +26,18 @@ const __iconNode = [["path", {
26
26
  const Trash2 = createLucideIcon("trash-2", __iconNode);
27
27
  function objectGet(obj, key) {
28
28
  let cur = obj;
29
- for (const prop of key) {
30
- if (!isPlainObject(cur) || !(prop in cur)) return;
31
- cur = cur[prop];
32
- }
29
+ for (const prop of key) if (isPlainObject(cur) && prop in cur) cur = cur[prop];
30
+ else if (typeof prop === "number" && Array.isArray(cur)) cur = cur[prop];
31
+ else return;
33
32
  return cur;
34
33
  }
35
- function objectSet(obj, key, value) {
36
- if (key.length === 0) return value;
37
- const parent = objectGet(obj, key.slice(0, -1));
38
- if (!isPlainObject(parent)) throw new Error("missing parent object");
39
- parent[key[key.length - 1]] = value;
34
+ function objectSet(obj, field, value) {
35
+ if (field.length === 0) return value;
36
+ const parent = objectGet(obj, field.slice(0, -1));
37
+ const key = field[field.length - 1];
38
+ if (isPlainObject(parent)) parent[key] = value;
39
+ else if (typeof key === "number" && Array.isArray(parent)) parent[key] = value;
40
+ else throw new Error("missing parent object");
40
41
  return obj;
41
42
  }
42
43
  function deepEqual$1(a, b) {
@@ -65,113 +66,6 @@ function isPlainObject(value) {
65
66
  const prototype = Object.getPrototypeOf(value);
66
67
  return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null;
67
68
  }
68
- const Context = reactExports.createContext(null);
69
- function StfProvider({
70
- value,
71
- children
72
- }) {
73
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Context, {
74
- value,
75
- children
76
- });
77
- }
78
- function useStf(options) {
79
- const {
80
- defaultValues
81
- } = options;
82
- const dataEngine = reactExports.useMemo(() => new DataEngine(defaultValues), []);
83
- return reactExports.useMemo(() => ({
84
- dataEngine
85
- }), [dataEngine]);
86
- }
87
- function useDataEngine(instance) {
88
- if (instance instanceof DataEngine) return instance;
89
- if (instance) return instance.dataEngine;
90
- return reactExports.use(Context).dataEngine;
91
- }
92
- function useArray(field, options = {}) {
93
- const engine = useDataEngine();
94
- const [items] = useFieldValue(field, {
95
- defaultValue: options.defaultValue,
96
- compute(value) {
97
- const items2 = [];
98
- if (Array.isArray(value)) for (let i = 0; i < value.length; i++) items2.push({
99
- field: [...field, i],
100
- index: i
101
- });
102
- return items2;
103
- },
104
- isChanged(prev, next) {
105
- return prev.length !== next.length;
106
- }
107
- });
108
- return {
109
- items,
110
- insertItem(itemValue) {
111
- const value = engine.get(field);
112
- engine.update(field, Array.isArray(value) ? [...value, itemValue] : [itemValue]);
113
- },
114
- removeItem(index) {
115
- engine.delete([...field, index]);
116
- }
117
- };
118
- }
119
- function useObject(field, options) {
120
- const engine = useDataEngine();
121
- const [objectKeys] = useFieldValue(field, {
122
- defaultValue: options.defaultValue,
123
- compute(currentValue) {
124
- return currentValue ? Object.keys(currentValue) : [];
125
- },
126
- isChanged(prev, next) {
127
- return !deepEqual$1(prev, next);
128
- }
129
- });
130
- return {
131
- properties: reactExports.useMemo(() => {
132
- const properties = [];
133
- const unknownKeys = new Set(objectKeys);
134
- for (const [key, prop] of Object.entries(options.properties)) {
135
- unknownKeys.delete(key);
136
- properties.push({
137
- kind: "fixed",
138
- field: [...field, key],
139
- key,
140
- info: prop
141
- });
142
- }
143
- for (const [pattern, prop] of Object.entries(options.patternProperties ?? {})) {
144
- const regex = RegExp(pattern);
145
- for (const key of unknownKeys) {
146
- if (!key.match(regex)) continue;
147
- unknownKeys.delete(key);
148
- properties.push({
149
- kind: "pattern",
150
- info: prop,
151
- key,
152
- pattern,
153
- field: [...field, key]
154
- });
155
- }
156
- }
157
- if (options.fallback) for (const key of unknownKeys) properties.push({
158
- kind: "fallback",
159
- field: [...field, key],
160
- key,
161
- info: options.fallback
162
- });
163
- return properties;
164
- }, [field, objectKeys, options.fallback, options.patternProperties, options.properties]),
165
- onAppend(name, value) {
166
- name = name.trim();
167
- if (name.length === 0) return;
168
- engine.init([...field, name], value);
169
- },
170
- onDelete(name) {
171
- return engine.delete([...field, name]);
172
- }
173
- };
174
- }
175
69
  function getDefaultValue$1(defaultValue) {
176
70
  return typeof defaultValue === "function" ? defaultValue() : defaultValue;
177
71
  }
@@ -218,10 +112,6 @@ var ListenerManager = class {
218
112
  for (const v of listeners) v.onDelete?.(field, ctx);
219
113
  }
220
114
  }
221
- onUnmount() {
222
- for (const v of this.unindexed) v.onUnmount?.();
223
- for (const listeners of this.indexed.values()) for (const v of listeners) v.onUnmount?.();
224
- }
225
115
  };
226
116
  var DataEngine = class DataEngine2 {
227
117
  constructor(defaultValues = {}) {
@@ -240,37 +130,44 @@ var DataEngine = class DataEngine2 {
240
130
  }
241
131
  /**
242
132
  * init a field
243
- * @param key the key of field
133
+ * @param field the key of field
244
134
  * @param defaultValue the initial value, the field is also created for `undefined`
245
135
  * @returns the value of initialized field, or the current value of field if already initialized
246
136
  */
247
- init(key, defaultValue, ctx = {}) {
248
- if (key.length === 0) return this.data;
137
+ init(field, defaultValue, ctx = {}) {
138
+ if (field.length === 0) return this.data;
249
139
  const parentKey = [];
250
140
  const parentUpdateCtx = {
251
141
  swallow: true,
252
142
  ...ctx
253
143
  };
254
- let cur = this.data;
255
- for (let i = 0; i < key.length; i++) {
256
- const propKey = key[i];
257
- const propValue = cur[propKey];
258
- if (i === key.length - 1) {
259
- if (propValue !== void 0) return propValue;
260
- cur[propKey] = getDefaultValue$1(defaultValue);
261
- this.listeners.onUpdate(parentKey, parentUpdateCtx);
262
- this.listeners.onInit(key, ctx);
263
- return cur[propKey];
264
- } else if (isPlainObject(propValue)) {
265
- cur = propValue;
266
- parentKey.push(propKey);
144
+ let parent = this.data;
145
+ const fieldsToInit = [];
146
+ let initStart = null;
147
+ for (let i = 0; i < field.length; i++) {
148
+ const key = field[i];
149
+ const value = parent[key];
150
+ if (i === field.length - 1) {
151
+ if (value !== void 0) return value;
152
+ const out = parent[key] = getDefaultValue$1(defaultValue);
153
+ fieldsToInit.push(field);
154
+ for (const initField of fieldsToInit) this.listeners.onInit(initField, ctx);
155
+ this.listeners.onUpdate(initStart ?? parentKey, parentUpdateCtx);
156
+ return out;
157
+ } else if (isPlainObject(value) || Array.isArray(value)) {
158
+ parent = value;
159
+ parentKey.push(key);
267
160
  } else {
268
- cur = cur[propKey] = {};
269
- this.listeners.onUpdate(parentKey, parentUpdateCtx);
270
- parentKey.push(propKey);
271
- if (propValue !== void 0) {
272
- console.warn(`the original value of field ${parentKey.join(".")} is overidden, this might be unexpected.`);
161
+ const nextKey = field[i + 1];
162
+ parent = parent[key] = typeof nextKey === "number" ? new Array(nextKey + 1) : {};
163
+ if (value === void 0) {
164
+ initStart ??= [...parentKey];
165
+ parentKey.push(key);
166
+ fieldsToInit.push([...parentKey]);
167
+ } else {
168
+ parentKey.push(key);
273
169
  this.listeners.onUpdate(parentKey, parentUpdateCtx);
170
+ console.warn(`the original value of field ${parentKey.join(".")} is overidden, this might be unexpected.`);
274
171
  }
275
172
  }
276
173
  }
@@ -280,16 +177,18 @@ var DataEngine = class DataEngine2 {
280
177
  const parentKey = key.slice(0, -1);
281
178
  const prop = key[key.length - 1];
282
179
  const parent = this.get(parentKey);
283
- if (Array.isArray(parent) && typeof prop === "number") {
180
+ if (typeof prop === "number" && Array.isArray(parent)) {
181
+ if (parent.length === 0) return;
182
+ const isLast = prop === parent.length - 1;
284
183
  const deleted = parent.splice(prop, 1);
285
184
  if (deleted.length === 0) return;
286
185
  this.listeners.onDelete(key, ctx);
287
186
  this.listeners.onUpdate(parentKey, {
288
- swallow: false,
187
+ swallow: isLast,
289
188
  ...ctx
290
189
  });
291
190
  return deleted[0];
292
- } else if (isPlainObject(parent)) {
191
+ } else if (isPlainObject(parent) && prop in parent) {
293
192
  const temp = parent[prop];
294
193
  delete parent[prop];
295
194
  this.listeners.onDelete(key, ctx);
@@ -322,24 +221,146 @@ var DataEngine = class DataEngine2 {
322
221
  /**
323
222
  * create an isolated data engine
324
223
  */
325
- namespace(namespace, initialValue) {
224
+ namespace(namespace, initialValue, config) {
326
225
  let child = this.namespaces.get(namespace);
327
226
  if (!child) {
328
- child = new DataEngine2(initialValue);
227
+ child = {
228
+ engine: new DataEngine2(initialValue),
229
+ ...config
230
+ };
329
231
  this.namespaces.set(namespace, child);
330
- }
331
- return child;
232
+ } else Object.assign(child, config);
233
+ return child.engine;
332
234
  }
333
235
  reset(data) {
334
236
  this.update([], data);
335
- }
336
- clearNamespaces() {
337
- for (const [name, engine] of this.namespaces) {
338
- this.namespaces.delete(name);
339
- engine.listeners.onUnmount();
340
- }
237
+ for (const {
238
+ engine,
239
+ reset
240
+ } of this.namespaces.values()) reset?.({
241
+ engine
242
+ });
341
243
  }
342
244
  };
245
+ const Context = reactExports.createContext(null);
246
+ function StfProvider({
247
+ value,
248
+ children
249
+ }) {
250
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Context, {
251
+ value,
252
+ children
253
+ });
254
+ }
255
+ function useStf(options) {
256
+ const optionsRef = reactExports.useRef(options);
257
+ optionsRef.current = options;
258
+ return reactExports.useMemo(() => ({
259
+ dataEngine: new DataEngine(optionsRef.current.defaultValues)
260
+ }), []);
261
+ }
262
+ function useDataEngine(instance) {
263
+ if (instance instanceof DataEngine) return instance;
264
+ if (instance) return instance.dataEngine;
265
+ return reactExports.use(Context).dataEngine;
266
+ }
267
+ function useArray(field, options = {}) {
268
+ const engine = useDataEngine();
269
+ const {
270
+ defaultValue
271
+ } = options;
272
+ const [items] = useFieldValue(field, {
273
+ defaultValue,
274
+ compute(value) {
275
+ const items2 = [];
276
+ if (!Array.isArray(value)) return items2;
277
+ for (let i = 0; i < value.length; i++) items2.push({
278
+ field: [...field, i],
279
+ index: i
280
+ });
281
+ return items2;
282
+ },
283
+ isChanged(prev, next) {
284
+ return prev.length !== next.length;
285
+ }
286
+ });
287
+ return {
288
+ items,
289
+ insertItem(itemValue) {
290
+ const value = engine.get(field);
291
+ const idx = Array.isArray(value) ? value.length : 0;
292
+ engine.init([...field, idx], itemValue);
293
+ },
294
+ removeItem(index) {
295
+ engine.delete([...field, index]);
296
+ }
297
+ };
298
+ }
299
+ function useObject(field, options) {
300
+ const {
301
+ properties: definedProps,
302
+ patternProperties: definedPatternProps = {},
303
+ defaultValue,
304
+ fallback,
305
+ lazy
306
+ } = options;
307
+ const engine = useDataEngine();
308
+ const [objectKeys] = useFieldValue(field, {
309
+ defaultValue,
310
+ compute(currentValue) {
311
+ return isPlainObject(currentValue) ? Object.keys(currentValue) : [];
312
+ },
313
+ isChanged(prev, next) {
314
+ return !deepEqual$1(prev, next);
315
+ }
316
+ });
317
+ return {
318
+ properties: reactExports.useMemo(() => {
319
+ const properties = [];
320
+ const unknownKeys = new Set(objectKeys);
321
+ for (const [key, prop] of Object.entries(definedProps)) {
322
+ if (lazy && !unknownKeys.has(key)) continue;
323
+ unknownKeys.delete(key);
324
+ properties.push({
325
+ kind: "fixed",
326
+ field: [...field, key],
327
+ key,
328
+ info: prop
329
+ });
330
+ }
331
+ for (const [pattern, prop] of Object.entries(definedPatternProps)) {
332
+ const regex = RegExp(pattern);
333
+ for (const key of unknownKeys) {
334
+ if (!key.match(regex)) continue;
335
+ unknownKeys.delete(key);
336
+ properties.push({
337
+ kind: "pattern",
338
+ info: prop,
339
+ key,
340
+ pattern,
341
+ field: [...field, key]
342
+ });
343
+ }
344
+ }
345
+ if (fallback) for (const key of unknownKeys) properties.push({
346
+ kind: "fallback",
347
+ field: [...field, key],
348
+ key,
349
+ info: fallback
350
+ });
351
+ return properties;
352
+ }, [definedPatternProps, definedProps, fallback, field, lazy, objectKeys]),
353
+ _objectKeys: objectKeys,
354
+ onAppend(name, value) {
355
+ name = name.trim();
356
+ if (name.length === 0) return;
357
+ engine.init([...field, name], value);
358
+ },
359
+ onDelete(name) {
360
+ return engine.delete([...field, name]);
361
+ }
362
+ };
363
+ }
343
364
  function useFieldValue(key, options = {}) {
344
365
  const {
345
366
  stf,
@@ -348,23 +369,21 @@ function useFieldValue(key, options = {}) {
348
369
  isChanged = (a, b) => a !== b
349
370
  } = options;
350
371
  const engine = useDataEngine(stf);
351
- const [value, setValue] = reactExports.useState(() => compute(engine.init(key, defaultValue)));
372
+ const [value, setValue] = reactExports.useState(() => compute(defaultValue === void 0 ? engine.get(key) : engine.init(key, defaultValue)));
352
373
  const prevEngineRef = reactExports.useRef(engine);
353
374
  if (prevEngineRef.current !== engine) {
354
- setValue(compute(engine.init(key, defaultValue)));
375
+ setValue(compute(defaultValue === void 0 ? engine.get(key) : engine.init(key, defaultValue)));
355
376
  prevEngineRef.current = engine;
356
377
  }
378
+ function onUpdate() {
379
+ const computed = compute(engine.get(key));
380
+ setValue((prev) => isChanged(prev, computed) ? computed : prev);
381
+ }
357
382
  useListener({
358
383
  field: key,
359
384
  stf,
360
- onInit() {
361
- const computed = compute(engine.get(key));
362
- setValue((prev) => isChanged(prev, computed) ? computed : prev);
363
- },
364
- onUpdate() {
365
- const computed = compute(engine.get(key));
366
- setValue((prev) => isChanged(prev, computed) ? computed : prev);
367
- },
385
+ onInit: onUpdate,
386
+ onUpdate,
368
387
  onDelete() {
369
388
  const computed = compute(void 0);
370
389
  setValue((prev) => isChanged(prev, computed) ? computed : prev);
@@ -379,9 +398,6 @@ function useListener(listener) {
379
398
  reactExports.useEffect(() => {
380
399
  const internal = {
381
400
  field: listener.field,
382
- onUnmount(...args) {
383
- return listenerRef.current.onUnmount?.(...args);
384
- },
385
401
  onDelete(...args) {
386
402
  return listenerRef.current.onDelete?.(...args);
387
403
  },
@@ -22,7 +22,7 @@ import { createLowlight, all as all$1 } from "lowlight";
22
22
  import remarkGfm from "remark-gfm";
23
23
  import remarkMath from "remark-math";
24
24
  import katex from "katex";
25
- import { J as JSONSchemaEditorProvider, a as JSONSchemaEditorContent, I as Input, T as Trash2, L as Label } from "./client-DIrftxPs.js";
25
+ import { J as JSONSchemaEditorProvider, a as JSONSchemaEditorContent, I as Input, T as Trash2, L as Label } from "./client-Dm8-2ev7.js";
26
26
  import { L as LoaderCircle } from "./spinner-dtA37v95.js";
27
27
  import { AbstractChat, DefaultChatTransport } from "ai";
28
28
  import { differenceInMinutes, differenceInHours, differenceInDays, format as format$1, addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarMonths, eachMonthOfInterval, eachYearOfInterval, endOfISOWeek, endOfMonth, endOfWeek, endOfYear, getISOWeek, getMonth, getYear, getWeek, isAfter, isBefore, isDate as isDate$1, isSameDay, isSameMonth, isSameYear, max as max$2, min as min$2, setMonth, setYear, startOfDay, startOfISOWeek, startOfMonth, startOfWeek, startOfYear } from "date-fns";
@@ -502,23 +502,6 @@ const __iconNode$T = [["path", {
502
502
  }]];
503
503
  const Heading2 = createLucideIcon("heading-2", __iconNode$T);
504
504
  const __iconNode$S = [["path", {
505
- d: "M12 18V6",
506
- key: "zqpxq5"
507
- }], ["path", {
508
- d: "M17 10v3a1 1 0 0 0 1 1h3",
509
- key: "tj5zdr"
510
- }], ["path", {
511
- d: "M21 10v8",
512
- key: "1kdml4"
513
- }], ["path", {
514
- d: "M4 12h8",
515
- key: "17cfdx"
516
- }], ["path", {
517
- d: "M4 18V6",
518
- key: "1rz3zl"
519
- }]];
520
- const Heading4 = createLucideIcon("heading-4", __iconNode$S);
521
- const __iconNode$R = [["path", {
522
505
  d: "M4 12h8",
523
506
  key: "17cfdx"
524
507
  }], ["path", {
@@ -534,7 +517,24 @@ const __iconNode$R = [["path", {
534
517
  d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",
535
518
  key: "1ejuhz"
536
519
  }]];
537
- const Heading3 = createLucideIcon("heading-3", __iconNode$R);
520
+ const Heading3 = createLucideIcon("heading-3", __iconNode$S);
521
+ const __iconNode$R = [["path", {
522
+ d: "M12 18V6",
523
+ key: "zqpxq5"
524
+ }], ["path", {
525
+ d: "M17 10v3a1 1 0 0 0 1 1h3",
526
+ key: "tj5zdr"
527
+ }], ["path", {
528
+ d: "M21 10v8",
529
+ key: "1kdml4"
530
+ }], ["path", {
531
+ d: "M4 12h8",
532
+ key: "17cfdx"
533
+ }], ["path", {
534
+ d: "M4 18V6",
535
+ key: "1rz3zl"
536
+ }]];
537
+ const Heading4 = createLucideIcon("heading-4", __iconNode$R);
538
538
  const __iconNode$Q = [["path", {
539
539
  d: "M4 12h8",
540
540
  key: "17cfdx"
@@ -909,6 +909,11 @@ const __iconNode$s = [["path", {
909
909
  }]];
910
910
  const PenLine = createLucideIcon("pen-line", __iconNode$s);
911
911
  const __iconNode$r = [["path", {
912
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
913
+ key: "1a8usu"
914
+ }]];
915
+ const Pen = createLucideIcon("pen", __iconNode$r);
916
+ const __iconNode$q = [["path", {
912
917
  d: "M13 21h8",
913
918
  key: "1jsn5i"
914
919
  }], ["path", {
@@ -918,12 +923,7 @@ const __iconNode$r = [["path", {
918
923
  d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
919
924
  key: "1a8usu"
920
925
  }]];
921
- const PencilLine = createLucideIcon("pencil-line", __iconNode$r);
922
- const __iconNode$q = [["path", {
923
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
924
- key: "1a8usu"
925
- }]];
926
- const Pen = createLucideIcon("pen", __iconNode$q);
926
+ const PencilLine = createLucideIcon("pencil-line", __iconNode$q);
927
927
  const __iconNode$p = [["path", {
928
928
  d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
929
929
  key: "1a8usu"
@@ -73544,6 +73544,7 @@ function useRange(props, dateLib) {
73544
73544
  const {
73545
73545
  disabled,
73546
73546
  excludeDisabled,
73547
+ resetOnSelect,
73547
73548
  selected: initiallySelected,
73548
73549
  required,
73549
73550
  onSelect
@@ -73556,7 +73557,25 @@ function useRange(props, dateLib) {
73556
73557
  min: min2,
73557
73558
  max: max2
73558
73559
  } = props;
73559
- const newRange = triggerDate ? addToRange(triggerDate, selected, min2, max2, required, dateLib) : void 0;
73560
+ let newRange;
73561
+ if (triggerDate) {
73562
+ const selectedFrom = selected?.from;
73563
+ const selectedTo = selected?.to;
73564
+ const hasFullRange = !!selectedFrom && !!selectedTo;
73565
+ const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom);
73566
+ if (resetOnSelect && (hasFullRange || !selected?.from)) {
73567
+ if (!required && isClickingSingleDayRange) {
73568
+ newRange = void 0;
73569
+ } else {
73570
+ newRange = {
73571
+ from: triggerDate,
73572
+ to: void 0
73573
+ };
73574
+ }
73575
+ } else {
73576
+ newRange = addToRange(triggerDate, selected, min2, max2, required, dateLib);
73577
+ }
73578
+ }
73560
73579
  if (excludeDisabled && disabled && newRange?.from && newRange.to) {
73561
73580
  if (rangeContainsModifiers({
73562
73581
  from: newRange.from,
@@ -73944,7 +73963,7 @@ function DayPicker(initialProps) {
73944
73963
  style,
73945
73964
  dir: props.dir,
73946
73965
  id: props.id,
73947
- lang: props.lang,
73966
+ lang: props.lang ?? locale.code,
73948
73967
  nonce: props.nonce,
73949
73968
  title: props.title,
73950
73969
  role: props.role,
@@ -1,4 +1,4 @@
1
- import { J as JSONSchemaEditorProvider, a as JSONSchemaEditorContent } from "./client-DIrftxPs.js";
1
+ import { J as JSONSchemaEditorProvider, a as JSONSchemaEditorContent } from "./client-Dm8-2ev7.js";
2
2
  import { P as PopoverTrigger, a as PopoverContent, b as Popover } from "./popover-CHIvaTz_.js";
3
3
  import "../index.js";
4
4
  import "../__vite_rsc_assets_manifest.js";
@@ -5961,19 +5961,19 @@ const clientReferences = {
5961
5961
  return m.export_37eafacc3f00;
5962
5962
  },
5963
5963
  "dc3a4fc5767f": async () => {
5964
- const m = await import("./assets/route-r7ypDwBC.js");
5964
+ const m = await import("./assets/route-D3n8i03R.js");
5965
5965
  return m.export_dc3a4fc5767f;
5966
5966
  },
5967
5967
  "793b5b94ae43": async () => {
5968
- const m = await import("./assets/route-r7ypDwBC.js");
5968
+ const m = await import("./assets/route-D3n8i03R.js");
5969
5969
  return m.export_793b5b94ae43;
5970
5970
  },
5971
5971
  "ba92e02b9841": async () => {
5972
- const m = await import("./assets/client-DZ7MH4ui.js");
5972
+ const m = await import("./assets/client-BbQZwY1s.js");
5973
5973
  return m.export_ba92e02b9841;
5974
5974
  },
5975
5975
  "e9c83060cf4f": async () => {
5976
- const m = await import("./assets/client-CoRUI7H1.js");
5976
+ const m = await import("./assets/client-aUUPy-yC.js");
5977
5977
  return m.export_e9c83060cf4f;
5978
5978
  },
5979
5979
  "3e8fc4d4edf5": async () => {