origam 2.21.0 → 2.22.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/CHANGELOG.md +54 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +8 -0
- package/dist/src/assets/css/tokens/light.css +3 -0
- package/dist/src/assets/scss/tokens/_dark.scss +8 -0
- package/dist/src/assets/scss/tokens/_light.scss +3 -0
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +8 -2
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +1 -1
- package/dist/src/components/Dialog/OrigamDialog.vue +1 -1
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +1 -1
- package/dist/src/components/Drawer/OrigamDrawer.vue +12 -2
- package/dist/src/components/Menu/OrigamMenu.vue +1 -1
- package/dist/src/components/Overlay/OrigamOverlay.vue +2 -2
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +1 -1
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +8 -2
- package/dist/src/components/Tooltip/OrigamTooltip.vue +1 -1
- package/dist/src/composables/Commons/hydration.composable.cjs +8 -3
- package/dist/src/composables/Commons/hydration.composable.d.ts +13 -5
- package/dist/src/composables/Commons/hydration.composable.js +6 -1
- package/dist/src/composables/Commons/teleport.composable.cjs +3 -0
- package/dist/src/composables/Commons/teleport.composable.d.ts +56 -0
- package/dist/src/composables/Commons/teleport.composable.js +3 -0
- package/dist/src/interfaces/CommandPalette/command-palette.interface.d.ts +2 -1
- package/dist/src/interfaces/Commons/attach.interface.cjs +1 -0
- package/dist/src/interfaces/Commons/attach.interface.d.ts +30 -0
- package/dist/src/interfaces/Commons/attach.interface.js +0 -0
- package/dist/src/interfaces/Drawer/drawer.interface.d.ts +24 -1
- package/dist/src/interfaces/Overlay/overlay.interface.d.ts +2 -2
- package/dist/src/interfaces/Snackbar/snackbar-group.interface.d.ts +2 -1
- package/dist/src/interfaces/index.cjs +11 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/themes/origam.theme.cjs +10 -1
- package/dist/src/themes/origam.theme.js +10 -1
- package/dist/src/types/tokens.type.d.ts +1 -1
- 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
|
|
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="
|
|
4
|
-
:to="
|
|
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
|
|
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 },
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
*
|
|
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
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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
|
-
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import type { ICommand } from './command.interface';
|
|
2
|
+
import type { IAttachProps } from '../Commons/attach.interface';
|
|
2
3
|
import type { ICommonsComponentProps } from '../Commons/commons.interface';
|
|
3
4
|
import type { ITypographyProps } from '../Commons/typography.interface';
|
|
4
5
|
/**
|
|
@@ -11,7 +12,7 @@ import type { ITypographyProps } from '../Commons/typography.interface';
|
|
|
11
12
|
* the listeners so consumers can pass either form interchangeably.
|
|
12
13
|
*/
|
|
13
14
|
export type TCommandPaletteHotkey = ReadonlyArray<string> | ReadonlyArray<ReadonlyArray<string>>;
|
|
14
|
-
export interface ICommandPaletteProps extends ICommonsComponentProps, Pick<ITypographyProps, 'fontSize'
|
|
15
|
+
export interface ICommandPaletteProps extends ICommonsComponentProps, Pick<ITypographyProps, 'fontSize'>, IAttachProps {
|
|
15
16
|
/** v-model — whether the palette is open. */
|
|
16
17
|
modelValue?: boolean;
|
|
17
18
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `attach` — the teleport target for a component's floating / portal
|
|
3
|
+
* surface, resolved through `useTeleport()`
|
|
4
|
+
* (`composables/Commons/teleport.composable.ts`), the SINGLE consumption
|
|
5
|
+
* point for the whole DS. Extracted from `IOverlayProps` (#attach-
|
|
6
|
+
* harmonisation) so every component that teleports declares the exact
|
|
7
|
+
* same surface instead of a half-implemented, hand-rolled `to="body"`.
|
|
8
|
+
*
|
|
9
|
+
* • `true` → no teleport, render in place.
|
|
10
|
+
* • `false` / unset → `document.body`. Vue's boolean-prop casting
|
|
11
|
+
* defaults an ABSENT prop whose declared type
|
|
12
|
+
* includes `Boolean` to `false` when the
|
|
13
|
+
* component declares no `default` for it — so
|
|
14
|
+
* "not passed" and "passed `false`" resolve
|
|
15
|
+
* identically to `document.body` by design
|
|
16
|
+
* (see `OrigamOverlay`, `OrigamMenu`).
|
|
17
|
+
* • a CSS selector string → resolved against `document.querySelector`.
|
|
18
|
+
* • an `Element` → used directly as the teleport container.
|
|
19
|
+
* • `null` → reserved for a component whose OWN default
|
|
20
|
+
* is not `document.body` (`OrigamDrawer`
|
|
21
|
+
* teleports into its `<OrigamLayout>` wrapper
|
|
22
|
+
* by default) and therefore needs a THIRD
|
|
23
|
+
* state, distinguishable from an explicit
|
|
24
|
+
* `false`, to fall back to that non-body
|
|
25
|
+
* default instead. Same tri-state pattern as
|
|
26
|
+
* `IDrawerProps.push` / `.clipped`.
|
|
27
|
+
*/
|
|
28
|
+
export interface IAttachProps {
|
|
29
|
+
attach?: boolean | string | Element | null;
|
|
30
|
+
}
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IActiveProps } from '../Commons/active.interface';
|
|
2
2
|
import type { IAdjacentSlots } from '../Commons/adjacent.interface';
|
|
3
|
+
import type { IAttachProps } from '../Commons/attach.interface';
|
|
3
4
|
import type { IBgColorProps, IColorProps } from '../Commons/color.interface';
|
|
4
5
|
import type { IBorderProps } from '../Commons/border.interface';
|
|
5
6
|
import type { ICommonsComponentEmits, ICommonsComponentProps, ITagProps } from '../Commons/commons.interface';
|
|
@@ -12,7 +13,7 @@ import type { IPaddingProps } from '../Commons/padding.interface';
|
|
|
12
13
|
import type { IRoundedProps } from '../Commons/rounded.interface';
|
|
13
14
|
import type { IScrimProps } from '../Overlay/overlay-scrim.interface';
|
|
14
15
|
import type { ITransitionComponentProps } from '../Commons/transition-component.interface';
|
|
15
|
-
export interface IDrawerProps extends ITagProps, ICommonsComponentProps, IBorderProps, IElevationProps, ILayoutItemProps, IRoundedProps, IColorProps, IBgColorProps, IDensityProps, IPaddingProps, IMarginProps, ITransitionComponentProps, IScrimProps, IActiveProps, IHoverProps {
|
|
16
|
+
export interface IDrawerProps extends ITagProps, ICommonsComponentProps, IBorderProps, IElevationProps, ILayoutItemProps, IRoundedProps, IColorProps, IBgColorProps, IDensityProps, IPaddingProps, IMarginProps, ITransitionComponentProps, IScrimProps, IActiveProps, IHoverProps, IAttachProps {
|
|
16
17
|
disableResizeWatcher?: boolean;
|
|
17
18
|
disableRouteWatcher?: boolean;
|
|
18
19
|
expandOnHover?: boolean;
|
|
@@ -60,6 +61,28 @@ export interface IDrawerProps extends ITagProps, ICommonsComponentProps, IBorder
|
|
|
60
61
|
* Drawer before AppBar → drawer full-height.
|
|
61
62
|
*/
|
|
62
63
|
clipped?: boolean | null;
|
|
64
|
+
/**
|
|
65
|
+
* `attach` — inherited from `IAttachProps`, re-documented here because
|
|
66
|
+
* `OrigamDrawer`'s DEFAULT target is not `document.body` like the rest
|
|
67
|
+
* of the Overlay family: it teleports into its `<OrigamLayout>`
|
|
68
|
+
* ancestor's `.origam-layout__wrapper` (by `id`, via `useLayoutItem`),
|
|
69
|
+
* or renders inline when no `<OrigamLayout>` ancestor exists (the
|
|
70
|
+
* "orphan" case).
|
|
71
|
+
*
|
|
72
|
+
* • `null` (default) → keep the layout-wrapper / orphan-inline
|
|
73
|
+
* behaviour described above. Declared as the explicit
|
|
74
|
+
* `withDefaults` value so Vue's boolean-prop casting —
|
|
75
|
+
* which would otherwise force an UNSET `attach` to
|
|
76
|
+
* `false` — never overrides it. Same device as `push` /
|
|
77
|
+
* `clipped` above.
|
|
78
|
+
* • `true` → render in place, bypassing BOTH the layout teleport
|
|
79
|
+
* AND the orphan fallback.
|
|
80
|
+
* • `false` → `document.body`, same as the rest of the Overlay
|
|
81
|
+
* family — escapes the layout wrapper entirely.
|
|
82
|
+
* • a CSS selector `string` / an `Element` → teleport there instead
|
|
83
|
+
* of the layout wrapper.
|
|
84
|
+
*/
|
|
85
|
+
attach?: boolean | string | Element | null;
|
|
63
86
|
}
|
|
64
87
|
/**
|
|
65
88
|
* Emits fired by `<OrigamDrawer>` — v-model on the open state, plus a
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IActivatorProps } from '../Commons/activator.interface';
|
|
2
|
+
import type { IAttachProps } from '../Commons/attach.interface';
|
|
2
3
|
import type { IClickOutsideEmits } from '../Commons/clickOutside.interface';
|
|
3
4
|
import type { ICommonsComponentEmits, ICommonsComponentProps } from '../Commons/commons.interface';
|
|
4
5
|
import type { IDimensionProps } from '../Commons/dimension.interface';
|
|
@@ -7,9 +8,8 @@ import type { ILocationStrategyProps } from '../Commons/location.interface';
|
|
|
7
8
|
import type { IScrimProps } from './overlay-scrim.interface';
|
|
8
9
|
import type { IScrollStrategyProps } from '../Commons/scroll.interface';
|
|
9
10
|
import type { ITransitionComponentProps } from '../Commons/transition-component.interface';
|
|
10
|
-
export interface IOverlayProps extends ICommonsComponentProps, IDimensionProps, IActivatorProps, ILocationStrategyProps, IScrollStrategyProps, ILazyProps, ITransitionComponentProps, IScrimProps {
|
|
11
|
+
export interface IOverlayProps extends ICommonsComponentProps, IDimensionProps, IActivatorProps, ILocationStrategyProps, IScrollStrategyProps, ILazyProps, ITransitionComponentProps, IScrimProps, IAttachProps {
|
|
11
12
|
absolute?: boolean;
|
|
12
|
-
attach?: boolean | string | Element;
|
|
13
13
|
closeOnBack?: boolean;
|
|
14
14
|
contentClass?: string | Array<string>;
|
|
15
15
|
contentProps?: any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
+
import type { IAttachProps } from '../Commons/attach.interface';
|
|
2
3
|
import type { ICommonsComponentProps, ITagProps } from '../Commons/commons.interface';
|
|
3
4
|
import type { ISnackbarGroupItem, ISnackbarGroupItemOptions } from './snackbar-group-item.interface';
|
|
4
5
|
import type { TSnackbarGroupDirection, TSnackbarGroupLocation } from '../../types/Snackbar/snackbar-group.type';
|
|
@@ -12,7 +13,7 @@ import type { TSnackbarGroupDirection, TSnackbarGroupLocation } from '../../type
|
|
|
12
13
|
* The component subscribes to its registered stack `id` and re-renders
|
|
13
14
|
* when the underlying `items` ref changes.
|
|
14
15
|
*/
|
|
15
|
-
export interface ISnackbarGroupProps extends ICommonsComponentProps, ITagProps {
|
|
16
|
+
export interface ISnackbarGroupProps extends ICommonsComponentProps, ITagProps, IAttachProps {
|
|
16
17
|
/**
|
|
17
18
|
* Identifier of the stack this container renders. Pair with
|
|
18
19
|
* `useSnackbarGroup({ id })` to spawn items into the same stack.
|
|
@@ -520,6 +520,17 @@ Object.keys(_align).forEach(function (key) {
|
|
|
520
520
|
}
|
|
521
521
|
});
|
|
522
522
|
});
|
|
523
|
+
var _attach = require("./Commons/attach.interface.cjs");
|
|
524
|
+
Object.keys(_attach).forEach(function (key) {
|
|
525
|
+
if (key === "default" || key === "__esModule") return;
|
|
526
|
+
if (key in exports && exports[key] === _attach[key]) return;
|
|
527
|
+
Object.defineProperty(exports, key, {
|
|
528
|
+
enumerable: true,
|
|
529
|
+
get: function () {
|
|
530
|
+
return _attach[key];
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
});
|
|
523
534
|
var _audio = require("./Commons/audio.interface.cjs");
|
|
524
535
|
Object.keys(_audio).forEach(function (key) {
|
|
525
536
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -45,6 +45,7 @@ export * from './Commons/activator.interface';
|
|
|
45
45
|
export * from './Commons/active.interface';
|
|
46
46
|
export * from './Commons/adjacent.interface';
|
|
47
47
|
export * from './Commons/align.interface';
|
|
48
|
+
export * from './Commons/attach.interface';
|
|
48
49
|
export * from './Commons/audio.interface';
|
|
49
50
|
export * from './Commons/autocomplete.interface';
|
|
50
51
|
export * from './Commons/backdrop.interface';
|
|
@@ -45,6 +45,7 @@ export * from "./Commons/activator.interface.js";
|
|
|
45
45
|
export * from "./Commons/active.interface.js";
|
|
46
46
|
export * from "./Commons/adjacent.interface.js";
|
|
47
47
|
export * from "./Commons/align.interface.js";
|
|
48
|
+
export * from "./Commons/attach.interface.js";
|
|
48
49
|
export * from "./Commons/audio.interface.js";
|
|
49
50
|
export * from "./Commons/autocomplete.interface.js";
|
|
50
51
|
export * from "./Commons/backdrop.interface.js";
|