@ulu/frontend-vue 0.1.0-beta.5 → 0.1.0-beta.6

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.
@@ -23,7 +23,7 @@
23
23
  <slot name="icon" :open="open">
24
24
  <span class="accordion__icon" :class="classes.icon">
25
25
  <UluIcon
26
- :type="open ? 'collapse' : 'expand'"
26
+ :icon="open ? 'type:collapse' : 'type:expand'"
27
27
  style="display: inline;"
28
28
  />
29
29
  </span>
@@ -26,7 +26,7 @@
26
26
  <UluIcon
27
27
  v-if="titleIcon"
28
28
  class="modal__title-icon"
29
- :definition="titleIcon"
29
+ :icon="titleIcon"
30
30
  />
31
31
  <span class="modal__title-text">{{ title }}</span>
32
32
  </slot>
@@ -35,8 +35,7 @@
35
35
  <slot name="closeIcon">
36
36
  <UluIcon
37
37
  class="modal__close-icon"
38
- type="close"
39
- :definition="closeIcon"
38
+ :icon="closeIcon || 'type:close'"
40
39
  />
41
40
  </slot>
42
41
  </button>
@@ -56,7 +55,7 @@
56
55
  </div>
57
56
  <button v-if="resizerEnabled" class="modal__resizer" ref="resizer" type="button">
58
57
  <slot name="resizerIcon">
59
- <UluIcon class="modal__resizer-icon" :type="resizerIconType" :definition="resizerIcon" />
58
+ <UluIcon class="modal__resizer-icon" :icon="resizerIcon || resizerIconType" />
60
59
  </slot>
61
60
  </button>
62
61
  </dialog>
@@ -213,7 +212,7 @@
213
212
  });
214
213
 
215
214
  const resizerIconType = computed(() => {
216
- return props.position === 'center' ? 'resizeBoth' : 'resizeHorizontal';
215
+ return props.position === 'center' ? 'type:resizeBoth' : 'type:resizeHorizontal';
217
216
  });
218
217
 
219
218
  // Define the internal modifiers object as a computed property (so it can react to changes)
@@ -9,7 +9,7 @@
9
9
  size="large"
10
10
  >
11
11
  <template #trigger>
12
- <UluIcon type="ellipsis" :definition="triggerIcon"/>
12
+ <UluIcon :icon="triggerIcon || 'type:ellipsis'"/>
13
13
  </template>
14
14
  <template #content>
15
15
  <div class="type-word-break">
@@ -4,8 +4,7 @@
4
4
  <UluIcon
5
5
  class="type-large margin-right-small"
6
6
  :class="`color-${ type }`"
7
- :type="type"
8
- :definition="icon"
7
+ :icon="icon || `type:${type}`"
9
8
  />
10
9
  <div class="type-small">
11
10
  <div>
@@ -22,7 +22,7 @@
22
22
  <slot name="before"/>
23
23
  <UluIcon
24
24
  v-if="icon && (iconBefore || iconOnly)"
25
- :definition="icon"
25
+ :icon="icon"
26
26
  class="button__icon"
27
27
  />
28
28
  <span v-if="($slots.default || text) && !iconOnly">
@@ -32,7 +32,7 @@
32
32
  </span>
33
33
  <UluIcon
34
34
  v-if="icon && (!iconBefore && !iconOnly)"
35
- :definition="icon"
35
+ :icon="icon"
36
36
  class="button__icon"
37
37
  />
38
38
  <slot name="after"/>
@@ -5,8 +5,7 @@
5
5
  </span>
6
6
  <UluIcon
7
7
  class="external-link__icon margin-left-small-x display-inline"
8
- type="externalLink"
9
- :definition="icon"
8
+ :icon="icon || 'type:externalLink'"
10
9
  />
11
10
  </a>
12
11
  </template>
@@ -27,15 +27,11 @@
27
27
  let FaModule;
28
28
 
29
29
  const props = defineProps({
30
- /**
31
- * Semantic type of icon to use, will be resolved from settings
32
- */
33
- type: String,
34
30
  /**
35
31
  * Icon definition can be string (fa classes), or array or object (any prop format FaIcon accepts)
36
32
  * - This will override the 'type' prop if both are provided
37
33
  */
38
- definition: [String, Array, Object, Boolean],
34
+ icon: [String, Array, Object, Boolean],
39
35
  });
40
36
 
