origam 2.21.0 → 2.23.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/src/assets/css/main.css +1 -1
  3. package/dist/src/assets/css/tokens/dark.css +8 -0
  4. package/dist/src/assets/css/tokens/light.css +3 -0
  5. package/dist/src/assets/scss/tokens/_dark.scss +8 -0
  6. package/dist/src/assets/scss/tokens/_light.scss +3 -0
  7. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +8 -2
  8. package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +1 -1
  9. package/dist/src/components/Dialog/OrigamDialog.vue +1 -1
  10. package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +1 -1
  11. package/dist/src/components/Drawer/OrigamDrawer.vue +12 -2
  12. package/dist/src/components/Menu/OrigamMenu.vue +1 -1
  13. package/dist/src/components/Overlay/OrigamOverlay.vue +2 -2
  14. package/dist/src/components/Snackbar/OrigamSnackbar.vue +1 -1
  15. package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +8 -2
  16. package/dist/src/components/Tooltip/OrigamTooltip.vue +1 -1
  17. package/dist/src/composables/Code/code.composable.cjs +7 -5
  18. package/dist/src/composables/Code/code.composable.d.ts +7 -0
  19. package/dist/src/composables/Code/code.composable.js +8 -6
  20. package/dist/src/composables/Commons/hydration.composable.cjs +8 -3
  21. package/dist/src/composables/Commons/hydration.composable.d.ts +13 -5
  22. package/dist/src/composables/Commons/hydration.composable.js +6 -1
  23. package/dist/src/composables/Commons/teleport.composable.cjs +3 -0
  24. package/dist/src/composables/Commons/teleport.composable.d.ts +56 -0
  25. package/dist/src/composables/Commons/teleport.composable.js +3 -0
  26. package/dist/src/composables/Commons/variant.composable.d.ts +11 -3
  27. package/dist/src/consts/Code/code.const.cjs +3 -2
  28. package/dist/src/consts/Code/code.const.d.ts +14 -0
  29. package/dist/src/consts/Code/code.const.js +1 -0
  30. package/dist/src/interfaces/Btn/btn-group.interface.d.ts +2 -2
  31. package/dist/src/interfaces/Btn/btn.interface.d.ts +2 -2
  32. package/dist/src/interfaces/Code/code.interface.d.ts +33 -1
  33. package/dist/src/interfaces/CommandPalette/command-palette.interface.d.ts +2 -1
  34. package/dist/src/interfaces/Commons/attach.interface.cjs +1 -0
  35. package/dist/src/interfaces/Commons/attach.interface.d.ts +30 -0
  36. package/dist/src/interfaces/Commons/attach.interface.js +0 -0
  37. package/dist/src/interfaces/Commons/commons.interface.d.ts +2 -0
  38. package/dist/src/interfaces/Commons/variant.interface.d.ts +30 -8
  39. package/dist/src/interfaces/ConfirmWrapper/confirm-wrapper.interface.d.ts +7 -2
  40. package/dist/src/interfaces/Drawer/drawer.interface.d.ts +24 -1
  41. package/dist/src/interfaces/Field/field.interface.d.ts +2 -2
  42. package/dist/src/interfaces/NumberField/number-field.interface.d.ts +2 -2
  43. package/dist/src/interfaces/OtpInputField/otp-input-field.interface.d.ts +2 -2
  44. package/dist/src/interfaces/Overlay/overlay.interface.d.ts +2 -2
  45. package/dist/src/interfaces/Snackbar/snackbar-group.interface.d.ts +2 -1
  46. package/dist/src/interfaces/index.cjs +11 -0
  47. package/dist/src/interfaces/index.d.ts +1 -0
  48. package/dist/src/interfaces/index.js +1 -0
  49. package/dist/src/origam.cjs +1 -0
  50. package/dist/src/origam.js +2 -0
  51. package/dist/src/themes/origam.theme.cjs +10 -1
  52. package/dist/src/themes/origam.theme.js +10 -1
  53. package/dist/src/types/Code/code.type.d.ts +29 -0
  54. package/dist/src/types/tokens.type.d.ts +1 -1
  55. package/package.json +1 -1
@@ -182,6 +182,11 @@
182
182
  --origam-color__surface---inverse: var(--origam-color__neutral---0);
183
183
  --origam-color__text---primary: var(--origam-color__neutral---50);
184
184
  --origam-color__text---secondary: var(--origam-color__neutral---400);
185
+ /* #1044 — `neutral---500` échoue AA ici (4.18:1 sur #0a0a0a, sous 4.5:1) ;
186
+ aucun rung n'existe entre 400 et 500 (300/400/500 = d4d4d4/a3a3a3/737373).
187
+ `tertiary` s'aplatit donc sur la même valeur que `secondary` en sombre —
188
+ assumé, pas un oubli : préféré à une violation AA. */
189
+ --origam-color__text---tertiary: var(--origam-color__neutral---400);
185
190
  --origam-color__text---disabled: var(--origam-color__neutral---600);
186
191
  --origam-color__text---inverse: var(--origam-color__neutral---950); /* #615 — voir light.css : le bloc runtime de `origamDarkTheme` pose #0a0a0a */
187
192
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -3192,6 +3197,9 @@
3192
3197
  --origam-color__surface---inverse: var(--origam-color__neutral---0);
