@witchcraft/ui 0.0.1 → 0.1.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 (155) hide show
  1. package/README.md +18 -28
  2. package/dist/module.d.mts +3 -1
  3. package/dist/module.d.ts +3 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +20 -11
  6. package/dist/runtime/assets/base.css +1 -1
  7. package/dist/runtime/assets/locales/en.json +2 -2
  8. package/dist/runtime/assets/tailwind.css +1 -1
  9. package/dist/runtime/assets/utils.css +1 -0
  10. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  11. package/dist/runtime/components/Icon/Icon.vue +10 -5
  12. package/dist/runtime/components/LibButton/LibButton.vue +41 -46
  13. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +7 -3
  14. package/dist/runtime/components/LibColorInput/LibColorInput.vue +111 -36
  15. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +2 -0
  16. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +26 -9
  17. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  18. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
  19. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
  20. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
  21. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
  22. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
  23. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
  24. package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
  25. package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
  26. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +1 -1
  27. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -8
  28. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  29. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  30. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  31. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  32. package/dist/runtime/components/LibDebug/LibDebug.vue +15 -5
  33. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  34. package/dist/runtime/components/LibFileInput/LibFileInput.vue +54 -28
  35. package/dist/runtime/components/{LibInput/LibInput.stories.d.ts → LibInputDeprecated/LibInputDeprecated.stories.d.ts} +6 -6
  36. package/dist/runtime/components/{LibInput/LibInput.stories.js → LibInputDeprecated/LibInputDeprecated.stories.js} +64 -19
  37. package/{src/runtime/components/LibInput/LibInput.vue → dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -33
  38. package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
  39. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +1 -1
  40. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +5 -4
  41. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +11 -12
  42. package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -10
  43. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +2 -2
  44. package/dist/runtime/components/LibNotifications/LibNotifications.vue +20 -11
  45. package/dist/runtime/components/LibPagination/LibPagination.stories.js +2 -2
  46. package/dist/runtime/components/LibPagination/LibPagination.vue +19 -19
  47. package/dist/runtime/components/LibPalette/LibPalette.vue +3 -3
  48. package/dist/runtime/components/LibPopup/LibPopup.stories.js +2 -2
  49. package/dist/runtime/components/LibPopup/LibPopup.vue +30 -66
  50. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +3 -1
  51. package/dist/runtime/components/LibRecorder/LibRecorder.vue +2 -2
  52. package/dist/runtime/components/LibRoot/LibRoot.vue +14 -1
  53. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +1 -1
  54. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -7
  55. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +42 -25
  56. package/dist/runtime/components/LibTable/LibTable.vue +8 -8
  57. package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
  58. package/dist/runtime/components/Scrolling.stories.js +44 -0
  59. package/dist/runtime/components/Template/NAME.vue +1 -1
  60. package/dist/runtime/components/TestControls/TestControls.vue +1 -1
  61. package/dist/runtime/components/index.d.ts +12 -11
  62. package/dist/runtime/components/index.js +12 -11
  63. package/dist/runtime/components/shared/props.d.ts +81 -16
  64. package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
  65. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
  66. package/dist/runtime/composables/index.d.ts +5 -0
  67. package/dist/runtime/composables/index.js +5 -0
  68. package/dist/runtime/composables/useDivideAttrs.js +1 -0
  69. package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
  70. package/dist/runtime/composables/useDragWithThreshold.js +40 -0
  71. package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
  72. package/dist/runtime/composables/usePreHydrationValue.js +15 -0
  73. package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
  74. package/dist/runtime/composables/useSetupI18n.js +5 -1
  75. package/dist/runtime/composables/useSuggestions.d.ts +7 -5
  76. package/dist/runtime/composables/useSuggestions.js +94 -57
  77. package/dist/runtime/directives/vResizableCols.js +3 -1
  78. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
  79. package/dist/runtime/helpers/index.d.ts +3 -1
  80. package/dist/runtime/helpers/index.js +3 -1
  81. package/dist/runtime/types/index.d.ts +6 -0
  82. package/dist/runtime/utils/notifyIfError.d.ts +14 -0
  83. package/dist/runtime/utils/notifyIfError.js +29 -0
  84. package/package.json +18 -20
  85. package/src/module.ts +31 -12
  86. package/src/runtime/assets/base.css +10 -1
  87. package/src/runtime/assets/locales/en.json +2 -2
  88. package/src/runtime/assets/tailwind.css +1 -1
  89. package/src/runtime/assets/{style.css → utils.css} +86 -4
  90. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  91. package/src/runtime/components/Icon/Icon.vue +10 -5
  92. package/src/runtime/components/LibButton/LibButton.vue +41 -46
  93. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -3
  94. package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -36
  95. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
  96. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  97. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +25 -0
  98. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
  99. package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
  100. package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
  101. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
  102. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -8
  103. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  104. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  105. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  106. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  107. package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
  108. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  109. package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -28
  110. package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
  111. package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -33
  112. package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
  113. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
  114. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -12
  115. package/src/runtime/components/LibNotifications/LibNotification.vue +19 -10
  116. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
  117. package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -11
  118. package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
  119. package/src/runtime/components/LibPagination/LibPagination.vue +19 -19
  120. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  121. package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
  122. package/src/runtime/components/LibPopup/LibPopup.vue +30 -66
  123. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -1
  124. package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -2
  125. package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
  126. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
  127. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -7
  128. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -25
  129. package/src/runtime/components/LibTable/LibTable.vue +8 -8
  130. package/src/runtime/components/Scrolling.stories.ts +58 -0
  131. package/src/runtime/components/Template/NAME.vue +1 -1
  132. package/src/runtime/components/TestControls/TestControls.vue +1 -1
  133. package/src/runtime/components/index.ts +12 -12
  134. package/src/runtime/components/shared/props.ts +82 -19
  135. package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
  136. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
  137. package/src/runtime/composables/index.ts +5 -0
  138. package/src/runtime/composables/useDarkMode.ts +2 -2
  139. package/src/runtime/composables/useDivideAttrs.ts +1 -0
  140. package/src/runtime/composables/useDragWithThreshold.ts +108 -0
  141. package/src/runtime/composables/usePreHydrationValue.ts +30 -0
  142. package/src/runtime/composables/useSetupI18n.ts +8 -2
  143. package/src/runtime/composables/useSuggestions.ts +92 -45
  144. package/src/runtime/directives/vResizableCols.ts +3 -1
  145. package/src/runtime/helpers/NotificationHandler.ts +5 -0
  146. package/src/runtime/helpers/index.ts +3 -1
  147. package/src/runtime/types/index.ts +5 -0
  148. package/src/runtime/utils/notifyIfError.ts +45 -0
  149. package/dist/runtime/assets/style.css +0 -1
  150. package/dist/runtime/helpers/addValue.d.ts +0 -1
  151. package/dist/runtime/helpers/addValue.js +0 -8
  152. package/src/runtime/helpers/addValue.ts +0 -10
  153. /package/dist/runtime/components/{reset.stories.d.ts → Reset.stories.d.ts} +0 -0
  154. /package/dist/runtime/components/{reset.stories.js → Reset.stories.js} +0 -0
  155. /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
package/README.md CHANGED
@@ -16,7 +16,7 @@ This is unfortunately not true styleless since the tailwind classes are still in
16
16
 
17
17
  # Usage with Nuxt
18
18
 
19
- Modules, composables, and directives should work out of the box without auto imports.
19
+ Modules, composables, and directives should work out of the box without auto imports. The module also installs the `reka-ui/nuxt` module.
20
20
 
21
21
  ## Tailwind (V4)
22
22
 
@@ -24,9 +24,16 @@ The module automatically sets up tailwind v4 and generates a custom `witchcraft-
24
24
 
25
25
  It does not install "@nuxtjs/tailwindcss" for now since it's not compatible with v4. See [#919](https://github.com/nuxt-modules/tailwindcss/issues/919).
26
26
 
27
- ```css[~/assets/css/tailwind.css]
28
- @import "@tailwindcss";
27
+ ```css [~/assets/css/tailwind.css]
28
+ @import "@tailwindcss" source("../../../app");
29
29
  @import "../../../.nuxt/witchcraft-ui.css";
30
+
31
+ // without Nuxt:
32
+ @import "@witchcraft/ui/utils.css";
33
+ @import "@witchcraft/ui/base.css";
34
+ // source used components
35
+ @source "@witchcraft/ui/components";
36
+
30
37
  ```
31
38
 
32
39
  ## Icons
@@ -54,14 +61,14 @@ Usually it is possible to do most modifications through props, but slots to repl
54
61
  Most slots where possible are passed all properties needed to replace them except classes so you can do something like this, to for example replace the simple input component inside the input component.
55
62
 
56
63
  ```vue
57
- <lib-input>
64
+ <lib-simple-input-deprecated>
58
65
  <template #input="slotProps">
59
66
  <lib-simple-input
60
67
  :class="'completely custom styles'"
61
68
  v-bind="slotProps"
62
69
  ></lib-simple-input>
63
70
  </template>
64
- </lib-input>
71
+ </lib-simple-input>
65
72
 
66
73
  ```
67
74
 
@@ -108,17 +115,11 @@ See [@witchcraft/editor/vite.config.dev.ts].
108
115
  #### Extra Classes
109
116
 
110
117
  ```css
111
- @import "@witchcraft/ui/style.css"; /* tailwind v4 style utils - required */
118
+ @import "@witchcraft/ui/utils.css";
112
119
  @import "@witchcraft/ui/base.css";
113
- @source "@witchcraft/ui/src/runtime/components";
120
+ @source "/path/to/node_modules/@witchcraft/ui/src/runtime/components";
114
121
  ```
115
- Base just contains animation keyframes and basic styles for vue animations. They will get imported regardless of whether they are used since otherwise tailwind does not detect they are being used.
116
-
117
-
118
- #### Tailwind Configuration
119
-
120
- This module does everything v4 style, so no configuration is needed.
121
-
122
+ Base just contains animation keyframes, basic styles for vue animations, and some basic global styles. They will get imported regardless of whether they are used since otherwise tailwind does not detect they are being used.
122
123
 
123
124
  #### tailwind-merge
124
125
 
@@ -164,7 +165,7 @@ Note that using the strictTemplates compiler option can cause weird issues with
164
165
 
165
166
  ## Props
166
167
 
167
- Due to issues with vue 3 removing $listeners and the fact that we can't inherit from an existing HTML attribute types to specify props for wrapper components (most of them), we have to declare props in a convoluted way to get proper types when we consume the componenets.
168
+ Due to issues with vue 3 removing $listeners and the fact that we can't inherit from an existing HTML attribute types to specify props for wrapper components (most of them), we have to declare props in a convoluted way to get proper types when we consume the components.
168
169
 
169
170
  Here is an example of the needed code for props to work correctly:
170
171
  ```vue
@@ -174,14 +175,6 @@ Here is an example of the needed code for props to work correctly:
174
175
 
175
176
  import type { BaseInteractiveProps } from "../shared/props.js"
176
177
 
177
- // if using useDivideAttrs, we need to do the below for each prefix
178
- // a helper type WrapperProps is provided to do this
179
- type WrapperTypes = (WrapperProps<"wrapper", HTMLAttributes, {
180
- // overrides
181
- /** Tailwind classes. */
182
- class:string;
183
- }>)
184
-
185
178
  // real props vue can understand, they will show up under props.*
186
179
  type RealProps =
187
180
  // simple types are okay
@@ -193,7 +186,6 @@ type RealProps =
193
186
  id?: InputHTMLAttributes["id"]
194
187
  }
195
188
 
196
-
197
189
  interface Props
198
190
  extends
199
191
  // we need to ignore the complex InputHTMLAttributes type
@@ -205,12 +197,10 @@ interface Props
205
197
  Partial<Omit<InputHTMLAttributes,"class" | "onSubmit"> & {
206
198
  // overrides for the components
207
199
  // usually, for example, class can only be a string (because of tailwind)
208
- // this is still part of the ignored type above
209
- // it will be passed as an attr
200
+ // this will be passed as an attr
210
201
  class?:string
211
202
  }>,
212
203
  /** @vue-ignore */
213
- Partial<WrapperTypes>,
214
204
  RealProps
215
205
  { }
216
206
  </script>
@@ -223,7 +213,7 @@ const props = withDefaults(defineProps<Props>(), {
223
213
  id: "",
224
214
  ...baseInteractivePropsDefaults
225
215
  })
226
- const $ = useDivideAttrs(["wrapper"] as const)
216
+ const $attrs = useAttrs()
227
217
  </script>
228
218
  ```
229
219
 
package/dist/module.d.mts CHANGED
@@ -24,9 +24,11 @@ interface ModuleOptions {
24
24
  componentPrefix: string;
25
25
  debug?: boolean;
26
26
  /**
27
- * @default "~/assets/css/tailwind.css"
27
+ * @default "~/assets/css/tailwind.css" if it exists.
28
28
  */
29
29
  mainCssFile?: string;
30
+ /** @internal */
31
+ _playgroundWorkaround?: boolean;
30
32
  }
31
33
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
32
34
 
package/dist/module.d.ts CHANGED
@@ -24,9 +24,11 @@ interface ModuleOptions {
24
24
  componentPrefix: string;
25
25
  debug?: boolean;
26
26
  /**
27
- * @default "~/assets/css/tailwind.css"
27
+ * @default "~/assets/css/tailwind.css" if it exists.
28
28
  */
29
29
  mainCssFile?: string;
30
+ /** @internal */
31
+ _playgroundWorkaround?: boolean;
30
32
  }
31
33
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
32
34
 
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "witchcraftUi",
3
3
  "configKey": "witchcraftUi",
4
- "version": "0.0.1",
4
+ "version": "0.1.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
- "unbuild": "3.5.0"
7
+ "unbuild": "3.6.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -18,6 +18,7 @@ const componentsInfo = globFiles([
18
18
  `${resolve("./runtime/components")}/**/*.vue*`,
19
19
  `!**/Template/**.vue`
20
20
  ], [], (filepath, name) => ({
21
+ originalName: name,
21
22
  name: name.startsWith("Lib") ? name.replace("Lib", "PREFIX") : `PREFIX${name}`,
22
23
  filepath
23
24
  }));
