@iris-ui-kit/vue 0.2.18 → 0.2.19

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/undo.cjs CHANGED
@@ -27,12 +27,12 @@ function useUndoStack(options) {
27
27
  };
28
28
  const undo$1 = () => {
29
29
  const result = stack.undo();
30
- if (result !== void 0) sync();
30
+ sync();
31
31
  return result;
32
32
  };
33
33
  const redo = () => {
34
34
  const result = stack.redo();
35
- if (result !== void 0) sync();
35
+ sync();
36
36
  return result;
37
37
  };
38
38
  const clear = () => {
package/dist/undo.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/undo/useUndoStack.ts"],"names":["createUndoStack","shallowRef","undo"],"mappings":";;;;;;AAgCO,SAAS,aAAgB,OAAA,EAa9B;AACA,EAAA,MAAM,KAAA,GAAQA,qBAAmB,OAAO,CAAA;AAExC,EAAA,MAAM,QAAQC,cAAA,CAAmC;AAAA,IAC/C,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,OAAO,KAAA,CAAM;AAAA,GACd,CAAA;AAED,EAAA,MAAM,OAAO,MAAM;AACjB,IAAA,KAAA,CAAM,KAAA,GAAQ;AAAA,MACZ,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,OAAO,KAAA,CAAM;AAAA,KACf;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,GAAO,CAAC,QAAA,KAAmB;AAC/B,IAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAClC,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAMC,SAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,KAAA,CAAM,KAAA,EAAM;AACZ,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AAEA,EAAA,OAAO,EAAE,IAAA,QAAMA,MAAA,EAAM,IAAA,EAAM,KAAA,EAAO,OAAO,KAAA,EAAM;AACjD","file":"undo.cjs","sourcesContent":["import { shallowRef, type ShallowRef } from 'vue'\nimport { createUndoStack, type UndoStack, type UndoStackOptions } from '@iris-ui-kit/core/undo'\n\n/**\n * Reactive snapshot metadata for the UndoStack: convenience booleans that\n * update on every push/undo/redo/clear for use in UI bindings (enable/disable\n * undo/redo buttons).\n */\nexport interface UndoStackReactiveState {\n canUndo: boolean\n canRedo: boolean\n depth: number\n index: number\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createUndoStack}.\n * Creates the stack once in `setup()` and returns a stable controller\n * plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for\n * easy UI binding.\n *\n * The returned `push`/`undo`/`redo`/`clear` automatically update the reactive\n * state — no manual `.value = ...` needed.\n *\n * @example\n * const { push, undo, redo, state } = useUndoStack({ initial: formValues })\n * // After mutation:\n * push(currentValues)\n * // In template:\n * <button :disabled=\"!state.canUndo\" @click=\"undo\">Undo</button>\n * <button :disabled=\"!state.canRedo\" @click=\"redo\">Redo</button>\n */\nexport function useUndoStack<T>(options?: UndoStackOptions<T>): {\n /** Push a new snapshot onto the stack. Returns the stored value. */\n push: (snapshot: T) => T\n /** Undo: returns the previous snapshot, or undefined if nothing to undo. */\n undo: () => T | undefined\n /** Redo: returns the next snapshot, or undefined if nothing to redo. */\n redo: () => T | undefined\n /** Clear all history. */\n clear: () => void\n /** The raw undo stack (stable reference, same across renders). */\n stack: UndoStack<T>\n /** Reactive metadata: canUndo, canRedo, depth, index. */\n state: ShallowRef<UndoStackReactiveState>\n} {\n const stack = createUndoStack<T>(options)\n\n const state = shallowRef<UndoStackReactiveState>({\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n })\n\n const sync = () => {\n state.value = {\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n }\n }\n\n const push = (snapshot: T): T => {\n const result = stack.push(snapshot)\n sync()\n return result\n }\n\n const undo = (): T | undefined => {\n const result = stack.undo()\n if (result !== undefined) sync()\n return result\n }\n\n const redo = (): T | undefined => {\n const result = stack.redo()\n if (result !== undefined) sync()\n return result\n }\n\n const clear = () => {\n stack.clear()\n sync()\n }\n\n return { push, undo, redo, clear, stack, state }\n}\n"]}
1
+ {"version":3,"sources":["../src/undo/useUndoStack.ts"],"names":["createUndoStack","shallowRef","undo"],"mappings":";;;;;;AAgCO,SAAS,aAAgB,OAAA,EAa9B;AACA,EAAA,MAAM,KAAA,GAAQA,qBAAmB,OAAO,CAAA;AAExC,EAAA,MAAM,QAAQC,cAAA,CAAmC;AAAA,IAC/C,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,OAAO,KAAA,CAAM;AAAA,GACd,CAAA;AAED,EAAA,MAAM,OAAO,MAAM;AACjB,IAAA,KAAA,CAAM,KAAA,GAAQ;AAAA,MACZ,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,OAAO,KAAA,CAAM;AAAA,KACf;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,GAAO,CAAC,QAAA,KAAmB;AAC/B,IAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAClC,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAMC,SAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAK1B,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,KAAA,CAAM,KAAA,EAAM;AACZ,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AAEA,EAAA,OAAO,EAAE,IAAA,QAAMA,MAAA,EAAM,IAAA,EAAM,KAAA,EAAO,OAAO,KAAA,EAAM;AACjD","file":"undo.cjs","sourcesContent":["import { shallowRef, type ShallowRef } from 'vue'\nimport { createUndoStack, type UndoStack, type UndoStackOptions } from '@iris-ui-kit/core/undo'\n\n/**\n * Reactive snapshot metadata for the UndoStack: convenience booleans that\n * update on every push/undo/redo/clear for use in UI bindings (enable/disable\n * undo/redo buttons).\n */\nexport interface UndoStackReactiveState {\n canUndo: boolean\n canRedo: boolean\n depth: number\n index: number\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createUndoStack}.\n * Creates the stack once in `setup()` and returns a stable controller\n * plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for\n * easy UI binding.\n *\n * The returned `push`/`undo`/`redo`/`clear` automatically update the reactive\n * state — no manual `.value = ...` needed.\n *\n * @example\n * const { push, undo, redo, state } = useUndoStack({ initial: formValues })\n * // After mutation:\n * push(currentValues)\n * // In template:\n * <button :disabled=\"!state.canUndo\" @click=\"undo\">Undo</button>\n * <button :disabled=\"!state.canRedo\" @click=\"redo\">Redo</button>\n */\nexport function useUndoStack<T>(options?: UndoStackOptions<T>): {\n /** Push a new snapshot onto the stack. Returns the stored value. */\n push: (snapshot: T) => T\n /** Undo: returns the previous snapshot, or undefined if nothing to undo. */\n undo: () => T | undefined\n /** Redo: returns the next snapshot, or undefined if nothing to redo. */\n redo: () => T | undefined\n /** Clear all history. */\n clear: () => void\n /** The raw undo stack (stable reference, same across renders). */\n stack: UndoStack<T>\n /** Reactive metadata: canUndo, canRedo, depth, index. */\n state: ShallowRef<UndoStackReactiveState>\n} {\n const stack = createUndoStack<T>(options)\n\n const state = shallowRef<UndoStackReactiveState>({\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n })\n\n const sync = () => {\n state.value = {\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n }\n }\n\n const push = (snapshot: T): T => {\n const result = stack.push(snapshot)\n sync()\n return result\n }\n\n const undo = (): T | undefined => {\n const result = stack.undo()\n // Always sync: `undefined` is a legal snapshot value for a generic T, so\n // the return value cannot distinguish \"no-op\" from \"moved onto an\n // undefined snapshot\". A true no-op writes identical values, which is\n // harmless (same as push/clear).\n sync()\n return result\n }\n\n const redo = (): T | undefined => {\n const result = stack.redo()\n sync()\n return result\n }\n\n const clear = () => {\n stack.clear()\n sync()\n }\n\n return { push, undo, redo, clear, stack, state }\n}\n"]}
package/dist/undo.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createUndoStack, useUndoStack } from './chunk-VM2CXEUA.js';
1
+ export { createUndoStack, useUndoStack } from './chunk-RLVG5JQH.js';
2
2
  //# sourceMappingURL=undo.js.map
