@witchcraft/ui 0.1.1 → 0.1.3

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 (122) hide show
  1. package/dist/module.cjs +5 -0
  2. package/dist/module.d.ts +36 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +2 -1
  5. package/dist/runtime/assets/utils.css +1 -1
  6. package/dist/runtime/components/Aria/Aria.vue +9 -5
  7. package/dist/runtime/components/Focus.stories.d.ts +11 -0
  8. package/dist/runtime/components/Focus.stories.js +53 -0
  9. package/dist/runtime/components/Icon/Icon.vue +30 -10
  10. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
  11. package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +72 -58
  13. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +74 -48
  16. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
  17. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +107 -63
  19. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +9 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +68 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +352 -271
  22. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
  23. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +56 -32
  25. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
  26. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +38 -17
  28. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +82 -53
  29. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +67 -50
  30. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +8 -7
  31. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
  32. package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
  33. package/dist/runtime/components/LibDebug/LibDebug.vue +70 -42
  34. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +31 -18
  35. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
  36. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
  37. package/dist/runtime/components/LibFileInput/LibFileInput.vue +156 -113
  38. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +33 -0
  39. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +384 -0
  40. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +241 -215
  41. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
  42. package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
  43. package/dist/runtime/components/LibLabel/LibLabel.vue +46 -30
  44. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
  45. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +61 -0
  46. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +58 -44
  47. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
  48. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
  49. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -32
  50. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
  51. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
  52. package/dist/runtime/components/LibNotifications/LibNotifications.vue +83 -63
  53. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
  54. package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
  55. package/dist/runtime/components/LibPagination/LibPagination.vue +111 -67
  56. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
  57. package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -20
  59. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
  61. package/dist/runtime/components/LibPopup/LibPopup.vue +351 -314
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
  64. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +91 -70
  65. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
  66. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
  67. package/dist/runtime/components/LibRecorder/LibRecorder.vue +177 -133
  68. package/dist/runtime/components/LibRoot/LibRoot.vue +100 -73
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
  70. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
  71. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +77 -49
  72. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
  73. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
  74. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +156 -123
  75. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
  76. package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
  77. package/dist/runtime/components/LibTable/LibTable.vue +99 -63
  78. package/dist/runtime/components/Reset.stories.d.ts +5 -0
  79. package/dist/runtime/components/Reset.stories.js +19 -0
  80. package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
  81. package/dist/runtime/components/Scrolling.stories.js +44 -0
  82. package/dist/runtime/components/Template/NAME.vue +36 -15
  83. package/dist/runtime/components/TestControls/TestControls.vue +9 -6
  84. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
  85. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
  86. package/dist/types.d.mts +6 -2
  87. package/dist/types.d.ts +7 -0
  88. package/package.json +11 -5
  89. package/src/module.ts +2 -1
  90. package/src/runtime/assets/utils.css +5 -5
  91. package/src/runtime/components/LibButton/LibButton.vue +2 -6
  92. package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
  93. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
  94. package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
  95. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
  96. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
  97. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -63
  98. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +0 -61
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +0 -22
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -40
  101. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
  102. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +0 -34
  103. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
  104. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +0 -32
  105. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +0 -22
  106. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
  108. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  109. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
  110. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -17
  111. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
  112. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
  113. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
  114. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
  115. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +0 -41
  116. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +0 -77
  117. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +0 -41
  118. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
  119. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
  120. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
  121. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
  122. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +0 -5
@@ -7,7 +7,7 @@
7
7
  :style="`background-color: var(${color});`"
8
8
  :class="`theme-palette--item h-10 rounded-sm flex items-center justify-center text-fg dark:text-bg`"
9
9
  >
10
- {{ [5, 16, 27, 38, 49].includes(i) ? "Text" : "" }}
10
+ {{ [5, 16, 27, 38, 49].includes(i) ? 'Text':'' }}
11
11
  </div>
12
12
  </template>
13
13
  </div>
@@ -22,25 +22,28 @@
22
22
  </div>