@@ -34,7 +35,8 @@ const module = defineNuxtModule({
34
35
  ],
35
36
  componentPrefix: "W",
36
37
  debug: true,
37
- mainCssFile: "~/assets/css/tailwind.css"
38
+ mainCssFile: "~/assets/css/tailwind.css",
39
+ _playgroundWorkaround: false
38
40
  },
39
41
  async setup(options, nuxt) {
40
42
  const moduleName = "@witchcraft/ui";
@@ -57,18 +59,20 @@ const module = defineNuxtModule({
57
59
  directives: options.directives
58
60
  }
59
61
  );
60
- const contents = [
61
- ...componentsInfo.map((_) => _.filepath)
62
- ];
63
62
  addTemplate({
64
63
  filename: "witchcraft-ui.css",
65
64
  write: true,
66
- getContents: () => crop`
67
- ${indent(themeAsTailwindCss(theme, themeConvertionOpts), 4)}
68
- @import "@witchcraft/ui/style.css";
69
- @import "@witchcraft/ui/base.css";
70
- ${indent(contents.map((_) => `@source "${_}";`).join("\n"), 4)}
71
- `
65
+ getContents: () => options._playgroundWorkaround ? crop`
66
+ ${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
67
+ @import "${resolve("runtime/assets/base.css")}";
68
+ @import "${resolve("runtime/assets/utils.css")}";
69
+ ${indent(filteredComponentsInfo.map((_) => `@source "${_.filepath}";`).join("\n"), 5)}
70
+ ` : crop`
71
+ ${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
72
+ @import "@witchcraft/ui/base.css";
73
+ @import "@witchcraft/ui/utils.css";
74
+ ${indent(filteredComponentsInfo.map((_) => `@source "${_.filepath}";`).join("\n"), 5)}
75
+ `
72
76
  });
73
77
  await Promise.all(
74
78
  filteredComponentsInfo.map(async (entry) => addComponent({
@@ -110,8 +114,13 @@ const module = defineNuxtModule({
110
114
  ];
111
115
  }
112
116
  });
113
- nuxt.options.css.push(await resolvePath(options.mainCssFile, nuxt.options.alias));
117
+ const mainCssFile = await resolvePath(options.mainCssFile, nuxt.options.alias);
118
+ const exists = fs.existsSync(mainCssFile);
119
+ if (exists) {
120
+ nuxt.options.css.push(mainCssFile);
121
+ }
114
122
  await installModule("unplugin-icons/nuxt");
123
+ await installModule("reka-ui/nuxt");
115
124
  nuxt.options.alias["#witchcraft-ui"] = resolve("runtime");
116
125
  nuxt.options.alias["#witchcraft-ui-helpers"] = resolve("runtime/helpers");
117
126
  addTypeTemplate({
@@ -1 +1 @@
1
- .v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(30px)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}@keyframes blink{0%{opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0}}@keyframes slide{0%{background-position:0}to{background-position:100%}}a{@apply link-like}
1
+ .v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(100%)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}@keyframes blink{0%{opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0}}@keyframes slide{0%{background-position:0}to{background-position:100%}}a{@apply link-like}*{@apply styled-scrollbar}textarea{@apply styled-resizer}
@@ -5,7 +5,7 @@
5
5
  "file-input.compact-choose-file-plural": "Choose Files",
6
6
  "file-input.non-compact-choose-file": "Drag & Drop File",
7
7
  "file-input.non-compact-choose-file-plural": "Drag & Drop Files",
8
- "color-picker.pick-color": "Pick Color",
8
+ "color-input.aria-and-title-prefix": "Click to Open Color Picker, Current Color: ",
9
9
  "cancel": "Cancel",
10
10
  "save": "Save",
11
11
  "copy": "Copy",
@@ -15,7 +15,7 @@
15
15
  "color-picker.aria.value": "Value",
16
16
  "color-picker.aria.hue-slider": "Hue Slider",
17
17
  "color-picker.aria.alpha-slider": "Alpha Slider",
18
- "color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments.",
18
+ "color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments. Press enter to save value.",
19
19
  "dark-mode-switcher.title": "Switch dark mode type, current: ",
20
20
  "dark-mode-switcher.system": "System",
21
21
  "dark-mode-switcher.dark": "Dark",
@@ -1 +1 @@
1
- @import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./style.css";
1
+ @import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./utils.css";
@@ -0,0 +1 @@
1
+ @custom-variant dark (&:where(.dark, .dark *));@utility focus-outline-within{@apply outlined-within:outline-2 outlined-within:outline-accent-500 outlined-within:outline-offset-2}@utility focus-outline{@apply outlined:outline-2 outlined:outline-accent-500 outlined:outline-offset-2}@utility focus-outline-no-offset{@apply outlined:outline-2 outlined:outline-accent-500}@utility focus-outline-hidden{@apply outlined:outline-none}@utility bg-squares-gradient{--_square:var(--squareSize,5px);--_double_square:calc(var(--_square)*2);--_light_square:var(--lightSquare,var(--color-white));--_dark_square:var(--darkSquare,var(--color-black));background-color:var(--_light_square);background:repeating-conic-gradient(var(--_dark_square) 0 25%,var(--_light_square) 0 50%) 50% /var(--_double_square) var(--_double_square)}@utility square-light-*{--lightSquare:--value(--color- *)}@utility square-dark-*{--darkSquare:--value(--color- *)}@utility square-size-*{--squareSize:calc(--value(integer) * 1px)}@utility bg-bars-gradient{--_bg_color:var(--bars-bg-color,var(--color-accent-700));--_fg_color:var(--bars-fg-color,var(--color-accent-800));--_angle:var(--bars-angle,45deg);--_fg_width:var(--bars-fg-width,50%);--_bg_width:calc(100% - var(--_fg_width));background-color:var(--_bg_color);--_pos_1:calc(var(--_bg_width)/2);--_pos_2:calc(var(--_bg_width)/2 + var(--_fg_width)/2);--_pos_3:calc(var(--_bg_width) + var(--_fg_width)/2);background-image:repeating-linear-gradient(var(--_angle),var(--_bg_color),var(--_bg_color) var(--_pos_1),var(--_fg_color) var(--_pos_1),var(--_fg_color) var(--_pos_2),var(--_bg_color) var(--_pos_2),var(--_bg_color) var(--_pos_3),var(--_fg_color) var(--_pos_3),var(--_fg_color))}@utility bars-angle-*{--bars-angle:var(--value(integer) * 1deg)}@utility bars-fg-*{--bars-fg-color:--value(--color-*)}@utility bars-bg-*{--bars-bg-color:--value(--color-*)}@utility bars-w-*{--bars-fg-width:calc(--value(integer) * 1%, 50%)}@utility scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none}}@utility styled-scrollbar{--_scrollbar_width:var(--scrollbar-width,calc(var(--spacing)*3));--_scrollbar_border_width:var(--scrollbar-border-width,calc(var(--spacing)/2));--_scrollbar_color:var(--scrollbar-color,--alpha(var(--color-accent-500)/40%));--_scrollbar_hover_color:var(--scrollbar-hover-color,--alpha(var(--color-accent-500)/80%));--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-bg));.dark &{--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-fg))}&::-webkit-scrollbar{height:var(--_scrollbar_width);width:var(--_scrollbar_width)}&::-webkit-scrollbar-corner,&::-webkit-scrollbar-track{background-color:transparent}&::-webkit-scrollbar-thumb,&::-webkit-scrollbar-track{border-radius:var(--_scrollbar_width)}&::-webkit-scrollbar-thumb{background-color:var(--_scrollbar_color);border:var(--_scrollbar_border_width) solid var(--_scrollbar_bg_color)}&::-webkit-scrollbar-thumb:hover{cursor:pointer}&::-webkit-scrollbar-thumb:active,&::-webkit-scrollbar-thumb:hover{background-color:var(--_scrollbar_hover_color);border-radius:var(--_scrollbar_width)}}@utility styled-scrollbar-w-*{--scrollbar-width:--value(integer)}@utility styled-scrollbar-border-w-*{--scrollbar-border-width:--value(integer)}@utility styled-scrollbar-*{--scrollbar-color:--value(--color-*)}@utility styled-scrollbar-bg-*{--scrollbar-bg-color:--value(--color-*)}@utility styled-resizer{--_resizer_width:var(--resizer-width,8px);--_resizer_color:var(--resizer-color,var(--color-neutral-300));.dark &{--_resizer_color:var(--resizer-color,var(--color-neutral-700))}&::-webkit-resizer{border-bottom-color:var(--_resizer_color);border-left-color:transparent;border-right-color:var(--_resizer_color);border-style:solid;border-top-color:transparent;border-width:var(--_resizer_width)}}@utility styled-resizer-w-*{--resizer-width:--value(integer)}@utility styled-resizer-color-*{--resizer-color:--value(--color-*)}@utility content-vertical-holder{--tw-content:"\200b";content:var(--tw-content)}@utility no-touch-action{touch-action:none}@utility bg-transparency-squares{@apply bg-squares-gradient square-light-white square-dark-neutral-300 square-size-6}@utility link-like{@apply cursor-pointer hover:text-accent-500}
@@ -1,4 +1,4 @@
1
- const prefixless = ["Icon", "Aria", "TestWrapper"];
1
+ const prefixless = ["Icon", "Aria"];
2
2
  export const WitchcraftUiResolver = ({
3
3
  prefix = "W",
4
4
  filter = () => true
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="icon inline-block"
3
+ :class="twMerge('icon inline-block', $attrs?.class)"
4
4
  v-bind="{...$attrs, class:undefined}"
5
5
  >
6
6
  <slot/>
@@ -10,7 +10,15 @@
10
10
  <script setup lang="ts">
11
11
  import { computed, type HTMLAttributes,useAttrs } from "vue"
12
12
 
13
- const $attrs = useAttrs()
13
+ import { twMerge } from "../../utils/twMerge.js"
14
+
15
+ defineOptions({
16
+ name: "icon",
17
+ inheritAttrs: false,
18
+ })
19
+
20
+
21
+ const $attrs = useAttrs() as any
14
22
 
15
23
  // eslint-disable-next-line no-use-before-define
16
24
  const props = defineProps<Props>()
@@ -26,9 +34,6 @@ const props = defineProps<Props>()
26
34
  * <icon><i-...></icon>
27
35
  * ``
28
36
  */
29
- export default {
30
- name: "icon",
31
- }
32
37
 
33
38
  interface Props
34
39
  extends
@@ -2,26 +2,26 @@
2
2
  <button
3
3
  :id="id ?? fallbackId"
4
4
  :class="!($attrs as any).unstyle && twMerge(`
5
- button
6
- flex
7
- cursor-pointer
8
- items-center
9
- justify-center
10
- rounded-sm
11
- px-1
12
- hover:cursor-pointer
13
- [&:hover_*]:cursor-pointer
14
- focus-outline
15
- disabled:shadow-none
16
- disabled:text-neutral-500
17
- disabled:cursor-default
18
- text-fg
19
- hover:text-accent-700
20
- dark:text-bg
21
- dark:hover:text-accent-500
22
- dark:disabled:text-neutral-500
23
- dark:disabled:hover:text-neutral-500
24
- `,
5
+ button
6
+ flex
7
+ cursor-pointer
8
+ items-center
9
+ justify-center
10
+ rounded-sm
11
+ px-1
12
+ hover:cursor-pointer
13
+ [&:hover_*]:cursor-pointer
14
+ focus-outline
15
+ disabled:shadow-none
16
+ disabled:text-neutral-500
17
+ disabled:cursor-default
18
+ text-fg
19
+ hover:text-accent-700
20
+ dark:text-bg
21
+ dark:hover:text-accent-500
22
+ dark:disabled:text-neutral-500
23
+ dark:disabled:hover:text-neutral-500
24
+ `,
25
25
  !color && `active:text-neutral-800` /* todo for colors */,
26
26
  border && `
27
27
  transition-all
@@ -31,11 +31,11 @@
31
31
  shadow-neutral-950/20
32
32
  hover:shadow-[0_1px_3px_0]
33
33
  hover:shadow-neutral-950/30
34
- hover:border-neutral-300
35
-
34
+ hover:border-neutral-200
35
+ dark:hover:border-neutral-800
36
36
  relative
37
37
  after:absolute
38
- after:rounded-sm
38
+ after:rounded-xs
39
39
  after:inset-0
40
40
  after:content
41
41
  after:shadow-[0_1px_0_0_inset]
@@ -45,15 +45,13 @@
45
45
  dark:hover:after:shadow-bg/50
46
46
  after:pointer-events-none
47
47
  after:mix-blend-overlay
48
-
49
- active:shadow-inner
48
+ active:inset-shadow
50
49
  active:shadow-fg/20
51
50
  active:border-transparent
52
51
  border
53
- border-neutral-400
52
+ border-neutral-300
54
53
  disabled:border-neutral-200
55
54
  disabled:bg-neutral-50
56
-
57
55
  dark:hover:shadow-accent-950/30
58
56
  dark:active:shadow-fg/40
59
57
  dark:active:border-neutral-900
@@ -156,7 +154,7 @@
156
154
  `,
157
155
  ($attrs as any)?.class
158
156
  )"
159
- :type="$attrs.type as any ?? 'submit'"
157
+ :type="$attrs.type as any"
160
158
  :tabindex="0"
161
159
  :disabled="disabled"
162
160
  :data-border="border"
@@ -169,17 +167,19 @@
169
167
  ...ariaLabel,
170
168
  }"
