@supersoniks/concorde 5.0.0 → 5.0.2
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/.gitlab-ci.yml +0 -13
- package/build-infos.json +1 -1
- package/concorde-core.bundle.js +606 -689
- package/concorde-core.es.js +4511 -4329
- package/dist/concorde-core.bundle.js +606 -689
- package/dist/concorde-core.es.js +4511 -4329
- package/gitlab/job_tests.sh +25 -12
- package/index.html +3 -3
- package/package.json +16 -1
- package/scripts/post-build-docs.js +0 -0
- package/scripts/post-build.mjs +0 -0
- package/src/core/components/functional/fetch/fetch.md +0 -0
- package/src/core/components/functional/if/if.md +0 -0
- package/src/core/components/functional/list/list.demo.ts +0 -0
- package/src/core/components/functional/list/list.md +0 -0
- package/src/core/components/functional/list/list.ts +0 -0
- package/src/core/components/functional/router/router.md +0 -0
- package/src/core/components/functional/router/router.ts +0 -0
- package/src/core/components/functional/sdui/sdui.md +0 -0
- package/src/core/components/functional/states/states.md +0 -0
- package/src/core/components/functional/submit/submit.md +0 -0
- package/src/core/components/ui/_css/rounded.ts +36 -0
- package/src/core/components/ui/_css/size.ts +0 -0
- package/src/core/components/ui/_css/type.ts +49 -0
- package/src/core/components/ui/_i18n/ui-aria-labels.ts +104 -0
- package/src/core/components/ui/alert/alert.md +128 -72
- package/src/core/components/ui/alert/alert.spec.ts +145 -0
- package/src/core/components/ui/alert/alert.ts +86 -91
- package/src/core/components/ui/alert-messages/alert-messages.ts +1 -1
- package/src/core/components/ui/badge/badge.md +126 -78
- package/src/core/components/ui/badge/badge.ts +29 -81
- package/src/core/components/ui/button/button.md +1 -0
- package/src/core/components/ui/button/button.ts +11 -8
- package/src/core/components/ui/captcha/altchaStyles.ts +0 -0
- package/src/core/components/ui/captcha/captcha.md +0 -0
- package/src/core/components/ui/card/card-header.ts +7 -2
- package/src/core/components/ui/card/card.md +120 -65
- package/src/core/components/ui/divider/divider.ts +4 -9
- package/src/core/components/ui/form/fieldset/legend-description.ts +1 -1
- package/src/core/components/ui/form/fieldset/legend.ts +1 -1
- package/src/core/components/ui/form/input/input.md +1 -1
- package/src/core/components/ui/form/input/input.ts +19 -15
- package/src/core/components/ui/form/radio/radio.md +0 -0
- package/src/core/components/ui/form/select/select.md +0 -0
- package/src/core/components/ui/form/switch/switch.md +0 -0
- package/src/core/components/ui/form/textarea/textarea.md +1 -1
- package/src/core/components/ui/image/image.md +147 -53
- package/src/core/components/ui/image/image.ts +10 -44
- package/src/core/components/ui/link/link.md +2 -2
- package/src/core/components/ui/link/link.ts +42 -37
- package/src/core/components/ui/loader/loader.md +0 -0
- package/src/core/components/ui/menu/menu.md +0 -0
- package/src/core/components/ui/modal/modal-close.ts +8 -12
- package/src/core/components/ui/modal/modal.md +0 -0
- package/src/core/components/ui/modal/modal.ts +18 -18
- package/src/core/components/ui/pop/pop.md +105 -1
- package/src/core/components/ui/pop/pop.ts +143 -148
- package/src/core/components/ui/table/table-caption.ts +0 -0
- package/src/core/components/ui/table/table.md +0 -0
- package/src/core/components/ui/table/table.ts +2 -8
- package/src/core/components/ui/theme/theme.ts +1 -1
- package/src/core/components/ui/toast/dismissed.ts +14 -0
- package/src/core/components/ui/toast/toast-item.ts +139 -91
- package/src/core/components/ui/toast/toast.ts +4 -7
- package/src/core/components/ui/tooltip/tooltip.ts +176 -154
- package/src/core/utils/LocationHandler.ts +12 -5
- package/src/core/utils/dismissed.ts +22 -0
- package/src/core/utils/positioning.spec.ts +208 -0
- package/src/core/utils/positioning.ts +183 -0
- package/src/core/utils/route.ts +0 -0
- package/src/directives.ts +2 -3
- package/src/docs/_core-concept/subscriber.md +0 -0
- package/src/docs/_getting-started/concorde-outside.md +3 -3
- package/src/docs/_getting-started/my-first-subscriber.md +0 -0
- package/src/docs/_getting-started/pubsub.md +0 -0
- package/src/docs/_getting-started/start.md +0 -0
- package/src/docs/code.ts +3 -1
- package/src/docs/example/users.ts +0 -0
- package/src/docs/search/docs-search.json +651 -21
- package/src/docs/search/page.ts +0 -0
- package/src/docs/tailwind/css/tailwind.css +13 -6
- package/src/tsconfig.json +45 -0
- package/src/tsconfig.tsbuildinfo +1 -1
- package/tailwind.config.js +50 -3
- package/vitest.setup.ts +49 -13
- package/.github/workflows/ci.yml +0 -21
- package/.github-export-ignore +0 -30
- package/CONTRIBUTING.md +0 -59
- package/DEV.md +0 -54
- package/LICENSE +0 -21
- package/OPEN_SOURCE_CHECKPOINT.md +0 -133
- package/concorde-3d.bundle.js +0 -3960
- package/concorde-3d.es.js +0 -33433
- package/concorde-hugging-face-infer.bundle.js +0 -32
- package/concorde-hugging-face-infer.es.js +0 -2952
- package/concorde-shader.bundle.js +0 -116
- package/concorde-shader.es.js +0 -8353
- package/concorde-webgpu.bundle.js +0 -307
- package/concorde-webgpu.es.js +0 -8627
- package/docs/altcha-widget.js +0 -2662
- package/docs/assets/index-BZiZXMU-.css +0 -1
- package/docs/assets/index-FmK4JaIM.js +0 -11992
- package/docs/crawl/core/components/functional/date/date.html +0 -190
- package/docs/crawl/core/components/functional/fetch/fetch.html +0 -109
- package/docs/crawl/core/components/functional/if/if.html +0 -27
- package/docs/crawl/core/components/functional/jsonata/jsonata.html +0 -79
- package/docs/crawl/core/components/functional/list/list.html +0 -70
- package/docs/crawl/core/components/functional/mix/mix.html +0 -45
- package/docs/crawl/core/components/functional/queue/queue.html +0 -96
- package/docs/crawl/core/components/functional/router/router.html +0 -106
- package/docs/crawl/core/components/functional/sdui/sdui.html +0 -269
- package/docs/crawl/core/components/functional/states/states.html +0 -66
- package/docs/crawl/core/components/functional/submit/submit.html +0 -160
- package/docs/crawl/core/components/functional/subscriber/subscriber.html +0 -67
- package/docs/crawl/core/components/functional/value/value.html +0 -51
- package/docs/crawl/core/components/ui/alert/alert.html +0 -110
- package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +0 -23
- package/docs/crawl/core/components/ui/badge/badge.html +0 -119
- package/docs/crawl/core/components/ui/button/button.html +0 -149
- package/docs/crawl/core/components/ui/captcha/captcha.html +0 -30
- package/docs/crawl/core/components/ui/card/card.html +0 -99
- package/docs/crawl/core/components/ui/divider/divider.html +0 -58
- package/docs/crawl/core/components/ui/form/checkbox/checkbox.html +0 -73
- package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +0 -135
- package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +0 -79
- package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +0 -62
- package/docs/crawl/core/components/ui/form/input/input.html +0 -109
- package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +0 -106
- package/docs/crawl/core/components/ui/form/radio/radio.html +0 -56
- package/docs/crawl/core/components/ui/form/select/select.html +0 -73
- package/docs/crawl/core/components/ui/form/switch/switch.html +0 -56
- package/docs/crawl/core/components/ui/form/textarea/textarea.html +0 -59
- package/docs/crawl/core/components/ui/group/group.html +0 -82
- package/docs/crawl/core/components/ui/icon/icon.html +0 -133
- package/docs/crawl/core/components/ui/image/image.html +0 -110
- package/docs/crawl/core/components/ui/link/link.html +0 -42
- package/docs/crawl/core/components/ui/loader/loader.html +0 -50
- package/docs/crawl/core/components/ui/menu/menu.html +0 -322
- package/docs/crawl/core/components/ui/modal/modal.html +0 -117
- package/docs/crawl/core/components/ui/pop/pop.html +0 -102
- package/docs/crawl/core/components/ui/progress/progress.html +0 -58
- package/docs/crawl/core/components/ui/table/table.html +0 -413
- package/docs/crawl/core/components/ui/toast/toast.html +0 -122
- package/docs/crawl/core/components/ui/tooltip/tooltip.html +0 -79
- package/docs/crawl/docs/_core-concept/dataFlow.html +0 -177
- package/docs/crawl/docs/_core-concept/overview.html +0 -66
- package/docs/crawl/docs/_core-concept/subscriber.html +0 -75
- package/docs/crawl/docs/_decorators/ancestor-attribute.html +0 -116
- package/docs/crawl/docs/_decorators/auto-subscribe.html +0 -202
- package/docs/crawl/docs/_decorators/bind.html +0 -141
- package/docs/crawl/docs/_decorators/get.html +0 -149
- package/docs/crawl/docs/_decorators/handle.html +0 -165
- package/docs/crawl/docs/_decorators/on-assign.html +0 -355
- package/docs/crawl/docs/_decorators/patch.html +0 -78
- package/docs/crawl/docs/_decorators/post.html +0 -139
- package/docs/crawl/docs/_decorators/publish.html +0 -61
- package/docs/crawl/docs/_decorators/put.html +0 -78
- package/docs/crawl/docs/_decorators/subscribe.html +0 -109
- package/docs/crawl/docs/_decorators/wait-for-ancestors.html +0 -137
- package/docs/crawl/docs/_directives/sub.html +0 -93
- package/docs/crawl/docs/_getting-started/ai-agents.html +0 -173
- package/docs/crawl/docs/_getting-started/concorde-manual-install.html +0 -100
- package/docs/crawl/docs/_getting-started/concorde-outside.html +0 -58
- package/docs/crawl/docs/_getting-started/create-a-component.html +0 -111
- package/docs/crawl/docs/_getting-started/my-first-component.html +0 -189
- package/docs/crawl/docs/_getting-started/my-first-subscriber.html +0 -110
- package/docs/crawl/docs/_getting-started/pubsub.html +0 -62
- package/docs/crawl/docs/_getting-started/start.html +0 -76
- package/docs/crawl/docs/_getting-started/theming.html +0 -85
- package/docs/crawl/docs/_misc/api-configuration.html +0 -149
- package/docs/crawl/docs/_misc/dataProviderKey.html +0 -135
- package/docs/crawl/docs/_misc/docs-mock-api.html +0 -158
- package/docs/crawl/docs/_misc/dynamic-path.html +0 -180
- package/docs/crawl/docs/_misc/endpoint.html +0 -50
- package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +0 -138
- package/docs/crawl/docs/_misc/html-integration.html +0 -48
- package/docs/crawl/hubs/decorators.html +0 -547
- package/docs/crawl/hubs/form-components.html +0 -357
- package/docs/crawl/hubs/remote-data.html +0 -452
- package/docs/crawl/index.html +0 -101
- package/docs/css/docs.css +0 -0
- package/docs/docs-mock-api-sw.js +0 -720
- package/docs/docs-mock-api-sw.js.map +0 -7
- package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
- package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
- package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Light.eot +0 -0
- package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Light.woff +0 -0
- package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
- package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
- package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
- package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
- package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
- package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
- package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
- package/docs/img/concorde-icon.svg +0 -5
- package/docs/img/concorde-logo.svg +0 -1
- package/docs/img/concorde.png +0 -0
- package/docs/img/concorde_def.png +0 -0
- package/docs/img/concorde_seuil.png.webp +0 -0
- package/docs/img/concorde_seuil_invert.png +0 -0
- package/docs/img/paul_metrand.jpg +0 -0
- package/docs/img/paul_metrand_xs.jpg +0 -0
- package/docs/index.html +0 -93
- package/docs/llms-full.txt +0 -5787
- package/docs/llms.txt +0 -104
- package/docs/robots.txt +0 -16
- package/docs/sitemap.xml +0 -237
- package/docs/src/core/components/functional/date/date.md +0 -290
- package/docs/src/core/components/functional/fetch/fetch.md +0 -125
- package/docs/src/core/components/functional/if/if.md +0 -9
- package/docs/src/core/components/functional/jsonata/jsonata.md +0 -56
- package/docs/src/core/components/functional/list/list.md +0 -65
- package/docs/src/core/components/functional/mix/mix.md +0 -41
- package/docs/src/core/components/functional/queue/queue.md +0 -72
- package/docs/src/core/components/functional/router/router.md +0 -94
- package/docs/src/core/components/functional/sdui/default-library.json +0 -108
- package/docs/src/core/components/functional/sdui/example.json +0 -99
- package/docs/src/core/components/functional/sdui/sdui.md +0 -356
- package/docs/src/core/components/functional/states/states.md +0 -87
- package/docs/src/core/components/functional/submit/submit.md +0 -114
- package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
- package/docs/src/core/components/functional/value/value.md +0 -35
- package/docs/src/core/components/ui/alert/alert.md +0 -121
- package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
- package/docs/src/core/components/ui/badge/badge.md +0 -127
- package/docs/src/core/components/ui/button/button.md +0 -182
- package/docs/src/core/components/ui/captcha/captcha.md +0 -12
- package/docs/src/core/components/ui/card/card.md +0 -97
- package/docs/src/core/components/ui/divider/divider.md +0 -35
- package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
- package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
- package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
- package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
- package/docs/src/core/components/ui/form/input/input.md +0 -142
- package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -133
- package/docs/src/core/components/ui/form/radio/radio.md +0 -57
- package/docs/src/core/components/ui/form/select/select.md +0 -71
- package/docs/src/core/components/ui/form/switch/switch.md +0 -57
- package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
- package/docs/src/core/components/ui/group/group.md +0 -75
- package/docs/src/core/components/ui/icon/icon.md +0 -125
- package/docs/src/core/components/ui/icon/icons.json +0 -1
- package/docs/src/core/components/ui/image/image.md +0 -107
- package/docs/src/core/components/ui/link/link.md +0 -43
- package/docs/src/core/components/ui/loader/loader.md +0 -55
- package/docs/src/core/components/ui/menu/menu.md +0 -329
- package/docs/src/core/components/ui/modal/modal.md +0 -119
- package/docs/src/core/components/ui/pop/pop.md +0 -96
- package/docs/src/core/components/ui/progress/progress.md +0 -63
- package/docs/src/core/components/ui/table/table.md +0 -455
- package/docs/src/core/components/ui/toast/toast.md +0 -166
- package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
- package/docs/src/docs/_core-concept/dataFlow.md +0 -88
- package/docs/src/docs/_core-concept/overview.md +0 -57
- package/docs/src/docs/_core-concept/subscriber.md +0 -75
- package/docs/src/docs/_decorators/ancestor-attribute.md +0 -127
- package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
- package/docs/src/docs/_decorators/bind.md +0 -167
- package/docs/src/docs/_decorators/get.md +0 -162
- package/docs/src/docs/_decorators/handle.md +0 -175
- package/docs/src/docs/_decorators/on-assign.md +0 -390
- package/docs/src/docs/_decorators/patch.md +0 -70
- package/docs/src/docs/_decorators/post.md +0 -146
- package/docs/src/docs/_decorators/publish.md +0 -55
- package/docs/src/docs/_decorators/put.md +0 -70
- package/docs/src/docs/_decorators/subscribe.md +0 -100
- package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
- package/docs/src/docs/_directives/sub.md +0 -91
- package/docs/src/docs/_getting-started/ai-agents.md +0 -76
- package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
- package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
- package/docs/src/docs/_getting-started/create-a-component.md +0 -139
- package/docs/src/docs/_getting-started/my-first-component.md +0 -236
- package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
- package/docs/src/docs/_getting-started/pubsub.md +0 -37
- package/docs/src/docs/_getting-started/start.md +0 -47
- package/docs/src/docs/_getting-started/theming.md +0 -91
- package/docs/src/docs/_misc/api-configuration.md +0 -81
- package/docs/src/docs/_misc/dataProviderKey.md +0 -168
- package/docs/src/docs/_misc/docs-mock-api.md +0 -63
- package/docs/src/docs/_misc/dynamic-path.md +0 -71
- package/docs/src/docs/_misc/endpoint.md +0 -45
- package/docs/src/docs/_misc/formelement-subscriber-removal.md +0 -115
- package/docs/src/docs/_misc/html-integration.md +0 -15
- package/docs/src/docs/search/docs-search.json +0 -9512
- package/docs/src/tag-list.json +0 -1
- package/docs/src/tsconfig-model.json +0 -23
- package/docs/src/tsconfig.declarations.json +0 -22
- package/docs/src/tsconfig.emit.json +0 -23
- package/docs/src/tsconfig.json +0 -858
- package/docs/svg/regular/plane.svg +0 -1
- package/docs/svg/solid/plane.svg +0 -1
- package/gitlab/job_github_mirror.sh +0 -39
- package/scripts/github-export.mjs +0 -150
- package/src/css.d.ts +0 -19
- package/src/tsconfig.declarations.json +0 -22
- package/src/tsconfig.emit.json +0 -23
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import HTML, { SearchableDomElement } from "./HTML";
|
|
2
|
+
|
|
3
|
+
export type FloatingSide = "top" | "right" | "bottom" | "left";
|
|
4
|
+
export type FloatingAlign = "start" | "center" | "end";
|
|
5
|
+
export type FloatingPlacement =
|
|
6
|
+
| FloatingSide
|
|
7
|
+
| `${FloatingSide}-${FloatingAlign}`;
|
|
8
|
+
|
|
9
|
+
const SIDES: readonly string[] = ["top", "right", "bottom", "left"];
|
|
10
|
+
const ALIGNS: readonly string[] = ["start", "center", "end"];
|
|
11
|
+
|
|
12
|
+
/** Découpe `"côté-alignement"` ; une valeur inconnue retombe sur le défaut. */
|
|
13
|
+
export function parsePlacement(
|
|
14
|
+
placement: string | undefined,
|
|
15
|
+
defaultSide: FloatingSide,
|
|
16
|
+
defaultAlign: FloatingAlign,
|
|
17
|
+
): { side: FloatingSide; align: FloatingAlign } {
|
|
18
|
+
const [side, align] = (placement ?? "").split("-");
|
|
19
|
+
return {
|
|
20
|
+
side: SIDES.includes(side) ? (side as FloatingSide) : defaultSide,
|
|
21
|
+
align: ALIGNS.includes(align) ? (align as FloatingAlign) : defaultAlign,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type FloatingBounds = {
|
|
26
|
+
minX: number;
|
|
27
|
+
minY: number;
|
|
28
|
+
maxX: number;
|
|
29
|
+
maxY: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type Rect = Pick<DOMRect, "left" | "top" | "right" | "bottom" | "width" | "height">;
|
|
33
|
+
type Size = Pick<DOMRect, "width" | "height">;
|
|
34
|
+
|
|
35
|
+
export const supportsPopover = "popover" in HTMLElement.prototype;
|
|
36
|
+
|
|
37
|
+
const OPPOSITE_SIDE: Record<FloatingSide, FloatingSide> = {
|
|
38
|
+
top: "bottom",
|
|
39
|
+
bottom: "top",
|
|
40
|
+
left: "right",
|
|
41
|
+
right: "left",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Zone dans laquelle un élément flottant doit rester visible :
|
|
46
|
+
* le viewport, restreint par le premier ancêtre qui scrolle ou clippe `node`.
|
|
47
|
+
*/
|
|
48
|
+
export function getFloatingBounds(
|
|
49
|
+
node: SearchableDomElement,
|
|
50
|
+
padding = 0,
|
|
51
|
+
): FloatingBounds {
|
|
52
|
+
const clipRect = (
|
|
53
|
+
HTML.getScrollableAncestor(node) as HTMLElement | null
|
|
54
|
+
)?.getBoundingClientRect();
|
|
55
|
+
|
|
56
|
+
// `||` et non `??` : un bord à 0 (ancêtre non rendu) retombe sur le viewport, comme historiquement dans sonic-pop.
|
|
57
|
+
return {
|
|
58
|
+
minX: Math.max(0, clipRect?.left || 0) + padding,
|
|
59
|
+
minY: Math.max(0, clipRect?.top || 0) + padding,
|
|
60
|
+
maxX:
|
|
61
|
+
Math.min(window.innerWidth, clipRect?.right || window.innerWidth) -
|
|
62
|
+
padding,
|
|
63
|
+
maxY:
|
|
64
|
+
Math.min(window.innerHeight, clipRect?.bottom || window.innerHeight) -
|
|
65
|
+
padding,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function alignOnAxis(
|
|
70
|
+
start: number,
|
|
71
|
+
length: number,
|
|
72
|
+
floatingLength: number,
|
|
73
|
+
align: FloatingAlign,
|
|
74
|
+
) {
|
|
75
|
+
if (align === "start") return start;
|
|
76
|
+
if (align === "end") return start + length - floatingLength;
|
|
77
|
+
return start + (length - floatingLength) / 2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function placeOnSide(
|
|
81
|
+
anchor: Rect,
|
|
82
|
+
floating: Size,
|
|
83
|
+
side: FloatingSide,
|
|
84
|
+
align: FloatingAlign,
|
|
85
|
+
gap: number,
|
|
86
|
+
) {
|
|
87
|
+
switch (side) {
|
|
88
|
+
case "top":
|
|
89
|
+
return {
|
|
90
|
+
x: alignOnAxis(anchor.left, anchor.width, floating.width, align),
|
|
91
|
+
y: anchor.top - floating.height - gap,
|
|
92
|
+
};
|
|
93
|
+
case "bottom":
|
|
94
|
+
return {
|
|
95
|
+
x: alignOnAxis(anchor.left, anchor.width, floating.width, align),
|
|
96
|
+
y: anchor.bottom + gap,
|
|
97
|
+
};
|
|
98
|
+
case "left":
|
|
99
|
+
return {
|
|
100
|
+
x: anchor.left - floating.width - gap,
|
|
101
|
+
y: alignOnAxis(anchor.top, anchor.height, floating.height, align),
|
|
102
|
+
};
|
|
103
|
+
case "right":
|
|
104
|
+
return {
|
|
105
|
+
x: anchor.right + gap,
|
|
106
|
+
y: alignOnAxis(anchor.top, anchor.height, floating.height, align),
|
|
107
|
+
};
|
|
108
|
+
default:
|
|
109
|
+
return { x: anchor.left, y: anchor.top };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function overflowsSide(
|
|
114
|
+
position: { x: number; y: number },
|
|
115
|
+
floating: Size,
|
|
116
|
+
side: FloatingSide,
|
|
117
|
+
bounds: FloatingBounds,
|
|
118
|
+
) {
|
|
119
|
+
switch (side) {
|
|
120
|
+
case "top":
|
|
121
|
+
return position.y < bounds.minY;
|
|
122
|
+
case "bottom":
|
|
123
|
+
return position.y + floating.height > bounds.maxY;
|
|
124
|
+
case "left":
|
|
125
|
+
return position.x < bounds.minX;
|
|
126
|
+
case "right":
|
|
127
|
+
return position.x + floating.width > bounds.maxX;
|
|
128
|
+
default:
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Position (coordonnées viewport) d'un élément flottant accolé à `anchor` :
|
|
135
|
+
* bascule sur le côté opposé s'il déborde, puis le contraint dans `bounds`.
|
|
136
|
+
* S'il est plus grand que `bounds`, c'est le bord bas / droit qui l'emporte.
|
|
137
|
+
*/
|
|
138
|
+
export function computeFloatingPosition({
|
|
139
|
+
anchor,
|
|
140
|
+
floating,
|
|
141
|
+
side,
|
|
142
|
+
align = "center",
|
|
143
|
+
gap = 0,
|
|
144
|
+
bounds,
|
|
145
|
+
}: {
|
|
146
|
+
anchor: Rect;
|
|
147
|
+
floating: Size;
|
|
148
|
+
side: FloatingSide;
|
|
149
|
+
align?: FloatingAlign;
|
|
150
|
+
gap?: number;
|
|
151
|
+
bounds: FloatingBounds;
|
|
152
|
+
}) {
|
|
153
|
+
let placedSide = side;
|
|
154
|
+
let position = placeOnSide(anchor, floating, placedSide, align, gap);
|
|
155
|
+
|
|
156
|
+
if (overflowsSide(position, floating, placedSide, bounds)) {
|
|
157
|
+
placedSide = OPPOSITE_SIDE[placedSide];
|
|
158
|
+
position = placeOnSide(anchor, floating, placedSide, align, gap);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
side: placedSide,
|
|
163
|
+
x: Math.min(
|
|
164
|
+
Math.max(position.x, bounds.minX),
|
|
165
|
+
bounds.maxX - floating.width,
|
|
166
|
+
),
|
|
167
|
+
y: Math.min(
|
|
168
|
+
Math.max(position.y, bounds.minY),
|
|
169
|
+
bounds.maxY - floating.height,
|
|
170
|
+
),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Appelle `callback` à chaque frame ; renvoie la fonction d'arrêt. */
|
|
175
|
+
export function startFrameLoop(callback: () => void) {
|
|
176
|
+
let frame = 0;
|
|
177
|
+
const tick = () => {
|
|
178
|
+
callback();
|
|
179
|
+
frame = requestAnimationFrame(tick);
|
|
180
|
+
};
|
|
181
|
+
tick();
|
|
182
|
+
return () => cancelAnimationFrame(frame);
|
|
183
|
+
}
|
package/src/core/utils/route.ts
CHANGED
|
File without changes
|
package/src/directives.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as directives from "@supersoniks/concorde/core/directives/DataProvider";
|
|
2
2
|
import {dp as pubDp, dataProvider as pubDataProvider, get as pubGet, set as pubSet} from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
3
|
-
import type {DirectiveResult} from "lit/async-directive.js";
|
|
4
3
|
|
|
5
4
|
import {ConcordeWindow} from "./core/_types/types";
|
|
6
5
|
/**
|
|
@@ -11,8 +10,8 @@ export const dp = pubDp;
|
|
|
11
10
|
* @deprecated @see pubDataProvider
|
|
12
11
|
*/
|
|
13
12
|
export const dataProvider = pubDataProvider;
|
|
14
|
-
export const subscribe = directives.subscribe
|
|
15
|
-
export const sub = directives.sub
|
|
13
|
+
export const subscribe = directives.subscribe;
|
|
14
|
+
export const sub = directives.sub;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* @deprecated @see pubGet
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Installation
|
|
2
2
|
|
|
3
|
-
<sonic-alert status="
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<sonic-alert status="info" label="Recommended — use the starter" background>
|
|
4
|
+
<p>For almost all new projects, use <a href="https://www.npmjs.com/package/@supersoniks/create-concorde-ts-starter">create-concorde-ts-starter</a></p>
|
|
5
|
+
<p>You get Vite + TypeScript + Lit + Tailwind, an example component, <code>npx concorde enable-short-paths</code> ready to run, and <code>yarn ai:sync</code> for <a href="#docs/_getting-started/ai-agents.md/ai-agents">AI agent skills</a> (<code>AGENTS.md</code>, Cursor / JetBrains rules) without extra setup.</p>
|
|
6
6
|
</sonic-alert>
|
|
7
7
|
|
|
8
8
|
## Starter
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/docs/code.ts
CHANGED
|
@@ -36,6 +36,8 @@ export class DocsCode extends LitElement {
|
|
|
36
36
|
pre {
|
|
37
37
|
font-size: 13px !important;
|
|
38
38
|
padding-right: 5rem !important;
|
|
39
|
+
border: 1px solid var(--sc-base-200);
|
|
40
|
+
border-radius: var(--sc-rounded);
|
|
39
41
|
}
|
|
40
42
|
.custom-scroll {
|
|
41
43
|
overflow: auto !important;
|
|
@@ -239,7 +241,7 @@ export class DocsCode extends LitElement {
|
|
|
239
241
|
return html`
|
|
240
242
|
<div
|
|
241
243
|
class="relative ${this.language === "markup"
|
|
242
|
-
? "border border-neutral-
|
|
244
|
+
? "rounded-md border border-neutral-200 bg-neutral-50/80 dark:border-neutral-700/80 dark:bg-neutral-900/40 p-4"
|
|
243
245
|
: ""}"
|
|
244
246
|
>
|
|
245
247
|
${this.language === "markup" && !this.noOutput
|
|
File without changes
|