41
37
  const useStaticFa = computed(() => {
@@ -52,18 +48,17 @@
52
48
 
53
49
  // Resolve the final icon definition, giving precedence to the `definition` prop
54
50
  const resolvedDefinition = computed(() => {
55
- if (props.definition) {
56
- return props.definition;
57
- }
58
- if (props.type) {
51
+ const { icon } = props;
52
+ if (typeof icon === 'string' && icon.startsWith('type:')) {
59
53
  try {
60
- return uluCore.getIcon(props.type);
54
+ const type = icon.substring(5);
55
+ return uluCore.getIcon(type);
61
56
  } catch (e) {
62
57
  console.warn(e);
63
58
  return null;
64
59
  }
65
60
  }
66
- return null;
61
+ return icon;
67
62
  });
68
63
 
69
64
  const customIconProps = computed(() => {
@@ -10,7 +10,7 @@
10
10
  resolvedModifiers
11
11
  ]"
12
12
  >
13
- <UluIcon v-if="icon" :definition="icon" />
13
+ <UluIcon v-if="icon" :icon="icon" />
14
14
  <slot>
15
15
  {{ text }}
16
16
  </slot>
@@ -8,10 +8,9 @@
8
8
  :style="{ alignItems: iconAlign }"
9
9
  >
10
10
  <UluIcon
11
- v-if="icon || iconType"
11
+ v-if="icon"
12
12
  :class="classes.icon"
13
- :type="iconType"
14
- :definition="icon"
13
+ :icon="icon"
15
14
  />
16
15
  <slot>
17
16
  {{ title }}
@@ -38,7 +37,6 @@
38
37
  type: String,
39
38
  default: "baseline"
40
39
  },
41
- iconType: String,
42
40
  classes: {
43
41
  type: Object,
44
42
  default: () => ({
@@ -19,8 +19,7 @@
19
19
  <slot name="separator">
20
20
  <UluIcon
21
21
  :class="classes.separator"
22
- type="pathSeparator"
23
- :definition="separatorIcon"
22
+ :icon="separatorIcon || 'type:pathSeparator'"
24
23
  />
25
24
  </slot>
26
25
  </template>
@@ -26,7 +26,7 @@
26
26
  <slot :item="item" :index="index">
27
27
  <UluIcon
28
28
  v-if="item.icon"
29
- :definition="item.icon"
29
+ :icon="item.icon"
30
30
  :class="[classes.linkIcon, item?.classes?.linkIcon]"
31
31
  />
32
32
  <span :class="[classes.linkText, item?.classes?.linkText]">{{ item.title }}</span>
@@ -8,7 +8,7 @@ const defaults = {
8
8
  fontAwesomeStatic: false,
9
9
  iconComponent: null,
10
10
  iconPropResolver: (definition) => ({ icon: definition }),
11
- icons: {
11
+ iconsByType: {
12
12
  danger: "fas fa-triangle-exclamation",
13
13
  warning: "fas fa-circle-exclamation",
14
14
  info: "fas fa-circle-info",
@@ -25,14 +25,14 @@ const defaults = {
25
25
  }
26
26
  };
27
27
 
28
- export const iconKeys = Object.keys(defaults.icons);
28
+ export const iconKeys = Object.keys(defaults.iconsByType);
29
29
 
30
30
  export default function install(app, userSettings = {}) {
31
31
  // A single reactive object for all settings
32
32
  const settings = reactive({ ...defaults });
33
33
 
34
34
  // Separate icon overrides from other options to handle them safely
35
- const { icons: iconOverrides, ...otherOptions } = userSettings || {};
35
+ const { iconsByType: iconOverrides, ...otherOptions } = userSettings || {};
36
36
 
37
37
  // Merge any user-provided options during installation
38
38
  if (otherOptions) {
@@ -64,14 +64,14 @@ export default function install(app, userSettings = {}) {
64
64
  settings[key] = value;
65
65
  },
66
66
  getIcon(type) {
67
- const icons = settings.icons;
67
+ const icons = settings.iconsByType;
68
68
  if (!icons[type]) {
69
69
  throw new Error(`Icon type "${type}" not found!`);
70
70
  }
71
71
  return icons[type];
72
72
  },
73
73
  setIcon(type, definition) {
74
- settings.icons[type] = definition;
74
+ settings.iconsByType[type] = definition;
75
75
  }
76
76
  };
77
77
 
@@ -43,7 +43,7 @@
43
43
  </button>
44
44
  </div>
45
45
  <button class="toast__close" :class="classes.closeButton" @click="toast.close">
46
- <UluIcon type="close"/>
46
+ <UluIcon :icon="'type:close'"/>
47
47
  </button>
48
48
  </div>
49
49
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "A modular and tree-shakeable Vue 3 component library for the Ulu frontend",
5
5
  "type": "module",
6
6
  "files": [
@@ -18,15 +18,23 @@
18
18
  "./*": "./lib/*",
19
19
  "./scss": "./lib/_index.scss"
20
20
  },
21
+ "typesVersions": {
22
+ "*": {
23
+ "lib/*": [
24
+ "./types/*"
25
+ ]
26
+ }
27
+ },
21
28
  "repository": {
22
29
  "type": "git",
23
30
  "url": "git+https://github.com/Jscherbe/frontend-vue.git"
24
31
  },
25
32
  "scripts": {
26
33
  "dev": "storybook dev -p 6006",
27
- "docs:build": "storybook build -o docs --docs",
34
+ "docs:build": "storybook build -o docs",
28
35
  "build": "vite build",
29
- "deploy": "npm run build && npm run docs:build"
36
+ "types": "npx tsc",
37
+ "deploy": "npm run types && npm run build && npm run docs:build"
30
38
  },
31
39
  "keywords": [
32
40
  "vue",
@@ -78,7 +86,8 @@
78
86
  "storybook": "^9.1.1",
79
87
  "storybook-addon-vue-mdx": "^2.0.2",
80
88
  "vite": "^7.0.0",
81
- "vue-router": "^4.5.1"
89
+ "vue-router": "^4.5.1",
90
+ "typescript": "^5.3.3"
82
91
  },
83
92
  "volta": {
84
93
  "node": "22.17.0"