@pentacode/embed 0.0.0-stage → 1.52.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +233 -2
- package/dist/api.d.ts +59 -0
- package/dist/api.js +6 -0
- package/dist/icon-names.d.ts +8 -0
- package/dist/icon-names.js +454 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/load.d.ts +6 -0
- package/dist/load.js +22 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +1 -0
- package/dist/react/jsx.d.ts +17 -0
- package/dist/react/jsx.js +3 -0
- package/dist/react/use-pentacode-app.d.ts +30 -0
- package/dist/react/use-pentacode-app.js +42 -0
- package/dist/route-map.d.ts +22 -0
- package/dist/route-map.js +76 -0
- package/package.json +55 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.52.0
|
|
4
|
+
|
|
5
|
+
- Versions follow the pentacode release they ship with. No changes to the API.
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
- Types for `<pentacode-app>`: the element, its attributes, `PentacodeRoute`, and the `pentacode-ready`,
|
|
10
|
+
`pentacode-route-change` and `pentacode-error` events. `pentacode-error` says whether the app stopped
|
|
11
|
+
(`fatal`).
|
|
12
|
+
- `loadPentacode(origin)` loads the element from your pentacode origin, once per origin.
|
|
13
|
+
- `createRouteMap` maps your URLs to pentacode routes and back.
|
|
14
|
+
- `ICON_NAMES` and `IconName`, the icon tokens an `icon-sprite` can provide.
|
|
15
|
+
- `@pentacode/embed/react`: JSX typings for React 19 and `usePentacodeApp`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pentacode AG
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,234 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pentacode/embed
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Types and helpers for apps that embed pentacode with the `<pentacode-app>` custom element.
|
|
4
|
+
|
|
5
|
+
pentacode itself is not in this package. It is served as an ES module from your pentacode origin
|
|
6
|
+
(`<origin>/embed/pentacode.js`); this package types the element and covers the code every host
|
|
7
|
+
needs around it: loading the module and mapping your URLs to pentacode routes.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @pentacode/embed
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Versions follow the pentacode release they ship with. A `~` range takes that release's fixes, and moving to a newer
|
|
16
|
+
release stays a deliberate update. Your build bundles the version you installed, while `pentacode.js` comes from
|
|
17
|
+
your origin and may be newer.
|
|
18
|
+
|
|
19
|
+
TypeScript hosts need `moduleResolution` `bundler`, `node16` or `nodenext`: the package resolves through `exports` only.
|
|
20
|
+
|
|
21
|
+
## Load pentacode
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { loadPentacode } from "@pentacode/embed";
|
|
25
|
+
|
|
26
|
+
await loadPentacode("https://manage.example.pentacode.app");
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`loadPentacode` imports the entry once per origin and registers `<pentacode-app>`. Elements already on the
|
|
30
|
+
page upgrade when it resolves. A failed load stays failed until the page reloads, so catch the rejection
|
|
31
|
+
and offer a reload.
|
|
32
|
+
|
|
33
|
+
Take the origin from your host's config, one per environment, for example `loadPentacode(import.meta.env.VITE_PENTACODE_ORIGIN)`.
|
|
34
|
+
The origin decides which pentacode server the app talks to. A page holds one origin: `<pentacode-app>` registers once, so
|
|
35
|
+
switching environments takes a reload. List the origin you load in your [Content-Security-Policy](#content-security-policy).
|
|
36
|
+
|
|
37
|
+
## Render the element
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<div style="height: 100vh">
|
|
41
|
+
<pentacode-app route="roster"></pentacode-app>
|
|
42
|
+
</div>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- The element fills its container, so the container needs a height.
|
|
46
|
+
- Use one element per page, and render it only on routes that show pentacode. Removing it keeps the app
|
|
47
|
+
running; the next mount resumes without a reboot.
|
|
48
|
+
- Changing `route` navigates without a remount.
|
|
49
|
+
|
|
50
|
+
Importing the package types the tag and its events globally:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import "@pentacode/embed";
|
|
54
|
+
|
|
55
|
+
const app = document.querySelector("pentacode-app")!;
|
|
56
|
+
app.route = "employees/42/time"; // checked against PentacodeRoute
|
|
57
|
+
app.addEventListener("pentacode-error", ({ detail }) => console.error(detail.code, detail.message));
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Attribute | Property | Meaning |
|
|
61
|
+
| -------------- | ------------- | ------------------------------------------------------- |
|
|
62
|
+
| `route` | `route` | pentacode route to show, e.g. `"roster?venue=1"` |
|
|
63
|
+
| `color-scheme` | `colorScheme` | `"light"`, `"dark"` or `"system"` (the default) |
|
|
64
|
+
| `icon-sprite` | `iconSprite` | URL of an SVG sprite with one `<symbol>` per icon token |
|
|
65
|
+
|
|
66
|
+
| Event | Constant | `detail` | Fires when |
|
|
67
|
+
| ------------------------ | -------------------- | ------------------------------------- | ---------------------------------------- |
|
|
68
|
+
| `pentacode-ready` | `READY_EVENT` | none | the app is interactive, on every mount |
|
|
69
|
+
| `pentacode-route-change` | `ROUTE_CHANGE_EVENT` | `route`, `replace?` | pentacode navigated itself |
|
|
70
|
+
| `pentacode-error` | `ERROR_EVENT` | `message`, `cause?`, `code?`, `fatal` | a load, mount, auth or non-fatal failure |
|
|
71
|
+
|
|
72
|
+
`fatal` says whether the app stopped. The non-fatal ones (codes `icon-sprite` and `route-denied` today) leave it
|
|
73
|
+
running.
|
|
74
|
+
|
|
75
|
+
## Map your URLs to pentacode routes
|
|
76
|
+
|
|
77
|
+
pentacode never touches `window.history`; your router owns the URL. `createRouteMap` translates in both
|
|
78
|
+
directions:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { createRouteMap } from "@pentacode/embed";
|
|
82
|
+
|
|
83
|
+
const pentacodeRoutes = createRouteMap(
|
|
84
|
+
{
|
|
85
|
+
"/dienstplan": "roster",
|
|
86
|
+
"/team/mitarbeiter": "employees",
|
|
87
|
+
"/team/mitarbeiter/hinweise": "issues", // of nested entries the longer one wins
|
|
88
|
+
},
|
|
89
|
+
"/pentacode" // prefix for pentacode pages you don't alias
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
pentacodeRoutes.toPentacode("/team/mitarbeiter/12/time"); // "employees/12/time"
|
|
93
|
+
pentacodeRoutes.toHost("roster?from=2026-10-12"); // "/dienstplan?from=2026-10-12"
|
|
94
|
+
pentacodeRoutes.toHost("settings/account"); // "/pentacode/settings/account"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- The targets are checked against `PentacodeRoute`, so a typo or a removed route fails your build.
|
|
98
|
+
- Register `${path}/*` in your router for every entry of `pentacodeRoutes.hostPaths`, each rendering the
|
|
99
|
+
element.
|
|
100
|
+
- **Host → pentacode:** set `route` to `toPentacode(pathname + search + hash)`.
|
|
101
|
+
- **pentacode → host:** on `pentacode-route-change`, navigate to `toHost(detail.route)`; replace the history
|
|
102
|
+
entry instead of pushing when `detail.replace` is true.
|
|
103
|
+
- Host paths start with `/` and appear once, the fallback included; `createRouteMap` throws otherwise.
|
|
104
|
+
`toHost` throws when it's called for a route whose host path another entry maps, e.g. a nested alias
|
|
105
|
+
that takes a path below a broader one, so the wrong page never opens. That only shows once pentacode
|
|
106
|
+
navigates there, so try the routes below nested aliases and the fallback.
|
|
107
|
+
|
|
108
|
+
Deeper segments pass through unchecked. A route pentacode doesn't have, or one the user may not open,
|
|
109
|
+
shows a no-access page and fires `pentacode-error` with code `route-denied`.
|
|
110
|
+
|
|
111
|
+
## Handle errors
|
|
112
|
+
|
|
113
|
+
- `pentacode-error` reports mount and auth failures; show them in your UI. The codes `icon-sprite` and
|
|
114
|
+
`route-denied` are the exceptions: the app keeps running.
|
|
115
|
+
- A failed module load can't fire that event. Catch the rejected `loadPentacode()` instead.
|
|
116
|
+
|
|
117
|
+
## Replace a submenu (optional)
|
|
118
|
+
|
|
119
|
+
A `slot="submenu"` child replaces the submenu of the section currently shown (settings, employees, exports):
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<pentacode-app route="settings">
|
|
123
|
+
<nav slot="submenu">…</nav>
|
|
124
|
+
</pentacode-app>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
On settings and exports the submenu column takes the child's size, so an empty child removes it. On
|
|
128
|
+
employees the column keeps its width and its header above the child. Without a child, pentacode shows its
|
|
129
|
+
own submenu.
|
|
130
|
+
|
|
131
|
+
- The child replaces the submenu of whatever section is current, so render it only while pentacode shows
|
|
132
|
+
the section you mean to replace.
|
|
133
|
+
- You own its links: your router changes the URL, and you set `route` from it.
|
|
134
|
+
- The child stays in your DOM, so your styles apply to it.
|
|
135
|
+
|
|
136
|
+
## Theme it (optional)
|
|
137
|
+
|
|
138
|
+
CSS custom properties inherit into the element, so override pentacode's tokens on it:
|
|
139
|
+
|
|
140
|
+
```css
|
|
141
|
+
pentacode-app {
|
|
142
|
+
--font-family: "Barlow", Arial, sans-serif;
|
|
143
|
+
--color-primary: #ff8c9b;
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Aliases such as `--primary` don't follow `--color-primary`; set each one.
|
|
148
|
+
|
|
149
|
+
## Swap the icons (optional)
|
|
150
|
+
|
|
151
|
+
Point `icon-sprite` at an SVG sprite. Icons swap in place, without a remount:
|
|
152
|
+
|
|
153
|
+
```html
|
|
154
|
+
<pentacode-app route="roster" icon-sprite="/icons/pentacode.svg"></pentacode-app>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- One `<symbol>` per pentacode icon token, `id` = token name (e.g. `icon.action.add`). `…:active` tokens
|
|
158
|
+
are the selected or filled state.
|
|
159
|
+
- `ICON_NAMES` lists every token and `IconName` types them, so a sprite build can iterate over the list
|
|
160
|
+
and report tokens it doesn't cover yet.
|
|
161
|
+
- Leave `fill` unset or use `currentColor`; icons take the text color.
|
|
162
|
+
- Partial sprites are fine. An `:active` icon the sprite lacks falls back to your base token, any other to
|
|
163
|
+
pentacode's default; the console warns once per token.
|
|
164
|
+
- Cross-origin sprites need CORS, and the root needs `xmlns="http://www.w3.org/2000/svg"`. If the sprite
|
|
165
|
+
fails to load or parse, the current icons stay and `pentacode-error` fires with code `icon-sprite`.
|
|
166
|
+
|
|
167
|
+
## Content-Security-Policy
|
|
168
|
+
|
|
169
|
+
If you set one, pentacode needs these, with `<origin>` your pentacode origin and `<server>` the pentacode
|
|
170
|
+
server URL:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
script-src <origin> 'wasm-unsafe-eval';
|
|
174
|
+
style-src <origin>;
|
|
175
|
+
style-src-attr 'unsafe-inline';
|
|
176
|
+
font-src <origin>;
|
|
177
|
+
img-src <origin> blob: data:;
|
|
178
|
+
connect-src <origin> <server>;
|
|
179
|
+
worker-src blob:;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `'wasm-unsafe-eval'` and `worker-src blob:` are for the PDF viewer, whose worker runs from a blob.
|
|
183
|
+
- `style-src-attr 'unsafe-inline'`: layout values such as row heights are bound as style attributes.
|
|
184
|
+
- `img-src blob:`: the icon sprite is fetched from `<origin>` and used as a blob URL.
|
|
185
|
+
- Blocked loads don't fire `pentacode-error`. Stylesheet, fonts or icons just go missing, so check the
|
|
186
|
+
console when something looks off.
|
|
187
|
+
|
|
188
|
+
Some features need more:
|
|
189
|
+
|
|
190
|
+
- Documents and avatars: your pentacode file storage origin in `connect-src`, `img-src` and `object-src`.
|
|
191
|
+
- Office and CSV previews: `frame-src https://docs.google.com https://view.officeapps.live.com`.
|
|
192
|
+
- Maps: `img-src https://maps.googleapis.com`.
|
|
193
|
+
- Emoji picker: `connect-src https://cdn.jsdelivr.net`.
|
|
194
|
+
- Voice assistant: the LiveKit `wss:` host in `connect-src`, and microphone access in your
|
|
195
|
+
Permissions-Policy.
|
|
196
|
+
- An `icon-sprite`: its origin in `connect-src`, `'self'` if it's on your own origin. A sprite on your own
|
|
197
|
+
origin is used by URL instead of as a blob, so it also needs `img-src 'self'`.
|
|
198
|
+
|
|
199
|
+
## React
|
|
200
|
+
|
|
201
|
+
`@pentacode/embed/react` holds the React-specific parts; it needs React 19, which binds `on<event>` props
|
|
202
|
+
as listeners on custom elements. Importing it types `<pentacode-app>` in JSX.
|
|
203
|
+
|
|
204
|
+
`usePentacodeApp` loads pentacode, tracks the element's status and gives you the listeners to spread onto
|
|
205
|
+
it:
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { usePentacodeApp } from "@pentacode/embed/react";
|
|
209
|
+
|
|
210
|
+
function PentacodePage() {
|
|
211
|
+
const navigate = useNavigate();
|
|
212
|
+
const { pathname, search, hash } = useLocation();
|
|
213
|
+
const { status, props } = usePentacodeApp({
|
|
214
|
+
origin: "https://manage.example.pentacode.app",
|
|
215
|
+
onRouteChange: (route, replace) => navigate(pentacodeRoutes.toHost(route), { replace }),
|
|
216
|
+
onWarning: (detail) => console.warn(detail.code, detail.message),
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (status.state === "error") {
|
|
220
|
+
return <button onClick={() => location.reload()}>Reload ({status.message})</button>;
|
|
221
|
+
}
|
|
222
|
+
return (
|
|
223
|
+
<pentacode-app
|
|
224
|
+
route={pentacodeRoutes.toPentacode(pathname + search + hash) ?? ""}
|
|
225
|
+
style={{ display: "block", height: "100vh" }}
|
|
226
|
+
{...props}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
- `status.state` is `loading` until `pentacode-ready`, then `ready`; `error` after a failed load or a fatal
|
|
233
|
+
`pentacode-error`.
|
|
234
|
+
- Errors with `fatal: false` go to `onWarning` and leave the status alone.
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Fired whenever the embedded pentacode app navigates internally. */
|
|
2
|
+
export declare const ROUTE_CHANGE_EVENT = "pentacode-route-change";
|
|
3
|
+
/** Fired once the embedded app finished mounting and is interactive. */
|
|
4
|
+
export declare const READY_EVENT = "pentacode-ready";
|
|
5
|
+
/** Fired on load, mount or auth failures. */
|
|
6
|
+
export declare const ERROR_EVENT = "pentacode-error";
|
|
7
|
+
export interface PentacodeRouteChangeDetail {
|
|
8
|
+
/** pentacode-internal route, e.g. "roster" or "roster?venue=1" */
|
|
9
|
+
route: string;
|
|
10
|
+
/** True for silent corrections (default params etc.) — hosts should map
|
|
11
|
+
* this to a history *replace* so their URL history doesn't fill up. */
|
|
12
|
+
replace?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PentacodeErrorDetail {
|
|
15
|
+
message: string;
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
/** Whether the app stopped. On `false` it keeps running; `code` says what went wrong. */
|
|
18
|
+
fatal: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* `icon-sprite`: the host's `icon-sprite` didn't load; the app keeps running with its current icons.
|
|
21
|
+
* `route-denied`: the requested route doesn't exist or isn't available embedded or to this user; the app shows a
|
|
22
|
+
* no-access page at that address.
|
|
23
|
+
*/
|
|
24
|
+
code?: "icon-sprite" | "route-denied";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The `<pentacode-app>` element. Give it an explicit height; the app fills it.
|
|
28
|
+
*
|
|
29
|
+
* Attributes: `route`, `icon-sprite` and `color-scheme`, mirrored by the properties below.
|
|
30
|
+
*
|
|
31
|
+
* Slot `submenu`: a `slot="submenu"` child replaces the submenu of the section currently shown (settings, employees,
|
|
32
|
+
* exports). On settings and exports the submenu column then takes the child's size, so an empty child removes it. On
|
|
33
|
+
* employees the column keeps its width and its header above the child; the button for a new employee goes with the
|
|
34
|
+
* submenu. Without a child, pentacode shows its own submenu.
|
|
35
|
+
*/
|
|
36
|
+
export interface PentacodeAppElement extends HTMLElement {
|
|
37
|
+
/** pentacode-internal route shown, e.g. "roster" or "roster?venue=1"; mirrors the `route` attribute. */
|
|
38
|
+
get route(): string;
|
|
39
|
+
set route(route: PentacodeRouteTarget);
|
|
40
|
+
/** URL of an svg sprite with a `<symbol>` per icon token; icons it lacks come from the default sprite. */
|
|
41
|
+
iconSprite: string;
|
|
42
|
+
/** `light`, `dark` or `system` (the default): `system` follows `prefers-color-scheme`. */
|
|
43
|
+
colorScheme: string;
|
|
44
|
+
}
|
|
45
|
+
/** A route a host can navigate to, optionally with a `?query` and/or `#hash`; `""` shows the default page. */
|
|
46
|
+
export type PentacodeRouteTarget = "" | PentacodeRoute | `${PentacodeRoute}${"?" | "#"}${string}`;
|
|
47
|
+
/** A route `<pentacode-app>` can show; set it as `route`, optionally with a `?query`. */
|
|
48
|
+
export type PentacodeRoute = "employees" | `employees/${number}` | `employees/${number}/absences` | `employees/${number}/availabilities` | `employees/${number}/bonuses-balance` | `employees/${number}/contracts` | `employees/${number}/core-data` | `employees/${number}/documents` | `employees/${number}/ledgers` | `employees/${number}/payroll-data` | `employees/${number}/permissions` | `employees/${number}/positions` | `employees/${number}/time` | `employees/${number}/time-balance` | `employees/${number}/vacation-balance` | "employees/all" | "employees/all/absences" | "employees/all/availabilities" | "employees/all/bonuses-balance" | "employees/all/contracts" | "employees/all/core-data" | "employees/all/documents" | "employees/all/ledgers-month" | "employees/all/ledgers-year" | "employees/all/permissions" | "employees/all/positions" | "employees/all/time" | "employees/all/time-balance" | "employees/all/vacation-balance" | "exports" | "exports/balances-average-work-time-excel" | "exports/balances-bonuses-excel" | "exports/balances-overtime-excel" | "exports/balances-time-excel" | "exports/balances-vacation-excel" | "exports/employee-data-csv" | "exports/employee-data-pdf" | "exports/employee-table-excel" | "exports/payroll-addison" | "exports/payroll-agenda" | "exports/payroll-agenda-calendar" | "exports/payroll-agenda-employee-core-data" | "exports/payroll-bmd" | "exports/payroll-bmd-absences" | "exports/payroll-datev-lg" | "exports/payroll-datev-lodas" | "exports/payroll-lexware" | "exports/payroll-lohn-ag" | "exports/payroll-report-detailed" | "exports/payroll-report-overview" | "exports/payroll-sage" | "exports/roster-excel" | "exports/time-sheet" | "issues" | "recruiting" | "roster" | "settings" | "settings/account" | "settings/ai-assistant" | "settings/benefits" | "settings/bonuses" | "settings/company" | "settings/core-data" | "settings/documents" | "settings/time" | "settings/venues" | "time";
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
"pentacode-app": PentacodeAppElement;
|
|
52
|
+
}
|
|
53
|
+
/** pentacode's events. All bubble and are composed, so hosts can listen on any ancestor. */
|
|
54
|
+
interface HTMLElementEventMap {
|
|
55
|
+
[ROUTE_CHANGE_EVENT]: CustomEvent<PentacodeRouteChangeDetail>;
|
|
56
|
+
[READY_EVENT]: CustomEvent<void>;
|
|
57
|
+
[ERROR_EVENT]: CustomEvent<PentacodeErrorDetail>;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Fired whenever the embedded pentacode app navigates internally. */
|
|
2
|
+
export const ROUTE_CHANGE_EVENT = "pentacode-route-change";
|
|
3
|
+
/** Fired once the embedded app finished mounting and is interactive. */
|
|
4
|
+
export const READY_EVENT = "pentacode-ready";
|
|
5
|
+
/** Fired on load, mount or auth failures. */
|
|
6
|
+
export const ERROR_EVENT = "pentacode-error";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Every semantic icon token, straight from `packages/ui/src/tokens/icons/<concept>.tokens.json`. */
|
|
2
|
+
export declare const ICON_NAMES: readonly ["icon.action.add", "icon.action.add-employee", "icon.action.add-image", "icon.action.add-note", "icon.action.add:active", "icon.action.adjust-settings", "icon.action.apply", "icon.action.apply-template", "icon.action.archive", "icon.action.attach", "icon.action.auto-assign", "icon.action.autosize-all-columns", "icon.action.autosize-all-columns:active", "icon.action.autosize-column", "icon.action.autosize-column:active", "icon.action.backspace", "icon.action.book-advance", "icon.action.choose-file", "icon.action.choose-image", "icon.action.claim-shift", "icon.action.clear", "icon.action.close", "icon.action.configure-view", "icon.action.confirm", "icon.action.contact-support", "icon.action.copy", "icon.action.copy-to-clipboard", "icon.action.delete", "icon.action.delete-employee", "icon.action.disconnect", "icon.action.dismiss-employee", "icon.action.download", "icon.action.drag", "icon.action.duplicate", "icon.action.edit", "icon.action.edit-document", "icon.action.end-shift", "icon.action.end-shift:active", "icon.action.export", "icon.action.filter", "icon.action.finalize", "icon.action.generate-wage-types", "icon.action.help", "icon.action.hire", "icon.action.hire-applicant", "icon.action.import", "icon.action.leave-shift", "icon.action.link", "icon.action.lock", "icon.action.log-out", "icon.action.minimize", "icon.action.move-down", "icon.action.move-item-down", "icon.action.move-item-up", "icon.action.move-up", "icon.action.offer-shift", "icon.action.open", "icon.action.open-in-tab", "icon.action.open-in-window", "icon.action.pay-out", "icon.action.picture-in-picture", "icon.action.pin", "icon.action.pin:active", "icon.action.print", "icon.action.publish", "icon.action.raise-salary", "icon.action.recalculate", "icon.action.refresh", "icon.action.regenerate", "icon.action.rehire", "icon.action.reject-application", "icon.action.relocate", "icon.action.remove", "icon.action.remove-contact", "icon.action.reorder", "icon.action.report-child-sick", "icon.action.report-sick", "icon.action.reset", "icon.action.resolve", "icon.action.restore", "icon.action.retake-photo", "icon.action.save", "icon.action.scan-code", "icon.action.search", "icon.action.send-chat", "icon.action.send-feedback", "icon.action.send-feedback:active", "icon.action.send-message", "icon.action.set-password", "icon.action.share", "icon.action.show-all", "icon.action.show-more", "icon.action.show-on-map", "icon.action.show-options", "icon.action.show-options:active", "icon.action.sort-ascending", "icon.action.sort-ascending:active", "icon.action.sort-descending", "icon.action.sort-descending:active", "icon.action.split", "icon.action.start-shift", "icon.action.start-shift:active", "icon.action.stop-generation", "icon.action.switch-company", "icon.action.take-photo", "icon.action.terminate", "icon.action.undo", "icon.action.unlock", "icon.action.upload", "icon.action.view", "icon.communication.chat", "icon.communication.email", "icon.communication.message", "icon.communication.phone", "icon.communication.push-notification", "icon.event.anniversary", "icon.event.birthday", "icon.event.christmas-eve", "icon.event.holiday", "icon.event.school-holiday", "icon.event.sunday", "icon.event.year-end", "icon.feature.ai-assistant", "icon.feature.ai-assistant:active", "icon.feature.contracts", "icon.feature.dashboard", "icon.feature.dashboard:active", "icon.feature.employees", "icon.feature.employees:active", "icon.feature.exports", "icon.feature.exports:active", "icon.feature.issues", "icon.feature.issues:active", "icon.feature.job-postings", "icon.feature.planning", "icon.feature.planning:active", "icon.feature.recruiting", "icon.feature.recruiting:active", "icon.feature.reports", "icon.feature.reports:active", "icon.feature.revenues", "icon.feature.revenues:active", "icon.feature.roster", "icon.feature.roster:active", "icon.feature.settings", "icon.feature.settings:active", "icon.feature.time-tracking", "icon.feature.time-tracking:active", "icon.file.archive", "icon.file.collection", "icon.file.collection:active", "icon.file.csv", "icon.file.csv:active", "icon.file.document", "icon.file.excel", "icon.file.excel:active", "icon.file.image", "icon.file.none", "icon.file.payroll", "icon.file.payroll:active", "icon.file.pdf", "icon.file.pdf:active", "icon.file.plain-text", "icon.file.spreadsheet", "icon.file.text", "icon.format.bold", "icon.format.bullet-list", "icon.format.emoji", "icon.format.heading", "icon.format.italic", "icon.format.paragraph", "icon.navigation.appearance", "icon.navigation.back", "icon.navigation.documentation", "icon.navigation.dropdown", "icon.navigation.external-link", "icon.navigation.forward", "icon.navigation.scroll-down", "icon.navigation.shortcut", "icon.navigation.step-down", "icon.navigation.step-up", "icon.navigation.support", "icon.navigation.up", "icon.object.absence", "icon.object.absence-day", "icon.object.absence:active", "icon.object.account", "icon.object.account:active", "icon.object.accounting", "icon.object.accounting:active", "icon.object.address", "icon.object.analysis", "icon.object.api-source", "icon.object.application-photo", "icon.object.bank-deposit", "icon.object.bank-deposit:active", "icon.object.benefit", "icon.object.benefit:active", "icon.object.bonus", "icon.object.bonus-taxable", "icon.object.bonus:active", "icon.object.booking", "icon.object.break", "icon.object.break:active", "icon.object.cash-count", "icon.object.cash-count:active", "icon.object.cashbook", "icon.object.cashbook:active", "icon.object.category", "icon.object.chart", "icon.object.clocked-time", "icon.object.comment", "icon.object.comment:active", "icon.object.common-workday", "icon.object.company", "icon.object.company:active", "icon.object.contract", "icon.object.contract:active", "icon.object.cost-center", "icon.object.count", "icon.object.currency", "icon.object.currency:active", "icon.object.daily-closing", "icon.object.daily-closing:active", "icon.object.data-table", "icon.object.date", "icon.object.date-range", "icon.object.day-of-shift-start", "icon.object.day-view", "icon.object.department", "icon.object.department-group", "icon.object.device-desktop", "icon.object.device-tablet", "icon.object.divided-by", "icon.object.divider", "icon.object.duration", "icon.object.employee", "icon.object.employee-group", "icon.object.employee-group:active", "icon.object.employee:active", "icon.object.equals", "icon.object.expense", "icon.object.expense:active", "icon.object.following-day", "icon.object.form", "icon.object.global-scope", "icon.object.global-scope:active", "icon.object.history", "icon.object.hours-summary", "icon.object.info", "icon.object.integration", "icon.object.invoice", "icon.object.invoice:active", "icon.object.labour-cost", "icon.object.labour-cost:active", "icon.object.license-lite", "icon.object.license-pro", "icon.object.location", "icon.object.master-data", "icon.object.master-data:active", "icon.object.meal", "icon.object.meal-breakfast", "icon.object.meal-dinner", "icon.object.meal-lunch", "icon.object.mobile-app", "icon.object.mobile-app:active", "icon.object.multiplier", "icon.object.night-shift", "icon.object.note", "icon.object.note:active", "icon.object.overview", "icon.object.overview:active", "icon.object.pay-advance", "icon.object.pay-advance:active", "icon.object.payment-method", "icon.object.payment-method:active", "icon.object.payroll-report", "icon.object.percentage", "icon.object.permissions", "icon.object.permissions:active", "icon.object.position", "icon.object.position:active", "icon.object.posting-key", "icon.object.productivity", "icon.object.proof-photo", "icon.object.range-separator", "icon.object.receivable", "icon.object.receivable:active", "icon.object.recruiting", "icon.object.recruiting:active", "icon.object.responsibility", "icon.object.revenue", "icon.object.revenue-adjustment", "icon.object.revenue-adjustment:active", "icon.object.revenue-allocation", "icon.object.revenue-allocation:active", "icon.object.revenue-group", "icon.object.revenue-group:active", "icon.object.revenue-other", "icon.object.revenue-other:active", "icon.object.revenue-overview", "icon.object.revenue-overview:active", "icon.object.revenue:active", "icon.object.rules", "icon.object.salary", "icon.object.saved-range", "icon.object.savings", "icon.object.sign-minus", "icon.object.sign-plus", "icon.object.source", "icon.object.staff-number", "icon.object.subtask", "icon.object.suggestion", "icon.object.suggestion:active", "icon.object.support-tools", "icon.object.tag", "icon.object.target-hours", "icon.object.task", "icon.object.time", "icon.object.time-balance", "icon.object.time-balance:active", "icon.object.time-history", "icon.object.time-log", "icon.object.total", "icon.object.total:active", "icon.object.trend-down", "icon.object.trend-up", "icon.object.vacation-balance", "icon.object.venue", "icon.object.venue:active", "icon.object.wage-item", "icon.object.weather", "icon.object.work-area", "icon.object.work-area:active", "icon.object.working-hours", "icon.object.working-hours:active", "icon.planning.availability", "icon.planning.availability:active", "icon.planning.roster-tabs", "icon.planning.schedule", "icon.planning.shift", "icon.planning.shift-countdown", "icon.planning.shift-end", "icon.planning.shift-spontaneous", "icon.planning.shift-start", "icon.planning.staffing-target", "icon.planning.staffing-target:active", "icon.planning.vacation-request", "icon.role.manager", "icon.role.manager:active", "icon.role.owner", "icon.role.staff", "icon.status.access-denied", "icon.status.access-granted", "icon.status.active", "icon.status.added", "icon.status.all-clear", "icon.status.approved", "icon.status.approved:active", "icon.status.available", "icon.status.blocked", "icon.status.draft", "icon.status.edited", "icon.status.email-sent", "icon.status.employed", "icon.status.employment-ended", "icon.status.empty", "icon.status.error", "icon.status.error:active", "icon.status.failed", "icon.status.failed:active", "icon.status.info", "icon.status.info:active", "icon.status.live", "icon.status.loading", "icon.status.locked", "icon.status.no-shift", "icon.status.none-chosen", "icon.status.not-connected", "icon.status.nothing-selected", "icon.status.offline", "icon.status.online", "icon.status.paused", "icon.status.pending", "icon.status.preferred", "icon.status.probation", "icon.status.probation-ending", "icon.status.probation-period", "icon.status.question", "icon.status.refunded", "icon.status.rejected", "icon.status.rejected:active", "icon.status.removed", "icon.status.retired", "icon.status.selected-nested", "icon.status.success", "icon.status.success:active", "icon.status.swapped", "icon.status.syncing", "icon.status.unassigned", "icon.status.unassigned:active", "icon.status.unavailable", "icon.status.unknown", "icon.status.unpreferred", "icon.status.unsafe", "icon.status.unsupported-display", "icon.status.update-available", "icon.status.verified", "icon.status.warning", "icon.status.warning:active", "icon.time-entry.adjustment", "icon.time-entry.adjustment:active", "icon.time-entry.child-sick", "icon.time-entry.child-sick:active", "icon.time-entry.comp-day", "icon.time-entry.comp-day:active", "icon.time-entry.free", "icon.time-entry.free:active", "icon.time-entry.sick", "icon.time-entry.sick:active", "icon.time-entry.vacation", "icon.time-entry.vacation:active", "icon.time-entry.work", "icon.time-entry.work:active", "icon.toggle.ancillary-costs", "icon.toggle.average", "icon.toggle.collapse-note", "icon.toggle.color-scheme", "icon.toggle.density-compact", "icon.toggle.density-compact:active", "icon.toggle.density-minimal", "icon.toggle.density-minimal:active", "icon.toggle.density-normal", "icon.toggle.density-normal:active", "icon.toggle.expand", "icon.toggle.expand-active", "icon.toggle.expand-note", "icon.toggle.favorite", "icon.toggle.microphone", "icon.toggle.microphone-active", "icon.toggle.microphone-active:active", "icon.toggle.microphone:active", "icon.toggle.select-all", "icon.toggle.select-none", "icon.toggle.show-less", "icon.toggle.show-more", "icon.toggle.suggestions", "icon.toggle.suggestions-hidden", "icon.toggle.visibility", "icon.toggle.visibility-hidden"];
|
|
3
|
+
/** A semantic icon token id, `icon.<concept>.<role>` or `icon.<concept>.<role>:active`. */
|
|
4
|
+
export type IconName = (typeof ICON_NAMES)[number];
|
|
5
|
+
/** The names whose `:active` variant exists. */
|
|
6
|
+
export type ActivatableIconName = {
|
|
7
|
+
[Name in IconName]: `${Name}:active` extends IconName ? Name : never;
|
|
8
|
+
}[IconName];
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
// generated by `pnpm -F @pentacode/ui run tokens:build` — edit packages/ui/src/tokens/icons/ instead
|
|
2
|
+
/** Every semantic icon token, straight from `packages/ui/src/tokens/icons/<concept>.tokens.json`. */
|
|
3
|
+
export const ICON_NAMES = [
|
|
4
|
+
"icon.action.add",
|
|
5
|
+
"icon.action.add-employee",
|
|
6
|
+
"icon.action.add-image",
|
|
7
|
+
"icon.action.add-note",
|
|
8
|
+
"icon.action.add:active",
|
|
9
|
+
"icon.action.adjust-settings",
|
|
10
|
+
"icon.action.apply",
|
|
11
|
+
"icon.action.apply-template",
|
|
12
|
+
"icon.action.archive",
|
|
13
|
+
"icon.action.attach",
|
|
14
|
+
"icon.action.auto-assign",
|
|
15
|
+
"icon.action.autosize-all-columns",
|
|
16
|
+
"icon.action.autosize-all-columns:active",
|
|
17
|
+
"icon.action.autosize-column",
|
|
18
|
+
"icon.action.autosize-column:active",
|
|
19
|
+
"icon.action.backspace",
|
|
20
|
+
"icon.action.book-advance",
|
|
21
|
+
"icon.action.choose-file",
|
|
22
|
+
"icon.action.choose-image",
|
|
23
|
+
"icon.action.claim-shift",
|
|
24
|
+
"icon.action.clear",
|
|
25
|
+
"icon.action.close",
|
|
26
|
+
"icon.action.configure-view",
|
|
27
|
+
"icon.action.confirm",
|
|
28
|
+
"icon.action.contact-support",
|
|
29
|
+
"icon.action.copy",
|
|
30
|
+
"icon.action.copy-to-clipboard",
|
|
31
|
+
"icon.action.delete",
|
|
32
|
+
"icon.action.delete-employee",
|
|
33
|
+
"icon.action.disconnect",
|
|
34
|
+
"icon.action.dismiss-employee",
|
|
35
|
+
"icon.action.download",
|
|
36
|
+
"icon.action.drag",
|
|
37
|
+
"icon.action.duplicate",
|
|
38
|
+
"icon.action.edit",
|
|
39
|
+
"icon.action.edit-document",
|
|
40
|
+
"icon.action.end-shift",
|
|
41
|
+
"icon.action.end-shift:active",
|
|
42
|
+
"icon.action.export",
|
|
43
|
+
"icon.action.filter",
|
|
44
|
+
"icon.action.finalize",
|
|
45
|
+
"icon.action.generate-wage-types",
|
|
46
|
+
"icon.action.help",
|
|
47
|
+
"icon.action.hire",
|
|
48
|
+
"icon.action.hire-applicant",
|
|
49
|
+
"icon.action.import",
|
|
50
|
+
"icon.action.leave-shift",
|
|
51
|
+
"icon.action.link",
|
|
52
|
+
"icon.action.lock",
|
|
53
|
+
"icon.action.log-out",
|
|
54
|
+
"icon.action.minimize",
|
|
55
|
+
"icon.action.move-down",
|
|
56
|
+
"icon.action.move-item-down",
|
|
57
|
+
"icon.action.move-item-up",
|
|
58
|
+
"icon.action.move-up",
|
|
59
|
+
"icon.action.offer-shift",
|
|
60
|
+
"icon.action.open",
|
|
61
|
+
"icon.action.open-in-tab",
|
|
62
|
+
"icon.action.open-in-window",
|
|
63
|
+
"icon.action.pay-out",
|
|
64
|
+
"icon.action.picture-in-picture",
|
|
65
|
+
"icon.action.pin",
|
|
66
|
+
"icon.action.pin:active",
|
|
67
|
+
"icon.action.print",
|
|
68
|
+
"icon.action.publish",
|
|
69
|
+
"icon.action.raise-salary",
|
|
70
|
+
"icon.action.recalculate",
|
|
71
|
+
"icon.action.refresh",
|
|
72
|
+
"icon.action.regenerate",
|
|
73
|
+
"icon.action.rehire",
|
|
74
|
+
"icon.action.reject-application",
|
|
75
|
+
"icon.action.relocate",
|
|
76
|
+
"icon.action.remove",
|
|
77
|
+
"icon.action.remove-contact",
|
|
78
|
+
"icon.action.reorder",
|
|
79
|
+
"icon.action.report-child-sick",
|
|
80
|
+
"icon.action.report-sick",
|
|
81
|
+
"icon.action.reset",
|
|
82
|
+
"icon.action.resolve",
|
|
83
|
+
"icon.action.restore",
|
|
84
|
+
"icon.action.retake-photo",
|
|
85
|
+
"icon.action.save",
|
|
86
|
+
"icon.action.scan-code",
|
|
87
|
+
"icon.action.search",
|
|
88
|
+
"icon.action.send-chat",
|
|
89
|
+
"icon.action.send-feedback",
|
|
90
|
+
"icon.action.send-feedback:active",
|
|
91
|
+
"icon.action.send-message",
|
|
92
|
+
"icon.action.set-password",
|
|
93
|
+
"icon.action.share",
|
|
94
|
+
"icon.action.show-all",
|
|
95
|
+
"icon.action.show-more",
|
|
96
|
+
"icon.action.show-on-map",
|
|
97
|
+
"icon.action.show-options",
|
|
98
|
+
"icon.action.show-options:active",
|
|
99
|
+
"icon.action.sort-ascending",
|
|
100
|
+
"icon.action.sort-ascending:active",
|
|
101
|
+
"icon.action.sort-descending",
|
|
102
|
+
"icon.action.sort-descending:active",
|
|
103
|
+
"icon.action.split",
|
|
104
|
+
"icon.action.start-shift",
|
|
105
|
+
"icon.action.start-shift:active",
|
|
106
|
+
"icon.action.stop-generation",
|
|
107
|
+
"icon.action.switch-company",
|
|
108
|
+
"icon.action.take-photo",
|
|
109
|
+
"icon.action.terminate",
|
|
110
|
+
"icon.action.undo",
|
|
111
|
+
"icon.action.unlock",
|
|
112
|
+
"icon.action.upload",
|
|
113
|
+
"icon.action.view",
|
|
114
|
+
"icon.communication.chat",
|
|
115
|
+
"icon.communication.email",
|
|
116
|
+
"icon.communication.message",
|
|
117
|
+
"icon.communication.phone",
|
|
118
|
+
"icon.communication.push-notification",
|
|
119
|
+
"icon.event.anniversary",
|
|
120
|
+
"icon.event.birthday",
|
|
121
|
+
"icon.event.christmas-eve",
|
|
122
|
+
"icon.event.holiday",
|
|
123
|
+
"icon.event.school-holiday",
|
|
124
|
+
"icon.event.sunday",
|
|
125
|
+
"icon.event.year-end",
|
|
126
|
+
"icon.feature.ai-assistant",
|
|
127
|
+
"icon.feature.ai-assistant:active",
|
|
128
|
+
"icon.feature.contracts",
|
|
129
|
+
"icon.feature.dashboard",
|
|
130
|
+
"icon.feature.dashboard:active",
|
|
131
|
+
"icon.feature.employees",
|
|
132
|
+
"icon.feature.employees:active",
|
|
133
|
+
"icon.feature.exports",
|
|
134
|
+
"icon.feature.exports:active",
|
|
135
|
+
"icon.feature.issues",
|
|
136
|
+
"icon.feature.issues:active",
|
|
137
|
+
"icon.feature.job-postings",
|
|
138
|
+
"icon.feature.planning",
|
|
139
|
+
"icon.feature.planning:active",
|
|
140
|
+
"icon.feature.recruiting",
|
|
141
|
+
"icon.feature.recruiting:active",
|
|
142
|
+
"icon.feature.reports",
|
|
143
|
+
"icon.feature.reports:active",
|
|
144
|
+
"icon.feature.revenues",
|
|
145
|
+
"icon.feature.revenues:active",
|
|
146
|
+
"icon.feature.roster",
|
|
147
|
+
"icon.feature.roster:active",
|
|
148
|
+
"icon.feature.settings",
|
|
149
|
+
"icon.feature.settings:active",
|
|
150
|
+
"icon.feature.time-tracking",
|
|
151
|
+
"icon.feature.time-tracking:active",
|
|
152
|
+
"icon.file.archive",
|
|
153
|
+
"icon.file.collection",
|
|
154
|
+
"icon.file.collection:active",
|
|
155
|
+
"icon.file.csv",
|
|
156
|
+
"icon.file.csv:active",
|
|
157
|
+
"icon.file.document",
|
|
158
|
+
"icon.file.excel",
|
|
159
|
+
"icon.file.excel:active",
|
|
160
|
+
"icon.file.image",
|
|
161
|
+
"icon.file.none",
|
|
162
|
+
"icon.file.payroll",
|
|
163
|
+
"icon.file.payroll:active",
|
|
164
|
+
"icon.file.pdf",
|
|
165
|
+
"icon.file.pdf:active",
|
|
166
|
+
"icon.file.plain-text",
|
|
167
|
+
"icon.file.spreadsheet",
|
|
168
|
+
"icon.file.text",
|
|
169
|
+
"icon.format.bold",
|
|
170
|
+
"icon.format.bullet-list",
|
|
171
|
+
"icon.format.emoji",
|
|
172
|
+
"icon.format.heading",
|
|
173
|
+
"icon.format.italic",
|
|
174
|
+
"icon.format.paragraph",
|
|
175
|
+
"icon.navigation.appearance",
|
|
176
|
+
"icon.navigation.back",
|
|
177
|
+
"icon.navigation.documentation",
|
|
178
|
+
"icon.navigation.dropdown",
|
|
179
|
+
"icon.navigation.external-link",
|
|
180
|
+
"icon.navigation.forward",
|
|
181
|
+
"icon.navigation.scroll-down",
|
|
182
|
+
"icon.navigation.shortcut",
|
|
183
|
+
"icon.navigation.step-down",
|
|
184
|
+
"icon.navigation.step-up",
|
|
185
|
+
"icon.navigation.support",
|
|
186
|
+
"icon.navigation.up",
|
|
187
|
+
"icon.object.absence",
|
|
188
|
+
"icon.object.absence-day",
|
|
189
|
+
"icon.object.absence:active",
|
|
190
|
+
"icon.object.account",
|
|
191
|
+
"icon.object.account:active",
|
|
192
|
+
"icon.object.accounting",
|
|
193
|
+
"icon.object.accounting:active",
|
|
194
|
+
"icon.object.address",
|
|
195
|
+
"icon.object.analysis",
|
|
196
|
+
"icon.object.api-source",
|
|
197
|
+
"icon.object.application-photo",
|
|
198
|
+
"icon.object.bank-deposit",
|
|
199
|
+
"icon.object.bank-deposit:active",
|
|
200
|
+
"icon.object.benefit",
|
|
201
|
+
"icon.object.benefit:active",
|
|
202
|
+
"icon.object.bonus",
|
|
203
|
+
"icon.object.bonus-taxable",
|
|
204
|
+
"icon.object.bonus:active",
|
|
205
|
+
"icon.object.booking",
|
|
206
|
+
"icon.object.break",
|
|
207
|
+
"icon.object.break:active",
|
|
208
|
+
"icon.object.cash-count",
|
|
209
|
+
"icon.object.cash-count:active",
|
|
210
|
+
"icon.object.cashbook",
|
|
211
|
+
"icon.object.cashbook:active",
|
|
212
|
+
"icon.object.category",
|
|
213
|
+
"icon.object.chart",
|
|
214
|
+
"icon.object.clocked-time",
|
|
215
|
+
"icon.object.comment",
|
|
216
|
+
"icon.object.comment:active",
|
|
217
|
+
"icon.object.common-workday",
|
|
218
|
+
"icon.object.company",
|
|
219
|
+
"icon.object.company:active",
|
|
220
|
+
"icon.object.contract",
|
|
221
|
+
"icon.object.contract:active",
|
|
222
|
+
"icon.object.cost-center",
|
|
223
|
+
"icon.object.count",
|
|
224
|
+
"icon.object.currency",
|
|
225
|
+
"icon.object.currency:active",
|
|
226
|
+
"icon.object.daily-closing",
|
|
227
|
+
"icon.object.daily-closing:active",
|
|
228
|
+
"icon.object.data-table",
|
|
229
|
+
"icon.object.date",
|
|
230
|
+
"icon.object.date-range",
|
|
231
|
+
"icon.object.day-of-shift-start",
|
|
232
|
+
"icon.object.day-view",
|
|
233
|
+
"icon.object.department",
|
|
234
|
+
"icon.object.department-group",
|
|
235
|
+
"icon.object.device-desktop",
|
|
236
|
+
"icon.object.device-tablet",
|
|
237
|
+
"icon.object.divided-by",
|
|
238
|
+
"icon.object.divider",
|
|
239
|
+
"icon.object.duration",
|
|
240
|
+
"icon.object.employee",
|
|
241
|
+
"icon.object.employee-group",
|
|
242
|
+
"icon.object.employee-group:active",
|
|
243
|
+
"icon.object.employee:active",
|
|
244
|
+
"icon.object.equals",
|
|
245
|
+
"icon.object.expense",
|
|
246
|
+
"icon.object.expense:active",
|
|
247
|
+
"icon.object.following-day",
|
|
248
|
+
"icon.object.form",
|
|
249
|
+
"icon.object.global-scope",
|
|
250
|
+
"icon.object.global-scope:active",
|
|
251
|
+
"icon.object.history",
|
|
252
|
+
"icon.object.hours-summary",
|
|
253
|
+
"icon.object.info",
|
|
254
|
+
"icon.object.integration",
|
|
255
|
+
"icon.object.invoice",
|
|
256
|
+
"icon.object.invoice:active",
|
|
257
|
+
"icon.object.labour-cost",
|
|
258
|
+
"icon.object.labour-cost:active",
|
|
259
|
+
"icon.object.license-lite",
|
|
260
|
+
"icon.object.license-pro",
|
|
261
|
+
"icon.object.location",
|
|
262
|
+
"icon.object.master-data",
|
|
263
|
+
"icon.object.master-data:active",
|
|
264
|
+
"icon.object.meal",
|
|
265
|
+
"icon.object.meal-breakfast",
|
|
266
|
+
"icon.object.meal-dinner",
|
|
267
|
+
"icon.object.meal-lunch",
|
|
268
|
+
"icon.object.mobile-app",
|
|
269
|
+
"icon.object.mobile-app:active",
|
|
270
|
+
"icon.object.multiplier",
|
|
271
|
+
"icon.object.night-shift",
|
|
272
|
+
"icon.object.note",
|
|
273
|
+
"icon.object.note:active",
|
|
274
|
+
"icon.object.overview",
|
|
275
|
+
"icon.object.overview:active",
|
|
276
|
+
"icon.object.pay-advance",
|
|
277
|
+
"icon.object.pay-advance:active",
|
|
278
|
+
"icon.object.payment-method",
|
|
279
|
+
"icon.object.payment-method:active",
|
|
280
|
+
"icon.object.payroll-report",
|
|
281
|
+
"icon.object.percentage",
|
|
282
|
+
"icon.object.permissions",
|
|
283
|
+
"icon.object.permissions:active",
|
|
284
|
+
"icon.object.position",
|
|
285
|
+
"icon.object.position:active",
|
|
286
|
+
"icon.object.posting-key",
|
|
287
|
+
"icon.object.productivity",
|
|
288
|
+
"icon.object.proof-photo",
|
|
289
|
+
"icon.object.range-separator",
|
|
290
|
+
"icon.object.receivable",
|
|
291
|
+
"icon.object.receivable:active",
|
|
292
|
+
"icon.object.recruiting",
|
|
293
|
+
"icon.object.recruiting:active",
|
|
294
|
+
"icon.object.responsibility",
|
|
295
|
+
"icon.object.revenue",
|
|
296
|
+
"icon.object.revenue-adjustment",
|
|
297
|
+
"icon.object.revenue-adjustment:active",
|
|
298
|
+
"icon.object.revenue-allocation",
|
|
299
|
+
"icon.object.revenue-allocation:active",
|
|
300
|
+
"icon.object.revenue-group",
|
|
301
|
+
"icon.object.revenue-group:active",
|
|
302
|
+
"icon.object.revenue-other",
|
|
303
|
+
"icon.object.revenue-other:active",
|
|
304
|
+
"icon.object.revenue-overview",
|
|
305
|
+
"icon.object.revenue-overview:active",
|
|
306
|
+
"icon.object.revenue:active",
|
|
307
|
+
"icon.object.rules",
|
|
308
|
+
"icon.object.salary",
|
|
309
|
+
"icon.object.saved-range",
|
|
310
|
+
"icon.object.savings",
|
|
311
|
+
"icon.object.sign-minus",
|
|
312
|
+
"icon.object.sign-plus",
|
|
313
|
+
"icon.object.source",
|
|
314
|
+
"icon.object.staff-number",
|
|
315
|
+
"icon.object.subtask",
|
|
316
|
+
"icon.object.suggestion",
|
|
317
|
+
"icon.object.suggestion:active",
|
|
318
|
+
"icon.object.support-tools",
|
|
319
|
+
"icon.object.tag",
|
|
320
|
+
"icon.object.target-hours",
|
|
321
|
+
"icon.object.task",
|
|
322
|
+
"icon.object.time",
|
|
323
|
+
"icon.object.time-balance",
|
|
324
|
+
"icon.object.time-balance:active",
|
|
325
|
+
"icon.object.time-history",
|
|
326
|
+
"icon.object.time-log",
|
|
327
|
+
"icon.object.total",
|
|
328
|
+
"icon.object.total:active",
|
|
329
|
+
"icon.object.trend-down",
|
|
330
|
+
"icon.object.trend-up",
|
|
331
|
+
"icon.object.vacation-balance",
|
|
332
|
+
"icon.object.venue",
|
|
333
|
+
"icon.object.venue:active",
|
|
334
|
+
"icon.object.wage-item",
|
|
335
|
+
"icon.object.weather",
|
|
336
|
+
"icon.object.work-area",
|
|
337
|
+
"icon.object.work-area:active",
|
|
338
|
+
"icon.object.working-hours",
|
|
339
|
+
"icon.object.working-hours:active",
|
|
340
|
+
"icon.planning.availability",
|
|
341
|
+
"icon.planning.availability:active",
|
|
342
|
+
"icon.planning.roster-tabs",
|
|
343
|
+
"icon.planning.schedule",
|
|
344
|
+
"icon.planning.shift",
|
|
345
|
+
"icon.planning.shift-countdown",
|
|
346
|
+
"icon.planning.shift-end",
|
|
347
|
+
"icon.planning.shift-spontaneous",
|
|
348
|
+
"icon.planning.shift-start",
|
|
349
|
+
"icon.planning.staffing-target",
|
|
350
|
+
"icon.planning.staffing-target:active",
|
|
351
|
+
"icon.planning.vacation-request",
|
|
352
|
+
"icon.role.manager",
|
|
353
|
+
"icon.role.manager:active",
|
|
354
|
+
"icon.role.owner",
|
|
355
|
+
"icon.role.staff",
|
|
356
|
+
"icon.status.access-denied",
|
|
357
|
+
"icon.status.access-granted",
|
|
358
|
+
"icon.status.active",
|
|
359
|
+
"icon.status.added",
|
|
360
|
+
"icon.status.all-clear",
|
|
361
|
+
"icon.status.approved",
|
|
362
|
+
"icon.status.approved:active",
|
|
363
|
+
"icon.status.available",
|
|
364
|
+
"icon.status.blocked",
|
|
365
|
+
"icon.status.draft",
|
|
366
|
+
"icon.status.edited",
|
|
367
|
+
"icon.status.email-sent",
|
|
368
|
+
"icon.status.employed",
|
|
369
|
+
"icon.status.employment-ended",
|
|
370
|
+
"icon.status.empty",
|
|
371
|
+
"icon.status.error",
|
|
372
|
+
"icon.status.error:active",
|
|
373
|
+
"icon.status.failed",
|
|
374
|
+
"icon.status.failed:active",
|
|
375
|
+
"icon.status.info",
|
|
376
|
+
"icon.status.info:active",
|
|
377
|
+
"icon.status.live",
|
|
378
|
+
"icon.status.loading",
|
|
379
|
+
"icon.status.locked",
|
|
380
|
+
"icon.status.no-shift",
|
|
381
|
+
"icon.status.none-chosen",
|
|
382
|
+
"icon.status.not-connected",
|
|
383
|
+
"icon.status.nothing-selected",
|
|
384
|
+
"icon.status.offline",
|
|
385
|
+
"icon.status.online",
|
|
386
|
+
"icon.status.paused",
|
|
387
|
+
"icon.status.pending",
|
|
388
|
+
"icon.status.preferred",
|
|
389
|
+
"icon.status.probation",
|
|
390
|
+
"icon.status.probation-ending",
|
|
391
|
+
"icon.status.probation-period",
|
|
392
|
+
"icon.status.question",
|
|
393
|
+
"icon.status.refunded",
|
|
394
|
+
"icon.status.rejected",
|
|
395
|
+
"icon.status.rejected:active",
|
|
396
|
+
"icon.status.removed",
|
|
397
|
+
"icon.status.retired",
|
|
398
|
+
"icon.status.selected-nested",
|
|
399
|
+
"icon.status.success",
|
|
400
|
+
"icon.status.success:active",
|
|
401
|
+
"icon.status.swapped",
|
|
402
|
+
"icon.status.syncing",
|
|
403
|
+
"icon.status.unassigned",
|
|
404
|
+
"icon.status.unassigned:active",
|
|
405
|
+
"icon.status.unavailable",
|
|
406
|
+
"icon.status.unknown",
|
|
407
|
+
"icon.status.unpreferred",
|
|
408
|
+
"icon.status.unsafe",
|
|
409
|
+
"icon.status.unsupported-display",
|
|
410
|
+
"icon.status.update-available",
|
|
411
|
+
"icon.status.verified",
|
|
412
|
+
"icon.status.warning",
|
|
413
|
+
"icon.status.warning:active",
|
|
414
|
+
"icon.time-entry.adjustment",
|
|
415
|
+
"icon.time-entry.adjustment:active",
|
|
416
|
+
"icon.time-entry.child-sick",
|
|
417
|
+
"icon.time-entry.child-sick:active",
|
|
418
|
+
"icon.time-entry.comp-day",
|
|
419
|
+
"icon.time-entry.comp-day:active",
|
|
420
|
+
"icon.time-entry.free",
|
|
421
|
+
"icon.time-entry.free:active",
|
|
422
|
+
"icon.time-entry.sick",
|
|
423
|
+
"icon.time-entry.sick:active",
|
|
424
|
+
"icon.time-entry.vacation",
|
|
425
|
+
"icon.time-entry.vacation:active",
|
|
426
|
+
"icon.time-entry.work",
|
|
427
|
+
"icon.time-entry.work:active",
|
|
428
|
+
"icon.toggle.ancillary-costs",
|
|
429
|
+
"icon.toggle.average",
|
|
430
|
+
"icon.toggle.collapse-note",
|
|
431
|
+
"icon.toggle.color-scheme",
|
|
432
|
+
"icon.toggle.density-compact",
|
|
433
|
+
"icon.toggle.density-compact:active",
|
|
434
|
+
"icon.toggle.density-minimal",
|
|
435
|
+
"icon.toggle.density-minimal:active",
|
|
436
|
+
"icon.toggle.density-normal",
|
|
437
|
+
"icon.toggle.density-normal:active",
|
|
438
|
+
"icon.toggle.expand",
|
|
439
|
+
"icon.toggle.expand-active",
|
|
440
|
+
"icon.toggle.expand-note",
|
|
441
|
+
"icon.toggle.favorite",
|
|
442
|
+
"icon.toggle.microphone",
|
|
443
|
+
"icon.toggle.microphone-active",
|
|
444
|
+
"icon.toggle.microphone-active:active",
|
|
445
|
+
"icon.toggle.microphone:active",
|
|
446
|
+
"icon.toggle.select-all",
|
|
447
|
+
"icon.toggle.select-none",
|
|
448
|
+
"icon.toggle.show-less",
|
|
449
|
+
"icon.toggle.show-more",
|
|
450
|
+
"icon.toggle.suggestions",
|
|
451
|
+
"icon.toggle.suggestions-hidden",
|
|
452
|
+
"icon.toggle.visibility",
|
|
453
|
+
"icon.toggle.visibility-hidden",
|
|
454
|
+
];
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/load.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports pentacode's entry from `origin` (e.g. `https://manage.pentacode.app`) once, which registers
|
|
3
|
+
* `<pentacode-app>`. Elements rendered earlier upgrade as soon as it resolves. A rejected load stays rejected for the
|
|
4
|
+
* page's lifetime, so offer a reload rather than a retry.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadPentacode(origin: string): Promise<void>;
|
package/dist/load.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const ENTRY_PATH = "/embed/pentacode.js";
|
|
2
|
+
const loads = new Map();
|
|
3
|
+
/**
|
|
4
|
+
* Imports pentacode's entry from `origin` (e.g. `https://manage.pentacode.app`) once, which registers
|
|
5
|
+
* `<pentacode-app>`. Elements rendered earlier upgrade as soon as it resolves. A rejected load stays rejected for the
|
|
6
|
+
* page's lifetime, so offer a reload rather than a retry.
|
|
7
|
+
*/
|
|
8
|
+
export function loadPentacode(origin) {
|
|
9
|
+
let url;
|
|
10
|
+
try {
|
|
11
|
+
url = new URL(ENTRY_PATH, origin).href;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return Promise.reject(error);
|
|
15
|
+
}
|
|
16
|
+
let load = loads.get(url);
|
|
17
|
+
if (!load) {
|
|
18
|
+
load = import(/* @vite-ignore */ /* webpackIgnore: true */ url).then(() => undefined);
|
|
19
|
+
loads.set(url, load);
|
|
20
|
+
}
|
|
21
|
+
return load;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePentacodeApp, } from "./use-pentacode-app.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
|
2
|
+
import type { PentacodeAppElement, PentacodeErrorDetail, PentacodeRouteChangeDetail, PentacodeRouteTarget } from "../api.js";
|
|
3
|
+
export interface PentacodeAppProps extends DetailedHTMLProps<HTMLAttributes<PentacodeAppElement>, PentacodeAppElement> {
|
|
4
|
+
route?: PentacodeRouteTarget;
|
|
5
|
+
"icon-sprite"?: string;
|
|
6
|
+
"color-scheme"?: "light" | "dark" | "system";
|
|
7
|
+
"onpentacode-route-change"?: (event: CustomEvent<PentacodeRouteChangeDetail>) => void;
|
|
8
|
+
"onpentacode-ready"?: (event: CustomEvent<void>) => void;
|
|
9
|
+
"onpentacode-error"?: (event: CustomEvent<PentacodeErrorDetail>) => void;
|
|
10
|
+
}
|
|
11
|
+
declare module "react" {
|
|
12
|
+
namespace JSX {
|
|
13
|
+
interface IntrinsicElements {
|
|
14
|
+
"pentacode-app": PentacodeAppProps;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PentacodeErrorDetail } from "../api.js";
|
|
2
|
+
import type { PentacodeAppProps } from "./jsx.js";
|
|
3
|
+
export type PentacodeAppStatus = {
|
|
4
|
+
state: "loading";
|
|
5
|
+
} | {
|
|
6
|
+
state: "ready";
|
|
7
|
+
} | {
|
|
8
|
+
state: "error";
|
|
9
|
+
message: string;
|
|
10
|
+
cause?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export interface UsePentacodeAppOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The pentacode origin to load the entry from, e.g. `https://manage.pentacode.app`. Fixed once pentacode runs: a
|
|
15
|
+
* new origin only takes effect after a failed load.
|
|
16
|
+
*/
|
|
17
|
+
origin: string;
|
|
18
|
+
/** pentacode navigated itself: navigate your router, replacing the history entry when `replace` is true. */
|
|
19
|
+
onRouteChange(route: string, replace: boolean): void;
|
|
20
|
+
/** A `pentacode-error` with `fatal: false`; the app keeps running. */
|
|
21
|
+
onWarning?(detail: PentacodeErrorDetail): void;
|
|
22
|
+
}
|
|
23
|
+
export interface UsePentacodeApp {
|
|
24
|
+
/** `loading` until `pentacode-ready`, `error` after a failed load or a fatal `pentacode-error`. */
|
|
25
|
+
status: PentacodeAppStatus;
|
|
26
|
+
/** Listeners to spread onto `<pentacode-app>`. */
|
|
27
|
+
props: Pick<PentacodeAppProps, "onpentacode-ready" | "onpentacode-route-change" | "onpentacode-error">;
|
|
28
|
+
}
|
|
29
|
+
/** Loads pentacode and tracks `<pentacode-app>`'s status; spread `props` onto the element. */
|
|
30
|
+
export declare function usePentacodeApp(options: UsePentacodeAppOptions): UsePentacodeApp;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { loadPentacode } from "../load.js";
|
|
3
|
+
/** Loads pentacode and tracks `<pentacode-app>`'s status; spread `props` onto the element. */
|
|
4
|
+
export function usePentacodeApp(options) {
|
|
5
|
+
const [status, setStatus] = useState({ state: "loading" });
|
|
6
|
+
const latest = useRef(options);
|
|
7
|
+
latest.current = options;
|
|
8
|
+
const previousOrigin = useRef(options.origin);
|
|
9
|
+
const currentStatus = useRef(status);
|
|
10
|
+
currentStatus.current = status;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (previousOrigin.current !== options.origin) {
|
|
13
|
+
previousOrigin.current = options.origin;
|
|
14
|
+
if (currentStatus.current.state === "ready") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setStatus({ state: "loading" });
|
|
18
|
+
}
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
loadPentacode(options.origin).catch((cause) => {
|
|
21
|
+
if (!cancelled) {
|
|
22
|
+
setStatus({ state: "error", message: String(cause), cause });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
cancelled = true;
|
|
27
|
+
};
|
|
28
|
+
}, [options.origin]);
|
|
29
|
+
const props = useMemo(() => ({
|
|
30
|
+
"onpentacode-ready": () => setStatus({ state: "ready" }),
|
|
31
|
+
"onpentacode-route-change": ({ detail }) => latest.current.onRouteChange(detail.route, detail.replace ?? false),
|
|
32
|
+
"onpentacode-error": ({ detail }) => {
|
|
33
|
+
if (detail.fatal) {
|
|
34
|
+
setStatus({ state: "error", message: detail.message, cause: detail.cause });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
latest.current.onWarning?.(detail);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
}), []);
|
|
41
|
+
return { status, props };
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PentacodeRoute, PentacodeRouteTarget } from "./api.js";
|
|
2
|
+
export interface PentacodeRouteMap {
|
|
3
|
+
/** Host paths that render pentacode; each also covers its subpaths. */
|
|
4
|
+
hostPaths: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Host path (with `?query#hash`) → pentacode route, or null where pentacode doesn't render. Deeper segments pass
|
|
7
|
+
* through unchecked: a route pentacode doesn't have shows its no-access page and fires `route-denied`.
|
|
8
|
+
*/
|
|
9
|
+
toPentacode(hostPath: string): PentacodeRouteTarget | null;
|
|
10
|
+
/** Pentacode route (with `?query#hash`) → host path, for `pentacode-route-change`. */
|
|
11
|
+
toHost(pentacodeRoute: string): string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Two-way mapping between host paths and pentacode routes.
|
|
15
|
+
*
|
|
16
|
+
* @param routes host path → pentacode route, e.g. `{ "/dienstplan": "roster" }`. Deeper segments pass through:
|
|
17
|
+
* `/dienstplan/42` ↔ `roster/42`. Of nested entries, the fallback included, the longer one wins.
|
|
18
|
+
* @param fallback host path for pentacode routes without an entry: pentacode's own route is appended to it.
|
|
19
|
+
* @throws if a host path doesn't start with `/`, or two host paths, the fallback included, are the same once trailing
|
|
20
|
+
* slashes are dropped. `toHost` throws for a route whose host path another entry maps.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createRouteMap(routes: Record<string, PentacodeRoute>, fallback: string): PentacodeRouteMap;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two-way mapping between host paths and pentacode routes.
|
|
3
|
+
*
|
|
4
|
+
* @param routes host path → pentacode route, e.g. `{ "/dienstplan": "roster" }`. Deeper segments pass through:
|
|
5
|
+
* `/dienstplan/42` ↔ `roster/42`. Of nested entries, the fallback included, the longer one wins.
|
|
6
|
+
* @param fallback host path for pentacode routes without an entry: pentacode's own route is appended to it.
|
|
7
|
+
* @throws if a host path doesn't start with `/`, or two host paths, the fallback included, are the same once trailing
|
|
8
|
+
* slashes are dropped. `toHost` throws for a route whose host path another entry maps.
|
|
9
|
+
*/
|
|
10
|
+
export function createRouteMap(routes, fallback) {
|
|
11
|
+
for (const host of [...Object.keys(routes), fallback]) {
|
|
12
|
+
if (!host.startsWith("/")) {
|
|
13
|
+
throw new Error(`createRouteMap: host path "${host}" must start with "/"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const fallbackPath = normalize(fallback);
|
|
17
|
+
const entries = Object.entries(routes).map(([host, route]) => [normalize(host), route]);
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
for (const host of [...entries.map(([host]) => host), fallbackPath]) {
|
|
20
|
+
if (seen.has(host)) {
|
|
21
|
+
throw new Error(`createRouteMap: host path "${host || "/"}" is mapped twice`);
|
|
22
|
+
}
|
|
23
|
+
seen.add(host);
|
|
24
|
+
}
|
|
25
|
+
const byHost = [...entries, [fallbackPath, null]].sort(([a], [b]) => b.length - a.length);
|
|
26
|
+
const byPentacode = [...entries].sort(([, a], [, b]) => b.length - a.length);
|
|
27
|
+
function toPentacode(hostPath) {
|
|
28
|
+
const [path, suffix] = splitSuffix(hostPath);
|
|
29
|
+
for (const [host, route] of byHost) {
|
|
30
|
+
const rest = restOf(normalize(path), host);
|
|
31
|
+
if (rest !== null) {
|
|
32
|
+
return ((route === null ? rest.slice(1) : route + rest) + suffix);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function toHost(pentacodeRoute) {
|
|
38
|
+
const [path, suffix] = splitSuffix(pentacodeRoute);
|
|
39
|
+
const host = hostPathOf(path) + suffix;
|
|
40
|
+
if (toPentacode(host) !== trimSlash(path) + suffix) {
|
|
41
|
+
throw new Error(`createRouteMap: "${pentacodeRoute}" would go to "${host}", which another host path maps`);
|
|
42
|
+
}
|
|
43
|
+
return host;
|
|
44
|
+
}
|
|
45
|
+
function hostPathOf(path) {
|
|
46
|
+
for (const [host, route] of byPentacode) {
|
|
47
|
+
const rest = restOf(path, route);
|
|
48
|
+
if (rest !== null) {
|
|
49
|
+
return host + rest || "/";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return path ? `${fallbackPath}/${path}` : fallbackPath || "/";
|
|
53
|
+
}
|
|
54
|
+
return { hostPaths: [...entries.map(([host]) => host || "/"), fallbackPath || "/"], toPentacode, toHost };
|
|
55
|
+
}
|
|
56
|
+
function splitSuffix(path) {
|
|
57
|
+
const index = path.search(/[?#]/);
|
|
58
|
+
return index === -1 ? [path, ""] : [path.slice(0, index), path.slice(index)];
|
|
59
|
+
}
|
|
60
|
+
function restOf(path, base) {
|
|
61
|
+
if (path === base) {
|
|
62
|
+
return "";
|
|
63
|
+
}
|
|
64
|
+
return path.startsWith(base + "/") ? path.slice(base.length) : null;
|
|
65
|
+
}
|
|
66
|
+
function trimSlash(path) {
|
|
67
|
+
return path.replace(/\/+$/, "");
|
|
68
|
+
}
|
|
69
|
+
function normalize(path) {
|
|
70
|
+
try {
|
|
71
|
+
return trimSlash(decodeURI(path));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return trimSlash(path);
|
|
75
|
+
}
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pentacode/embed",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.52.0",
|
|
4
|
+
"description": "Types and helpers for hosts embedding <pentacode-app>",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/pentacode/pentacode.git",
|
|
9
|
+
"directory": "packages/embed"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./react": {
|
|
18
|
+
"types": "./dist/react/index.d.ts",
|
|
19
|
+
"default": "./dist/react/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/jsdom": "^30.0.0",
|
|
33
|
+
"@types/node": "^24.19.2",
|
|
34
|
+
"@types/react": "^19.2.17",
|
|
35
|
+
"@types/react-dom": "~19.2.7",
|
|
36
|
+
"jsdom": "^27.2.0",
|
|
37
|
+
"react": "^19.2.0",
|
|
38
|
+
"react-dom": "^19.2.0",
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@types/react": ">=19",
|
|
43
|
+
"react": ">=19"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"react": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@types/react": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "rm -rf dist && tsc --project tsconfig.build.json",
|
|
55
|
+
"typecheck": "tsc --noEmit --project . && tsc --noEmit --project tsconfig.test.json",
|
|
56
|
+
"test": "node --import ./test/resolve-ts.ts --test \"src/**/*.test.ts\""
|
|
57
|
+
}
|
|
6
58
|
}
|