@strands.gg/accui 1.7.2 → 1.7.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.
@@ -6968,12 +6968,12 @@ const _hoisted_2$5 = { class: "profile-image-section" };
6968
6968
  const _hoisted_3$5 = { class: "profile-image-container" };
6969
6969
  const _hoisted_4$4 = { class: "profile-image-wrapper" };
6970
6970
  const _hoisted_5$4 = {
6971
- key: 1,
6971
+ key: 0,
6972
6972
  class: "profile-avatar profile-avatar-with-image"
6973
6973
  };
6974
6974
  const _hoisted_6$2 = ["src", "alt"];
6975
6975
  const _hoisted_7$2 = {
6976
- key: 2,
6976
+ key: 1,
6977
6977
  class: "profile-avatar profile-avatar-initials"
6978
6978
  };
6979
6979
  const _hoisted_8$2 = ["disabled"];
@@ -7652,16 +7652,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7652
7652
  createElementVNode("div", _hoisted_2$5, [
7653
7653
  createElementVNode("div", _hoisted_3$5, [
7654
7654
  createElementVNode("div", _hoisted_4$4, [
7655
- currentUser.value ? (openBlock(), createBlock(unref(StrandsUiLevelProgress), {
7656
- key: 0,
7655
+ createVNode(unref(StrandsUiLevelProgress), {
7657
7656
  size: 140,
7658
- value: currentUser.value.xp | 0,
7659
- max: currentUser.value.next_level_xp | 1,
7660
- level: currentUser.value.level | 0,
7661
- "level-label": `LEVEL ${currentUser.value.level | 0}`,
7662
- "user-settings": currentUser.value.settings,
7657
+ value: currentUser.value?.xp || 0,
7658
+ max: currentUser.value?.next_level_xp || 1,
7659
+ level: currentUser.value?.level || 0,
7660
+ "level-label": `LEVEL ${currentUser.value?.level || 0}`,
7661
+ "user-settings": currentUser.value?.settings,
7663
7662
  class: "profile-progress-ring"
7664
- }, null, 8, ["value", "max", "level", "level-label", "user-settings"])) : createCommentVNode("", true),
7663
+ }, null, 8, ["value", "max", "level", "level-label", "user-settings"]),
7665
7664
  currentUser.value?.avatar ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
7666
7665
  createElementVNode("img", {
7667
7666
  src: currentUser.value.avatar,
@@ -8127,7 +8126,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8127
8126
  };
8128
8127
  }
8129
8128
  });
8130
- const StrandsUserProfile = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-31d6a9db"]]);
8129
+ const StrandsUserProfile = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b880e15b"]]);
8131
8130
  const _hoisted_1$6 = { class: "accui-component-scope" };
8132
8131
  const _hoisted_2$4 = { class: "accui-w-full accui-min-w-100 accui-max-w-md accui-mx-auto accui-animate-slide-up" };
8133
8132
  const _hoisted_3$4 = { class: "accui-mt-8 accui-text-center" };
@@ -8555,10 +8554,15 @@ const _hoisted_3$2 = {
8555
8554
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8556
8555
  __name: "SignedIn",
8557
8556
  props: {
8558
- showFallback: { type: Boolean, default: true }
8557
+ showFallback: { type: Boolean, default: true },
8558
+ invert: { type: Boolean, default: false }
8559
8559
  },
8560
8560
  emits: ["sign-in-required"],
8561
8561
  setup(__props, { emit: __emit }) {
8562
+ const props = __props;
8563
+ const invert = props.invert ?? false;
8564
+ const signedInOrInverted = computed(() => (isAuthenticated.value && !invert || !isAuthenticated.value && invert) && !showLoading.value);
8565
+ const signedOutOrInverted = computed(() => (isAuthenticated.value && invert || !isAuthenticated.value && !invert) && props.showFallback && !showLoading.value);
8562
8566
  const emit = __emit;
8563
8567
  const isComponentReady = ref(false);
8564
8568
  const { isAuthenticated, isInitializing, isSigningIn, user, signOut } = useStrandsAuth();
@@ -8572,15 +8576,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8572
8576
  emit("sign-in-required");
8573
8577
  };
8574
8578
  return (_ctx, _cache) => {
8575
- return unref(isAuthenticated) && !showLoading.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8579
+ return signedInOrInverted.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8576
8580
  renderSlot(_ctx.$slots, "default", {
8577
8581
  user: unref(user),
8578
- signOut: unref(signOut)
8582
+ signOut: unref(signOut),
8583
+ invert: unref(invert)
8579
8584
  }, void 0, true)
8580
- ])) : !unref(isAuthenticated) && _ctx.showFallback && !showLoading.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
8585
+ ])) : signedOutOrInverted.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
8581
8586
  renderSlot(_ctx.$slots, "fallback", { signIn }, () => [
8582
8587
  createElementVNode("div", { class: "signed-in-fallback" }, [
8583
- _cache[0] || (_cache[0] = createStaticVNode('<div class="signed-in-icon-container" data-v-ab5f199f><svg class="signed-in-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-ab5f199f><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" data-v-ab5f199f></path></svg></div><h3 class="signed-in-title" data-v-ab5f199f>Sign in required</h3><p class="signed-in-subtitle" data-v-ab5f199f>You need to be signed in to access this content.</p>', 3)),
8588
+ _cache[0] || (_cache[0] = createStaticVNode('<div class="signed-in-icon-container" data-v-669fa3b4><svg class="signed-in-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-669fa3b4><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" data-v-669fa3b4></path></svg></div><h3 class="signed-in-title" data-v-669fa3b4>Sign in required</h3><p class="signed-in-subtitle" data-v-669fa3b4>You need to be signed in to access this content.</p>', 3)),
8584
8589
  createElementVNode("button", {
8585
8590
  onClick: signIn,
8586
8591
  class: "signed-in-button"
@@ -8600,7 +8605,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8600
8605
  };
8601
8606
  }
8602
8607
  });
8603
- const SignedIn = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ab5f199f"]]);
8608
+ const SignedIn = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-669fa3b4"]]);
8604
8609
  const _hoisted_1$3 = {
8605
8610
  key: 0,
8606
8611
  class: "animate-fade-in"
@@ -8900,17 +8905,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8900
8905
  props: {
8901
8906
  hideUser: { type: Boolean, default: false },
8902
8907
  variant: { default: "minimal" },
8903
- redirectUrl: { default: "/" }
8908
+ redirectUrl: { default: "/" },
8909
+ user: { default: void 0 },
8910
+ menuAlign: { default: "right" },
8911
+ menuVerticalAlign: { default: "bottom" }
8904
8912
  },
8905
8913
  emits: ["profile-updated", "signed-out", "signed-in"],
8906
8914
  setup(__props, { emit: __emit }) {
8915
+ const props = __props;
8907
8916
  const emit = __emit;
8908
- const { currentUser: user, signOut } = useStrandsAuth();
8917
+ const { currentUser, signOut } = useStrandsAuth();
8909
8918
  const showDropdown = ref(false);
8910
8919
  const showProfileModal = ref(false);
8911
8920
  const showSignInModal = ref(false);
8912
8921
  const containerRef = ref();
8913
8922
  const profileButtonRef = ref();
8923
+ const user = computed(() => props.user || currentUser.value);
8914
8924
  const displayName = computed(() => {
8915
8925
  if (!user.value) return "User";
8916
8926
  if (user.value.username) {
@@ -9002,7 +9012,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9002
9012
  ref_key: "containerRef",
9003
9013
  ref: containerRef
9004
9014
  }, [
9005
- createVNode(unref(SignedIn), null, {
9015
+ createVNode(unref(SignedIn), {
9016
+ invert: !!props.user
9017
+ }, {
9006
9018
  fallback: withCtx(() => [
9007
9019
  createElementVNode("button", {
9008
9020
  onClick: openSignIn,
@@ -9084,10 +9096,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9084
9096
  ])) : createCommentVNode("", true),
9085
9097
  createElementVNode("div", _hoisted_5, [
9086
9098
  createElementVNode("div", _hoisted_6, [
9087
- unref(user)?.avatar ? (openBlock(), createElementBlock("img", {
9099
+ user.value?.avatar ? (openBlock(), createElementBlock("img", {
9088
9100
  key: 0,
9089
- src: unref(user).avatar,
9090
- alt: `${unref(user).firstName || unref(user).email}'s avatar`,
9101
+ src: user.value.avatar,
9102
+ alt: `${user.value.firstName || user.value.email}'s avatar`,
9091
9103
  class: "avatar-image"
9092
9104
  }, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("div", _hoisted_8, _cache[0] || (_cache[0] = [
9093
9105
  createElementVNode("svg", {
@@ -9122,7 +9134,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9122
9134
  default: withCtx(() => [
9123
9135
  showDropdown.value ? (openBlock(), createElementBlock("div", {
9124
9136
  key: 0,
9125
- class: "dropdown-menu",
9137
+ class: normalizeClass([
9138
+ "dropdown-menu",
9139
+ `dropdown-menu-align-${props.menuAlign}`,
9140
+ `dropdown-menu-vertical-${props.menuVerticalAlign}`
9141
+ ]),
9126
9142
  role: "menu",
9127
9143
  "aria-orientation": "vertical",
9128
9144
  onKeydown: [
@@ -9135,20 +9151,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9135
9151
  }, [
9136
9152
  createElementVNode("div", _hoisted_10, [
9137
9153
  createElementVNode("div", _hoisted_11, [
9138
- unref(user) ? (openBlock(), createElementBlock("div", _hoisted_12, [
9154
+ user.value ? (openBlock(), createElementBlock("div", _hoisted_12, [
9139
9155
  createVNode(unref(StrandsUiLevelProgress), {
9140
9156
  size: 80,
9141
- value: unref(user).xp,
9142
- max: unref(user).next_level_xp,
9143
- level: unref(user).level,
9144
- "level-label": `LEVEL ${unref(user).level}`,
9145
- "user-settings": unref(user).settings,
9157
+ value: user.value.xp,
9158
+ max: user.value.next_level_xp,
9159
+ level: user.value.level,
9160
+ "level-label": `LEVEL ${user.value.level}`,
9161
+ "user-settings": user.value.settings,
9146
9162
  class: "level-progress-overlay"
9147
9163
  }, null, 8, ["value", "max", "level", "level-label", "user-settings"]),
9148
- unref(user)?.avatar ? (openBlock(), createElementBlock("img", {
9164
+ user.value?.avatar ? (openBlock(), createElementBlock("img", {
9149
9165
  key: 0,
9150
- src: unref(user).avatar,
9151
- alt: `${unref(user).firstName || unref(user).email}'s avatar`,
9166
+ src: user.value.avatar,
9167
+ alt: `${user.value.firstName || user.value.email}'s avatar`,
9152
9168
  class: "dropdown-avatar-image"
9153
9169
  }, null, 8, _hoisted_13)) : (openBlock(), createElementBlock("div", _hoisted_14, _cache[2] || (_cache[2] = [
9154
9170
  createElementVNode("svg", {
@@ -9166,7 +9182,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9166
9182
  ])) : createCommentVNode("", true),
9167
9183
  createElementVNode("div", _hoisted_15, [
9168
9184
  createElementVNode("div", _hoisted_16, toDisplayString(displayName.value), 1),
9169
- createElementVNode("div", _hoisted_17, toDisplayString(unref(user)?.email), 1)
9185
+ createElementVNode("div", _hoisted_17, toDisplayString(user.value?.email), 1)
9170
9186
  ])
9171
9187
  ]),
9172
9188
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "dropdown-divider" }, null, -1)),
@@ -9217,7 +9233,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9217
9233
  ]))
9218
9234
  ])
9219
9235
  ])
9220
- ], 40, _hoisted_9)) : createCommentVNode("", true)
9236
+ ], 42, _hoisted_9)) : createCommentVNode("", true)
9221
9237
  ]),
9222
9238
  _: 1
9223
9239
  })
@@ -9253,21 +9269,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9253
9269
  ]),
9254
9270
  default: withCtx(() => [
9255
9271
  createVNode(unref(StrandsUserProfile), {
9272
+ user: user.value,
9256
9273
  onProfileUpdated: handleProfileUpdated,
9257
9274
  onError: handleProfileError,
9258
9275
  "in-modal": ""
9259
- })
9276
+ }, null, 8, ["user"])
9260
9277
  ]),
9261
9278
  _: 1
9262
9279
  }, 8, ["open"])
9263
9280
  ]),
9264
9281
  _: 1
9265
- })
9282
+ }, 8, ["invert"])
9266
9283
  ], 512);
9267
9284
  };
9268
9285
  }
9269
9286
  });
9270
- const StrandsUserButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5acc4f6e"]]);
9287
+ const StrandsUserButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9e187d2c"]]);
9271
9288
  const components = {
9272
9289
  StrandsUiAlert,
9273
9290
  StrandsUiButton,