@wishbone-media/spark 0.25.0 → 0.26.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.
package/formkit.config.js CHANGED
@@ -1,5 +1,4 @@
1
- import { defaultConfig } from '@formkit/vue';
2
- import { genesisIcons } from '@formkit/icons';
1
+ // Note: Consumer apps should wrap the returned config with defaultConfig()
3
2
  import { createAutoAnimatePlugin } from '@formkit/addons';
4
3
  import {
5
4
  createProPlugin,
@@ -15,6 +14,7 @@ import {
15
14
  togglebuttons,
16
15
  } from '@formkit/pro';
17
16
  import { rootClasses } from '@wishbone-media/spark/formkit.theme.mjs';
17
+ import { formKitIcons, formKitIconLoader, formKitGenesisOverride } from '@wishbone-media/spark';
18
18
 
19
19
  const autoAnimatePlugin = createAutoAnimatePlugin(
20
20
  {
@@ -51,13 +51,16 @@ export default function createFormKitConfig(formKitProKey) {
51
51
  togglebuttons,
52
52
  });
53
53
 
54
- return defaultConfig({
54
+ // Return plain config object - consumer apps wrap with defaultConfig()
55
+ return {
55
56
  config: {
56
57
  rootClasses
57
58
  },
58
59
  icons: {
59
- ...genesisIcons
60
+ ...formKitGenesisOverride, // FontAwesome replacements for FormKit's built-in icons
61
+ ...formKitIcons, // Additional FA icons available via prefix-icon/suffix-icon
60
62
  },
63
+ iconLoader: formKitIconLoader,
61
64
  plugins: [proPlugin, autoAnimatePlugin]
62
- });
65
+ };
63
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wishbone-media/spark",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,4 +1,4 @@
1
- import { library } from '@fortawesome/fontawesome-svg-core'
1
+ import { library, icon as faIconToSvg } from '@fortawesome/fontawesome-svg-core'
2
2
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
3
3
 
4
4
  import {
@@ -43,6 +43,19 @@ import {
43
43
  faBolt,
44
44
  faCloudDownload,
45
45
  faInbox,
46
+ // Additional icons for FormKit genesis replacement
47
+ faPlus,
48
+ faArrowDown,
49
+ faArrowUp,
50
+ faCalendar,
51
+ faFile,
52
+ faCircle,
53
+ faCircleDot,
54
+ faSpinnerThird,
55
+ faStar,
56
+ faAnglesRight,
57
+ faAnglesLeft,
58
+ faEyeDropper,
46
59
  } from '@fortawesome/pro-regular-svg-icons'
47
60
 
48
61
  import {
@@ -97,6 +110,82 @@ export const Icons = {
97
110
  fadSort: faSortDuotone,
98
111
  fadSortDown: faSortDownDuotone,
99
112
  fadSortUp: faSortUpDuotone,
113
+
114
+ // Additional icons for FormKit genesis replacement
115
+ farPlus: faPlus,
116
+ farArrowDown: faArrowDown,
117
+ farArrowUp: faArrowUp,
118
+ farCalendar: faCalendar,
119
+ farFile: faFile,
120
+ farCircle: faCircle,
121
+ farSpinner: faSpinnerThird,
122
+ farStar: faStar,
123
+ farAnglesRight: faAnglesRight,
124
+ farAnglesLeft: faAnglesLeft,
125
+ farEyeDropper: faEyeDropper,
126
+ farCircleDot: faCircleDot,
127
+ }
128
+
129
+ /**
130
+ * Icons converted to SVG strings for FormKit's icon system.
131
+ * Use with FormKit's prefix-icon/suffix-icon props: prefix-icon="farCheck"
132
+ * These are registered in formkit.config.js and preloaded at app initialization.
133
+ */
134
+ export const formKitIcons = Object.fromEntries(
135
+ Object.entries(Icons).map(([key, iconDef]) => {
136
+ const result = faIconToSvg(iconDef)
137
+ return [key, result?.html?.[0] || '']
138
+ })
139
+ )
140
+
141
+ /**
142
+ * FontAwesome replacements for FormKit's built-in genesis icons.
143
+ * These override the default icons used by FormKit components (datepicker, select, etc.)
144
+ * Keys match the genesis icon names so FormKit uses these instead.
145
+ */
146
+ const genesisIconMapping = {
147
+ add: faPlus,
148
+ arrowDown: faArrowDown,
149
+ arrowUp: faArrowUp,
150
+ check: faCheck,
151
+ close: faXmark,
152
+ checkboxDecorator: faCheck,
153
+ date: faCalendar,
154
+ dragHandle: faGripDotsVertical,
155
+ fileItem: faFile,
156
+ fileRemove: faXmark,
157
+ noFiles: faFile,
158
+ radioDecorator: faCircleDot, // Circle with dot for radio indicator
159
+ select: faChevronDown,
160
+ spinner: faSpinnerThird,
161
+ star: faStar,
162
+ trash: faTrash,
163
+ fastForward: faAnglesRight,
164
+ right: faChevronRight,
165
+ left: faChevronLeft,
166
+ rewind: faAnglesLeft,
167
+ color: faEyeDropper,
168
+ }
169
+
170
+ export const formKitGenesisOverride = Object.fromEntries(
171
+ Object.entries(genesisIconMapping).map(([key, iconDef]) => {
172
+ const result = faIconToSvg(iconDef)
173
+ return [key, result?.html?.[0] || '']
174
+ })
175
+ )
176
+
177
+ /**
178
+ * FormKit iconLoader that looks up icons from the Icons object.
179
+ * This handles icons added by consumer apps via addIcons() after FormKit is configured.
180
+ * Called lazily by FormKit when an icon isn't found in the pre-registered registry.
181
+ */
182
+ export function formKitIconLoader(iconName) {
183
+ const iconDef = Icons[iconName]
184
+ if (iconDef) {
185
+ const result = faIconToSvg(iconDef)
186
+ return Promise.resolve(result?.html?.[0] || undefined)
187
+ }
188
+ return Promise.resolve(undefined)
100
189
  }
101
190
 
102
191
  export function addIcons(newIcons) {
@@ -1,4 +1,4 @@
1
- export { Icons, addIcons, setupFontAwesome } from './fontawesome.js'
1
+ export { Icons, addIcons, setupFontAwesome, formKitIcons, formKitIconLoader, formKitGenesisOverride } from './fontawesome.js'
2
2
  export { createAuthRoutes, setupAuthGuards, create403Route, create404Route, setupBootstrapGuard } from './router.js'
3
3
  export { createAxiosInstance, setupAxios, getAxiosInstance } from './axios.js'
4
4
  export { createBootstrapService } from './app-bootstrap.js'