3
3
  //# sourceMappingURL=undo.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iris-ui-kit/vue",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Vue 3.5 adapter for Iris UI — full component set",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/undo/useUndoStack.ts"],"names":[],"mappings":";;;;;AAgCO,SAAS,aAAgB,OAAA,EAa9B;AACA,EAAA,MAAM,KAAA,GAAQ,gBAAmB,OAAO,CAAA;AAExC,EAAA,MAAM,QAAQ,UAAA,CAAmC;AAAA,IAC/C,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IACvB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,OAAO,KAAA,CAAM;AAAA,GACd,CAAA;AAED,EAAA,MAAM,OAAO,MAAM;AACjB,IAAA,KAAA,CAAM,KAAA,GAAQ;AAAA,MACZ,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,MACvB,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,OAAO,KAAA,CAAM;AAAA,KACf;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,GAAO,CAAC,QAAA,KAAmB;AAC/B,IAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAClC,IAAA,IAAA,EAAK;AACL,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAO,MAAqB;AAChC,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,EAAK;AAC1B,IAAA,IAAI,MAAA,KAAW,QAAW,IAAA,EAAK;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,KAAA,CAAM,KAAA,EAAM;AACZ,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AAEA,EAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,OAAO,KAAA,EAAM;AACjD","file":"chunk-VM2CXEUA.js","sourcesContent":["import { shallowRef, type ShallowRef } from 'vue'\nimport { createUndoStack, type UndoStack, type UndoStackOptions } from '@iris-ui-kit/core/undo'\n\n/**\n * Reactive snapshot metadata for the UndoStack: convenience booleans that\n * update on every push/undo/redo/clear for use in UI bindings (enable/disable\n * undo/redo buttons).\n */\nexport interface UndoStackReactiveState {\n canUndo: boolean\n canRedo: boolean\n depth: number\n index: number\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createUndoStack}.\n * Creates the stack once in `setup()` and returns a stable controller\n * plus a reactive `state` that tracks `canUndo`/`canRedo`/`depth`/`index` for\n * easy UI binding.\n *\n * The returned `push`/`undo`/`redo`/`clear` automatically update the reactive\n * state — no manual `.value = ...` needed.\n *\n * @example\n * const { push, undo, redo, state } = useUndoStack({ initial: formValues })\n * // After mutation:\n * push(currentValues)\n * // In template:\n * <button :disabled=\"!state.canUndo\" @click=\"undo\">Undo</button>\n * <button :disabled=\"!state.canRedo\" @click=\"redo\">Redo</button>\n */\nexport function useUndoStack<T>(options?: UndoStackOptions<T>): {\n /** Push a new snapshot onto the stack. Returns the stored value. */\n push: (snapshot: T) => T\n /** Undo: returns the previous snapshot, or undefined if nothing to undo. */\n undo: () => T | undefined\n /** Redo: returns the next snapshot, or undefined if nothing to redo. */\n redo: () => T | undefined\n /** Clear all history. */\n clear: () => void\n /** The raw undo stack (stable reference, same across renders). */\n stack: UndoStack<T>\n /** Reactive metadata: canUndo, canRedo, depth, index. */\n state: ShallowRef<UndoStackReactiveState>\n} {\n const stack = createUndoStack<T>(options)\n\n const state = shallowRef<UndoStackReactiveState>({\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n })\n\n const sync = () => {\n state.value = {\n canUndo: stack.canUndo(),\n canRedo: stack.canRedo(),\n depth: stack.depth,\n index: stack.index,\n }\n }\n\n const push = (snapshot: T): T => {\n const result = stack.push(snapshot)\n sync()\n return result\n }\n\n const undo = (): T | undefined => {\n const result = stack.undo()\n if (result !== undefined) sync()\n return result\n }\n\n const redo = (): T | undefined => {\n const result = stack.redo()\n if (result !== undefined) sync()\n return result\n }\n\n const clear = () => {\n stack.clear()\n sync()\n }\n\n return { push, undo, redo, clear, stack, state }\n}\n"]}