@supersoniks/concorde 4.7.4 → 4.8.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/README.md +1 -1
- package/ai/cursor/rules/concorde.mdc +1 -1
- package/ai/skills/concorde-scope/SKILL.md +2 -2
- package/build-infos.json +1 -1
- package/concorde-core.bundle.js +289 -289
- package/concorde-core.es.js +4837 -4544
- package/dist/concorde-core.bundle.js +289 -289
- package/dist/concorde-core.es.js +4837 -4544
- package/dist/docs-mock-api-sw.js +19 -0
- package/dist/docs-mock-api-sw.js.map +2 -2
- package/docs/assets/index-wyNMyWT9.js +11196 -0
- package/docs/docs-mock-api-sw.js +19 -0
- package/docs/docs-mock-api-sw.js.map +2 -2
- package/docs/index.html +1 -1
- package/package.json +9 -1
- package/public/docs-mock-api-sw.js +19 -0
- package/public/docs-mock-api-sw.js.map +2 -2
- package/src/core/components/functional/example/example.ts +3 -3
- package/src/core/components/ui/icon/icon.ts +17 -2
- package/src/core/components/ui/menu/menu.ts +12 -3
- package/src/core/decorators/api.post.spec.ts +293 -0
- package/src/core/decorators/api.spec.ts +6 -6
- package/src/core/decorators/api.ts +643 -12
- package/src/core/decorators/subscriber/bind.ts +13 -5
- package/src/core/decorators/subscriber/dynamicPath.spec.ts +53 -0
- package/src/core/decorators/subscriber/dynamicPath.ts +23 -1
- package/src/core/decorators/subscriber/handle.ts +3 -1
- package/src/core/decorators/subscriber/onAssign.ts +10 -2
- package/src/core/decorators/subscriber/publish.ts +12 -2
- package/src/core/utils/PublisherProxy.ts +95 -11
- package/src/core/utils/api.ts +72 -3
- package/src/core/utils/dpOptions.spec.ts +56 -0
- package/src/core/utils/endpoint.ts +3 -3
- package/src/decorators.ts +17 -1
- package/src/docs/_core-concept/dataFlow.md +9 -3
- package/src/docs/_decorators/bind.md +2 -2
- package/src/docs/_decorators/get.md +13 -4
- package/src/docs/_decorators/handle.md +5 -1
- package/src/docs/_decorators/on-assign.md +2 -0
- package/src/docs/_decorators/patch.md +45 -0
- package/src/docs/_decorators/post.md +93 -0
- package/src/docs/_decorators/publish.md +1 -1
- package/src/docs/_decorators/put.md +43 -0
- package/src/docs/_decorators/subscribe.md +4 -1
- package/src/docs/_directives/sub.md +1 -1
- package/src/docs/_getting-started/my-first-component.md +1 -1
- package/src/docs/_misc/api-configuration.md +3 -1
- package/src/docs/_misc/dataProviderKey.md +2 -2
- package/src/docs/_misc/dynamic-path.md +71 -0
- package/src/docs/_misc/endpoint.md +5 -3
- package/src/docs/components/docs-demo-sources.ts +102 -3
- package/src/docs/components/docs-lit-demo-raw.ts +2 -26
- package/src/docs/components/docs-lit-demo.ts +9 -42
- package/src/docs/components/docs-source-excerpt.ts +53 -0
- package/src/docs/components/docs-source-link.ts +24 -8
- package/src/docs/components/docs-source-raw.ts +34 -0
- package/src/docs/example/decorators-demo-geo.ts +2 -2
- package/src/docs/example/decorators-demo-post.ts +249 -0
- package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +5 -5
- package/src/docs/example/decorators-demo.ts +1 -0
- package/src/docs/example/docs-api-config-demos.ts +5 -5
- package/src/docs/mock-api/router.ts +20 -0
- package/src/docs/navigation/navigation.ts +16 -0
- package/src/docs/search/docs-search.json +540 -15
- package/src/tsconfig.json +24 -0
- package/src/tsconfig.tsbuildinfo +1 -1
- package/vite.config.mts +1 -1
- package/docs/assets/index-CwtPzTFq.js +0 -7508
- package/docs/src/core/components/functional/date/date.md +0 -290
- package/docs/src/core/components/functional/fetch/fetch.md +0 -125
- package/docs/src/core/components/functional/if/if.md +0 -9
- package/docs/src/core/components/functional/list/list.md +0 -65
- package/docs/src/core/components/functional/mix/mix.md +0 -41
- package/docs/src/core/components/functional/queue/queue.md +0 -72
- package/docs/src/core/components/functional/router/router.md +0 -94
- package/docs/src/core/components/functional/sdui/default-library.json +0 -108
- package/docs/src/core/components/functional/sdui/example.json +0 -99
- package/docs/src/core/components/functional/sdui/sdui.md +0 -356
- package/docs/src/core/components/functional/states/states.md +0 -87
- package/docs/src/core/components/functional/submit/submit.md +0 -114
- package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
- package/docs/src/core/components/functional/value/value.md +0 -35
- package/docs/src/core/components/ui/alert/alert.md +0 -121
- package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
- package/docs/src/core/components/ui/badge/badge.md +0 -127
- package/docs/src/core/components/ui/button/button.md +0 -182
- package/docs/src/core/components/ui/captcha/captcha.md +0 -12
- package/docs/src/core/components/ui/card/card.md +0 -97
- package/docs/src/core/components/ui/divider/divider.md +0 -35
- package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
- package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
- package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
- package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
- package/docs/src/core/components/ui/form/input/input.md +0 -142
- package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -133
- package/docs/src/core/components/ui/form/radio/radio.md +0 -57
- package/docs/src/core/components/ui/form/select/select.md +0 -71
- package/docs/src/core/components/ui/form/switch/switch.md +0 -57
- package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
- package/docs/src/core/components/ui/group/group.md +0 -75
- package/docs/src/core/components/ui/icon/icon.md +0 -125
- package/docs/src/core/components/ui/icon/icons.json +0 -1
- package/docs/src/core/components/ui/image/image.md +0 -107
- package/docs/src/core/components/ui/link/link.md +0 -43
- package/docs/src/core/components/ui/loader/loader.md +0 -55
- package/docs/src/core/components/ui/menu/menu.md +0 -329
- package/docs/src/core/components/ui/modal/modal.md +0 -119
- package/docs/src/core/components/ui/pop/pop.md +0 -96
- package/docs/src/core/components/ui/progress/progress.md +0 -63
- package/docs/src/core/components/ui/table/table.md +0 -455
- package/docs/src/core/components/ui/toast/toast.md +0 -166
- package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
- package/docs/src/docs/_core-concept/dataFlow.md +0 -73
- package/docs/src/docs/_core-concept/overview.md +0 -57
- package/docs/src/docs/_core-concept/subscriber.md +0 -75
- package/docs/src/docs/_decorators/ancestor-attribute.md +0 -79
- package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
- package/docs/src/docs/_decorators/bind.md +0 -167
- package/docs/src/docs/_decorators/get.md +0 -68
- package/docs/src/docs/_decorators/handle.md +0 -171
- package/docs/src/docs/_decorators/on-assign.md +0 -388
- package/docs/src/docs/_decorators/publish.md +0 -55
- package/docs/src/docs/_decorators/subscribe.md +0 -97
- package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
- package/docs/src/docs/_directives/sub.md +0 -91
- package/docs/src/docs/_getting-started/ai-agents.md +0 -56
- package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
- package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
- package/docs/src/docs/_getting-started/create-a-component.md +0 -139
- package/docs/src/docs/_getting-started/my-first-component.md +0 -236
- package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
- package/docs/src/docs/_getting-started/pubsub.md +0 -37
- package/docs/src/docs/_getting-started/start.md +0 -47
- package/docs/src/docs/_getting-started/theming.md +0 -91
- package/docs/src/docs/_misc/api-configuration.md +0 -79
- package/docs/src/docs/_misc/dataProviderKey.md +0 -168
- package/docs/src/docs/_misc/docs-mock-api.md +0 -60
- package/docs/src/docs/_misc/endpoint.md +0 -43
- package/docs/src/docs/_misc/html-integration.md +0 -13
- package/docs/src/docs/search/docs-search.json +0 -8532
- package/docs/src/tag-list.json +0 -1
- package/docs/src/tsconfig-model.json +0 -23
- package/docs/src/tsconfig.json +0 -1095
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
# DataProviderKey
|
|
2
|
-
|
|
3
|
-
The `DataProviderKey<T>` utility provides type-safe navigation through composite data structures. Each property or index access extends the path, and the final key can be retrieved via `toString()` or the `path` property.
|
|
4
|
-
|
|
5
|
-
For a **single HTTP path string** (no dot-syntax), see [Endpoint](#docs/_misc/endpoint.md/endpoint). For **`DataProviderKey<APIConfiguration>`**, see [API configuration](#docs/_misc/api-configuration.md/api-configuration).
|
|
6
|
-
|
|
7
|
-
## Principle
|
|
8
|
-
|
|
9
|
-
`DataProviderKey` uses a Proxy to intercept property access and build a cumulative path string. TypeScript infers the nested type at each level, so `myKey.items[0]` is correctly typed as `DataProviderKey<Item>` when `items` is `Item[]`.
|
|
10
|
-
|
|
11
|
-
In Lit demos, bind HTML attributes from a key’s **`.path`** (single source of truth), and use **`get` / `set` / `dp`** instead of `PublisherManager.get("…")`:
|
|
12
|
-
|
|
13
|
-
<sonic-code language="typescript">
|
|
14
|
-
<template>
|
|
15
|
-
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
16
|
-
import { get, set } from "@supersoniks/concorde/utils";
|
|
17
|
-
|
|
18
|
-
export const myFormKey = new DataProviderKey<{ email: string }>("myForm");
|
|
19
|
-
set(myFormKey, { email: "a@b.c" });
|
|
20
|
-
|
|
21
|
-
// template: formDataProvider=${myFormKey.path}
|
|
22
|
-
</template>
|
|
23
|
-
</sonic-code>
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
### Import
|
|
28
|
-
|
|
29
|
-
<sonic-code language="typescript">
|
|
30
|
-
<template>
|
|
31
|
-
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
32
|
-
</template>
|
|
33
|
-
</sonic-code>
|
|
34
|
-
|
|
35
|
-
### Basic example
|
|
36
|
-
|
|
37
|
-
<sonic-code language="typescript">
|
|
38
|
-
<template>
|
|
39
|
-
type Item = { id: string; name: string };
|
|
40
|
-
//
|
|
41
|
-
type Data = {
|
|
42
|
-
items: Item[];
|
|
43
|
-
count: number;
|
|
44
|
-
};
|
|
45
|
-
//
|
|
46
|
-
const myKey = new DataProviderKey<Data>("data").items[0];
|
|
47
|
-
// Equivalent to: new DataProviderKey<Item>("data.items.0")
|
|
48
|
-
myKey.toString(); // "data.items.0"
|
|
49
|
-
myKey.path; // same value
|
|
50
|
-
// myKey is typed as DataProviderKey<Item>
|
|
51
|
-
</template>
|
|
52
|
-
</sonic-code>
|
|
53
|
-
|
|
54
|
-
### Object property access
|
|
55
|
-
|
|
56
|
-
<sonic-code language="typescript">
|
|
57
|
-
<template>
|
|
58
|
-
const key = new DataProviderKey<Data>("data");
|
|
59
|
-
const countKey = key.count;
|
|
60
|
-
countKey.path; // "data.count"
|
|
61
|
-
countKey.toString(); // "data.count"
|
|
62
|
-
</template>
|
|
63
|
-
</sonic-code>
|
|
64
|
-
|
|
65
|
-
### Array index access
|
|
66
|
-
|
|
67
|
-
<sonic-code language="typescript">
|
|
68
|
-
<template>
|
|
69
|
-
const itemsKey = new DataProviderKey<Data>("data").items;
|
|
70
|
-
itemsKey.path; // "data.items"
|
|
71
|
-
// itemsKey is DataProviderKey<Item[]>
|
|
72
|
-
//
|
|
73
|
-
const firstItem = itemsKey[0];
|
|
74
|
-
firstItem.path; // "data.items.0"
|
|
75
|
-
// firstItem is DataProviderKey<Item>
|
|
76
|
-
</template>
|
|
77
|
-
</sonic-code>
|
|
78
|
-
|
|
79
|
-
### Dynamic paths
|
|
80
|
-
|
|
81
|
-
Use placeholders `${prop}` or `{$prop}` in the path string. The path is resolved at runtime from the component's properties. The type remains declarative:
|
|
82
|
-
|
|
83
|
-
<sonic-code language="typescript">
|
|
84
|
-
<template>
|
|
85
|
-
type User = { name: string; email: string };
|
|
86
|
-
//
|
|
87
|
-
// Path resolved from component.userIndex at runtime
|
|
88
|
-
@subscribe(new DataProviderKey<User>("users.${userIndex}"))
|
|
89
|
-
@state()
|
|
90
|
-
user: User | null = null;
|
|
91
|
-
</template>
|
|
92
|
-
</sonic-code>
|
|
93
|
-
|
|
94
|
-
Dynamic keys are **not** supported by `get`, `set`, or `dp` — those APIs take a snapshot at call time with no component context. For dynamic paths use decorators (`@subscribe`, `@publish`, `@handle`) or **`sub(key)`** in Lit templates (resolves `${…}` from the host component). See [sub()](#docs/_directives/sub.md/sub).
|
|
95
|
-
|
|
96
|
-
### get / set / dp with static keys
|
|
97
|
-
|
|
98
|
-
For programmatic access, pass a `DataProviderKey` or a static path string. Dynamic placeholders are rejected:
|
|
99
|
-
|
|
100
|
-
<sonic-code language="typescript">
|
|
101
|
-
<template>
|
|
102
|
-
import { dp, get, set } from "@supersoniks/concorde/utils";
|
|
103
|
-
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
104
|
-
//
|
|
105
|
-
const counterKey = new DataProviderKey<{ count: number }>("myCounter");
|
|
106
|
-
//
|
|
107
|
-
set(counterKey, { count: 0 });
|
|
108
|
-
dp(counterKey.count).set(1);
|
|
109
|
-
get(counterKey); // snapshot: { count: 1 }
|
|
110
|
-
</template>
|
|
111
|
-
</sonic-code>
|
|
112
|
-
|
|
113
|
-
## Path retrieval
|
|
114
|
-
|
|
115
|
-
The final path is built by concatenating each accessed property with a dot:
|
|
116
|
-
|
|
117
|
-
- `new DataProviderKey<T>("base")` → `"base"`
|
|
118
|
-
- `key.prop` → `"base.prop"`
|
|
119
|
-
- `key.items[0]` → `"base.items.0"`
|
|
120
|
-
|
|
121
|
-
Use `toString()` or `path` to get the full path string:
|
|
122
|
-
|
|
123
|
-
<sonic-code language="typescript">
|
|
124
|
-
<template>
|
|
125
|
-
const key = new DataProviderKey<Data>("data").count;
|
|
126
|
-
const pathString = key.toString(); // "data.count"
|
|
127
|
-
const pathProp = key.path; // "data.count"
|
|
128
|
-
</template>
|
|
129
|
-
</sonic-code>
|
|
130
|
-
|
|
131
|
-
## Use cases
|
|
132
|
-
|
|
133
|
-
- **Type-safe bindings**: paths for `@bind`, `@subscribe`, `@publish`, `@handle`
|
|
134
|
-
- **Dynamic paths**: reusable keys with `${...}` placeholders
|
|
135
|
-
- **Form fields**: form data paths with compile-time checking
|
|
136
|
-
|
|
137
|
-
## Integration with @subscribe, @publish and @handle
|
|
138
|
-
|
|
139
|
-
Use `DataProviderKey` with `@subscribe` (read-only), `@publish` (write-only), or `@handle` (method callback on assign). With `@subscribe` / `@publish`, the decorated property **must** match the key’s value type. With `@handle`, the method receives `(value: T)`.
|
|
140
|
-
|
|
141
|
-
<sonic-code language="typescript">
|
|
142
|
-
<template>
|
|
143
|
-
import { subscribe } from "@supersoniks/concorde/decorators";
|
|
144
|
-
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
145
|
-
//
|
|
146
|
-
type FormData = { email: string };
|
|
147
|
-
const formKey = new DataProviderKey<FormData>("formData");
|
|
148
|
-
//
|
|
149
|
-
@customElement("user-form")
|
|
150
|
-
export class UserForm extends LitElement {
|
|
151
|
-
@subscribe(formKey.email)
|
|
152
|
-
@state()
|
|
153
|
-
email = "";
|
|
154
|
-
//
|
|
155
|
-
render() {
|
|
156
|
-
return html`<input .value=${this.email} @input=${(e) => this.email = (e.target as HTMLInputElement).value}>`;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</template>
|
|
160
|
-
</sonic-code>
|
|
161
|
-
|
|
162
|
-
These decorators support dynamic paths: `"base.${prop}"` in the constructor. A wrong property type (e.g. `number` for `DataProviderKey<string>`) is a TypeScript error. See [@handle](#docs/_decorators/handle.md/handle) for method callbacks.
|
|
163
|
-
|
|
164
|
-
## Notes
|
|
165
|
-
|
|
166
|
-
- Function properties are excluded from navigation (no `key.method()` chaining)
|
|
167
|
-
- Primitives have no navigable properties
|
|
168
|
-
- The `path` property and `toString()` are equivalent for retrieving the key
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Local API demos (offline)
|
|
2
|
-
|
|
3
|
-
The Concorde doc site does not call fragile third-party APIs during `yarn dev`. A **Service Worker** and the Vite dev middleware serve **`/docs-mock-api/*`** on the same origin.
|
|
4
|
-
|
|
5
|
-
## How it works
|
|
6
|
-
|
|
7
|
-
1. On load, `registerDocsMockApiServiceWorker()` registers `/docs-mock-api-sw.js`.
|
|
8
|
-
2. Requests to `/docs-mock-api/...` are handled by the SW (production build) or Vite middleware (dev).
|
|
9
|
-
3. Live examples use `serviceURL="/docs-mock-api"` and relative paths.
|
|
10
|
-
|
|
11
|
-
TypeScript constants: `src/docs/mock-api/urls.ts` (`DOCS_MOCK_REQRES_SERVICE`, `DOCS_MOCK_GEO_SERVICE`, …).
|
|
12
|
-
|
|
13
|
-
## Routes
|
|
14
|
-
|
|
15
|
-
| Path | Used in |
|
|
16
|
-
|------|---------|
|
|
17
|
-
| `/docs-mock-api/api/users` | `sonic-list`, `sonic-fetch`, `sonic-queue` (users) |
|
|
18
|
-
| `/docs-mock-api/api/users/:id` | Single user, `docs-user` |
|
|
19
|
-
| `POST /docs-mock-api/api/register` | **sonic-submit** — JSON, `multipart/form-data` (`sendAsFormData`), or `application/x-www-form-urlencoded` (native `<form>`); response includes parsed `email` + `token` |
|
|
20
|
-
| `POST /docs-mock-api/api/register/nested` | Wrapped body `{ data: { id, token } }` for `submit-result-key` demo |
|
|
21
|
-
| `GET /docs-mock-api/api/register/echo` | Echoes query string (`method="get"` on submit) |
|
|
22
|
-
| `GET /docs-mock-api/auth/token` | [API configuration](#docs/_misc/api-configuration.md/api-configuration) — tokenProvider (Basic or `eventsApiToken`) |
|
|
23
|
-
| `GET /docs-mock-api/api/config/protected` | Bearer / Basic; `docs-mock-stale-token` → **498** |
|
|
24
|
-
| `GET /docs-mock-api/wording/labels` | Wording batch (`labels[]`, `lang`) |
|
|
25
|
-
| `/docs-mock-api/geo/communes` | Geo list, `@get` demos |
|
|
26
|
-
| `/docs-mock-api/jokes/joke/:category` | JokeAPI-shaped list (`key="jokes"` on queue/list) |
|
|
27
|
-
|
|
28
|
-
### Filtres `GET /jokes/joke/…`
|
|
29
|
-
|
|
30
|
-
| Query | Meaning |
|
|
31
|
-
|-------|---------|
|
|
32
|
-
| `amount` | Max jokes per request when not using `offset` |
|
|
33
|
-
| `offset` + `limit` / `per_page` | Pagination for **sonic-queue** lazy load |
|
|
34
|
-
| `contains` | Substring on joke text, setup/delivery, categories (**input** demo, `name="contains"`) |
|
|
35
|
-
| `lang` | `fr` or `en` — filters the local dataset (**select** demo, `name="lang"`) |
|
|
36
|
-
| `blacklistFlags` | Comma-separated flags to **exclude** (`nsfw`, `religious`, `political`, `racist`, `sexist`, `explicit`) — checkbox/radio/switch « Remove following jokes » demos; each joke has matching `flags` in fixtures |
|
|
37
|
-
|
|
38
|
-
### Pagination `GET /api/users`
|
|
39
|
-
|
|
40
|
-
| Query | Meaning |
|
|
41
|
-
|-------|---------|
|
|
42
|
-
| `offset` + `per_page` | Index-based slice on the filtered set — **sonic-queue** (`offset=$offset&per_page=$limit`) |
|
|
43
|
-
| `page` + `per_page` | 1-based page — static fetch examples (`?page=2`) |
|
|
44
|
-
| `limit` | Alias of `per_page` |
|
|
45
|
-
| `q` | Search on first name, last name, email (optional; **sonic-queue** + `dataFilterProvider`, field `name="q"`) |
|
|
46
|
-
|
|
47
|
-
**ALTCHA** (`sonic-captcha`) is **not** mocked — it still uses the Supersoniks service.
|
|
48
|
-
|
|
49
|
-
In TypeScript demos, import from `src/docs/mock-api/urls.ts` (e.g. `DOCS_MOCK_REQRES_SERVICE` on `serviceURL`).
|
|
50
|
-
|
|
51
|
-
## Source files
|
|
52
|
-
|
|
53
|
-
- `src/docs/mock-api/` — router, fixtures, service worker, `urls.ts`
|
|
54
|
-
- `scripts/docs-mock-api-vite-plugin.ts` — SW build + middleware
|
|
55
|
-
- `public/docs-mock-api-sw.js` — generated on `yarn dev` / `yarn build-docs`
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
yarn dev # mock API on by default
|
|
59
|
-
yarn build-docs # includes SW bundle
|
|
60
|
-
```
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Endpoint
|
|
2
|
-
|
|
3
|
-
`Endpoint<T, U>` describes a single HTTP path (or a path accepted by `API.get`) and carries the expected response type `T`. Unlike [DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey), there is no dot-navigation: the path is one string.
|
|
4
|
-
|
|
5
|
-
The optional second generic `U` (default `any`) describes host properties used to resolve dynamic segments in the path (`${…}` / `{$…}`), for example with the [@get](#docs/_decorators/get.md/get) decorator.
|
|
6
|
-
|
|
7
|
-
## Import
|
|
8
|
-
|
|
9
|
-
<sonic-code language="typescript">
|
|
10
|
-
<template>
|
|
11
|
-
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
12
|
-
</template>
|
|
13
|
-
</sonic-code>
|
|
14
|
-
|
|
15
|
-
## Construction
|
|
16
|
-
|
|
17
|
-
<sonic-code language="typescript">
|
|
18
|
-
<template>
|
|
19
|
-
const users = new Endpoint<User[]>("users?limit=10");
|
|
20
|
-
users.path; // "users?limit=10"
|
|
21
|
-
|
|
22
|
-
const one = new Endpoint<User, { userId: string }>("users/${userId}");
|
|
23
|
-
// `userId` on the host class is observed when used with @get
|
|
24
|
-
</template>
|
|
25
|
-
</sonic-code>
|
|
26
|
-
|
|
27
|
-
## Normalization
|
|
28
|
-
|
|
29
|
-
`Endpoint.normalizePath` trims the string, rejects an empty path, strips leading slashes for paths relative to `serviceURL`, collapses duplicate slashes, and validates absolute `http(s)://` URLs.
|
|
30
|
-
|
|
31
|
-
## Publisher key for payloads
|
|
32
|
-
|
|
33
|
-
`getDataProviderKey()` returns a typed publisher key whose `path` matches the endpoint path (payload typing follows `ApiGetResult` for this endpoint). Useful when pairing `@get` with `@publish` / `@subscribe` (see [@get](#docs/_decorators/get.md/get)).
|
|
34
|
-
|
|
35
|
-
## Data-provider paths
|
|
36
|
-
|
|
37
|
-
`Endpoint.looksLikeDataProviderPath(path)` returns true for strings shaped like `dataProvider(id)…`, which `API.get` can resolve without HTTP.
|
|
38
|
-
|
|
39
|
-
## See also
|
|
40
|
-
|
|
41
|
-
- [API configuration](#docs/_misc/api-configuration.md/api-configuration) — `serviceURL`, token, wording (mock demos)
|
|
42
|
-
- [@get](#docs/_decorators/get.md/get) — decorator that uses `Endpoint<T>`
|
|
43
|
-
- [DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey) — typed publisher paths (dot notation)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# HTML integration (no Lit)
|
|
2
|
-
|
|
3
|
-
Some hosts (legacy PHP pages, static HTML) embed Concorde components **without** a Lit build step. They can use HTML attributes such as **`data-bind`**, **`dataProvider`**, and **`formDataProvider`** on tags directly in the page.
|
|
4
|
-
|
|
5
|
-
That style is **not** what we demonstrate in this doc site: live examples are **Lit components** under `src/docs/example/`, registered once and reused from Markdown via tags like `<docs-joke-search-demo>`.
|
|
6
|
-
|
|
7
|
-
| Goal | Use |
|
|
8
|
-
|------|-----|
|
|
9
|
-
| Learn modern patterns | [My first component](#docs/_getting-started/my-first-component.md/my-first-component), [Data flow](#docs/_core-concept/dataFlow.md/dataFlow) |
|
|
10
|
-
| Author doc examples | `<docs-lit-demo>` + `src/docs/example/*.ts` — see [My first component](#docs/_getting-started/my-first-component.md/my-first-component) |
|
|
11
|
-
| Embed in plain HTML only | `data-bind` / Subscriber docs in **Legacy** — [Subscriber mixin](#docs/_core-concept/subscriber.md/subscriber) |
|
|
12
|
-
|
|
13
|
-
New application code in TypeScript should use **`@subscribe`**, **`formDataProvider` + `name`**, and Lit templates — not HTML `data-bind`.
|