@witchcraft/ui 0.3.13 → 0.3.14

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "witchcraftUi",
3
3
  "configKey": "witchcraftUi",
4
- "version": "0.3.13",
4
+ "version": "0.3.14",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -34,16 +34,16 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
34
34
  }> & Readonly<{
35
35
  "onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
36
36
  onCancel?: (() => any) | undefined;
37
- "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
38
37
  onSave?: (() => any) | undefined;
38
+ "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
39
39
  }>, {
40
40
  border: boolean;
41
41
  allowAlpha: boolean;
42
- copyTransform: (val: HsvaColor, stringVal: string) => any;
43
42
  stringPrecision: number;
44
43
  customRepresentation: {
45
44
  fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
46
45
  };
46
+ copyTransform: (val: HsvaColor, stringVal: string) => any;
47
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
48
48
  default?: (props: {
49
49
  stringColor: any;
@@ -34,16 +34,16 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
34
34
  }> & Readonly<{
35
35
  "onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
36
36
  onCancel?: (() => any) | undefined;
37
- "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
38
37
  onSave?: (() => any) | undefined;
38
+ "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
39
39
  }>, {
40
40
  border: boolean;
41
41
  allowAlpha: boolean;
42
- copyTransform: (val: HsvaColor, stringVal: string) => any;
43
42
  stringPrecision: number;
44
43
  customRepresentation: {
45
44
  fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
46
45
  };
46
+ copyTransform: (val: HsvaColor, stringVal: string) => any;
47
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
48
48
  default?: (props: {
49
49
  stringColor: any;
@@ -39,18 +39,18 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
39
39
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
41
41
  onCancel?: (() => any) | undefined;
42
- "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
43
42
  onSave?: ((val: RgbaColor) => any) | undefined;
43
+ "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
44
44
  }>, {
45
45
  border: boolean;
46
+ valid: boolean;
46
47
  allowAlpha: boolean;
47
- copyTransform: (val: HsvaColor, stringVal: string) => any;
48
48
  stringPrecision: number;
49
49
  customRepresentation: {
50
50
  fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
51
51
  fromStringToHsva?: (string: string) => HsvaColor | undefined;
52
52
  };
53
- valid: boolean;
53
+ copyTransform: (val: HsvaColor, stringVal: string) => any;
54
54
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
55
55
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
56
56
  export default _default;
@@ -39,18 +39,18 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
39
39
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
41
41
  onCancel?: (() => any) | undefined;
42
- "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
43
42
  onSave?: ((val: RgbaColor) => any) | undefined;
43
+ "onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
44
44
  }>, {
45
45
  border: boolean;
46
+ valid: boolean;
46
47
  allowAlpha: boolean;
47
- copyTransform: (val: HsvaColor, stringVal: string) => any;
48
48
  stringPrecision: number;
49
49
  customRepresentation: {
50
50
  fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
51
51
  fromStringToHsva?: (string: string) => HsvaColor | undefined;
52
52
  };
53
- valid: boolean;
53
+ copyTransform: (val: HsvaColor, stringVal: string) => any;
54
54
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
55
55
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
56
56
  export default _default;
@@ -110,8 +110,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
110
110
  blur: (val: FocusEvent) => any;
111
111
  input: (val: InputEvent) => any;
112
112
  submit: (val: string, suggestion?: any) => any;
113
- focus: (val: FocusEvent) => any;
114
113
  keydown: (val: KeyboardEvent) => any;
114
+ focus: (val: FocusEvent) => any;
115
115
  indicatorClick: (val: MouseEvent) => any;
116
116
  }, string, import("vue").PublicProps, Readonly<Props & {
117
117
  values?: string[] | undefined;
@@ -122,10 +122,10 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
122
122
  onInput?: ((val: InputEvent) => any) | undefined;
123
123
  onSubmit?: ((val: string, suggestion?: any) => any) | undefined;
124
124
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
125
- onFocus?: ((val: FocusEvent) => any) | undefined;
126
- onKeydown?: ((val: KeyboardEvent) => any) | undefined;
127
125
  "onUpdate:inputValue"?: ((value: string) => any) | undefined;
128
126
  "onUpdate:values"?: ((value: string[] | undefined) => any) | undefined;
127
+ onKeydown?: ((val: KeyboardEvent) => any) | undefined;
128
+ onFocus?: ((val: FocusEvent) => any) | undefined;
129
129
  onIndicatorClick?: ((val: MouseEvent) => any) | undefined;
130
130
  }>, {
131
131
  disabled: boolean;
@@ -110,8 +110,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
110
110
  blur: (val: FocusEvent) => any;
111
111
  input: (val: InputEvent) => any;
112
112
  submit: (val: string, suggestion?: any) => any;
113
- focus: (val: FocusEvent) => any;
114
113
  keydown: (val: KeyboardEvent) => any;
114
+ focus: (val: FocusEvent) => any;
115
115
  indicatorClick: (val: MouseEvent) => any;
116
116
  }, string, import("vue").PublicProps, Readonly<Props & {
117
117
  values?: string[] | undefined;
@@ -122,10 +122,10 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
122
122
  onInput?: ((val: InputEvent) => any) | undefined;
123
123
  onSubmit?: ((val: string, suggestion?: any) => any) | undefined;
124
124
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
125
- onFocus?: ((val: FocusEvent) => any) | undefined;
126
- onKeydown?: ((val: KeyboardEvent) => any) | undefined;
127
125
  "onUpdate:inputValue"?: ((value: string) => any) | undefined;
128
126
  "onUpdate:values"?: ((value: string[] | undefined) => any) | undefined;
127
+ onKeydown?: ((val: KeyboardEvent) => any) | undefined;
128
+ onFocus?: ((val: FocusEvent) => any) | undefined;
129
129
  onIndicatorClick?: ((val: MouseEvent) => any) | undefined;
130
130
  }>, {
131
131
  disabled: boolean;
@@ -22,12 +22,12 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
22
22
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
23
23
  onClose?: (() => any) | undefined;
24
24
  }>, {
25
+ canClose: boolean;
25
26
  useDialogForBackdrop: false;
26
27
  useBackdrop: boolean;
27
28
  preferredHorizontal: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | import("../../main.lib.js").PopupPositioner;
28
29
  preferredVertical: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | import("../../main.lib.js").PopupPositioner;
29
30
  avoidRepositioning: boolean;
30
- canClose: boolean;
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
32
32
  button?: (props: {
33
33
  extractEl: (_: any) => any;
@@ -22,12 +22,12 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
22
22
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
23
23
  onClose?: (() => any) | undefined;
24
24
  }>, {
25
+ canClose: boolean;
25
26
  useDialogForBackdrop: false;
26
27
  useBackdrop: boolean;
27
28
  preferredHorizontal: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | import("../../main.lib.js").PopupPositioner;
28
29
  preferredVertical: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | import("../../main.lib.js").PopupPositioner;
29
30
  avoidRepositioning: boolean;
30
- canClose: boolean;
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
32
32
  button?: (props: {
33
33
  extractEl: (_: any) => any;
@@ -25,6 +25,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
25
25
  slots: {
26
26
  [x: string]: ((props: {
27
27
  colKey: any;
28
+ config: any;
28
29
  style: string;
29
30
  class: string;
30
31
  }) => any) | undefined;
@@ -61,6 +61,7 @@
61
61
  ].join(' ')"
62
62
  :style="`width:${widths.length > 0 ? widths[i] : ``}; `"
63
63
  :col-key="col"
64
+ :config="colConfig[col]"
64
65
  >
65
66
  <td
66
67
  :class="[
@@ -145,7 +146,7 @@ const getExtraClasses = (row, col, isHeader) => {
145
146
  const extraClasses = computed(() => Object.fromEntries(
146
147
  [...Array(props.values.length + 1).keys()].map((row) => [...Array(props.cols.length).keys()].map((col) => [
147
148
  `${row - 1}-${col}`,
148
- getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" ")
149
+ " " + getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" ") + " "
149
150
  ])).flat()
150
151
  ));
151
152
  </script>
@@ -25,6 +25,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
25
25
  slots: {
26
26
  [x: string]: ((props: {
27
27
  colKey: any;
28
+ config: any;
28
29
  style: string;
29
30
  class: string;
30
31
  }) => any) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/ui",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Vue component library.",
5
5
  "type": "module",
6
6
  "main": "./dist/runtime/main.lib.js",
@@ -7,12 +7,12 @@ import LibTable from "./LibTable.vue"
7
7
  import * as components from "../index.js"
8
8
 
9
9
  const meta: Meta<typeof LibTable> = {
10
- component: LibTable,
10
+ component: LibTable as any,
11
11
  title: "Components/Table"
12
12
  }
13
13
 
14
14
  export default meta
15
- type Story = StoryObj<typeof LibTable>
15
+ type Story = StoryObj<typeof LibTable> & { args: { slots?: string } }
16
16
  export const Primary: Story = {
17
17
  render: args => ({
18
18
  components,
@@ -22,6 +22,7 @@ export const Primary: Story = {
22
22
  <lib-table
23
23
  v-bind="args"
24
24
  >
25
+ ${(args as any).slots}
25
26
  </lib-table>
26
27
  </div>
27
28
  `
@@ -91,6 +92,38 @@ export const NoHeaderNoCellBorders: Story = {
91
92
  cellBorder: false
92
93
  }
93
94
  }
95
+
96
+ export const InitialSize: Story = {
97
+ ...Primary,
98
+ args: {
99
+ ...Primary.args,
100
+ colConfig: {
101
+ prop1: { name: "Initially Flex 1", resizable: true },
102
+ prop2: { name: "Initially Flex 2", resizable: true },
103
+ prop3: { name: "Initially Size of Header", resizable: true }
104
+ },
105
+ resizable: {
106
+ enabled: true
107
+ },
108
+ class: `
109
+ [&:not(.resizable-cols-setup)]:block
110
+ [&:not(.resizable-cols-setup)_thead]:block
111
+ [&:not(.resizable-cols-setup)_thead_tr]:w-full
112
+ [&:not(.resizable-cols-setup)_thead_tr]:flex
113
+ [&:not(.resizable-cols-setup)_thead_tr]:flex-nowrap
114
+ [&:not(.resizable-cols-setup)_thead_td:not(.override-initial)]:flex-1
115
+ `,
116
+ slots: `
117
+ <template #header-prop3="colProps">
118
+ <td
119
+ :class="\`\${colProps.class} w-[min-content] whitespace-nowrap override-initial\`"
120
+ >
121
+ {{ colProps.config.name }}
122
+ </td>
123
+ </template>
124
+ `
125
+ }
126
+ }
94
127
  export const FitWidthFalse: Story = {
95
128
  ...Primary,
96
129
  args: {
@@ -61,6 +61,7 @@
61
61
  ].join(' ')"
62
62
  :style="`width:${widths.length > 0 ? widths[i] : ``}; `"
63
63
  :col-key="col"
64
+ :config="(colConfig as any)[col]"
64
65
  >
65
66
  <td
66
67
  :class="[
@@ -160,7 +161,7 @@ const extraClasses = computed(() => Object.fromEntries([...Array(props.values.le
160
161
  .map(col =>
161
162
  [
162
163
  `${row - 1}-${col}`,
163
- getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" ")
164
+ " " + getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" ") + " "
164
165
  ]))
165
166
  .flat()
166
167
  ))