171
169
  >
172
- <label :id="`label-${id ?? fallbackId}`" class="label pointer-events-none flex flex-1 items-center justify-center gap-1">
173
- <slot name="icon"/>
174
- <slot
175
- v-bind="{ label}"
176
- >
177
- <span v-if="label && !isBlank(label!)">
178
- {{ label }}
179
- </span>
180
- </slot>
181
- <slot name="icon-after"/>
182
- </label>
170
+ <slot name="label" v-bind="{id:`label-${id ?? fallbackId}`, classes:'button--label pointer-events-none flex flex-1 items-center justify-center gap-1'}">
171
+ <label :id="`label-${id ?? fallbackId}`" class="button--label pointer-events-none flex flex-1 items-center justify-center gap-1">
172
+ <slot name="icon"/>
173
+ <slot
174
+ v-bind="{ label}"
175
+ >
176
+ <span v-if="label && !isBlank(label!)">
177
+ {{ label }}
178
+ </span>
179
+ </slot>
180
+ <slot name="icon-after"/>
181
+ </label>
182
+ </slot>
183
183
  </button>
184
184
  </template>
185
185
 
@@ -193,7 +193,7 @@ import { type ButtonHTMLAttributes,computed, type HTMLAttributes, type PropType,
193
193
  import { useAriaLabel } from "../../composables/useAriaLabel.js"
194
194
  import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
195
195
  import { twMerge } from "../../utils/twMerge.js"
196
- import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
196
+ import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, type ButtonProps,getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
197
197
 
198
198
 
199
199
  const $attrs = useAttrs()
@@ -227,12 +227,7 @@ type RealProps =
227
227
  & LinkableByIdProps
228
228
  & LabelProps
229
229
  & BaseInteractiveProps
230
- & {
231
- border?: boolean
232
- color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
233
- label?: string
234
- autoTitleFromAria?: boolean
235
- }
230
+ & ButtonProps
236
231
 
237
232
  interface Props
238
233
  extends
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  :class="twMerge(`
4
+ checkbox--wrapper
4
5
  flex
5
6
  items-center
6
7
  gap-1
@@ -12,8 +13,8 @@
12
13
  >
13
14
  <slot name="left"/>
14
15
  <label
15
- class="flex items-center gap-1"
16
16
  :class="twMerge(`
17
+ checkbox--label
17
18
  flex
18
19
  items-center
19
20
  gap-1
@@ -26,6 +27,7 @@
26
27
  <input
27
28
  :id="id ?? fallbackId"
28
29
  :class="!($attrs as any).unstyle && twMerge(`
30
+ checkbox
29
31
  focus-outline-no-offset
30
32
  m-0
31
33
  p-[0.4em]
@@ -33,7 +35,8 @@
33
35
  dark:bg-fg
34
36
  appearance-none
35
37
  border
36
- border-accent-600
38
+ border-neutral-500
39
+ focus:border-accent-600
37
40
  rounded-sm
38
41
  aspect-square
39
42
  relative
@@ -71,6 +74,7 @@ import type { MakeRequired } from "@alanscodelog/utils/types"
71
74
  import { computed, type HTMLAttributes, type InputHTMLAttributes,type PropType, ref, useAttrs, useSlots } from "vue"
72
75
 
73
76
  import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
77
+ import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
74
78
  import { twMerge } from "../../utils/twMerge.js"
75
79
  import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
76
80
 
@@ -99,7 +103,7 @@ const el = ref<null | HTMLElement>(null)
99
103
  const inputEl = ref<null | HTMLElement>(null)
100
104
  const $value = defineModel<boolean>("modelValue", { default: false })
101
105
 
102
-
106
+ usePreHydrationValue(props.id ?? fallbackId, $value)
103
107
  </script>
104
108
 
105
109
  <script lang="ts">