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 +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +97 -87
- package/dist/hooks/useSelector.d.ts +16 -0
- package/dist/hooks/useSelector.js +35 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.js +184 -153
- package/dist/plugins/CellSelectionPlugin.js +2 -1
- package/dist/plugins/CommandPlugin.js +11 -5
- package/dist/plugins/CopyPastePlugin.js +1 -0
- package/dist/plugins/EditablePlugin.js +1 -0
- package/dist/plugins/ExpandPlugin.d.ts +3 -5
- package/dist/plugins/ExpandPlugin.js +40 -42
- package/dist/plugins/MenuPlugin.js +3 -2
- package/dist/plugins/RenderPlugin/index.js +1 -0
- package/dist/plugins/ResizePlugin.js +1 -0
- package/dist/plugins/RowGroupPlugin.js +4 -4
- package/dist/plugins/RowSelectionPlugin.d.ts +3 -15
- package/dist/plugins/RowSelectionPlugin.js +15 -31
- package/dist/style.css +2 -2
- package/dist/theme/element-plus.scss +5 -0
- package/dist/wc.js +6 -9
- package/package.json +1 -1
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)}}
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -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(
|
|
13
|
-
|
|
14
|
-
target:
|
|
12
|
+
function usePointerDrag(h, L) {
|
|
13
|
+
L = mergeProps({ preventDefault: !0 }, L), createPointerListeners({
|
|
14
|
+
target: h,
|
|
15
15
|
passive: !1,
|
|
16
|
-
onDown(
|
|
17
|
-
|
|
18
|
-
let [
|
|
19
|
-
|
|
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(
|
|
23
|
-
let [
|
|
24
|
-
|
|
25
|
-
sx:
|
|
26
|
-
sy:
|
|
27
|
-
ox:
|
|
28
|
-
oy:
|
|
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
|
-
|
|
32
|
+
V?.(h), L(), B = void 0, V = void 0;
|
|
33
33
|
}
|
|
34
|
-
}), createEventListenerMap(document, { drop:
|
|
34
|
+
}), createEventListenerMap(document, { drop: L });
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function model(
|
|
40
|
-
let [
|
|
41
|
-
createRenderEffect(() =>
|
|
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(
|
|
44
|
-
return [() =>
|
|
43
|
+
function toSignle(h, L) {
|
|
44
|
+
return [() => h[L], (R) => h[L] = R];
|
|
45
45
|
}
|
|
46
46
|
function useDark() {
|
|
47
|
-
let
|
|
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:
|
|
52
|
-
deserialize:
|
|
51
|
+
serialize: L,
|
|
52
|
+
deserialize: h
|
|
53
53
|
});
|
|
54
|
-
return createEffect(() => document.documentElement.classList[
|
|
54
|
+
return createEffect(() => document.documentElement.classList[z[0]() ? "add" : "remove"]("dark")), createEffect(() => window.dispatchEvent(new StorageEvent("storage", {
|
|
55
55
|
key: "color-schema",
|
|
56
|
-
newValue:
|
|
57
|
-
}))),
|
|
56
|
+
newValue: L(z[0]())
|
|
57
|
+
}))), z;
|
|
58
58
|
}
|
|
59
|
-
function useMemoAsync(
|
|
60
|
-
let
|
|
59
|
+
function useMemoAsync(h, L) {
|
|
60
|
+
let R = Symbol(), [B, V] = createSignal(L);
|
|
61
61
|
return createComputed(async () => {
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
}) :
|
|
65
|
-
|
|
66
|
-
}),
|
|
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(
|
|
69
|
-
let
|
|
70
|
-
let
|
|
71
|
-
return isPromise(
|
|
72
|
-
},
|
|
73
|
-
if (isFunction(
|
|
74
|
-
let
|
|
75
|
-
createComputed(() =>
|
|
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 [
|
|
77
|
+
return [V, R[1]];
|
|
78
78
|
}
|
|
79
79
|
var $MEMO = Symbol();
|
|
80
|
-
function toReactive(
|
|
81
|
-
let
|
|
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: (
|
|
84
|
-
set:
|
|
85
|
-
defineProperty: (
|
|
86
|
-
deleteProperty:
|
|
87
|
-
getPrototypeOf: () => Object.getPrototypeOf(
|
|
88
|
-
has: (
|
|
89
|
-
ownKeys: (
|
|
90
|
-
getOwnPropertyDescriptor: (
|
|
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
|
|
94
|
+
return V(L);
|
|
95
95
|
},
|
|
96
|
-
set:
|
|
96
|
+
set: B
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
function useMemo(
|
|
101
|
-
let
|
|
102
|
-
return
|
|
100
|
+
function useMemo(h) {
|
|
101
|
+
let L = createMemo(h);
|
|
102
|
+
return L[$MEMO] = 1, L;
|
|
103
103
|
}
|
|
104
|
-
function useHover(
|
|
105
|
-
let [
|
|
106
|
-
return createEventListener(
|
|
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(
|
|
109
|
-
let [
|
|
110
|
-
return createEventListener(
|
|
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(
|
|
113
|
-
let [
|
|
114
|
-
return createEventListener(() =>
|
|
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(
|
|
117
|
-
let
|
|
118
|
-
return createMutationObserver(
|
|
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(
|
|
121
|
-
createEventListener(
|
|
122
|
-
|
|
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([
|
|
126
|
-
let
|
|
125
|
+
function useHistory([h, L]) {
|
|
126
|
+
let R = 1, z = createMutable({
|
|
127
127
|
index: -1,
|
|
128
128
|
history: []
|
|
129
|
-
}),
|
|
130
|
-
return createRenderEffect(on(
|
|
131
|
-
if (
|
|
132
|
-
if (!
|
|
133
|
-
|
|
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: () =>
|
|
137
|
-
redo: () =>
|
|
138
|
-
clear:
|
|
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
|
|
140
|
+
return z.index;
|
|
141
141
|
},
|
|
142
142
|
get history() {
|
|
143
|
-
return
|
|
143
|
+
return z.history;
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
|
|
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 {
|
|
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?:
|
|
56
|
-
EachCells?:
|
|
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
|
|
123
|
+
props: TableProps2;
|
|
117
124
|
rawProps: TableProps;
|
|
118
125
|
plugins: Plugin[];
|
|
119
126
|
}
|