@ionic/vue 8.4.4-dev.11741648084.118e26ac → 8.4.4-dev.11741872392.110b2b59

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, getCurrentInstance, inject, h, withDirectives, computed, provide, shallowRef, watch, onUnmounted, Fragment, isVNode, Teleport, onMounted } from 'vue';
1
+ import { defineComponent, ref, onMounted, getCurrentInstance, inject, h, withDirectives, computed, provide, shallowRef, watch, onUnmounted, Fragment, isVNode, Teleport } from 'vue';
2
2
  import { defineCustomElement } from '@ionic/core/components/ion-accordion.js';
3
3
  import { defineCustomElement as defineCustomElement$1 } from '@ionic/core/components/ion-accordion-group.js';
4
4
  import { defineCustomElement as defineCustomElement$2 } from '@ionic/core/components/ion-avatar.js';
@@ -141,10 +141,30 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
141
141
  if (defineCustomElement !== undefined) {
142
142
  defineCustomElement();
143
143
  }
144
- const Container = defineComponent((props, { attrs, slots, emit }) => {
144
+ const emits = emitProps;
145
+ const props = [ROUTER_LINK_VALUE, ...componentProps].reduce((acc, prop) => {
146
+ acc[prop] = DEFAULT_EMPTY_PROP$1;
147
+ return acc;
148
+ }, {});
149
+ if (modelProp) {
150
+ emits.push(UPDATE_VALUE_EVENT);
151
+ props[MODEL_VALUE] = DEFAULT_EMPTY_PROP$1;
152
+ }
153
+ return defineComponent((props, { attrs, slots, emit }) => {
145
154
  let modelPropValue = modelProp ? props[modelProp] : undefined;
146
155
  const containerRef = ref();
147
156
  const classes = new Set(getComponentClasses(attrs.class));
157
+ onMounted(() => {
158
+ /**
159
+ * we register the event emmiter for @Event definitions
160
+ * so we can use @event
161
+ */
162
+ emitProps.forEach((eventName) => {
163
+ containerRef.value?.addEventListener(eventName, (e) => {
164
+ emit(eventName, e);
165
+ });
166
+ });
167
+ });
148
168
  /**
149
169
  * This directive is responsible for updating any reactive
150
170
  * reference associated with v-model on the component.
@@ -157,9 +177,9 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
157
177
  */
158
178
  const vModelDirective = {
159
179
  created: (el) => {
160
- const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
180
+ const eventsNames = (Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent]).map((ev) => ev.replace(/-([a-z])/g, (g) => g[1].toUpperCase()));
161
181
  eventsNames.forEach((eventName) => {
162
- el.addEventListener(eventName.toLowerCase(), (e) => {
182
+ el.addEventListener(eventName, (e) => {
163
183
  /**
164
184
  * Only update the v-model binding if the event's target is the element we are
165
185
  * listening on. For example, Component A could emit ionChange, but it could also
@@ -173,15 +193,6 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
173
193
  }
174
194
  });
175
195
  });
176
- /**
177
- * we register the event emmiter for @Event definitions
178
- * so we can use @event
179
- */
180
- emitProps.forEach((eventName) => {
181
- el.addEventListener(eventName, (e) => {
182
- emit(eventName, e);
183
- });
184
- });
185
196
  },
186
197
  };
187
198
  const currentInstance = getCurrentInstance();
@@ -229,7 +240,7 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
229
240
  handleRouterLink(ev);
230
241
  }
231
242
  };
232
- let propsToAdd = {
243
+ const propsToAdd = {
233
244
  ref: containerRef,
234
245
  class: getElementClasses(containerRef, classes),
235
246
  onClick: handleClick,
@@ -262,16 +273,10 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
262
273
  * was set as a static value (i.e. no v-model).
263
274
  */
264
275
  if (props[MODEL_VALUE] !== EMPTY_PROP$1) {
265
- propsToAdd = {
266
- ...propsToAdd,
267
- [modelProp]: props[MODEL_VALUE],
268
- };
276
+ propsToAdd[modelProp] = props[MODEL_VALUE];
269
277
  }
270
278
  else if (modelPropValue !== EMPTY_PROP$1) {
271
- propsToAdd = {
272
- ...propsToAdd,
273
- [modelProp]: modelPropValue,
274
- };
279
+ propsToAdd[modelProp] = modelPropValue;
275
280
  }
276
281
  }
277
282
  // If router link is defined, add href to props
@@ -279,10 +284,7 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
279
284
  // of components that should become activatable and
280
285
  // focusable with router link.
281
286
  if (ROUTER_LINK_VALUE in props && props[ROUTER_LINK_VALUE] !== EMPTY_PROP$1) {
282
- propsToAdd = {
283
- ...propsToAdd,
284
- href: props[ROUTER_LINK_VALUE],
285
- };
287
+ propsToAdd.href = props[ROUTER_LINK_VALUE];
286
288
  }
287
289
  /**
288
290
  * vModelDirective is only needed on components that support v-model.
@@ -291,31 +293,11 @@ const defineContainer = (name, defineCustomElement, componentProps = [], emitPro
291
293
  const node = h(name, propsToAdd, slots.default && slots.default());
292
294
  return modelProp === undefined ? node : withDirectives(node, [[vModelDirective]]);
293
295
  };
296
+ }, {
297
+ name,
298
+ props,
299
+ emits,
294
300
  });
295
- if (typeof Container !== 'function') {
296
- let emits = [];
297
- let props = {};
298
- props[ROUTER_LINK_VALUE] = DEFAULT_EMPTY_PROP$1;
299
- componentProps.forEach((componentProp) => (props[componentProp] = DEFAULT_EMPTY_PROP$1));
300
- emits = emitProps;
301
- if (modelProp) {
302
- props[MODEL_VALUE] = DEFAULT_EMPTY_PROP$1;
303
- emits.push(UPDATE_VALUE_EVENT);
304
- }
305
- /**
306
- * Add emit props to the component.
307
- * This is necessary for Vue to know
308
- * which events to listen to.
309
- * @see https://v3.vuejs.org/guide/component-custom-events.html#event-names
310
- */
311
- // @ts-expect-error
312
- Container.name = name;
313
- // @ts-expect-error
314
- Container.emits = emits;
315
- // @ts-expect-error
316
- Container.props = props;
317
- }
318
- return Container;
319
301
  };
320
302
 
321
303
  /* eslint-disable */
@@ -439,13 +421,10 @@ const IonCheckbox = /*@__PURE__*/ defineContainer('ion-checkbox', defineCustomEl
439
421
  'checked',
440
422
  'indeterminate',
441
423
  'disabled',
442
- 'errorText',
443
- 'helperText',
444
424
  'value',
445
425
  'labelPlacement',
446
426
  'justify',
447
427
  'alignment',
448
- 'required',
449
428
  'ionChange',
450
429
  'ionFocus',
451
430
  'ionBlur'
@@ -813,8 +792,6 @@ const IonRadioGroup = /*@__PURE__*/ defineContainer('ion-radio-group', defineCus
813
792
  'compareWith',
814
793
  'name',
815
794
  'value',
816
- 'helperText',
817
- 'errorText',
818
795
  'ionChange',
819
796
  'ionValueChange'
820
797
  ], [
@@ -958,8 +935,6 @@ const IonSelect = /*@__PURE__*/ defineContainer('ion-select', defineCustomElemen
958
935
  'compareWith',
959
936
  'disabled',
960
937
  'fill',
961
- 'errorText',
962
- 'helperText',
963
938
  'interface',
964
939
  'interfaceOptions',
965
940
  'justify',
@@ -974,7 +949,6 @@ const IonSelect = /*@__PURE__*/ defineContainer('ion-select', defineCustomElemen
974
949
  'expandedIcon',
975
950
  'shape',
976
951
  'value',
977
- 'required',
978
952
  'ionChange',
979
953
  'ionCancel',
980
954
  'ionDismiss',
@@ -1079,14 +1053,11 @@ const IonToggle = /*@__PURE__*/ defineContainer('ion-toggle', defineCustomElemen
1079
1053
  'name',
1080
1054
  'checked',
1081
1055
  'disabled',
1082
- 'errorText',
1083
- 'helperText',
1084
1056
  'value',
1085
1057
  'enableOnOffLabels',
1086
1058
  'labelPlacement',
1087
1059
  'justify',
1088
1060
  'alignment',
1089
- 'required',
1090
1061
  'ionChange',
1091
1062
  'ionFocus',
1092
1063
  'ionBlur'
@@ -1242,19 +1213,6 @@ const useIonRouter = () => {
1242
1213
  };
1243
1214
  };
1244
1215
 
1245
- // TODO(FW-2969): types
1246
- const toKebabCase = (eventName) => {
1247
- return eventName
1248
- .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
1249
- .toLowerCase();
1250
- };
1251
- const getHelperFunctions = () => {
1252
- return {
1253
- ael: (el, eventName, cb, opts) => el.addEventListener(toKebabCase(eventName), cb, opts),
1254
- rel: (el, eventName, cb, opts) => el.removeEventListener(toKebabCase(eventName), cb, opts),
1255
- ce: (eventName, opts) => new CustomEvent(toKebabCase(eventName), opts),
1256
- };
1257
- };
1258
1216
  const IonicVue = {
1259
1217
  async install(_, config = {}) {
1260
1218
  /**
@@ -1267,8 +1225,7 @@ const IonicVue = {
1267
1225
  if (typeof document !== "undefined") {
1268
1226
  document.documentElement.classList.add("ion-ce");
1269
1227
  }
1270
- const { ael, rel, ce } = getHelperFunctions();
1271
- initialize(Object.assign(Object.assign({}, config), { _ael: ael, _rel: rel, _ce: ce }));
1228
+ initialize(config);
1272
1229
  },
1273
1230
  };
1274
1231
 
@@ -2263,41 +2220,40 @@ const IonNav = /*@__PURE__*/ defineComponent((props) => {
2263
2220
  },
2264
2221
  });
2265
2222
 
2266
- const IonIcon = /*@__PURE__*/ defineComponent({
2267
- name: "IonIcon",
2268
- props: {
2269
- color: String,
2270
- flipRtl: Boolean,
2271
- icon: String,
2272
- ios: String,
2273
- lazy: String,
2274
- md: String,
2275
- mode: String,
2276
- name: String,
2277
- size: String,
2278
- src: String,
2279
- },
2280
- setup(props, { slots }) {
2281
- defineCustomElement$1j();
2282
- return () => {
2283
- var _a, _b;
2284
- const { icon, ios, md, mode } = props;
2285
- let iconToUse;
2286
- const config = getConfig();
2287
- const iconMode = mode || (config === null || config === void 0 ? void 0 : config.get("mode"));
2288
- if (ios || md) {
2289
- if (iconMode === "ios") {
2290
- iconToUse = (_a = ios !== null && ios !== void 0 ? ios : md) !== null && _a !== void 0 ? _a : icon;
2291
- }
2292
- else {
2293
- iconToUse = (_b = md !== null && md !== void 0 ? md : ios) !== null && _b !== void 0 ? _b : icon;
2294
- }
2223
+ const IonIcon = /*@__PURE__*/ defineComponent((props, { slots }) => {
2224
+ defineCustomElement$1j();
2225
+ return () => {
2226
+ var _a, _b;
2227
+ const { icon, ios, md, mode } = props;
2228
+ let iconToUse;
2229
+ const config = getConfig();
2230
+ const iconMode = mode || (config === null || config === void 0 ? void 0 : config.get("mode"));
2231
+ if (ios || md) {
2232
+ if (iconMode === "ios") {
2233
+ iconToUse = (_a = ios !== null && ios !== void 0 ? ios : md) !== null && _a !== void 0 ? _a : icon;
2295
2234
  }
2296
2235
  else {
2297
- iconToUse = icon;
2236
+ iconToUse = (_b = md !== null && md !== void 0 ? md : ios) !== null && _b !== void 0 ? _b : icon;
2298
2237
  }
2299
- return h("ion-icon", Object.assign(Object.assign({}, props), { icon: iconToUse }), slots);
2300
- };
2238
+ }
2239
+ else {
2240
+ iconToUse = icon;
2241
+ }
2242
+ return h("ion-icon", Object.assign(Object.assign({}, props), { icon: iconToUse }), slots);
2243
+ };
2244
+ }, {
2245
+ name: "IonIcon",
2246
+ props: {
2247
+ color: { type: String },
2248
+ flipRtl: { type: Boolean },
2249
+ icon: { type: String },
2250
+ ios: { type: String },
2251
+ lazy: { type: Boolean },
2252
+ md: { type: String },
2253
+ mode: { type: String },
2254
+ name: { type: String },
2255
+ size: { type: String },
2256
+ src: { type: String },
2301
2257
  },
2302
2258
  });
2303
2259
 
@@ -2307,10 +2263,10 @@ const defineOverlayContainer = (name, defineCustomElement, componentProps = [],
2307
2263
  const createControllerComponent = (options) => {
2308
2264
  return defineComponent((props, { slots, emit }) => {
2309
2265
  const eventListeners = [
2310
- { componentEv: `${name}-will-present`, frameworkEv: "willPresent" },
2311
- { componentEv: `${name}-did-present`, frameworkEv: "didPresent" },
2312
- { componentEv: `${name}-will-dismiss`, frameworkEv: "willDismiss" },
2313
- { componentEv: `${name}-did-dismiss`, frameworkEv: "didDismiss" },
2266
+ { componentEv: `${name}WillPresent`, frameworkEv: "willPresent" },
2267
+ { componentEv: `${name}DidPresent`, frameworkEv: "didPresent" },
2268
+ { componentEv: `${name}WillDismiss`, frameworkEv: "willDismiss" },
2269
+ { componentEv: `${name}DidDismiss`, frameworkEv: "didDismiss" },
2314
2270
  ];
2315
2271
  if (defineCustomElement !== undefined) {
2316
2272
  defineCustomElement();
@@ -2404,16 +2360,31 @@ const defineOverlayContainer = (name, defineCustomElement, componentProps = [],
2404
2360
  }, options);
2405
2361
  };
2406
2362
  const createInlineComponent = (options) => {
2407
- return defineComponent((props, { slots }) => {
2363
+ return defineComponent((props, { slots, emit }) => {
2408
2364
  if (defineCustomElement !== undefined) {
2409
2365
  defineCustomElement();
2410
2366
  }
2411
2367
  const isOpen = ref(false);
2412
2368
  const elementRef = ref();
2413
2369
  onMounted(() => {
2414
- elementRef.value.addEventListener("ion-mount", () => (isOpen.value = true));
2415
- elementRef.value.addEventListener("will-present", () => (isOpen.value = true));
2416
- elementRef.value.addEventListener("did-dismiss", () => (isOpen.value = false));
2370
+ elementRef.value.addEventListener("ionMount", (ev) => {
2371
+ emit("ionMount", ev);
2372
+ isOpen.value = true;
2373
+ });
2374
+ elementRef.value.addEventListener("willPresent", (ev) => {
2375
+ emit("willPresent", ev);
2376
+ isOpen.value = true;
2377
+ });
2378
+ elementRef.value.addEventListener("didDismiss", (ev) => {
2379
+ emit("didDismiss", ev);
2380
+ isOpen.value = false;
2381
+ });
2382
+ elementRef.value.addEventListener("willDismiss", (ev) => {
2383
+ emit("willDismiss", ev);
2384
+ });
2385
+ elementRef.value.addEventListener("didPresent", (ev) => {
2386
+ emit("didPresent", ev);
2387
+ });
2417
2388
  });
2418
2389
  return () => {
2419
2390
  const restOfProps = {};
@@ -2477,7 +2448,7 @@ const defineOverlayContainer = (name, defineCustomElement, componentProps = [],
2477
2448
  const IonActionSheet = /*@__PURE__*/ defineOverlayContainer('ion-action-sheet', defineCustomElement$1k, ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'mode', 'subHeader', 'translucent', 'trigger']);
2478
2449
  const IonAlert = /*@__PURE__*/ defineOverlayContainer('ion-alert', defineCustomElement$1l, ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'inputs', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'subHeader', 'translucent', 'trigger']);
2479
2450
  const IonLoading = /*@__PURE__*/ defineOverlayContainer('ion-loading', defineCustomElement$1m, ['animated', 'backdropDismiss', 'cssClass', 'duration', 'enterAnimation', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'showBackdrop', 'spinner', 'translucent', 'trigger']);
2480
- const IonModal = /*@__PURE__*/ defineOverlayContainer('ion-modal', defineCustomElement$1n, ['animated', 'backdropBreakpoint', 'backdropDismiss', 'breakpoints', 'canDismiss', 'enterAnimation', 'expandToScroll', 'focusTrap', 'handle', 'handleBehavior', 'htmlAttributes', 'initialBreakpoint', 'isOpen', 'keepContentsMounted', 'keyboardClose', 'leaveAnimation', 'mode', 'presentingElement', 'showBackdrop', 'trigger'], true);
2451
+ const IonModal = /*@__PURE__*/ defineOverlayContainer('ion-modal', defineCustomElement$1n, ['animated', 'backdropBreakpoint', 'backdropDismiss', 'breakpoints', 'canDismiss', 'enterAnimation', 'focusTrap', 'handle', 'handleBehavior', 'htmlAttributes', 'initialBreakpoint', 'isOpen', 'keepContentsMounted', 'keyboardClose', 'leaveAnimation', 'mode', 'presentingElement', 'showBackdrop', 'trigger'], true);
2481
2452
  const IonPickerLegacy = /*@__PURE__*/ defineOverlayContainer('ion-picker-legacy', defineCustomElement$1o, ['animated', 'backdropDismiss', 'buttons', 'columns', 'cssClass', 'duration', 'enterAnimation', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'mode', 'showBackdrop', 'trigger']);
2482
2453
  const IonPopover = /*@__PURE__*/ defineOverlayContainer('ion-popover', defineCustomElement$1p, ['alignment', 'animated', 'arrow', 'backdropDismiss', 'component', 'componentProps', 'dismissOnSelect', 'enterAnimation', 'event', 'focusTrap', 'htmlAttributes', 'isOpen', 'keepContentsMounted', 'keyboardClose', 'leaveAnimation', 'mode', 'reference', 'showBackdrop', 'side', 'size', 'translucent', 'trigger', 'triggerAction']);
2483
2454
  const IonToast = /*@__PURE__*/ defineOverlayContainer('ion-toast', defineCustomElement$1q, ['animated', 'buttons', 'color', 'cssClass', 'duration', 'enterAnimation', 'header', 'htmlAttributes', 'icon', 'isOpen', 'keyboardClose', 'layout', 'leaveAnimation', 'message', 'mode', 'position', 'positionAnchor', 'swipeGesture', 'translucent', 'trigger']);