3193
3198
  --origam-color__text---primary: var(--origam-color__neutral---50);
3194
3199
  --origam-color__text---secondary: var(--origam-color__neutral---400);
3200
+ /* #1044 — meme aplatissement que le bloc explicite ci-dessus : voir sa
3201
+ note, cette feuille doit rester le miroir exact de ce bloc. */
3202
+ --origam-color__text---tertiary: var(--origam-color__neutral---400);
3195
3203
  --origam-color__text---disabled: var(--origam-color__neutral---600);
3196
3204
  --origam-color__text---inverse: var(--origam-color__neutral---950); /* #615 — voir light.css : le bloc runtime de `origamDarkTheme` pose #0a0a0a */
3197
3205
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -84,6 +84,9 @@
84
84
  `origam.theme.ts` qu'il faut changer AVEC, sinon la divergence revient. */
85
85
  --origam-color__text---primary: var(--origam-color__neutral---950);
86
86
  --origam-color__text---secondary: var(--origam-color__neutral---600);
87
+ /* #1044 — un niveau sous `secondary`, mesuré 4.74:1 sur `surface---default`
88
+ (#ffffff), AA. Voir dark.css pour la contrainte qui a fixé ce rung. */
89
+ --origam-color__text---tertiary: var(--origam-color__neutral---500);
87
90
  --origam-color__text---disabled: var(--origam-color__neutral---400);
88
91
  --origam-color__text---inverse: var(--origam-color__neutral---0);
89
92
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -182,6 +182,11 @@
182
182
  --origam-color__surface---inverse: var(--origam-color__neutral---0);
183
183
  --origam-color__text---primary: var(--origam-color__neutral---50);
184
184
  --origam-color__text---secondary: var(--origam-color__neutral---400);
185
+ /* #1044 — `neutral---500` échoue AA ici (4.18:1 sur #0a0a0a, sous 4.5:1) ;
186
+ aucun rung n'existe entre 400 et 500 (300/400/500 = d4d4d4/a3a3a3/737373).
187
+ `tertiary` s'aplatit donc sur la même valeur que `secondary` en sombre —
188
+ assumé, pas un oubli : préféré à une violation AA. */
189
+ --origam-color__text---tertiary: var(--origam-color__neutral---400);
185
190
  --origam-color__text---disabled: var(--origam-color__neutral---600);
186
191
  --origam-color__text---inverse: var(--origam-color__neutral---950); /* #615 — voir light.css : le bloc runtime de `origamDarkTheme` pose #0a0a0a */
187
192
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -3192,6 +3197,9 @@
3192
3197
  --origam-color__surface---inverse: var(--origam-color__neutral---0);
3193
3198
  --origam-color__text---primary: var(--origam-color__neutral---50);
3194
3199
  --origam-color__text---secondary: var(--origam-color__neutral---400);
3200
+ /* #1044 — meme aplatissement que le bloc explicite ci-dessus : voir sa
3201
+ note, cette feuille doit rester le miroir exact de ce bloc. */
3202
+ --origam-color__text---tertiary: var(--origam-color__neutral---400);
3195
3203
  --origam-color__text---disabled: var(--origam-color__neutral---600);
3196
3204
  --origam-color__text---inverse: var(--origam-color__neutral---950); /* #615 — voir light.css : le bloc runtime de `origamDarkTheme` pose #0a0a0a */
3197
3205
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -84,6 +84,9 @@
84
84
  `origam.theme.ts` qu'il faut changer AVEC, sinon la divergence revient. */
85
85
  --origam-color__text---primary: var(--origam-color__neutral---950);
86
86
  --origam-color__text---secondary: var(--origam-color__neutral---600);
87
+ /* #1044 — un niveau sous `secondary`, mesuré 4.74:1 sur `surface---default`
88
+ (#ffffff), AA. Voir dark.css pour la contrainte qui a fixé ce rung. */
89
+ --origam-color__text---tertiary: var(--origam-color__neutral---500);
87
90
  --origam-color__text---disabled: var(--origam-color__neutral---400);
88
91
  --origam-color__text---inverse: var(--origam-color__neutral---0);
89
92
  --origam-color__text---onColor: var(--origam-color__neutral---0);
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <teleport to="body">
2
+ <teleport
3
+ :disabled="!teleportTarget"
4
+ :to="teleportTarget"
5
+ >
3
6
  <transition name="origam-command-palette--fade">
4
7
  <div
5
8
  v-if="isActive"
@@ -172,6 +175,7 @@ import OrigamKbd from "../Kbd/OrigamKbd.vue";
172
175
  import { useCommand } from "../../composables/CommandPalette/command.composable";
173
176
  import { useHotkey } from "../../composables/Commons/hotkey.composable";
174
177
  import { useLocale } from "../../composables/Commons/locale.composable";
178
+ import { useTeleport } from "../../composables/Commons/teleport.composable";
175
179
  import { useTypography } from "../../composables/Commons/typography.composable";
176
180
  import { useVModel } from "../../composables/Commons/vModel.composable";
177
181
  import { COMMAND_PALETTE_DEFAULT_HOTKEY, COMMAND_PALETTE_DEFAULT_MAX_HEIGHT, COMMAND_PALETTE_DEFAULT_WIDTH } from "../../consts/CommandPalette/command-palette.const";
