intable 0.0.4 → 0.0.5

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/__uno.css CHANGED
@@ -1 +1 @@
1
- @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--un-bg-opacity:100%;--un-content:"";--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-text-opacity:100%;--un-border-opacity:100%;--un-space-y-reverse:initial;--un-space-x-reverse:initial;--un-outline-style:solid;--un-outline-opacity:100%;--un-leading:initial}}@property --un-leading{syntax:"*";inherits:false}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-font-family:var(--font-sans);--default-monoFont-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--colors-gray-DEFAULT:lab(65.9269% -.832707 -8.17474);--colors-blue-DEFAULT:lab(65.0361% -1.42062 -56.9803)}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-featureSettings,normal);font-variation-settings:var(--default-font-variationSettings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-monoFont-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-monoFont-featureSettings,normal);font-variation-settings:var(--default-monoFont-variationSettings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden~=until-found])){display:none!important}.container{width:100%}.aic{align-items:center}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-3\.5{font-size:.875rem}.lh-\[1\]{--un-leading:1;line-height:1}.m9{margin:36px}.mx-1{margin-inline:4px}.mx-3\!{margin-inline:12px!important}.my-1{margin-block:4px}.ml{margin-left:16px}.ml-\.5{margin-left:2px}.ml-1{margin-left:4px}.mr--1{margin-right:-4px}.mr-1{margin-right:4px}.mr-2{margin-right:8px}.mr-2\.5{margin-right:10px}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#dafaea{background-color:color-mix(in oklab,#dafaea var(--un-bg-opacity),transparent)}.bg-\#ffe8e8{background-color:color-mix(in oklab,#ffe8e8 var(--un-bg-opacity),transparent)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.bg-gray\/20{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)20%,transparent)}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.translate-x-1\/2{--un-translate-x:50%;translate:var(--un-translate-x)var(--un-translate-y)}.transform{transform:var(--un-rotate-x)var(--un-rotate-y)var(--un-rotate-z)var(--un-skew-x)var(--un-skew-y)}.items-center{align-items:center}.box-border{box-sizing:border-box}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.bg-gray\/20{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)20%,transparent)}}
1
+ @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--un-bg-opacity:100%;--un-content:"";--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-text-opacity:100%;--un-border-opacity:100%;--un-space-y-reverse:initial;--un-space-x-reverse:initial;--un-outline-style:solid;--un-outline-opacity:100%;--un-leading:initial}}@property --un-leading{syntax:"*";inherits:false}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-font-family:var(--font-sans);--default-monoFont-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--colors-gray-DEFAULT:lab(65.9269% -.832707 -8.17474);--colors-blue-DEFAULT:lab(65.0361% -1.42062 -56.9803)}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-featureSettings,normal);font-variation-settings:var(--default-font-variationSettings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-monoFont-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-monoFont-featureSettings,normal);font-variation-settings:var(--default-monoFont-variationSettings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden~=until-found])){display:none!important}.container{width:100%}.aic{align-items:center}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-3\.5{font-size:.875rem}.lh-\[1\]{--un-leading:1;line-height:1}.m9{margin:36px}.mx-1{margin-inline:4px}.mx-3\!{margin-inline:12px!important}.my-1{margin-block:4px}.ml{margin-left:16px}.ml-\.5{margin-left:2px}.ml-1{margin-left:4px}.mr--1{margin-right:-4px}.mr-1{margin-right:4px}.mr-2{margin-right:8px}.mr-2\.5{margin-right:10px}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#dafaea{background-color:color-mix(in oklab,#dafaea var(--un-bg-opacity),transparent)}.bg-\#ffe8e8{background-color:color-mix(in oklab,#ffe8e8 var(--un-bg-opacity),transparent)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.bg-gray\/20{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)20%,transparent)}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.translate-x-1\/2{--un-translate-x:50%;translate:var(--un-translate-x)var(--un-translate-y)}.transform{transform:var(--un-rotate-x)var(--un-rotate-y)var(--un-rotate-z)var(--un-skew-x)var(--un-skew-y)}.items-center{align-items:center}.box-border{box-sizing:border-box}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.bg-gray\/20{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)20%,transparent)}}
@@ -36,4 +36,5 @@ export declare function useHistory([val, setVal]: [any, any]): {
36
36
  readonly index: number;
37
37
  readonly history: any[];
38
38
  };
39
+ export declare function useMemoState(fn: any): {};
39
40
  export {};
@@ -1,5 +1,5 @@
1
1
  import { unFn } from "../utils.js";
