mates-devtools 0.1.0-beta.6 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mates-devtools.es.js +912 -734
- package/dist/mates-devtools.umd.js +132 -87
- package/dist/types/Mates-DevTools/src/MatesDevTools.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/MatesDevToolsComponent.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/components/Header.d.ts +3 -2
- package/dist/types/Mates-DevTools/src/components/Header.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/components/UserLogsViewer.d.ts +6 -0
- package/dist/types/Mates-DevTools/src/components/UserLogsViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/userLogStore.d.ts +26 -0
- package/dist/types/Mates-DevTools/src/userLogStore.d.ts.map +1 -0
- package/dist/types/lib/Directives/animationClasses.d.ts +1 -1
- package/dist/types/lib/Directives/customEvent.d.ts +74 -0
- package/dist/types/lib/Directives/customEvent.d.ts.map +1 -0
- package/dist/types/lib/Directives/disappear.d.ts +23 -0
- package/dist/types/lib/Directives/disappear.d.ts.map +1 -0
- package/dist/types/lib/Directives/eleHook.d.ts.map +1 -1
- package/dist/types/lib/Directives/htmlHook.d.ts.map +1 -1
- package/dist/types/lib/Directives/index.d.ts +5 -3
- package/dist/types/lib/Directives/index.d.ts.map +1 -1
- package/dist/types/lib/Directives/onDirective.d.ts.map +1 -1
- package/dist/types/lib/Directives/onParentDirective.d.ts +1 -1
- package/dist/types/lib/Directives/timerDirective.d.ts +6 -6
- package/dist/types/lib/Directives/timerDirective.d.ts.map +1 -1
- package/dist/types/lib/Directives/virtualHelpers.d.ts +8 -6
- package/dist/types/lib/Directives/virtualHelpers.d.ts.map +1 -1
- package/dist/types/lib/Fetch/Fetch.d.ts +59 -13
- package/dist/types/lib/Fetch/Fetch.d.ts.map +1 -1
- package/dist/types/lib/MatesUtils/FetchUtils.d.ts +23 -0
- package/dist/types/lib/MatesUtils/FetchUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/MatesUtils.d.ts +47 -0
- package/dist/types/lib/MatesUtils/MatesUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/RouterUtils.d.ts +39 -0
- package/dist/types/lib/MatesUtils/RouterUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/StorageUtils.d.ts +16 -0
- package/dist/types/lib/MatesUtils/StorageUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/ThemeUtils.d.ts +18 -0
- package/dist/types/lib/MatesUtils/ThemeUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/index.d.ts +6 -0
- package/dist/types/lib/MatesUtils/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/changeFlagAtom.d.ts +56 -0
- package/dist/types/lib/Mutables/Extended Atoms/changeFlagAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts.map +1 -1
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts +3 -15
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/atom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/delayAtom.d.ts +40 -0
- package/dist/types/lib/Mutables/atom/delayAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/index.d.ts +2 -1
- package/dist/types/lib/Mutables/atom/index.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts +9 -31
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts +3 -9
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/form/formAtom.d.ts +7 -5
- package/dist/types/lib/Mutables/form/formAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/scope/scope.d.ts +32 -1
- package/dist/types/lib/Mutables/scope/scope.d.ts.map +1 -1
- package/dist/types/lib/Mutables/useStore/hostContext.d.ts.map +1 -1
- package/dist/types/lib/Mutables/useStore/subscription.d.ts +1 -1
- package/dist/types/lib/Mutables/useStore/subscription.d.ts.map +1 -1
- package/dist/types/lib/Router/Router.d.ts +2 -2
- package/dist/types/lib/Router/Router.d.ts.map +1 -1
- package/dist/types/lib/Router/animatedRouter.d.ts.map +1 -1
- package/dist/types/lib/Router/hashAtom.d.ts +7 -3
- package/dist/types/lib/Router/hashAtom.d.ts.map +1 -1
- package/dist/types/lib/Router/historyStateAtom.d.ts +8 -0
- package/dist/types/lib/Router/historyStateAtom.d.ts.map +1 -0
- package/dist/types/lib/Router/historyUtils.d.ts +14 -0
- package/dist/types/lib/Router/historyUtils.d.ts.map +1 -0
- package/dist/types/lib/Router/index.d.ts +2 -6
- package/dist/types/lib/Router/index.d.ts.map +1 -1
- package/dist/types/lib/Router/isPathMatching.d.ts +5 -1
- package/dist/types/lib/Router/isPathMatching.d.ts.map +1 -1
- package/dist/types/lib/Router/location.d.ts +4 -63
- package/dist/types/lib/Router/location.d.ts.map +1 -1
- package/dist/types/lib/Router/navigateTo.d.ts +8 -27
- package/dist/types/lib/Router/navigateTo.d.ts.map +1 -1
- package/dist/types/lib/Router/navigationLock.d.ts +5 -46
- package/dist/types/lib/Router/navigationLock.d.ts.map +1 -1
- package/dist/types/lib/Router/navigationRequest.d.ts +26 -0
- package/dist/types/lib/Router/navigationRequest.d.ts.map +1 -0
- package/dist/types/lib/Router/pathAtom.d.ts +16 -36
- package/dist/types/lib/Router/pathAtom.d.ts.map +1 -1
- package/dist/types/lib/Router/qsAtom.d.ts +7 -3
- package/dist/types/lib/Router/qsAtom.d.ts.map +1 -1
- package/dist/types/lib/Template/hmr.d.ts +6 -0
- package/dist/types/lib/Template/hmr.d.ts.map +1 -0
- package/dist/types/lib/Template/x-x.d.ts +1 -0
- package/dist/types/lib/Template/x-x.d.ts.map +1 -1
- package/dist/types/lib/Template/x-x.types.d.ts +0 -22
- package/dist/types/lib/Template/x-x.types.d.ts.map +1 -1
- package/dist/types/lib/Template/x.d.ts +19 -2
- package/dist/types/lib/Template/x.d.ts.map +1 -1
- package/dist/types/lib/TrackState/componentStatus.d.ts +0 -5
- package/dist/types/lib/TrackState/componentStatus.d.ts.map +1 -1
- package/dist/types/lib/TrackState/readTracking.d.ts.map +1 -1
- package/dist/types/lib/Utils/cookie.d.ts +2 -0
- package/dist/types/lib/Utils/cookie.d.ts.map +1 -0
- package/dist/types/lib/Utils/countdown.d.ts +48 -0
- package/dist/types/lib/Utils/countdown.d.ts.map +1 -0
- package/dist/types/lib/Utils/index.d.ts +3 -0
- package/dist/types/lib/Utils/index.d.ts.map +1 -1
- package/dist/types/lib/Utils/logEvent.d.ts +24 -0
- package/dist/types/lib/Utils/logEvent.d.ts.map +1 -0
- package/dist/types/lib/Utils/logger.d.ts +24 -13
- package/dist/types/lib/Utils/logger.d.ts.map +1 -1
- package/dist/types/lib/Utils/onceIdle.d.ts +28 -0
- package/dist/types/lib/Utils/onceIdle.d.ts.map +1 -0
- package/dist/types/lib/Utils/svgIcon.d.ts +2 -4
- package/dist/types/lib/Utils/svgIcon.d.ts.map +1 -1
- package/dist/types/lib/actions/asyncAction.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/index.d.ts +1 -1
- package/dist/types/lib/css-in-js/index.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/stylesheet.d.ts +15 -0
- package/dist/types/lib/css-in-js/stylesheet.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/theme.d.ts +0 -8
- package/dist/types/lib/css-in-js/theme.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +25 -18
- package/dist/types/lib/index.d.ts.map +1 -1
- package/dist/types/lib/indexdb/index.d.ts +3 -0
- package/dist/types/lib/indexdb/index.d.ts.map +1 -0
- package/dist/types/lib/indexdb/indexdb.d.ts +86 -0
- package/dist/types/lib/indexdb/indexdb.d.ts.map +1 -0
- package/dist/types/lib/indexdb/types.d.ts +249 -0
- package/dist/types/lib/indexdb/types.d.ts.map +1 -0
- package/dist/types/lib/minidb/index.d.ts +3 -0
- package/dist/types/lib/minidb/index.d.ts.map +1 -0
- package/dist/types/lib/minidb/minidb.d.ts +105 -0
- package/dist/types/lib/minidb/minidb.d.ts.map +1 -0
- package/dist/types/lib/on/hooks.d.ts.map +1 -1
- package/dist/types/lib/portals/floating-container.d.ts +129 -0
- package/dist/types/lib/portals/floating-container.d.ts.map +1 -0
- package/dist/types/lib/portals/index.d.ts +5 -3
- package/dist/types/lib/portals/index.d.ts.map +1 -1
- package/dist/types/lib/portals/popup.d.ts +75 -11
- package/dist/types/lib/portals/popup.d.ts.map +1 -1
- package/dist/types/lib/portals/popupPlacement.d.ts +52 -0
- package/dist/types/lib/portals/popupPlacement.d.ts.map +1 -0
- package/dist/types/lib/portals/portal.d.ts +40 -16
- package/dist/types/lib/portals/portal.d.ts.map +1 -1
- package/dist/types/lib/socket/ws.d.ts +2 -2
- package/dist/types/lib/ssr/index.d.ts +1 -0
- package/dist/types/lib/ssr/index.d.ts.map +1 -1
- package/dist/types/lib/ssr/ssrFlag.d.ts +56 -21
- package/dist/types/lib/ssr/ssrFlag.d.ts.map +1 -1
- package/dist/types/lib/ssr/useCtx.d.ts +63 -0
- package/dist/types/lib/ssr/useCtx.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/Virtualizer.d.ts +3 -2
- package/dist/types/lib/virtualizer/Virtualizer.d.ts.map +1 -1
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts +8 -0
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts.map +1 -1
- package/dist/types/lib/virtualizer/mates-adapter.d.ts +36 -88
- package/dist/types/lib/virtualizer/mates-adapter.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/lib/Router/pathResolver.d.ts +0 -9
- package/dist/types/lib/Router/pathResolver.d.ts.map +0 -1
- package/dist/types/lib/portals/tip.d.ts +0 -38
- package/dist/types/lib/portals/tip.d.ts.map +0 -1
- package/dist/types/lib/virtualizer/layouts/grid.d.ts +0 -25
- package/dist/types/lib/virtualizer/layouts/grid.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../lib/indexdb/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAIjC;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;OAOG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExE;;;;;;;OAOG;IACH,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,IAAI,CAAC;IAER;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAExD;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAIF,MAAM,MAAM,aAAa,GAAG;IAC1B,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,gEAAgE;IAChE,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC;IAExC,+FAA+F;IAC/F,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,W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ClE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC,CAAC;AAIF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAIF,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAEhE;;;;;;;;;OASG;IACH,WAAW,CACT,UAAU,EAAE,MAAM,EAAE,EACpB,EAAE,EAAE,CAAC,EAAE,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,qCAAqC;IACrC,KAAK,IAAI,IAAI,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/minidb/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type MiniDBMigrator = {
|
|
2
|
+
/** Wipe all records from a list during migration. */
|
|
3
|
+
clear(listName: string): void;
|
|
4
|
+
};
|
|
5
|
+
export type MiniDBMigrateFn = (oldVersion: number, newVersion: number, migrator: MiniDBMigrator) => void;
|
|
6
|
+
/**
|
|
7
|
+
* A reactive list backed by an IndexedDB object store.
|
|
8
|
+
*
|
|
9
|
+
* Calling `list()` returns a plain `T[]` and registers the list as a reactive
|
|
10
|
+
* dependency — components and effects re-run automatically when any item
|
|
11
|
+
* changes. The returned array is a normal JS array so `.filter()`, `.sort()`,
|
|
12
|
+
* `.map()` etc. work directly.
|
|
13
|
+
*
|
|
14
|
+
* All write methods (`add`, `set`, `update`, `deleteRow`, `clear`) are async
|
|
15
|
+
* and persist to IndexedDB before resolving. Every write is also broadcast to
|
|
16
|
+
* other tabs via `BroadcastChannel` so their atoms stay in sync.
|
|
17
|
+
*/
|
|
18
|
+
export type MiniDBList<T> = {
|
|
19
|
+
/** Reactive — returns all items as `T[]`. Tracks as a dependency. */
|
|
20
|
+
(): T[];
|
|
21
|
+
/** Reactive point lookup by id. */
|
|
22
|
+
get(id: string): T | undefined;
|
|
23
|
+
/** Reactive existence check by id. */
|
|
24
|
+
has(id: string): boolean;
|
|
25
|
+
/** Reactive item count. */
|
|
26
|
+
readonly size: number;
|
|
27
|
+
/**
|
|
28
|
+
* Add an item. Uses the item's `id` field as the key when present,
|
|
29
|
+
* otherwise auto-generates a UUID and assigns it.
|
|
30
|
+
* @returns The id used.
|
|
31
|
+
*/
|
|
32
|
+
add(item: T): Promise<string>;
|
|
33
|
+
/** Upsert — insert if absent, replace if present. */
|
|
34
|
+
set(id: string, item: T): Promise<void>;
|
|
35
|
+
/** Draft-style mutation — modify the item in-place, then persist. */
|
|
36
|
+
update(id: string, fn: (item: T) => void): Promise<void>;
|
|
37
|
+
/** Delete one item by id. */
|
|
38
|
+
deleteRow(id: string): Promise<void>;
|
|
39
|
+
/** Remove all items from the list. */
|
|
40
|
+
clear(): Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
export type MiniDBInstance = {
|
|
43
|
+
/**
|
|
44
|
+
* Returns a reactive list for the given name.
|
|
45
|
+
* The underlying IDB object store is created automatically on first call.
|
|
46
|
+
*
|
|
47
|
+
* Await calls sequentially when requesting multiple new lists — each new
|
|
48
|
+
* list may internally close and reopen the database to add the store.
|
|
49
|
+
*/
|
|
50
|
+
list<T>(name: string): Promise<MiniDBList<T>>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Opens (or creates) the opinionated `"mini-db"` IndexedDB database.
|
|
54
|
+
*
|
|
55
|
+
* - **Fixed name** — always `"mini-db"`, cannot be changed.
|
|
56
|
+
* - **No schema** — object stores are created automatically on first
|
|
57
|
+
* `db.list()` call.
|
|
58
|
+
* - **Designed for ≤ 1 000 records per list** — all data is held in memory
|
|
59
|
+
* as a reactive `mapAtom`. Components re-render automatically on any write.
|
|
60
|
+
* - **No cursors, no indexes, no query builder** — use plain JS array methods
|
|
61
|
+
* (`filter`, `sort`, `map`, …) on the result of `list()`.
|
|
62
|
+
* - **Cross-tab sync** — writes broadcast via `BroadcastChannel` so every
|
|
63
|
+
* open tab's atoms reflect changes immediately without polling.
|
|
64
|
+
*
|
|
65
|
+
* @param version App-level data version (default `1`). Increment to
|
|
66
|
+
* trigger the `onMigrate` callback.
|
|
67
|
+
* @param onMigrate Called once when `version` changes. Use
|
|
68
|
+
* `migrator.clear("listName")` to wipe stale data.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* interface User { id: string; name: string; role: string }
|
|
73
|
+
*
|
|
74
|
+
* // One shared instance — open at module level, export and reuse everywhere.
|
|
75
|
+
* export const db = await miniDB(2, (oldV, newV, m) => {
|
|
76
|
+
* if (oldV < 2) m.clear("users");
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* const users = await db.list<User>("users");
|
|
80
|
+
*
|
|
81
|
+
* // ── Reactive template ─────────────────────────────────────────────────────
|
|
82
|
+
* html`
|
|
83
|
+
* ${users()
|
|
84
|
+
* .filter(u => u.role === "admin")
|
|
85
|
+
* .sort((a, b) => a.name.localeCompare(b.name))
|
|
86
|
+
* .map(u => html`<li>${u.name}</li>`)}
|
|
87
|
+
* `
|
|
88
|
+
*
|
|
89
|
+
* // ── Writes (IDB + atom + broadcast to other tabs) ─────────────────────────
|
|
90
|
+
* await users.add({ id: "u1", name: "Alice", role: "admin" });
|
|
91
|
+
* await users.add({ name: "Bob", role: "user" }); // auto-generates id
|
|
92
|
+
* await users.set("u1", { id: "u1", name: "Alice B.", role: "admin" });
|
|
93
|
+
* await users.update("u1", u => { u.role = "mod"; });
|
|
94
|
+
* await users.deleteRow("u1");
|
|
95
|
+
* await users.clear();
|
|
96
|
+
*
|
|
97
|
+
* // ── Reactive reads ────────────────────────────────────────────────────────
|
|
98
|
+
* users(); // User[]
|
|
99
|
+
* users.get("u1"); // User | undefined
|
|
100
|
+
* users.has("u1"); // boolean
|
|
101
|
+
* users.size; // number
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function miniDB(version?: number, onMigrate?: MiniDBMigrateFn): Promise<MiniDBInstance>;
|
|
105
|
+
//# sourceMappingURL=minidb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minidb.d.ts","sourceRoot":"","sources":["../../../../../lib/minidb/minidb.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,cAAc,GAAG;IAC3B,qDAAqD;IACrD,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,cAAc,KACrB,IAAI,CAAC;AAEV;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,qEAAqE;IACrE,IAAI,CAAC,EAAE,CAAC;IACR,mCAAmC;IACnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/B,sCAAsC;IACtC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,qDAAqD;IACrD,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,qEAAqE;IACrE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,6BAA6B;IAC7B,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,sCAAsC;IACtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/C,CAAC;AAwNF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,MAAM,CAC1B,OAAO,SAAI,EACX,SAAS,CAAC,EAAE,eAAe,GAC1B,OAAO,CAAC,cAAc,CAAC,CAqDzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../lib/on/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../lib/on/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAqBjD,KAAK,SAAS,GAAG,MAAM,IAAI,CAAC;AAI5B;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,M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AuBF,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,KAAG,IAgBzD,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GACnB,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,SAAS,GAAG,SAAS,EACvC,SAAQ,WAAoB,KAC3B,IAgBF,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GACnB,IAAI,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,GAAG,SAAS,EACzD,SAAS,WAAW,KACnB,IAoBF,CAAC;AAIF,eAAO,MAAM,UAAU,GACrB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,IAAI,KACjD,IAgBF,CAAC;AAIF,eAAO,MAAM,UAAU,GACrB,IAAI,MAAM,SAAS,GAAG,SAAS,EAC/B,IAAI,MAAM,KACT,IAeF,CAAC;AAIF,eAAO,MAAM,SAAS,GACpB,IAAI,MAAM,SAAS,GAAG,SAAS,EAC/B,IAAI,MAAM,KACT,IAcF,CAAC;AAIF;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,EAC1B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GACzB,IAAI,CAON;AAID,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,SAAS,GAAG,SAAS,KAAG,IAa1D,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* floating-container.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared low-level utility for creating a `position:fixed` container element
|
|
5
|
+
* that lives on `document.body` (or a custom target).
|
|
6
|
+
*
|
|
7
|
+
* All portal-style primitives in this library (`portal`, `popup`,
|
|
8
|
+
* `cascading-popup-list`, etc.) ultimately need the same three operations:
|
|
9
|
+
* 1. Create a fixed-position div with a z-index above everything else.
|
|
10
|
+
* 2. Lazily attach it to the DOM exactly once — only when content needs to
|
|
11
|
+
* be shown, never eagerly on component mount.
|
|
12
|
+
* 3. Remove it cleanly when the component unmounts or the panel closes.
|
|
13
|
+
*
|
|
14
|
+
* Centralising this here ensures every floating surface shares identical
|
|
15
|
+
* defaults, avoids the "orphaned div" bug that comes from eagerly calling
|
|
16
|
+
* `document.body.appendChild` at mount time, and gives one place to tweak
|
|
17
|
+
* z-index, default styles, or target element logic across the whole library.
|
|
18
|
+
*
|
|
19
|
+
* ─── Usage ────────────────────────────────────────────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* // Create (not yet in DOM)
|
|
23
|
+
* const { el, attach, detach, isAttached } = createFloatingContainer();
|
|
24
|
+
*
|
|
25
|
+
* // Lazily attach when you actually need to show something
|
|
26
|
+
* attach();
|
|
27
|
+
* el.style.top = "100px";
|
|
28
|
+
* el.style.left = "200px";
|
|
29
|
+
* litRender(myTemplate, el);
|
|
30
|
+
*
|
|
31
|
+
* // Detach when done
|
|
32
|
+
* detach();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Apply extra styles at creation time:
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { el, attach, detach } = createFloatingContainer({
|
|
38
|
+
* style: {
|
|
39
|
+
* minWidth: "10rem",
|
|
40
|
+
* background: "var(--md-color-surface)",
|
|
41
|
+
* border: "0.06rem solid var(--md-color-border)",
|
|
42
|
+
* borderRadius: "var(--md-radius-sm)",
|
|
43
|
+
* boxShadow: "var(--md-shadow-dropdown)",
|
|
44
|
+
* overflow: "hidden",
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export interface FloatingContainerOptions {
|
|
50
|
+
/**
|
|
51
|
+
* Extra CSS properties merged onto the container element at creation time.
|
|
52
|
+
* These are applied on top of the mandatory base styles
|
|
53
|
+
* (`position:fixed`, `z-index`, `display:none`).
|
|
54
|
+
*/
|
|
55
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
56
|
+
/**
|
|
57
|
+
* Where to mount the container.
|
|
58
|
+
* Accepts an `Element` directly, a CSS selector string, or omit/`null` to
|
|
59
|
+
* default to `document.body`.
|
|
60
|
+
*
|
|
61
|
+
* @default document.body
|
|
62
|
+
*/
|
|
63
|
+
target?: Element | string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Override the default `z-index` value.
|
|
66
|
+
*
|
|
67
|
+
* @default "9999"
|
|
68
|
+
*/
|
|
69
|
+
zIndex?: string | number;
|
|
70
|
+
}
|
|
71
|
+
export interface FloatingContainer {
|
|
72
|
+
/**
|
|
73
|
+
* The raw `<div>` element. You can read/write styles, measure, and render
|
|
74
|
+
* lit-html templates into this element directly. It is NOT in the DOM until
|
|
75
|
+
* `attach()` is called.
|
|
76
|
+
*/
|
|
77
|
+
readonly el: HTMLDivElement;
|
|
78
|
+
/**
|
|
79
|
+
* Append `el` to the target (default: `document.body`) if it is not already
|
|
80
|
+
* attached. Safe to call multiple times — subsequent calls are no-ops.
|
|
81
|
+
*/
|
|
82
|
+
attach(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Remove `el` from the DOM. Safe to call when already detached — it is a
|
|
85
|
+
* no-op in that case. After calling `detach()` you may call `attach()`
|
|
86
|
+
* again to re-insert the same element.
|
|
87
|
+
*/
|
|
88
|
+
detach(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Returns `true` when `el` is currently in the DOM (i.e. `attach()` has
|
|
91
|
+
* been called and `detach()` has not been called since).
|
|
92
|
+
*/
|
|
93
|
+
isAttached(): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a reusable floating container element.
|
|
97
|
+
*
|
|
98
|
+
* The element is created synchronously but is **not** appended to the DOM.
|
|
99
|
+
* Call `attach()` exactly when you need to make it visible or measure it.
|
|
100
|
+
* Call `detach()` (or `el.remove()`) to clean up.
|
|
101
|
+
*
|
|
102
|
+
* This function is intentionally pure — it does NOT call `onCleanup()` or
|
|
103
|
+
* any other framework hook. The caller is responsible for calling `detach()`
|
|
104
|
+
* at the right time (e.g. inside `onCleanup` / `onCleanup` of an `eleHook`
|
|
105
|
+
* or `htmlHook` lifecycle).
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* // Inside an eleHook mountFn:
|
|
109
|
+
* const fc = createFloatingContainer({ style: { minWidth: "160px" } });
|
|
110
|
+
*
|
|
111
|
+
* const open = () => {
|
|
112
|
+
* fc.attach();
|
|
113
|
+
* litRender(content, fc.el);
|
|
114
|
+
* position(anchor, fc.el);
|
|
115
|
+
* fc.el.style.display = "block";
|
|
116
|
+
* };
|
|
117
|
+
*
|
|
118
|
+
* const close = () => {
|
|
119
|
+
* fc.el.style.display = "none";
|
|
120
|
+
* };
|
|
121
|
+
*
|
|
122
|
+
* return {
|
|
123
|
+
* onCleanup() {
|
|
124
|
+
* fc.detach();
|
|
125
|
+
* },
|
|
126
|
+
* };
|
|
127
|
+
*/
|
|
128
|
+
export declare function createFloatingContainer(opts?: FloatingContainerOptions): FloatingContainer;
|
|
129
|
+
//# sourceMappingURL=floating-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-container.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/floating-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC;IAE5B;;;OAGG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC;CACvB;AAgCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,GAAE,wBAA6B,GAClC,iBAAiB,CAsCnB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type { DialogOptions } from "./dialog";
|
|
2
2
|
export { dialog } from "./dialog";
|
|
3
|
-
export type {
|
|
3
|
+
export type { FloatingContainer, FloatingContainerOptions, } from "./floating-container";
|
|
4
|
+
export { createFloatingContainer } from "./floating-container";
|
|
5
|
+
export type { PopupOpenAtom, PopupOptions, PopupPlacement } from "./popup";
|
|
4
6
|
export { popup } from "./popup";
|
|
7
|
+
export type { ResolvedPlacement } from "./popupPlacement";
|
|
8
|
+
export { applyCoords, fits, flip, getScrollParent, resolvePlacement, } from "./popupPlacement";
|
|
5
9
|
export type { Placement, PortalOptions } from "./portal";
|
|
6
10
|
export { computeAutoPlacement, getCoords, placementTransform, portal, } from "./portal";
|
|
7
|
-
export type { TipContent, TipStyle } from "./tip";
|
|
8
|
-
export { tip, tooltip } from "./tip";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,kBAAkB,EAClB,MAAM,GACP,MAAM,UAAU,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { type TemplateResult } from "lit-html";
|
|
2
2
|
import type { DirectiveResult } from "lit-html/directive.js";
|
|
3
|
-
|
|
3
|
+
import type { PopupPlacement } from "./popupPlacement";
|
|
4
|
+
/**
|
|
5
|
+
* A readable boolean atom — any callable that returns a boolean and also
|
|
6
|
+
* exposes a `get()` method (compatible with mates `atom(false)`).
|
|
7
|
+
* Used by the `open` option of `popup()` to drive controlled mode.
|
|
8
|
+
*/
|
|
9
|
+
export interface PopupOpenAtom {
|
|
10
|
+
(): boolean;
|
|
11
|
+
get(): boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Accepted value for `PopupOptions.open` — an atom or a plain boolean. */
|
|
14
|
+
export type PopupOpenValue = PopupOpenAtom | boolean;
|
|
15
|
+
export type { PopupPlacement } from "./popupPlacement";
|
|
4
16
|
export interface PopupOptions {
|
|
5
17
|
/** default "bottom-start" */
|
|
6
18
|
position?: PopupPlacement;
|
|
@@ -9,6 +21,13 @@ export interface PopupOptions {
|
|
|
9
21
|
style?: Record<string, string>;
|
|
10
22
|
/** Set the floating panel's width to exactly match the anchor element's width. */
|
|
11
23
|
matchAnchorWidth?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* When true, the floating element is removed from `document.body` on close
|
|
26
|
+
* and re-appended on open. This keeps the DOM clean when the panel content
|
|
27
|
+
* is expensive (e.g. a calendar with 42 day cells).
|
|
28
|
+
* Default: false (legacy behaviour — panel stays in DOM, display:none).
|
|
29
|
+
*/
|
|
30
|
+
destroyOnClose?: boolean;
|
|
12
31
|
/**
|
|
13
32
|
* Called after the panel is shown and positioned (each time it opens).
|
|
14
33
|
* Use to move focus into the panel for keyboard navigation.
|
|
@@ -16,22 +35,67 @@ export interface PopupOptions {
|
|
|
16
35
|
onOpen?: (panel: HTMLElement) => void;
|
|
17
36
|
/**
|
|
18
37
|
* Called when the panel closes (outside click, Escape, or toggle).
|
|
19
|
-
* Receives the anchor element
|
|
38
|
+
* Receives the anchor element and the floating panel element.
|
|
39
|
+
* With `destroyOnClose: true`, the floating element is passed so the
|
|
40
|
+
* consumer can remove it after any exit animation completes.
|
|
41
|
+
* If the consumer calls `floating.remove()` itself, `popup()` will NOT
|
|
42
|
+
* call it again — it checks `floating.isConnected` before removing.
|
|
43
|
+
*/
|
|
44
|
+
onClose?: (anchor: HTMLElement, floating: HTMLElement) => void;
|
|
45
|
+
/**
|
|
46
|
+
* **Controlled mode** — pass a boolean atom to take full control of
|
|
47
|
+
* open/close state. When provided:
|
|
48
|
+
* - No `click` listener is attached to the anchor element.
|
|
49
|
+
* - The panel opens when `open()` becomes `true` and closes when it
|
|
50
|
+
* becomes `false` (evaluated on every render update).
|
|
51
|
+
* - Outside-click and Escape are **not** wired automatically; the caller
|
|
52
|
+
* is responsible for setting the atom to `false` when appropriate.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const isOpen = atom(false);
|
|
56
|
+
* html`<div ${popup(listEl, { open: isOpen, position: "bottom-start" })}>
|
|
57
|
+
* <input @focusin=${() => isOpen.set(true)}
|
|
58
|
+
* @focusout=${() => isOpen.set(false)} />
|
|
59
|
+
* </div>`
|
|
20
60
|
*/
|
|
21
|
-
|
|
61
|
+
open?: PopupOpenValue;
|
|
62
|
+
/**
|
|
63
|
+
* Override the z-index of the floating panel.
|
|
64
|
+
* Use `600` (or `--md-z-popup-above-modal`) when the popup must appear
|
|
65
|
+
* above an open dialog. Defaults to the floating-container default (9999).
|
|
66
|
+
*/
|
|
67
|
+
zIndex?: number | string;
|
|
68
|
+
/**
|
|
69
|
+
* When true, suppresses any CSS animations on the floating panel element.
|
|
70
|
+
* Useful for tour cards and other cases where you want instant appearance.
|
|
71
|
+
*/
|
|
72
|
+
disableAnimation?: boolean;
|
|
22
73
|
}
|
|
23
74
|
/**
|
|
24
|
-
* `popup(content,
|
|
25
|
-
* floating panel to any element.
|
|
75
|
+
* `popup(content, options?)` — attach an anchored floating panel to any element.
|
|
26
76
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* outside or pressing Escape closes it. Repositions on scroll and resize.
|
|
30
|
-
* Optional `onOpen` / `onClose` run when the panel opens or closes (e.g. focus management).
|
|
77
|
+
* **Toggle mode** (default) — clicking the anchor opens/closes the panel.
|
|
78
|
+
* Outside-click and Escape close it automatically.
|
|
31
79
|
*
|
|
32
|
-
*
|
|
80
|
+
* **Controlled mode** — pass `options.open` with a boolean atom to take full
|
|
81
|
+
* control. No click listener is attached; the panel opens/closes whenever
|
|
82
|
+
* the atom value changes. Outside-click and Escape are NOT wired automatically —
|
|
83
|
+
* the caller is responsible for setting the atom to `false`.
|
|
84
|
+
*
|
|
85
|
+
* Pure `position:fixed` — no Popover API, no portal wrapper needed.
|
|
86
|
+
* Repositions on scroll and resize.
|
|
87
|
+
*
|
|
88
|
+
* @example — toggle (default)
|
|
33
89
|
* html`<button ${popup(html`<ul>...</ul>`, "bottom-start")}>Menu ▾</button>`
|
|
34
|
-
*
|
|
90
|
+
*
|
|
91
|
+
* @example — controlled (combo-box / autocomplete)
|
|
92
|
+
* const isOpen = atom(false);
|
|
93
|
+
* html`
|
|
94
|
+
* <div ${popup(listEl, { open: isOpen, position: "bottom-start", matchAnchorWidth: true })}>
|
|
95
|
+
* <input @focusin=${() => isOpen.set(true)}
|
|
96
|
+
* @focusout=${() => isOpen.set(false)} />
|
|
97
|
+
* </div>
|
|
98
|
+
* `
|
|
35
99
|
*/
|
|
36
100
|
export declare function popup(content: TemplateResult, positionOrOptions?: PopupPlacement | PopupOptions): DirectiveResult;
|
|
37
101
|
//# sourceMappingURL=popup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/popup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/popup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,OAAO,CAAC;IACZ,GAAG,IAAI,OAAO,CAAC;CAChB;AAED,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,OAAO,CAAC;AAErD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/D;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAgQD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CACnB,OAAO,EAAE,cAAc,EACvB,iBAAiB,CAAC,EAAE,cAAc,GAAG,YAAY,GAChD,eAAe,CAMjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* popupPlacement.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared placement types and coordinate utilities used by `popup()` and any
|
|
5
|
+
* other portal-style floating surface that needs anchor-aware, flip-capable
|
|
6
|
+
* positioning (e.g. cascading menus, date-pickers, combobox panels).
|
|
7
|
+
*
|
|
8
|
+
* Centralising here means every floating surface gets:
|
|
9
|
+
* • Scroll-parent awareness (room measured against the scrollable ancestor,
|
|
10
|
+
* not just the viewport).
|
|
11
|
+
* • Automatic flip when the preferred side has insufficient space.
|
|
12
|
+
* • Viewport-edge clamping so the panel never overflows by more than 4 px.
|
|
13
|
+
*/
|
|
14
|
+
export type PopupPlacement = "auto" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
15
|
+
/** Every placement value except the virtual `"auto"` sentinel. */
|
|
16
|
+
export type ResolvedPlacement = Exclude<PopupPlacement, "auto">;
|
|
17
|
+
/**
|
|
18
|
+
* Returns `true` when placement `p` fits within the available room on each
|
|
19
|
+
* side of the anchor.
|
|
20
|
+
*/
|
|
21
|
+
export declare function fits(p: PopupPlacement, fW: number, fH: number, roomTop: number, roomBottom: number, roomLeft: number, roomRight: number): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Return the opposite placement axis (top ↔ bottom, left ↔ right).
|
|
24
|
+
* Sub-positions (`-start` / `-end`) are preserved.
|
|
25
|
+
*/
|
|
26
|
+
export declare function flip(p: PopupPlacement): ResolvedPlacement;
|
|
27
|
+
/**
|
|
28
|
+
* Walk up the DOM from `el` and return the first ancestor that scrolls
|
|
29
|
+
* vertically, or `null` if none is found (i.e. the document scrolls).
|
|
30
|
+
*/
|
|
31
|
+
export declare function getScrollParent(el: HTMLElement): HTMLElement | null;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the best concrete placement for a floating element given the
|
|
34
|
+
* anchor's bounding rect, the floating element's dimensions, and the
|
|
35
|
+
* preferred placement.
|
|
36
|
+
*
|
|
37
|
+
* - For `"auto"` the function tries a fixed priority list and falls back to
|
|
38
|
+
* `"bottom-start"`.
|
|
39
|
+
* - For any other placement it tries the preferred side, then its opposite
|
|
40
|
+
* (flip), and finally falls back to the original preference when neither
|
|
41
|
+
* side has enough room.
|
|
42
|
+
* - Scroll-parent aware: available space is measured against the nearest
|
|
43
|
+
* scrollable ancestor when one exists.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolvePlacement(anchor: HTMLElement, anchorRect: DOMRect, fW: number, fH: number, gap: number, preferred: PopupPlacement): ResolvedPlacement;
|
|
46
|
+
/**
|
|
47
|
+
* Apply `top` / `left` CSS coordinates to a fixed-position floating element
|
|
48
|
+
* so it is anchored to the given placement. Clamps to 4 px inside the
|
|
49
|
+
* viewport edges.
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyCoords(el: HTMLElement, anchorRect: DOMRect, placement: ResolvedPlacement, fW: number, fH: number, gap: number): void;
|
|
52
|
+
//# sourceMappingURL=popupPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popupPlacement.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/popupPlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAIhE;;;GAGG;AACH,wBAAgB,IAAI,CAClB,CAAC,EAAE,cAAc,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,cAAc,GAAG,iBAAiB,CAUzD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAUnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,OAAO,EACnB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,cAAc,GACxB,iBAAiB,CAmDnB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,WAAW,EACf,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,iBAAiB,EAC5B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,GACV,IAAI,CAgDN"}
|
|
@@ -3,14 +3,21 @@ import type { DirectiveResult } from "lit-html/directive.js";
|
|
|
3
3
|
export type Placement = "auto" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
4
4
|
export interface PortalOptions {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Optional inline styles applied to the wrapper `<div>`.
|
|
7
|
+
*
|
|
8
|
+
* In most cases you should style your own rendered content rather than the
|
|
9
|
+
* wrapper — the wrapper is just a lit-html render root with no default
|
|
10
|
+
* styles. Use this only when you specifically need the wrapper element
|
|
11
|
+
* itself to carry styles (e.g. a transparent full-screen scrim).
|
|
9
12
|
*/
|
|
10
13
|
style?: Record<string, string>;
|
|
11
14
|
/** Event listeners attached directly to the wrapper div. */
|
|
12
15
|
on?: Record<string, EventListener>;
|
|
13
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Where to mount the portal wrapper.
|
|
18
|
+
* Accepts an `Element` or a CSS selector string.
|
|
19
|
+
* Default: `document.body`
|
|
20
|
+
*/
|
|
14
21
|
target?: Element | string;
|
|
15
22
|
}
|
|
16
23
|
/**
|
|
@@ -32,25 +39,42 @@ export declare function placementTransform(placement: Placement): string;
|
|
|
32
39
|
*/
|
|
33
40
|
export declare function computeAutoPlacement(anchorRect: DOMRect, contentWidth: number, contentHeight: number, gap: number): "top" | "bottom" | "left" | "right";
|
|
34
41
|
/**
|
|
35
|
-
* `portal(content, options?)` — renders a `TemplateResult` into a
|
|
36
|
-
*
|
|
37
|
-
*
|
|
42
|
+
* `portal(content, options?)` — renders a `TemplateResult` into a plain
|
|
43
|
+
* `<div>` appended to `document.body` (or a custom `target`), outside the
|
|
44
|
+
* normal component DOM tree.
|
|
45
|
+
*
|
|
46
|
+
* The wrapper `<div>` has **no default styles** — your rendered content is
|
|
47
|
+
* fully responsible for its own positioning, z-index, and sizing. This makes
|
|
48
|
+
* `portal` work cleanly for every use-case without conflicting defaults.
|
|
38
49
|
*
|
|
39
50
|
* Nothing renders at the call site. The wrapper is removed automatically when
|
|
40
|
-
* the directive disconnects (component unmounts or condition becomes false).
|
|
51
|
+
* the directive disconnects (component unmounts or the condition becomes false).
|
|
41
52
|
*
|
|
42
|
-
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Toast — the toast element itself carries position:fixed
|
|
55
|
+
* html`${showToast && portal(html`
|
|
56
|
+
* <div style="position:fixed;bottom:16px;right:16px;z-index:9999;">
|
|
57
|
+
* Saved ✓
|
|
58
|
+
* </div>
|
|
59
|
+
* `)}`
|
|
43
60
|
*
|
|
44
61
|
* @example
|
|
45
|
-
* //
|
|
46
|
-
* html`${isOpen && portal(html
|
|
47
|
-
* style:
|
|
48
|
-
*
|
|
62
|
+
* // Full-screen modal scrim
|
|
63
|
+
* html`${isOpen && portal(html`
|
|
64
|
+
* <div style="position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.5);"
|
|
65
|
+
* @click=${close}>
|
|
66
|
+
* <div class="modal" @click=${stopPropagation}>...</div>
|
|
67
|
+
* </div>
|
|
68
|
+
* `)}`
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Mount into a custom target instead of body
|
|
72
|
+
* html`${portal(html`<span>...</span>`, { target: "#overlay-root" })}`
|
|
49
73
|
*
|
|
50
74
|
* @example
|
|
51
|
-
* //
|
|
52
|
-
* html`${
|
|
53
|
-
* style: { top: `${
|
|
75
|
+
* // Apply styles to the wrapper itself (rare — prefer styling your content)
|
|
76
|
+
* html`${portal(html`<ul class="menu">...</ul>`, {
|
|
77
|
+
* style: { position: "fixed", top: `${y}px`, left: `${x}px` },
|
|
54
78
|
* })}`
|
|
55
79
|
*/
|
|
56
80
|
export declare function portal(content: TemplateResult, options?: PortalOptions): DirectiveResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../../lib/portals/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/B,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAEnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC3B;AAKD;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,SAAS,EACnB,GAAG,EAAE,MAAM,GACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA2B/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAgB/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAoBrC;AAiDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,aAAa,GACtB,eAAe,CAEjB"}
|
|
@@ -59,7 +59,7 @@ export type WsConnection<T = unknown> = {
|
|
|
59
59
|
* ```ts
|
|
60
60
|
* // ✅ correct — inside a component's outer function
|
|
61
61
|
* const MyComponent = () => {
|
|
62
|
-
* const sock = ws<ChatMessage>("wss
|
|
62
|
+
* const sock = ws<ChatMessage>("wss://<your-server>/chat", {
|
|
63
63
|
* reconnect: true,
|
|
64
64
|
* });
|
|
65
65
|
* onSocket((msg) => { messages.update(d => { d.push(msg); }); }, [sock]);
|
|
@@ -67,7 +67,7 @@ export type WsConnection<T = unknown> = {
|
|
|
67
67
|
* };
|
|
68
68
|
*
|
|
69
69
|
* // ❌ wrong — module level, no host, cleanup is never registered
|
|
70
|
-
* const chatSocket = ws<ChatMessage>("wss
|
|
70
|
+
* const chatSocket = ws<ChatMessage>("wss://<your-server>/chat");
|
|
71
71
|
*
|
|
72
72
|
* // ❌ wrong — inner function, outer function has already returned
|
|
73
73
|
* const MyComponent = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/ssr/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/ssr/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|