@@ -195,7 +199,8 @@ const props = defineProps({
195
199
  id: { type: String, required: false },
196
200
  class: { type: [String, Array, Object], required: false },
197
201
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
198
- fontSize: { type: null, required: false }
202
+ fontSize: { type: null, required: false },
203
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true }
199
204
  });
200
205
  const emit = defineEmits(["update:modelValue", "select", "query"]);
201
206
  defineSlots();
@@ -208,6 +213,7 @@ watch(registryOpen, (next) => {
208
213
  watch(isActive, (next) => {
209
214
  if (next !== registryOpen.value) registryOpen.value = next;
210
215
  });
216
+ const { teleportTarget } = useTeleport(computed(() => props.attach || false));
211
217
  const uid = getUid();
212
218
  const inputId = computed(() => `origam-command-palette-input-${uid}`);
213
219
  const listboxId = computed(() => `origam-command-palette-listbox-${uid}`);
@@ -39,7 +39,6 @@ const props = defineProps({
39
39
  class: { type: [String, Array, Object], required: false },
40
40
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
41
41
  absolute: { type: Boolean, required: false },
42
- attach: { type: [Boolean, String], required: false, skipCheck: true },
43
42
  closeOnBack: { type: Boolean, required: false },
44
43
  contentClass: { type: [String, Array], required: false },
45
44
  contentProps: { type: null, required: false },
@@ -75,6 +74,7 @@ const props = defineProps({
75
74
  eager: { type: Boolean, required: false },
76
75
  transition: { type: [Boolean, String, Object], required: false, default: () => ({ component: OrigamTranslateScale }) },
77
76
  scrim: { type: [Boolean, String], required: false, default: false },
77
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
78
78
  activeClass: { type: String, required: false },
79
79
  expandIcon: { type: String, required: false },
80
80
  collapseIcon: { type: String, required: false },
@@ -168,7 +168,6 @@ const props = defineProps({
168
168
  class: { type: [String, Array, Object], required: false },
169
169
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
170
170
  absolute: { type: Boolean, required: false },
171
- attach: { type: [Boolean, String], required: false, skipCheck: true },
172
171
  closeOnBack: { type: Boolean, required: false },
173
172
  contentClass: { type: [String, Array], required: false },
174
173
  contentProps: { type: null, required: false },
@@ -204,6 +203,7 @@ const props = defineProps({
204
203
  eager: { type: Boolean, required: false },
205
204
  transition: { type: [Boolean, String, Object], required: false, default: () => ({ component: OrigamTranslateScale }) },
206
205
  scrim: { type: [Boolean, String], required: false, default: true },
206
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
207
207
  flat: { type: Boolean, required: false },
208
208
  hover: { type: Boolean, required: false },
209
209
  image: { type: String, required: false },
@@ -144,7 +144,6 @@ const props = defineProps({
144
144
  class: { type: [String, Array, Object], required: false },
145
145
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
146
146
  absolute: { type: Boolean, required: false },
147
- attach: { type: [Boolean, String], required: false, skipCheck: true },
148
147
  closeOnBack: { type: Boolean, required: false },
149
148
  contentClass: { type: [String, Array], required: false },
150
149
  contentProps: { type: null, required: false },
@@ -180,6 +179,7 @@ const props = defineProps({
180
179
  eager: { type: Boolean, required: false },
181
180
  transition: { type: [Boolean, String, Object], required: false },
182
181
  scrim: { type: [Boolean, String], required: false },
182
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
183
183
  flat: { type: Boolean, required: false },
184
184
  hover: { type: Boolean, required: false },
185
185
  image: { type: String, required: false },
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <teleport
3
- :disabled="isLayoutOrphan"
4
- :to="teleportDrawer"
3
+ :disabled="teleportDisabled"
4
+ :to="teleportTo"
5
5
  defer
6
6
  >
7
7
  <origam-transition :transition="transition">
@@ -83,6 +83,7 @@ import { useStateEffect } from "../../composables/Commons/stateEffect.composable
83
83
  import { useStateFlag } from "../../composables/Commons/stateFlag.composable";
84
84
  import { useSticky } from "../../composables/Commons/sticky.composable";
85
85
  import { useStyle } from "../../composables/Commons/style.composable";
86
+ import { useTeleport } from "../../composables/Commons/teleport.composable";
86
87
  import { useToggleScope } from "../../composables/Commons/toggleScope.composable";
87
88
  import { useTouch } from "../../composables/Commons/touch.composable";
88
89
  import { useVModel } from "../../composables/Commons/vModel.composable";
@@ -104,6 +105,7 @@ const props = defineProps({
104
105
  sticky: { type: Boolean, required: false },
105
106
  push: { type: [Boolean, null], required: false, default: null },
106
107
  clipped: { type: [Boolean, null], required: false, default: null },
108
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true, default: null },
107
109
  tag: { type: String, required: false, default: "nav" },
108
110
  id: { type: String, required: false },
109
111
  class: { type: [String, Array, Object], required: false },
@@ -276,6 +278,14 @@ const teleportDrawer = computed(() => {
276
278
  if (isLayoutOrphan.value) return void 0;
277
279
  return `#${resolvedLayoutId.value} .origam-layout__wrapper`;
278
280
  });
281
+ const hasExplicitAttach = computed(() => props.attach !== null);
282
+ const { teleportTarget: attachTarget } = useTeleport(computed(() => props.attach || false));
283
+ const teleportDisabled = computed(() => {
284
+ return hasExplicitAttach.value ? !attachTarget.value : isLayoutOrphan.value;
285
+ });
286
+ const teleportTo = computed(() => {
287
+ return hasExplicitAttach.value ? attachTarget.value : teleportDrawer.value;
288
+ });
279
289
  const { isStuck, stickyStyles } = useSticky({ rootEl, isSticky, layoutItemStyles });
280
290
  const scrimStyles = computed(() => ({
281
291
  ...isDragging.value ? {
@@ -101,7 +101,6 @@ import { getUid } from "../../utils/Commons/getCurrentInstance.util";
101
101
  const props = defineProps({
102
102
  id: { type: String, required: false },
103
103
  absolute: { type: Boolean, required: false },
104
- attach: { type: [Boolean, String], required: false, skipCheck: true },
105
104
  closeOnBack: { type: Boolean, required: false },
106
105
  contentClass: { type: [String, Array], required: false },
107
106
  contentProps: { type: null, required: false },
@@ -139,6 +138,7 @@ const props = defineProps({
139
138
  eager: { type: Boolean, required: false },
140
139
  transition: { type: [Boolean, String, Object], required: false, default: () => ({ component: OrigamTranslateScale }) },
141
140
  scrim: { type: [Boolean, String], required: false, default: false },
141
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
142
142
  activeClass: { type: String, required: false },
143
143
  expandIcon: { type: String, required: false },
144
144
  collapseIcon: { type: String, required: false },
@@ -83,7 +83,6 @@ import { getScrollParent } from "../../utils/Commons/scroll.util";
83
83
  defineOptions({ inheritAttrs: false });
84
84
  const props = defineProps({
85
85
  absolute: { type: Boolean, required: false },
86
- attach: { type: [Boolean, String], required: false, skipCheck: true },
87
86
  closeOnBack: { type: Boolean, required: false, default: true },
88
87
  contentClass: { type: [String, Array], required: false },
89
88
  contentProps: { type: null, required: false },
@@ -121,7 +120,8 @@ const props = defineProps({
121
120
  contained: { type: Boolean, required: false },
122
121
  eager: { type: Boolean, required: false },
123
122
  transition: { type: [Boolean, String, Object], required: false, default: () => ({ component: OrigamFade }) },
124
- scrim: { type: [Boolean, String], required: false, default: true }
123
+ scrim: { type: [Boolean, String], required: false, default: true },
124
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true }
125
125
  });
126
126
  const emits = defineEmits(["afterEnter", "afterLeave", "keydown", "update:modelValue", "click:outside"]);
127
127
  defineSlots();
@@ -120,7 +120,6 @@ const props = defineProps({
120
120
  color: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
121
121
  bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
122
122
  absolute: { type: Boolean, required: false },
123
- attach: { type: [Boolean, String], required: false, skipCheck: true },
124
123
  closeOnBack: { type: Boolean, required: false },
125
124
  contentClass: { type: [String, Array], required: false },
126
125
  contentProps: { type: null, required: false },
@@ -158,6 +157,7 @@ const props = defineProps({
158
157
  component: OrigamSnack
159
158
  }) },
160
159
  scrim: { type: [Boolean, String], required: false },
160
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
161
161
  position: { type: null, required: false },
162
162
  top: { type: [Number, String], required: false },
163
163
  bottom: { type: [Number, String], required: false },
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <teleport to="body">
2
+ <teleport
3
+ :disabled="!teleportTarget"
4
+ :to="teleportTarget"
5
+ >
3
6
  <component
4
7
  :is="tag"
5
8
  :id="resolvedDomId"
@@ -41,6 +44,7 @@ import OrigamSnackbarItem from "./OrigamSnackbarItem.vue";
41
44
  import { useLocale } from "../../composables/Commons/locale.composable";
42
45
  import { useProps } from "../../composables/Commons/props.composable";
43
46
  import { useStyle } from "../../composables/Commons/style.composable";
47
+ import { useTeleport } from "../../composables/Commons/teleport.composable";
44
48
  import { useSnackbarGroupInternal } from "../../composables/Snackbar/snackbarGroupInternal.composable";
45
49
  import { INTENT } from "../../enums/Commons/intent.enum";
46
50
  import { SNACKBAR_GROUP_DIRECTION } from "../../enums/Snackbar/snackbar-group.enum";
@@ -55,13 +59,15 @@ const props = defineProps({
55
59
  direction: { type: null, required: false },
56
60
  class: { type: [String, Array, Object], required: false },
57
61
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
58
- tag: { type: String, required: false, default: "div" }
62
+ tag: { type: String, required: false, default: "div" },
63
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true }
59
64
  });
60
65
  defineEmits([]);
61
66
  defineSlots();
62
67
  const { t } = useLocale();
63
68
  const { filterProps } = useProps(props);
64
69
  const rootRef = ref();
70
+ const { teleportTarget } = useTeleport(computed(() => props.attach || false));
65
71
  const { rawItems, registerDefaultDuration } = useSnackbarGroupInternal(() => props.id);
66
72
  watch(() => props.defaultDuration, (duration) => {
67
73
  registerDefaultDuration(duration);
@@ -59,7 +59,6 @@ const props = defineProps({
59
59
  class: { type: [String, Array, Object], required: false },
60
60
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
61
61
  absolute: { type: Boolean, required: false },
62
- attach: { type: [Boolean, String], required: false, skipCheck: true },
63
62
  closeOnBack: { type: Boolean, required: false, default: false },
64
63
  contentClass: { type: [String, Array], required: false },
65
64
  contentProps: { type: null, required: false },
@@ -95,6 +94,7 @@ const props = defineProps({
95
94
  eager: { type: Boolean, required: false, default: true },
96
95
  transition: { type: [Boolean, String, Object], required: false, default: false },
97
96
  scrim: { type: [Boolean, String], required: false, default: false },
97
+ attach: { type: [Boolean, String, null], required: false, skipCheck: true },
98
98
  color: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
99
99
  bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
100
100
  fontSize: { type: null, required: false },
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.resetCodeHighlighterForTesting = resetCodeHighlighterForTesting;
7
7
  exports.useCode = useCode;
8
+ var _vue = require("vue");
8
9
  var _code = require("../../consts/Code/code.const.cjs");
9
10
  var _enums = require("../../enums/index.cjs");
10
11
  let _highlighterPromise = null;
@@ -33,11 +34,11 @@ function lruSet(key, value) {
33
34
  }
34
35
  _cache.set(key, value);
35
36
  }
36
- async function loadHighlighter() {
37
+ async function loadHighlighter(loader) {
37
38
  if (_highlighterUnavailable) return null;
38
39
  if (_highlighterPromise) return _highlighterPromise;
39
40
  _highlighterPromise = (async () => {
40
- const shiki = await Promise.resolve().then(() => require("shiki"));
41
+ const shiki = loader ? await loader() : await Promise.resolve().then(() => require("shiki"));
41
42
  const highlighter = await shiki.createHighlighter({
42
43
  themes: [_code.CODE_LIGHT_THEME, _code.CODE_DARK_THEME],
43
44
  langs: [..._code.SUPPORTED_LANGS]
@@ -50,7 +51,7 @@ async function loadHighlighter() {
50
51
  _highlighterPromise = null;
51
52
  if (!_unavailableWarned) {
52
53
  _unavailableWarned = true;
53
- console.warn("[origam] OrigamCode: `shiki` is not installed \u2014 rendering plain, unhighlighted code. Add `shiki` to your dependencies to enable syntax highlighting.", err);
54
+ console.warn(loader ? "[origam] OrigamCode: the `highlighter` supplied to `createOrigam({ code })` failed to load \u2014 rendering plain, unhighlighted code." : "[origam] OrigamCode: `shiki` is not installed \u2014 rendering plain, unhighlighted code. Add `shiki` to your dependencies to enable syntax highlighting.", err);
54
55
  }
55
56
  return null;
56
57
  });
@@ -64,12 +65,13 @@ function resolveLang(lang) {
64
65
  return _enums.CODE_LANG.PLAINTEXT;
65
66
  }
66
67
  function useCode() {
68
+ const highlighterLoader = (0, _vue.inject)(_code.ORIGAM_CODE_KEY)?.highlighter;
67
69
  async function highlight(code, lang) {
68
70
  const resolvedLang = resolveLang(lang);
69
71
  const key = makeCacheKey(code, resolvedLang);
70
72
  const cached = lruGet(key);
71
73
  if (cached !== void 0) return cached;
72
- const highlighter = await loadHighlighter();
74
+ const highlighter = await loadHighlighter(highlighterLoader);
73
75
  if (!highlighter) {
74
76
  const plain = escapeHtml(code);
75
77
  lruSet(key, plain);
@@ -97,7 +99,7 @@ function useCode() {
97
99
  return html;
98
100
  }
99
101
  async function prime() {
100
- await loadHighlighter();
102
+ await loadHighlighter(highlighterLoader);
101
103
  }
102
104
  function isReady() {
103
105
  return _highlighterReady;
@@ -1,6 +1,13 @@
1
1
  import type { IUseCodeReturn } from '../../interfaces/Code/code.interface';
2
2
  /**
3
3
  * Public hook — see `IUseCodeReturn` for the surface contract.
4
+ *
5
+ * `inject(ORIGAM_CODE_KEY)` below is called synchronously here, which is
6
+ * only valid while THIS function runs during a component's `setup()`
7
+ * (exactly how `OrigamCode.vue` calls it). `undefined` when no
8
+ * `createOrigam({ code })` ancestor provided one (or none was installed at
9
+ * all): `loadHighlighter()` then keeps its original `import('shiki')`
10
+ * behaviour, unchanged.
4
11
  */
5
12
  export declare function useCode(): IUseCodeReturn;
6
13
  /**
@@ -1,4 +1,5 @@
1
- import { CODE_CACHE_MAX_ENTRIES, CODE_DARK_THEME as DARK_THEME, CODE_LIGHT_THEME as LIGHT_THEME, SUPPORTED_LANGS } from "../../consts/Code/code.const.js";
1
+ import { inject } from "vue";
2
+ import { CODE_CACHE_MAX_ENTRIES, CODE_DARK_THEME as DARK_THEME, CODE_LIGHT_THEME as LIGHT_THEME, ORIGAM_CODE_KEY, SUPPORTED_LANGS } from "../../consts/Code/code.const.js";
2
3
  import { CODE_LANG } from "../../enums/index.js";
3
4
  let _highlighterPromise = null;
4
5
  let _highlighterReady = false;
@@ -26,11 +27,11 @@ function lruSet(key, value) {
26
27
  }
27
28
  _cache.set(key, value);
28
29
  }
29
- async function loadHighlighter() {
30
+ async function loadHighlighter(loader) {
30
31
  if (_highlighterUnavailable) return null;
31
32
  if (_highlighterPromise) return _highlighterPromise;
32
33
  _highlighterPromise = (async () => {
33
- const shiki = await import(
34
+ const shiki = loader ? await loader() : await import(
34
35
  /* @vite-ignore */
35
36
  "shiki"
36
37
  );
@@ -47,7 +48,7 @@ async function loadHighlighter() {
47
48
  if (!_unavailableWarned) {
48
49
  _unavailableWarned = true;
49
50
  console.warn(
50
- "[origam] OrigamCode: `shiki` is not installed \u2014 rendering plain, unhighlighted code. Add `shiki` to your dependencies to enable syntax highlighting.",
51
+ loader ? "[origam] OrigamCode: the `highlighter` supplied to `createOrigam({ code })` failed to load \u2014 rendering plain, unhighlighted code." : "[origam] OrigamCode: `shiki` is not installed \u2014 rendering plain, unhighlighted code. Add `shiki` to your dependencies to enable syntax highlighting.",
51
52
  err
52
53
  );
53
54
  }
@@ -65,12 +66,13 @@ function resolveLang(lang) {
65
66
  return CODE_LANG.PLAINTEXT;
66
67
  }
67
68
  export function useCode() {
69
+ const highlighterLoader = inject(ORIGAM_CODE_KEY)?.highlighter;
68
70
  async function highlight(code, lang) {
69
71
  const resolvedLang = resolveLang(lang);
70
72
  const key = makeCacheKey(code, resolvedLang);
71
73
  const cached = lruGet(key);
72
74
  if (cached !== void 0) return cached;
73
- const highlighter = await loadHighlighter();
75
+ const highlighter = await loadHighlighter(highlighterLoader);
74
76
  if (!highlighter) {
75
77
  const plain = escapeHtml(code);
76
78
  lruSet(key, plain);
@@ -92,7 +94,7 @@ export function useCode() {
92
94
  return html;
93
95
  }
94
96
  async function prime() {
95
- await loadHighlighter();
97
+ await loadHighlighter(highlighterLoader);
96
98
  }
97
99
  function isReady() {
98
100
  return _highlighterReady;
@@ -9,9 +9,14 @@ var _display = require("./display.composable.cjs");
9
9
  var _commons = require("../../consts/Commons/commons.const.cjs");
10
10
  function useHydration() {
11
11
  if (!_commons.IN_BROWSER) return (0, _vue.shallowRef)(false);
12
- const {
13
- ssr
14
- } = (0, _display.useDisplay)();
12
+ let ssr;
13
+ try {
14
+ ({
15
+ ssr
16
+ } = (0, _display.useDisplay)());
17
+ } catch {
18
+ return (0, _vue.shallowRef)(true);
19
+ }
15
20
  if (ssr) {
16
21
  const isMounted = (0, _vue.shallowRef)(false);
17
22
  (0, _vue.onMounted)(() => {
@@ -13,11 +13,19 @@
13
13
  * navigateur (`!IN_BROWSER`), retourne un Ref fige a `false`.
14
14
  *
15
15
  * @description
16
- * ⛔ Dans un navigateur, ce composable DEPEND de `createOrigam()` : il
16
+ * ⚠️ Dans un navigateur, ce composable PREFERE `createOrigam()` : il
17
17
  * appelle `useDisplay()`, dont l'injection n'existe que si le plugin est
18
- * installe. Mesure, montage d'un composant sans `createOrigam()` :
19
- * `useHydration()` LEVE `Could not find Origam display injection`. Ce
20
- * n'est donc pas un utilitaire autonome, contrairement a `useSsrBoot` qui
21
- * n'injecte rien.
18
+ * installe, pour savoir si l'app tourne en SSR. **#attach-harmonisation** —
19
+ * jusque-la, l'absence du plugin faisait LEVER `useDisplay()` (« Could not
20
+ * find Origam display injection »), ce qui a casse 4 e2e marketing (SSR
21
+ * Nuxt) : `useTeleport()`, qui appelle desormais ce composable pour eviter
22
+ * une course de montage (voir teleport.composable.ts), doit rester
23
+ * utilisable comme primitive BRUTE — sans `createOrigam()` — exactement
24
+ * comme il l'etait avant. Le `try/catch` ci-dessous rattrape UNIQUEMENT ce
25
+ * cas (plugin absent) et retombe sur le chemin non-SSR (`shallowRef(true)`,
26
+ * aucun delai) : un consommateur qui a reellement besoin du signal SSR et
27
+ * installe le plugin obtient exactement le comportement documente plus
28
+ * haut, inchange. Aucun test n'epinglait le lever — `grep -rn "Could not
29
+ * find Origam display injection" packages/tests` ne retourne rien.
22
30
  ********************************************************/
23
31
  export declare function useHydration(): import("vue").ShallowRef<boolean, boolean>;
@@ -3,7 +3,12 @@ import { useDisplay } from "./display.composable.js";
3
3
  import { IN_BROWSER } from "../../consts/Commons/commons.const.js";
4
4
  export function useHydration() {
5
5
  if (!IN_BROWSER) return shallowRef(false);
6
- const { ssr } = useDisplay();
6
+ let ssr;
7
+ try {
8
+ ({ ssr } = useDisplay());
9
+ } catch {
10
+ return shallowRef(true);
11
+ }
7
12
  if (ssr) {
8
13
  const isMounted = shallowRef(false);
9
14
  onMounted(() => {
@@ -7,10 +7,13 @@ exports.useTeleport = useTeleport;
7
7
  var _commons = require("../../consts/Commons/commons.const.cjs");
8
8
  var _console = require("../../utils/Commons/console.util.cjs");
9
9
  var _vue = require("vue");
10
+ var _hydration = require("./hydration.composable.cjs");
10
11
  function useTeleport(target) {
12
+ const isHydrated = (0, _hydration.useHydration)();
11
13
  const teleportTarget = (0, _vue.computed)(() => {
12
14
  const _target = target.value;
13
15
  if (_target === true || !_commons.IN_BROWSER) return void 0;
16
+ if (!isHydrated.value) return void 0;
14
17
  const targetElement = _target === false ? document.body : typeof _target === "string" ? document.querySelector(_target) : _target;
15
18
  if (targetElement == null) {
16
19
  (0, _console.consoleWarn)(`Unable to locate target ${_target}`);
@@ -15,6 +15,62 @@ import { Ref } from 'vue';
15
15
  * `teleportTarget` reste `undefined` — le composant appelant retombe
16
16
  * alors sur son rendu non-teleporte plutot que de crasher. En SSR
17
17
  * (`!IN_BROWSER`), toujours `undefined`, sans avertissement.
18
+ *
19
+ * @description
20
+ * ⛔ `useHydration()` — #attach-harmonisation. Un selecteur `string` ciblant
21
+ * un NOEUD FRERE cree dans la MEME passe de rendu (ex: un conteneur local
22
+ * que le consommateur monte lui-meme juste avant le composant qui teleporte)
23
+ * peut ne pas encore etre connecte a `document` au moment ou ce `computed`
24
+ * s'evalue pour la PREMIERE fois — mesure concrete sous Histoire (dont
25
+ * `OrigamApp`/`OrigamLayout` englobent chaque story dans un `<Suspense>` :
26
+ * l'arbre entier, y compris les freres, n'est commit dans le vrai DOM
27
+ * qu'une fois la resolution async terminee). `document.querySelector` n'est
28
+ * PAS une dependance reactive : si le premier appel echoue, le `computed`
29
+ * reste bloque sur `undefined` pour toujours, meme apres que la cible soit
30
+ * reellement montee — rien ne le marque sale.
31
+ *
32
+ * @description
33
+ * ⛔ UN COMPTEUR LOCAL (`mountTick`, essaye d'abord) CASSE LE SSR MARKETING.
34
+ * Mesure, CI (#1043) : 4 e2e marketing (Nuxt, SSR) en echec sur « sans
35
+ * erreur JS console » / « pas d'erreur d'hydratation ». Cause reelle,
36
+ * independante de `mountTick` : la toute PREMIERE evaluation du computed
37
+ * divergeait DEJA entre serveur et client. Cote serveur, `!IN_BROWSER` est
38
+ * toujours vrai (pas de `window` en SSR) -> `undefined` (teleport
39
+ * desactive, rendu en place). Cote client, `IN_BROWSER` est vrai DES LE
40
+ * DEPART, y compris pendant la passe d'HYDRATATION (avant tout
41
+ * `onMounted`) -> la cible (souvent `document.body`, qui existe toujours)
42
+ * se resout avec SUCCES sur ce tout premier rendu -> teleport deja ACTIF.
43
+ * Vue compare les deux rendus pendant l'hydratation : desactive vs actif,
44
+ * d'ou le decalage. `mountTick` n'ajoutait qu'une DEUXIEME evaluation
45
+ * post-montage — elle n'a jamais ete la cause du decalage, qui existait
46
+ * deja sur la premiere.
47
+ *
48
+ * @description
49
+ * Le fix : `isHydrated.value` (vrai gate, pas une simple lecture de
50
+ * dependance) force EXACTEMENT le meme `undefined` cote client QUE cote
51
+ * serveur tant que l'hydratation n'est pas terminee — `useHydration()`
52
+ * (deja utilise par `OrigamOverlay.vue`) seede `isHydrated` a `false` sur
53
+ * les DEUX rendus compares (serveur ET premiere passe client) quand l'app
54
+ * est reellement en SSR (`ssr` vrai), et ne bascule a `true` que dans un
55
+ * `onMounted` — donc APRES que l'hydratation ait deja conclu. Reutilise,
56
+ * ne redeclare pas.
57
+ *
58
+ * @description
59
+ * ⚠️ Dans une app 100% client (pas de SSR — Histoire, Tauri…),
60
+ * `useHydration()` renvoie `isHydrated=true` DES LE DEPART (son
61
+ * optimisation deliberee : « pas de delai artificiel » — voir son propre
62
+ * commentaire de tete) : le gate ci-dessous ne retarde donc RIEN la ou il
63
+ * n'y a aucune hydratation a proteger. Consequence mesuree : une cible
64
+ * FRERE montee dans la MEME passe de rendu que le consommateur (ex: un
65
+ * conteneur local qu'une story Histoire monte juste avant le composant
66
+ * teleportant, sous un `<Suspense>` qui ne commit l'arbre qu'une fois
67
+ * resolu) peut encore echouer sur cette toute premiere resolution, pour la
68
+ * meme raison qu'avant : `document.querySelector` n'est pas reactif. Ce
69
+ * n'est PAS le defaut que ce correctif vise — c'est un defaut DIFFERENT,
70
+ * propre a la construction du test (une cible fraiche ne preexiste jamais
71
+ * en usage reel), traite cote story plutot qu'en reintroduisant un
72
+ * compteur local ici (voir les stories CommandPalette / SnackbarGroup /
73
+ * Drawer, variante « Prop - attach »).
18
74
  ********************************************************/
19
75
  export declare function useTeleport(target: Ref<boolean | string | Element>): {
20
76
  teleportTarget: import("vue").ComputedRef<Element | undefined>;
@@ -1,10 +1,13 @@
1
1
  import { IN_BROWSER } from "../../consts/Commons/commons.const.js";
2
2
  import { consoleWarn } from "../../utils/Commons/console.util.js";
3
3
  import { computed } from "vue";
4
+ import { useHydration } from "./hydration.composable.js";
4
5
  export function useTeleport(target) {
6
+ const isHydrated = useHydration();
5
7
  const teleportTarget = computed(() => {
6
8
  const _target = target.value;
7
9
  if (_target === true || !IN_BROWSER) return void 0;
10
+ if (!isHydrated.value) return void 0;
8
11
  const targetElement = _target === false ? document.body : typeof _target === "string" ? document.querySelector(_target) : _target;
9
12
  if (targetElement == null) {
10
13
  consoleWarn(`Unable to locate target ${_target}`);
@@ -1,5 +1,3 @@
1
- import type { IVariantProps } from '../../interfaces/Commons/variant.interface';
2
- import type { TVariant, TVariantInput } from '../../types/Commons/variant.type';
3
1
  import { Ref } from 'vue';
4
2
  /*********************************************************
5
3
  * useVariant
@@ -10,7 +8,17 @@ import { Ref } from 'vue';
10
8
  * contrairement a `useDensity`/`useSize`, il n'y a pas de liste blanche
11
9
  * (`*_ARRAY`) a matcher : toute valeur non-nulle produit une classe, y
12
10
  * compris une variante que le composant ne connait pas.
11
+ *
12
+ * Le parametre props n'est plus type via l'ancien `IVariantProps` (mixin
13
+ * unique acceptant a tort `TVariant | TVariantInput` partout — scinde en
14
+ * `IActionVariantProps` / `IInputVariantProps`, cf. #1050). Un type
15
+ * structurel `{ variant?: string }` suffit ici : la fonction ne fait que
16
+ * lire `props.variant` et le stringifier, elle n'a jamais eu besoin de
17
+ * connaitre la liste de valeurs d'une famille precise — et les deux
18
+ * interfaces scindees (comme toute autre) lui restent assignables.
13
19
  ********************************************************/
14
- export declare function useVariant(props: IVariantProps | Ref<TVariant | TVariantInput | string | undefined>, name?: string): {
20
+ export declare function useVariant(props: {
21
+ variant?: string;
22
+ } | Ref<string | undefined>, name?: string): {
15
23
  variantClasses: import("vue").ComputedRef<string[]>;
16
24
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SUPPORTED_LANGS = exports.CODE_LIGHT_THEME = exports.CODE_DEFAULTS = exports.CODE_DARK_THEME = exports.CODE_CACHE_MAX_ENTRIES = void 0;
6
+ exports.SUPPORTED_LANGS = exports.ORIGAM_CODE_KEY = exports.CODE_LIGHT_THEME = exports.CODE_DEFAULTS = exports.CODE_DARK_THEME = exports.CODE_CACHE_MAX_ENTRIES = void 0;
7
7
  var _enums = require("../../enums/index.cjs");
8
8
  const SUPPORTED_LANGS = exports.SUPPORTED_LANGS = Object.freeze([_enums.CODE_LANG.PLAINTEXT, _enums.CODE_LANG.VUE, _enums.CODE_LANG.TS, _enums.CODE_LANG.JS, _enums.CODE_LANG.TSX, _enums.CODE_LANG.JSX, _enums.CODE_LANG.SCSS, _enums.CODE_LANG.CSS, _enums.CODE_LANG.JSON, _enums.CODE_LANG.BASH, _enums.CODE_LANG.HTML, _enums.CODE_LANG.XML, _enums.CODE_LANG.YAML, _enums.CODE_LANG.MD]);
9
9
  const CODE_CACHE_MAX_ENTRIES = exports.CODE_CACHE_MAX_ENTRIES = 64;
@@ -20,4 +20,5 @@ const CODE_DEFAULTS = exports.CODE_DEFAULTS = Object.freeze({
20
20
  * snackbar default so the visual rhythm stays consistent.
21
21
  */
22
22
  copyFeedbackDurationMs: 2e3
23
- });
23
+ });
24
+ const ORIGAM_CODE_KEY = exports.ORIGAM_CODE_KEY = /* @__PURE__ */Symbol.for("origam:code");