2
- import { $PROXY, createComputed, createEffect, createMemo, createRenderEffect, createRoot, createSignal, mergeProps, on, onCleanup, untrack } from "solid-js";
2
+ import { $PROXY, batch, createComputed, createEffect, createMemo, createRenderEffect, createRoot, createSignal, mergeProps, on, onCleanup, untrack } from "solid-js";
3
3
  import { $RAW, createMutable } from "solid-js/store";
4
4
  import { isFunction, isPromise, mapValues } from "es-toolkit";
5
5
  import { createEventListener, createEventListenerMap } from "@solid-primitives/event-listener";
@@ -9,139 +9,149 @@ import { makePersisted, storageSync } from "@solid-primitives/storage";
9
9
  import { createMutationObserver } from "@solid-primitives/mutation-observer";
10
10
  import { castArray } from "es-toolkit/compat";
11
11
  import { createKeybindingsHandler } from "tinykeys";
12
- function usePointerDrag(m, P) {
13
- P = mergeProps({ preventDefault: !0 }, P), createPointerListeners({
14
- target: m,
12
+ function usePointerDrag(h, L) {
13
+ L = mergeProps({ preventDefault: !0 }, L), createPointerListeners({
14
+ target: h,
15
15
  passive: !1,
16
- onDown(m) {
17
- P.preventDefault && m.preventDefault();
18
- let [F, I] = [m.x, m.y], L, R;
19
- P.start?.(m, (m) => L = m, (m) => R = m), createRoot((P) => {
16
+ onDown(h) {
17
+ L.preventDefault && h.preventDefault();
18
+ let [R, z] = [h.x, h.y], B, V;
19
+ L.start?.(h, (h) => B = h, (h) => V = h), createRoot((L) => {
20
20
  createPointerListeners({
21
21
  target: document,
22
- onMove(m) {
23
- let [P, R] = [m.x - F, m.y - I];
24
- L?.(m, {
25
- sx: F,
26
- sy: I,
27
- ox: P,
28
- oy: R
22
+ onMove(h) {
23
+ let [L, V] = [h.x - R, h.y - z];
24
+ B?.(h, {
25
+ sx: R,
26
+ sy: z,
27
+ ox: L,
28
+ oy: V
29
29
  });
30
30
  },
31
31
  onUp() {
32
- R?.(m), P(), L = void 0, R = void 0;
32
+ V?.(h), L(), B = void 0, V = void 0;
33
33
  }
34
- }), createEventListenerMap(document, { drop: P });
34
+ }), createEventListenerMap(document, { drop: L });
35
35
  });
36
36
  }
37
37
  });
38
38
  }
39
- function model(m, P) {
40
- let [F, I] = P();
41
- createRenderEffect(() => m.value = F()), m.addEventListener("input", (m) => I(m.target.value));
39
+ function model(h, L) {
40
+ let [R, z] = L();
41
+ createRenderEffect(() => h.value = R()), h.addEventListener("input", (h) => z(h.target.value));
42
42
  }
43
- function toSignle(m, P) {
44
- return [() => m[P], (F) => m[P] = F];
43
+ function toSignle(h, L) {
44
+ return [() => h[L], (R) => h[L] = R];
45
45
  }
46
46
  function useDark() {
47
- let m = (m) => m == "dark" || F() && !m, P = (m) => m ? "dark" : "light", F = () => window.matchMedia("(prefers-color-scheme: dark)").matches, L = makePersisted(createSignal(F()), {
47
+ let h = (h) => h == "dark" || R() && !h, L = (h) => h ? "dark" : "light", R = () => window.matchMedia("(prefers-color-scheme: dark)").matches, z = makePersisted(createSignal(R()), {
48
48
  name: "color-schema",
49
49
  storage: localStorage,
50
50
  sync: storageSync,
51
- serialize: P,
52
- deserialize: m
51
+ serialize: L,
52
+ deserialize: h
53
53
  });
54
- return createEffect(() => document.documentElement.classList[L[0]() ? "add" : "remove"]("dark")), createEffect(() => window.dispatchEvent(new StorageEvent("storage", {
54
+ return createEffect(() => document.documentElement.classList[z[0]() ? "add" : "remove"]("dark")), createEffect(() => window.dispatchEvent(new StorageEvent("storage", {
55
55
  key: "color-schema",
56
- newValue: P(L[0]())
57
- }))), L;
56
+ newValue: L(z[0]())
57
+ }))), z;
58
58
  }
59
- function useMemoAsync(m, P) {
60
- let I = Symbol(), [L, R] = createSignal(P);
59
+ function useMemoAsync(h, L) {
60
+ let R = Symbol(), [B, V] = createSignal(L);
61
61
  return createComputed(async () => {
62
- let P = m(untrack(L)), F = P instanceof Promise ? await new Promise((m) => {
63
- P.then(m), onCleanup(() => m(I));
64
- }) : P;
65
- F == I || R(() => F);
66
- }), L;
62
+ let L = h(untrack(B)), z = L instanceof Promise ? await new Promise((h) => {
63
+ L.then(h), onCleanup(() => h(R));
64
+ }) : L;
65
+ z == R || V(() => z);
66
+ }), B;
67
67
  }
68
- function useSignle2(m, P) {
69
- let I = createSignal(isFunction(m) ? void 0 : m), L = (m) => {
70
- let F = P?.before?.(m);
71
- return isPromise(F) ? F.then((P) => P === void 0 ? m : P) : F ?? m;
72
- }, R = useMemoAsync(() => L(I[0]()));
73
- if (isFunction(m)) {
74
- let P = useMemoAsync(() => L(m()));
75
- createComputed(() => I[1](P()));
68
+ function useSignle2(h, L) {
69
+ let R = createSignal(isFunction(h) ? void 0 : h), B = (h) => {
70
+ let R = L?.before?.(h);
71
+ return isPromise(R) ? R.then((L) => L === void 0 ? h : L) : R ?? h;
72
+ }, V = useMemoAsync(() => B(R[0]()));
73
+ if (isFunction(h)) {
74
+ let L = useMemoAsync(() => B(h()));
75
+ createComputed(() => R[1](L()));
76
76
  }
77
- return [R, I[1]];
77
+ return [V, R[1]];
78
78
  }
79
79
  var $MEMO = Symbol();
80
- function toReactive(F) {
81
- let I = () => unFn(F), L = () => !0, R = (m) => ((m) => typeof m == "function" && $MEMO in m ? m() : m)(I()[m]);
80
+ function toReactive(R) {
81
+ let z = () => unFn(R), B = () => !0, V = (h) => ((h) => typeof h == "function" && $MEMO in h ? h() : h)(z()[h]);
82
82
  return new Proxy(Object.create(null), {
83
- get: (m, F, L) => F == $PROXY || F == $RAW ? L : ((m) => typeof m == "function" && $MEMO in m ? m() : m)(I()[F]),
84
- set: L,
85
- defineProperty: (m, P, F) => Object.defineProperty(I(), P, F),
86
- deleteProperty: L,
87
- getPrototypeOf: () => Object.getPrototypeOf(I()),
88
- has: (m, F) => F == $PROXY || F in I(),
89
- ownKeys: (m) => Object.keys(I()),
90
- getOwnPropertyDescriptor: (m, P) => ({
83
+ get: (h, R, B) => R == $PROXY || R == $RAW ? B : ((h) => typeof h == "function" && $MEMO in h ? h() : h)(z()[R]),
84
+ set: B,
85
+ defineProperty: (h, L, R) => Object.defineProperty(z(), L, R),
86
+ deleteProperty: B,
87
+ getPrototypeOf: () => Object.getPrototypeOf(z()),
88
+ has: (h, R) => R == $PROXY || R in z(),
89
+ ownKeys: (h) => Object.keys(z()),
90
+ getOwnPropertyDescriptor: (h, L) => ({
91
91
  enumerable: !0,
92
92
  configurable: !0,
93
93
  get() {
94
- return R(P);
94
+ return V(L);
95
95
  },
96
- set: L
96
+ set: B
97
97
  })
98
98
  });
99
99
  }
100
- function useMemo(m) {
101
- let P = createMemo(m);
102
- return P[$MEMO] = 1, P;
100
+ function useMemo(h) {
101
+ let L = createMemo(h);
102
+ return L[$MEMO] = 1, L;
103
103
  }
104
- function useHover(m) {
105
- let [P, F] = createSignal(!1);
106
- return createEventListener(m, "pointerenter", () => F(!0)), createEventListener(m, "pointerleave", () => F(!1)), P;
104
+ function useHover(h) {
105
+ let [L, R] = createSignal(!1);
106
+ return createEventListener(h, "pointerenter", () => R(!0)), createEventListener(h, "pointerleave", () => R(!1)), L;
107
107
  }
108
- function useMouseDown(m) {
109
- let [P, F] = createSignal(!1);
110
- return createEventListener(m, "pointerdown", () => F(!0)), createEventListener(document.body, "pointerup", () => F(!1)), P;
108
+ function useMouseDown(h) {
109
+ let [L, R] = createSignal(!1);
110
+ return createEventListener(h, "pointerdown", () => R(!0)), createEventListener(document.body, "pointerup", () => R(!1)), L;
111
111
  }
112
- function useClicked(m) {
113
- let [P, F] = createSignal(!1), I = () => castArray(access(m));
114
- return createEventListener(() => I().map((m) => m?.getRootNode()), "click", (m) => F(I().some((P) => P?.contains(m.target)))), P;
112
+ function useClicked(h) {
113
+ let [L, R] = createSignal(!1), z = () => castArray(access(h));
114
+ return createEventListener(() => z().map((h) => h?.getRootNode()), "click", (h) => R(z().some((L) => L?.contains(h.target)))), L;
115
115
  }
116
- function useMutation(m, P, F) {
117
- let I = createSignal(F());
118
- return createMutationObserver(m, P, (m) => I[1](F())), I[0];
116
+ function useMutation(h, L, R) {
117
+ let z = createSignal(R());
118
+ return createMutationObserver(h, L, (h) => z[1](R())), z[0];
119
119
  }
120
- function useTinykeys(m, P) {
121
- createEventListener(m, "keydown", createKeybindingsHandler({ ...mapValues(P, (m) => (P) => {
122
- P.preventDefault(), m(P);
120
+ function useTinykeys(h, L) {
121
+ createEventListener(h, "keydown", createKeybindingsHandler({ ...mapValues(L, (h) => (L) => {
122
+ L.preventDefault(), h(L);
123
123
  }) }));
124
124
  }
125
- function useHistory([m, P]) {
126
- let F = 1, I = createMutable({
125
+ function useHistory([h, L]) {
126
+ let R = 1, z = createMutable({
127
127
  index: -1,
128
128
  history: []
129
- }), L = () => (I.index = 0, I.history = [m()]), z = () => I.index > 0, B = () => I.index < I.history.length - 1;
130
- return createRenderEffect(on(m, (m) => {
131
- if (m != null) {
132
- if (!F) return F = 1;
133
- B() && (I.history = I.history.slice(0, I.index + 1)), I.history[++I.index] = m;
129
+ }), B = () => (z.index = 0, z.history = [h()]), V = () => z.index > 0, H = () => z.index < z.history.length - 1;
130
+ return createRenderEffect(on(h, (h) => {
131
+ if (h != null) {
132
+ if (!R) return R = 1;
133
+ H() && (z.history = z.history.slice(0, z.index + 1)), z.history[++z.index] = h;
134
134
  }
135
135
  })), {
136
- undo: () => z() && ((F = 0) || P(I.history[--I.index])),
137
- redo: () => B() && ((F = 0) || P(I.history[++I.index])),
138
- clear: L,
136
+ undo: () => V() && ((R = 0) || L(z.history[--z.index])),
137
+ redo: () => H() && ((R = 0) || L(z.history[++z.index])),
138
+ clear: B,
139
139
  get index() {
140
- return I.index;
140
+ return z.index;
141
141
  },
142
142
  get history() {
143
- return I.history;
143
+ return z.history;
144
144
  }
145
145
  };
146
146
  }
147
- export { model, toReactive, toSignle, useClicked, useDark, useHistory, useHover, useMemo, useMemoAsync, useMouseDown, useMutation, usePointerDrag, useSignle2, useTinykeys };
147
+ function useMemoState(h) {
148
+ let L = createMutable({});
149
+ return createComputed(() => {
150
+ let z = h();
151
+ untrack(() => batch(() => {
152
+ for (let h in L) h in z || delete L[h];
153
+ Object.assign(L, z);
154
+ }));
155
+ }), L;
156
+ }
157
+ export { model, toReactive, toSignle, useClicked, useDark, useHistory, useHover, useMemo, useMemoAsync, useMemoState, useMouseDown, useMutation, usePointerDrag, useSignle2, useTinykeys };
@@ -0,0 +1,16 @@
1
+ interface UseSelectorOpt<T> {
2
+ value?: T;
3
+ onChange?: (v: T) => void;
4
+ multiple?: boolean;
5
+ selectable?: (v: any) => boolean;
6
+ }
7
+ export declare function useSelector<T = any>(opt: UseSelectorOpt<T>): {
8
+ clear: () => void;
9
+ set: (v: T) => void;
10
+ has: (key: T | Set<T>) => boolean;
11
+ add: (v: T) => void;
12
+ del: (v: T) => void;
13
+ toggle: (v: T) => void;
14
+ readonly value: any;
15
+ };
16
+ export {};
@@ -0,0 +1,35 @@
1
+ import { createMemo, createSelector, createSignal } from "solid-js";
2
+ function useSelector(r) {
3
+ let { value: i, onChange: a, multiple: o = !1, selectable: s } = r, [c, l] = createSignal((() => o ? i ? new Set(Array.isArray(i) ? i : [i]) : /* @__PURE__ */ new Set() : i)()), u = (e) => s ? s(e) : !0, d = () => {
4
+ o ? (l(/* @__PURE__ */ new Set()), a?.([])) : (l(void 0), a?.(void 0));
5
+ }, f = (e) => {
6
+ if (u(e)) if (o) {
7
+ let n = new Set(Array.isArray(e) ? e : [e]);
8
+ l(n), a?.(Array.from(n));
9
+ } else l(e), a?.(e);
10
+ }, p = createSelector(c, (e, n) => o ? n.has(e) : e === n), m = (e) => {
11
+ if (u(e)) if (o) {
12
+ let n = new Set(c());
13
+ n.add(e), l(n), a?.(Array.from(n));
14
+ } else l(e), a?.(e);
15
+ }, h = (e) => {
16
+ if (o) {
17
+ let n = new Set(c());
18
+ n.delete(e), l(n), a?.(Array.from(n));
19
+ } else c() === e && (l(void 0), a?.(void 0));
20
+ }, g = (e) => {
21
+ p(e) ? h(e) : m(e);
22
+ }, _ = createMemo(() => o ? Array.from(c()) : c());
23
+ return {
24
+ clear: d,
25
+ set: f,
26
+ has: p,
27
+ add: m,
28
+ del: h,
29
+ toggle: g,
30
+ get value() {
31
+ return _();
32
+ }
33
+ };
34
+ }
35
+ export { useSelector };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { For, type JSX, type Component } from 'solid-js';
1
+ import { type JSX, type Component } from 'solid-js';
2
2
  import 'virtual:uno.css';
3
3
  import './style.scss';
4
4
  import './plugins/CellSelectionPlugin';
@@ -10,6 +10,8 @@ import './plugins/CommandPlugin';
10
10
  import './plugins/RowSelectionPlugin';
11
11
  import './plugins/ResizePlugin';
12
12
  import './plugins/DragPlugin';
13
+ import './plugins/RowGroupPlugin';
14
+ import './plugins/ExpandPlugin';
13
15
  export declare const Ctx: import("solid-js").Context<{
14
16
  props: TableProps2;
15
17
  store: TableStore;
@@ -19,12 +21,17 @@ type Pri<T> = {
19
21
  [K in keyof T]: T[K];
20
22
  };
21
23
  type TableProps2 = Requireds<TableProps, ('Table' | 'Thead' | 'Tbody' | 'Tr' | 'Th' | 'Td' | 'EachRows' | 'EachCells' | 'rowKey' | 'data' | 'columns' | 'newRow')>;
24
+ type Each<T = any> = (props: {
25
+ each: T[];
26
+ children: (e: () => any, i: () => number) => JSX.Element;
27
+ }) => JSX.Element;
22
28
  type ProcessProps = {
23
29
  [K in keyof TableProps]?: (prev: TableProps2, ctx: {
24
30
  store: TableStore;
25
31
  }) => TableProps[K];
26
32
  };
27
33
  export interface Plugin {
34
+ name?: string;
28
35
  priority?: number;
29
36
  store?: (store: TableStore) => Partial<TableStore> | void;
30
37
  rewriteProps?: ProcessProps;
@@ -52,8 +59,8 @@ export interface TableProps {
52
59
  data?: any;
53
60
  children: JSX.Element;
54
61
  }>;
55
- EachRows?: typeof For;
56
- EachCells?: typeof For<TableColumn[], JSX.Element>;
62
+ EachRows?: Each;
63
+ EachCells?: Each<TableColumn>;
57
64
  cellClass?: ((props: Omit<TDProps, 'y' | 'data'> & {
58
65
  y?: number;
59
66
  data?: any;
@@ -113,7 +120,7 @@ export interface TableStore extends Obj {
113
120
  }>[];
114
121
  internal: symbol;
115
122
  raw: symbol;
116
- props?: TableProps2;
123
+ props: TableProps2;
117
124
  rawProps: TableProps;
118
125
  plugins: Plugin[];
119
126
  }