23
23
  </template>
24
24
 
25
- <script>
26
- export default { name: "lib-palette" };
25
+ <script lang="ts">
26
+ export default { name: "lib-palette" }
27
27
  </script>
28
28
 
29
- <script setup>
30
- import { keys } from "@alanscodelog/utils/keys.js";
31
- import {} from "metamorphosis";
32
- import { baseInteractivePropsDefaults } from "../shared/props.js";
33
- const props = defineProps(/* @__PURE__ */ _mergeDefaults({
34
- id: { type: String, required: false },
35
- disabled: { type: Boolean, required: false },
36
- readonly: { type: Boolean, required: false },
37
- border: { type: Boolean, required: false },
38
- unstyle: { type: Boolean, required: false },
39
- theme: { type: Object, required: true }
40
- }, {
41
- theme: () => ({}),
42
- ...baseInteractivePropsDefaults
43
- }));
44
- const exclude = ["--color-bg", "--color-fg"];
45
- const colors = keys(props.theme.css).filter((key) => key.startsWith("--color") && !exclude.includes(key));
29
+ <script setup lang="ts">
30
+ import { keys } from "@alanscodelog/utils/keys.js"
31
+ import { type Theme } from "metamorphosis"
32
+
33
+ import { type BaseInteractiveProps, baseInteractivePropsDefaults,type LinkableByIdProps } from "../shared/props.js"
34
+
35
+
36
+ const props = withDefaults(defineProps<
37
+ & LinkableByIdProps
38
+ & BaseInteractiveProps
39
+ & {
40
+ theme: Theme
41
+ }>(), {
42
+ theme: () => ({} as any),
43
+ ...baseInteractivePropsDefaults
44
+ })
45
+
46
+ const exclude = ["--color-bg", "--color-fg"]
47
+ const colors = keys(props.theme.css).filter(key => key.startsWith("--color") && !exclude.includes(key))
48
+
46
49
  </script>
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ import LibPopup from "./LibPopup.vue.js";
3
+ declare const meta: Meta<typeof LibPopup>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LibPopup>;
6
+ export declare const Primary: Story;
7
+ export declare const PopupNoShift: any;
8
+ /** When the popup is too wide, it's positioned to the left and overflow scroll is set with an invisible scrollbar. */
9
+ export declare const PopupTooBig: any;
10
+ export declare const PopupCenterScreen: any;
11
+ export declare const PopupRightBottomMost: any;
12
+ export declare const PopupLeftTopMost: any;
13
+ export declare const PopupCenterMost: any;
14
+ export declare const LeftMenuShapeExample: any;
@@ -0,0 +1,147 @@
1
+ import { computed, ref, watch } from "vue";
2
+ import LibPopup from "./LibPopup.vue";
3
+ import { vExtractRootEl } from "../../directives/vExtractRootEl.js";
4
+ import * as components from "../index.js";
5
+ const meta = {
6
+ component: LibPopup,
7
+ title: "Components/Popup",
8
+ args: {}
9
+ };
10
+ export default meta;
11
+ export const Primary = {
12
+ render: (args) => ({
13
+ components,
14
+ directives: { extractRootEl: vExtractRootEl },
15
+ setup: () => {
16
+ const value = ref(false);
17
+ const buttonPositions = ["TL", "TC", "TR", "BL", "BC", "BR"];
18
+ const buttonPos = ref("TL");
19
+ const autoRotatePos = ref(true);
20
+ const buttonStyle = computed(() => {
21
+ switch (buttonPos.value) {
22
+ case "TL":
23
+ return `align-self: flex-start; justify-self: flex-start;`;
24
+ case "TC":
25
+ return `align-self: flex-start; justify-self: center;`;
26
+ case "TR":
27
+ return `align-self: flex-start; justify-self: flex-end;`;
28
+ case "BL":
29
+ return `align-self: flex-end; justify-self: flex-start;`;
30
+ case "BC":
31
+ return `align-self: flex-end; justify-self: center;`;
32
+ case "BR":
33
+ return `align-self: flex-end; justify-self: flex-end;`;
34
+ default:
35
+ return "";
36
+ }
37
+ });
38
+ watch(value, () => {
39
+ if (!value.value && autoRotatePos.value) {
40
+ const buttonI = buttonPositions.indexOf(buttonPos.value);
41
+ if (buttonI < 5) {
42
+ buttonPos.value = buttonPositions[buttonI + 1];
43
+ } else {
44
+ buttonPos.value = buttonPositions[0];
45
+ }
46
+ }
47
+ });
48
+ return {
49
+ args,
50
+ buttonPos,
51
+ autoRotatePos,
52
+ buttonStyle,
53
+ value
54
+ };
55
+ },
56
+ template: `
57
+ <lib-simple-input
58
+ :suggestions="['TL', 'TR', 'BL', 'BR']"
59
+ :restrict-to-suggestions="true"
60
+ :suggestions-filter="(_, items) => items"
61
+ :label="'Button Position'"
62
+ v-model="buttonPos"
63
+ >
64
+ </lib-simple-input>
65
+ <div>
66
+ <label>Auto Rotate Position</label>
67
+ <input type="checkbox" v-model="autoRotatePos">
68
+ </div>
69
+ <div class="test bg-transparency-squares" style="display:grid;height:80vh;padding:50px;border:1px solid black;">
70
+
71
+ <lib-popup v-model="value" v-bind="{ ...args, width:undefined, }" >
72
+ {{value}}
73
+ <template #button="{extractEl}">
74
+ <lib-button :style="buttonStyle" @click="value = !value" v-extract-root-el="extractEl">Toggle Popup</lib-button>
75
+ </template>
76
+ <template #popup="{position, extractEl}">
77
+ <lib-debug
78
+ v-extract-root-el="extractEl"
79
+ :style="(args.width ? \`width: \${args.width};\` : '') + (args.height ? \`height: \${args.height};\` : '')"
80
+ class="bg-bg dark:bg-fg w-[500px]"
81
+ >
82
+ {{ position }}
83
+ </lib-debug>
84
+ </template>
85
+ </lib-popup>
86
+ </div>
87
+ `
88
+ })
89
+ };
90
+ export const PopupNoShift = {
91
+ ...Primary,
92
+ args: {
93
+ avoidRepositioning: true
94
+ }
95
+ };
96
+ export const PopupTooBig = {
97
+ ...Primary,
98
+ args: {
99
+ width: "110vw"
100
+ }
101
+ };
102
+ export const PopupCenterScreen = {
103
+ ...Primary,
104
+ args: {
105
+ width: "500px",
106
+ height: "500px",
107
+ preferredHorizontal: ["center-screen"],
108
+ preferredVertical: ["center-screen"]
109
+ }
110
+ };
111
+ export const PopupRightBottomMost = {
112
+ ...Primary,
113
+ args: {
114
+ width: "500px",
115
+ height: "500px",
116
+ preferredHorizontal: ["right-most"],
117
+ preferredVertical: ["bottom-most"]
118
+ }
119
+ };
120
+ export const PopupLeftTopMost = {
121
+ ...Primary,
122
+ args: {
123
+ width: "500px",
124
+ height: "500px",
125
+ preferredHorizontal: ["left-most"],
126
+ preferredVertical: ["top-most"]
127
+ }
128
+ };
129
+ export const PopupCenterMost = {
130
+ ...Primary,
131
+ args: {
132
+ width: "500px",
133
+ height: "500px",
134
+ preferredHorizontal: ["center-most"],
135
+ preferredVertical: ["center-most"]
136
+ }
137
+ };
138
+ export const LeftMenuShapeExample = {
139
+ ...Primary,
140
+ args: {
141
+ width: "300px",
142
+ height: "500px",
143
+ preferredHorizontal: ["left-most"],
144
+ preferredVertical: ["center-most"],
145
+ avoidRepositioning: true
146
+ }
147
+ };