@aphexcms/plugin-phosphor-icons 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +51 -2
- package/dist/Icon.svelte +34 -0
- package/dist/Icon.svelte.d.ts +9 -0
- package/dist/Icon.svelte.d.ts.map +1 -0
- package/dist/IconInput.svelte +279 -0
- package/dist/IconInput.svelte.d.ts +5 -0
- package/dist/IconInput.svelte.d.ts.map +1 -0
- package/dist/app.d.ts +24 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +17 -0
- package/dist/data/bold.d.ts +3 -0
- package/dist/data/bold.d.ts.map +1 -0
- package/dist/data/bold.js +4 -0
- package/dist/data/catalog.d.ts +3 -0
- package/dist/data/catalog.d.ts.map +1 -0
- package/dist/data/catalog.js +4 -0
- package/dist/data/duotone.d.ts +3 -0
- package/dist/data/duotone.d.ts.map +1 -0
- package/dist/data/duotone.js +4 -0
- package/dist/data/fill.d.ts +3 -0
- package/dist/data/fill.d.ts.map +1 -0
- package/dist/data/fill.js +4 -0
- package/dist/data/light.d.ts +3 -0
- package/dist/data/light.d.ts.map +1 -0
- package/dist/data/light.js +4 -0
- package/dist/data/regular.d.ts +3 -0
- package/dist/data/regular.d.ts.map +1 -0
- package/dist/data/regular.js +4 -0
- package/dist/data/thin.d.ts +3 -0
- package/dist/data/thin.d.ts.map +1 -0
- package/dist/data/thin.js +4 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/lookup.d.ts +33 -0
- package/dist/lookup.d.ts.map +1 -0
- package/dist/lookup.js +88 -0
- package/dist/schema.d.ts +44 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +130 -0
- package/dist/value.d.ts +22 -0
- package/dist/value.d.ts.map +1 -0
- package/dist/value.js +14 -0
- package/package.json +72 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Benjamin Sinidol
|
|
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,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @aphexcms/plugin-phosphor-icons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An `icon` field for AphexCMS: a searchable picker of [Phosphor](https://phosphoricons.com)'s 1,512 icons in six weights, and a component that draws the chosen icon.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
// aphex.config.ts (and aphex.client.ts, if your plugins list is shared)
|
|
7
|
+
import { phosphorIconsPlugin } from '@aphexcms/plugin-phosphor-icons';
|
|
8
|
+
plugins: [phosphorIconsPlugin()];
|
|
9
|
+
|
|
10
|
+
// a schema
|
|
11
|
+
{ name: 'icon', type: 'icon', title: 'Icon' }
|
|
12
|
+
{ name: 'badge', type: 'icon', weight: 'duotone', weights: ['regular', 'duotone'] }
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```svelte
|
|
16
|
+
<script>
|
|
17
|
+
import Icon from '@aphexcms/plugin-phosphor-icons/icon';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Icon value={item.icon} class="size-6" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What's stored
|
|
24
|
+
|
|
25
|
+
`{ name, weight, path, shade? }`: the icon's name and weight, and its drawing (`path`, plus `shade` for two-tone). The drawing is saved with the choice, so a site draws icons from the document alone and ships no icon set. The admin loads one weight's drawings (about 200 KB compressed) when the picker opens.
|
|
26
|
+
|
|
27
|
+
A value needs only its name. Saving fills the drawing in (a `beforeValidate` hook the plugin adds to every document type holding an icon field), so an import, a script or the site's AI can write `{ "name": "coffee" }`. An unknown name is kept as written and draws nothing.
|
|
28
|
+
|
|
29
|
+
`icon` reads the field's type as `{ type: 'icon' }` everywhere once the plugin is imported. `icon({ name })` from `/schema` builds the same field.
|
|
30
|
+
|
|
31
|
+
## For the site's AI
|
|
32
|
+
|
|
33
|
+
The plugin adds a `search_icons` tool (names by meaning: "cafe" finds `coffee`) and a short section to what MCP clients are told on connecting.
|
|
34
|
+
|
|
35
|
+
## Entry points
|
|
36
|
+
|
|
37
|
+
- `.`: the plugin, `Icon`, constants and types.
|
|
38
|
+
- `./icon`: the `Icon` component alone, for sites.
|
|
39
|
+
- `./value`: `isDrawableIcon` and `isIconValue`, no data.
|
|
40
|
+
- `./lookup`: `searchIcons`, `resolveIcon`, `iconPaths` (loads data on demand).
|
|
41
|
+
- `./schema`: `icon()`, `expandIconTypes`.
|
|
42
|
+
|
|
43
|
+
## Updating the icons
|
|
44
|
+
|
|
45
|
+
`src/lib/data` is generated from `@phosphor-icons/core` (MIT):
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm pack @phosphor-icons/core@2.1.1 && tar xzf phosphor-icons-core-2.1.1.tgz
|
|
49
|
+
pnpm generate ./package
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Icons © Phosphor Icons, MIT licence.
|
package/dist/Icon.svelte
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isDrawableIcon } from './value.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Draws a stored icon value. It needs nothing but the value (the drawing is saved
|
|
6
|
+
* with it), so a site imports this alone and ships no icon set. Coloured by
|
|
7
|
+
* `currentColor`, sized by its `class` or the surrounding font (1em).
|
|
8
|
+
*
|
|
9
|
+
* `label` makes it an image with a name for screen readers; without one it's
|
|
10
|
+
* decoration, as an icon beside its own words should be.
|
|
11
|
+
*/
|
|
12
|
+
let {
|
|
13
|
+
value,
|
|
14
|
+
class: className = '',
|
|
15
|
+
label
|
|
16
|
+
}: { value: unknown; class?: string; label?: string } = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if isDrawableIcon(value)}
|
|
20
|
+
<svg
|
|
21
|
+
class={className}
|
|
22
|
+
viewBox="0 0 256 256"
|
|
23
|
+
fill="currentColor"
|
|
24
|
+
width="1em"
|
|
25
|
+
height="1em"
|
|
26
|
+
role={label ? 'img' : undefined}
|
|
27
|
+
aria-label={label}
|
|
28
|
+
aria-hidden={label ? undefined : 'true'}
|
|
29
|
+
focusable="false"
|
|
30
|
+
>
|
|
31
|
+
{#if value.shade}<path d={value.shade} opacity="0.2" />{/if}
|
|
32
|
+
<path d={value.path} />
|
|
33
|
+
</svg>
|
|
34
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
value: unknown;
|
|
3
|
+
class?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Icon = ReturnType<typeof Icon>;
|
|
8
|
+
export default Icon;
|
|
9
|
+
//# sourceMappingURL=Icon.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAKC,KAAK,gBAAgB,GAAI;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA4B7E,QAAA,MAAM,IAAI,sDAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { FieldComponentProps } from '@aphexcms/cms-core';
|
|
3
|
+
import * as Popover from '@aphexcms/ui/shadcn/popover';
|
|
4
|
+
import { Input } from '@aphexcms/ui/shadcn/input';
|
|
5
|
+
import { cn } from '@aphexcms/ui/utils';
|
|
6
|
+
import { X } from '@lucide/svelte';
|
|
7
|
+
import { ICON_WEIGHTS, WEIGHT_TITLES, isIconWeight, type IconWeight } from './constants.js';
|
|
8
|
+
import { allIcons, searchIcons } from './lookup.js';
|
|
9
|
+
import { isDrawableIcon, isIconValue, type IconValue } from './value.js';
|
|
10
|
+
import Icon from './Icon.svelte';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An icon field as one row: the chosen icon and its name, opening a searchable
|
|
14
|
+
* grid of Phosphor's icons. Search finds names and meanings (`cafe` finds a coffee
|
|
15
|
+
* cup). The weight row restyles the grid and the chosen icon together.
|
|
16
|
+
*/
|
|
17
|
+
let {
|
|
18
|
+
field,
|
|
19
|
+
value,
|
|
20
|
+
onUpdate,
|
|
21
|
+
validationClasses,
|
|
22
|
+
readonly = false
|
|
23
|
+
}: FieldComponentProps = $props();
|
|
24
|
+
|
|
25
|
+
const weights = $derived.by((): IconWeight[] => {
|
|
26
|
+
const allowed = field.inputOptions?.weights;
|
|
27
|
+
const list = Array.isArray(allowed) ? allowed.filter(isIconWeight) : [];
|
|
28
|
+
return list.length ? list : [...ICON_WEIGHTS];
|
|
29
|
+
});
|
|
30
|
+
const startWeight = $derived.by((): IconWeight => {
|
|
31
|
+
const option = field.inputOptions?.weight;
|
|
32
|
+
return isIconWeight(option) && weights.includes(option) ? option : (weights[0] ?? 'regular');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const current = $derived(isIconValue(value) ? value : null);
|
|
36
|
+
let open = $state(false);
|
|
37
|
+
let query = $state('');
|
|
38
|
+
let weight = $state<IconWeight>('regular');
|
|
39
|
+
$effect(() => {
|
|
40
|
+
// The grid opens in the chosen icon's weight, else the field's.
|
|
41
|
+
if (open)
|
|
42
|
+
weight = current?.weight && weights.includes(current.weight) ? current.weight : startWeight;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
let names = $state<string[]>([]);
|
|
46
|
+
let drawings = $state<Record<string, string | [string, string]>>({});
|
|
47
|
+
let loading = $state(true);
|
|
48
|
+
$effect(() => {
|
|
49
|
+
if (!open) return;
|
|
50
|
+
const q = query;
|
|
51
|
+
const w = weight;
|
|
52
|
+
let stale = false;
|
|
53
|
+
loading = true;
|
|
54
|
+
Promise.all([searchIcons(q, 240), allIcons(w)]).then(([found, data]) => {
|
|
55
|
+
if (stale) return;
|
|
56
|
+
names = found;
|
|
57
|
+
drawings = data;
|
|
58
|
+
loading = false;
|
|
59
|
+
});
|
|
60
|
+
return () => {
|
|
61
|
+
stale = true;
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function valueFor(name: string, w: IconWeight): IconValue | null {
|
|
66
|
+
const entry = drawings[name];
|
|
67
|
+
if (entry === undefined) return null;
|
|
68
|
+
return typeof entry === 'string'
|
|
69
|
+
? { name, weight: w, path: entry }
|
|
70
|
+
: { name, weight: w, path: entry[0], shade: entry[1] };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function choose(name: string) {
|
|
74
|
+
const next = valueFor(name, weight);
|
|
75
|
+
if (!next) return;
|
|
76
|
+
onUpdate(next);
|
|
77
|
+
open = false;
|
|
78
|
+
query = '';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A new weight restyles the chosen icon too, once its drawings are in. */
|
|
82
|
+
async function setWeight(next: IconWeight) {
|
|
83
|
+
weight = next;
|
|
84
|
+
if (!current) return;
|
|
85
|
+
const data = await allIcons(next);
|
|
86
|
+
const entry = data[current.name];
|
|
87
|
+
if (entry === undefined || weight !== next) return;
|
|
88
|
+
onUpdate(
|
|
89
|
+
typeof entry === 'string'
|
|
90
|
+
? { name: current.name, weight: next, path: entry }
|
|
91
|
+
: { name: current.name, weight: next, path: entry[0], shade: entry[1] }
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const label = (name: string) => name.replace(/-/g, ' ');
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<div class="row" class:readonly aria-disabled={readonly}>
|
|
99
|
+
<Popover.Root bind:open>
|
|
100
|
+
<Popover.Trigger
|
|
101
|
+
class={cn(
|
|
102
|
+
'border-input bg-background focus-visible:ring-ring/50 flex h-9 items-center gap-2 rounded-md border px-3 text-left text-sm shadow-xs outline-none focus-visible:ring-[3px]',
|
|
103
|
+
validationClasses
|
|
104
|
+
)}
|
|
105
|
+
disabled={readonly}
|
|
106
|
+
aria-label="Choose {field.title ?? 'an icon'}"
|
|
107
|
+
>
|
|
108
|
+
{#if isDrawableIcon(current)}
|
|
109
|
+
<Icon value={current} class="size-5 shrink-0" />
|
|
110
|
+
<span class="truncate">{label(current.name)}</span>
|
|
111
|
+
{#if current.weight && current.weight !== 'regular'}
|
|
112
|
+
<span class="text-muted-foreground shrink-0 text-xs">{WEIGHT_TITLES[current.weight]}</span
|
|
113
|
+
>
|
|
114
|
+
{/if}
|
|
115
|
+
{:else if current}
|
|
116
|
+
<!-- Named but not drawn: a name Phosphor doesn't have. -->
|
|
117
|
+
<span class="text-muted-foreground truncate"
|
|
118
|
+
>“{current.name}” isn't an icon. Choose one</span
|
|
119
|
+
>
|
|
120
|
+
{:else}
|
|
121
|
+
<span class="text-muted-foreground">Choose an icon</span>
|
|
122
|
+
{/if}
|
|
123
|
+
</Popover.Trigger>
|
|
124
|
+
<Popover.Content class="w-[22rem] p-0" align="start">
|
|
125
|
+
<div class="picker">
|
|
126
|
+
<Input
|
|
127
|
+
class="h-8 text-sm"
|
|
128
|
+
placeholder="Search: coffee, phone, star…"
|
|
129
|
+
value={query}
|
|
130
|
+
oninput={(event) => (query = event.currentTarget.value)}
|
|
131
|
+
autofocus
|
|
132
|
+
spellcheck={false}
|
|
133
|
+
autocomplete="off"
|
|
134
|
+
/>
|
|
135
|
+
{#if weights.length > 1}
|
|
136
|
+
<div class="weights" role="radiogroup" aria-label="Weight">
|
|
137
|
+
{#each weights as w (w)}
|
|
138
|
+
<button
|
|
139
|
+
type="button"
|
|
140
|
+
role="radio"
|
|
141
|
+
aria-checked={weight === w}
|
|
142
|
+
class:on={weight === w}
|
|
143
|
+
onclick={() => setWeight(w)}
|
|
144
|
+
>
|
|
145
|
+
{WEIGHT_TITLES[w]}
|
|
146
|
+
</button>
|
|
147
|
+
{/each}
|
|
148
|
+
</div>
|
|
149
|
+
{/if}
|
|
150
|
+
<div class="grid" aria-busy={loading}>
|
|
151
|
+
{#each names as name (name)}
|
|
152
|
+
{@const drawn = valueFor(name, weight)}
|
|
153
|
+
{#if drawn}
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
class:on={current?.name === name}
|
|
157
|
+
title={label(name)}
|
|
158
|
+
aria-label={label(name)}
|
|
159
|
+
onclick={() => choose(name)}
|
|
160
|
+
>
|
|
161
|
+
<Icon value={drawn} />
|
|
162
|
+
</button>
|
|
163
|
+
{/if}
|
|
164
|
+
{:else}
|
|
165
|
+
{#if !loading}<p class="empty">No icon matches “{query}”.</p>{/if}
|
|
166
|
+
{/each}
|
|
167
|
+
</div>
|
|
168
|
+
<p class="credit">Icons by Phosphor</p>
|
|
169
|
+
</div>
|
|
170
|
+
</Popover.Content>
|
|
171
|
+
</Popover.Root>
|
|
172
|
+
|
|
173
|
+
{#if current && !readonly}
|
|
174
|
+
<button
|
|
175
|
+
type="button"
|
|
176
|
+
class="clear"
|
|
177
|
+
aria-label="Clear {field.title ?? 'icon'}"
|
|
178
|
+
title="Clear"
|
|
179
|
+
onclick={() => onUpdate(undefined)}
|
|
180
|
+
>
|
|
181
|
+
<X class="size-4" />
|
|
182
|
+
</button>
|
|
183
|
+
{/if}
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<style>
|
|
187
|
+
/* Layout in the component's own CSS: an app's Tailwind may not scan this package. */
|
|
188
|
+
.row {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
gap: 0.25rem;
|
|
192
|
+
}
|
|
193
|
+
.row.readonly {
|
|
194
|
+
opacity: 0.5;
|
|
195
|
+
}
|
|
196
|
+
.row > :global(button:first-child) {
|
|
197
|
+
flex: 1 1 0;
|
|
198
|
+
min-width: 0;
|
|
199
|
+
}
|
|
200
|
+
.clear {
|
|
201
|
+
display: grid;
|
|
202
|
+
place-items: center;
|
|
203
|
+
flex: none;
|
|
204
|
+
width: 1.75rem;
|
|
205
|
+
height: 1.75rem;
|
|
206
|
+
border-radius: 0.375rem;
|
|
207
|
+
color: var(--muted-foreground);
|
|
208
|
+
}
|
|
209
|
+
.clear:hover {
|
|
210
|
+
color: var(--foreground);
|
|
211
|
+
background: var(--muted);
|
|
212
|
+
}
|
|
213
|
+
.clear :global(svg) {
|
|
214
|
+
width: 1rem;
|
|
215
|
+
height: 1rem;
|
|
216
|
+
}
|
|
217
|
+
.picker {
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
gap: 0.5rem;
|
|
221
|
+
padding: 0.625rem;
|
|
222
|
+
}
|
|
223
|
+
.weights {
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-wrap: wrap;
|
|
226
|
+
gap: 0.25rem;
|
|
227
|
+
}
|
|
228
|
+
.weights button {
|
|
229
|
+
border: 1px solid var(--border);
|
|
230
|
+
border-radius: 999px;
|
|
231
|
+
padding: 0.125rem 0.5rem;
|
|
232
|
+
font-size: 0.75rem;
|
|
233
|
+
color: var(--muted-foreground);
|
|
234
|
+
}
|
|
235
|
+
.weights button:hover {
|
|
236
|
+
color: var(--foreground);
|
|
237
|
+
}
|
|
238
|
+
.weights button.on {
|
|
239
|
+
border-color: var(--primary);
|
|
240
|
+
color: var(--foreground);
|
|
241
|
+
background: color-mix(in oklch, var(--primary) 12%, transparent);
|
|
242
|
+
}
|
|
243
|
+
.grid {
|
|
244
|
+
display: grid;
|
|
245
|
+
grid-template-columns: repeat(8, minmax(0, 1fr));
|
|
246
|
+
gap: 0.125rem;
|
|
247
|
+
max-height: 16.5rem;
|
|
248
|
+
overflow-y: auto;
|
|
249
|
+
overscroll-behavior: contain;
|
|
250
|
+
}
|
|
251
|
+
.grid button {
|
|
252
|
+
display: grid;
|
|
253
|
+
place-items: center;
|
|
254
|
+
aspect-ratio: 1;
|
|
255
|
+
border-radius: 0.375rem;
|
|
256
|
+
font-size: 1.25rem;
|
|
257
|
+
color: var(--foreground);
|
|
258
|
+
}
|
|
259
|
+
.grid button:hover,
|
|
260
|
+
.grid button:focus-visible {
|
|
261
|
+
background: var(--muted);
|
|
262
|
+
outline: none;
|
|
263
|
+
}
|
|
264
|
+
.grid button.on {
|
|
265
|
+
background: color-mix(in oklch, var(--primary) 16%, transparent);
|
|
266
|
+
box-shadow: inset 0 0 0 1px var(--primary);
|
|
267
|
+
}
|
|
268
|
+
.empty {
|
|
269
|
+
grid-column: 1 / -1;
|
|
270
|
+
padding: 1.5rem 0;
|
|
271
|
+
text-align: center;
|
|
272
|
+
font-size: 0.8125rem;
|
|
273
|
+
color: var(--muted-foreground);
|
|
274
|
+
}
|
|
275
|
+
.credit {
|
|
276
|
+
font-size: 0.6875rem;
|
|
277
|
+
color: var(--muted-foreground);
|
|
278
|
+
}
|
|
279
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '@aphexcms/cms-core';
|
|
2
|
+
declare const IconInput: import("svelte").Component<FieldComponentProps, {}, "">;
|
|
3
|
+
type IconInput = ReturnType<typeof IconInput>;
|
|
4
|
+
export default IconInput;
|
|
5
|
+
//# sourceMappingURL=IconInput.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconInput.svelte.d.ts","sourceRoot":"","sources":["../src/lib/IconInput.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAsK9D,QAAA,MAAM,SAAS,yDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Aphex plugins consume `@aphexcms/cms-core` from source, so this package's
|
|
2
|
+
// `svelte-check` follows into cms-core's server files, which rely on the
|
|
3
|
+
// SvelteKit `App.Locals` augmentation a host app provides. Re-declare it here so
|
|
4
|
+
// the plugin type-checks standalone (in an app, the app's own app.d.ts wins).
|
|
5
|
+
import type {
|
|
6
|
+
CMSInstances,
|
|
7
|
+
Auth,
|
|
8
|
+
Organization,
|
|
9
|
+
PreviewPerspective
|
|
10
|
+
} from '@aphexcms/cms-core/server';
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
namespace App {
|
|
14
|
+
interface Locals {
|
|
15
|
+
aphexCMS: CMSInstances;
|
|
16
|
+
aphexAuth?: Auth;
|
|
17
|
+
previewPerspective?: PreviewPerspective;
|
|
18
|
+
aphexTenant?: string | null;
|
|
19
|
+
aphexTenantOrganization?: Organization | null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The input key the picker registers (`input: ICON_INPUT`). Svelte-free, so `./schema` can import it. */
|
|
2
|
+
export declare const ICON_INPUT = "phosphor-icon";
|
|
3
|
+
/** The authored field keyword: `{ type: 'icon', name: 'icon' }`. */
|
|
4
|
+
export declare const ICON_TYPE = "icon";
|
|
5
|
+
/** Phosphor's six weights, lightest last. */
|
|
6
|
+
export declare const ICON_WEIGHTS: readonly ["regular", "bold", "fill", "duotone", "light", "thin"];
|
|
7
|
+
export type IconWeight = (typeof ICON_WEIGHTS)[number];
|
|
8
|
+
export declare const WEIGHT_TITLES: Record<IconWeight, string>;
|
|
9
|
+
export declare function isIconWeight(value: unknown): value is IconWeight;
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/lib/constants.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAE1C,oEAAoE;AACpE,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,6CAA6C;AAC7C,eAAO,MAAM,YAAY,kEAAmE,CAAC;AAC7F,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAOpD,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The input key the picker registers (`input: ICON_INPUT`). Svelte-free, so `./schema` can import it. */
|
|
2
|
+
export const ICON_INPUT = 'phosphor-icon';
|
|
3
|
+
/** The authored field keyword: `{ type: 'icon', name: 'icon' }`. */
|
|
4
|
+
export const ICON_TYPE = 'icon';
|
|
5
|
+
/** Phosphor's six weights, lightest last. */
|
|
6
|
+
export const ICON_WEIGHTS = ['regular', 'bold', 'fill', 'duotone', 'light', 'thin'];
|
|
7
|
+
export const WEIGHT_TITLES = {
|
|
8
|
+
regular: 'Regular',
|
|
9
|
+
bold: 'Bold',
|
|
10
|
+
fill: 'Filled',
|
|
11
|
+
duotone: 'Two-tone',
|
|
12
|
+
light: 'Light',
|
|
13
|
+
thin: 'Thin'
|
|
14
|
+
};
|
|
15
|
+
export function isIconWeight(value) {
|
|
16
|
+
return typeof value === 'string' && ICON_WEIGHTS.includes(value);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bold.d.ts","sourceRoot":"","sources":["../../src/lib/data/bold.js"],"names":[],"mappings":""}
|