@perkyzz/emvb 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.
Files changed (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/package.json +72 -4
  4. package/src/admin/access/RequireEditor.tsx +39 -0
  5. package/src/admin/access/role.ts +36 -0
  6. package/src/admin/access/sidebar-shim.ts +108 -0
  7. package/src/admin/api.ts +48 -0
  8. package/src/admin/content-api.ts +147 -0
  9. package/src/admin/editor/Editor.tsx +457 -0
  10. package/src/admin/editor/EditorOverlay.tsx +54 -0
  11. package/src/admin/editor/ShortcutsDialog.tsx +30 -0
  12. package/src/admin/editor/SmallScreenNotice.tsx +20 -0
  13. package/src/admin/editor/TopBar.tsx +179 -0
  14. package/src/admin/editor/canvas/CanvasFrame.tsx +355 -0
  15. package/src/admin/editor/canvas/CanvasTextEdit.tsx +87 -0
  16. package/src/admin/editor/canvas/DeviceBar.tsx +50 -0
  17. package/src/admin/editor/canvas/EmptyCanvas.tsx +49 -0
  18. package/src/admin/editor/canvas/SelectionOverlay.tsx +185 -0
  19. package/src/admin/editor/canvas/canvas-events.ts +232 -0
  20. package/src/admin/editor/canvas/state-preview.ts +19 -0
  21. package/src/admin/editor/canvas/tab-reveal.ts +35 -0
  22. package/src/admin/editor/canvas/vnode-react.tsx +49 -0
  23. package/src/admin/editor/clipboard-store.ts +44 -0
  24. package/src/admin/editor/dialogs.tsx +125 -0
  25. package/src/admin/editor/dnd/drag-stash.ts +27 -0
  26. package/src/admin/editor/dnd/drop-target.ts +101 -0
  27. package/src/admin/editor/dnd/new-element.ts +32 -0
  28. package/src/admin/editor/editor-css.ts +539 -0
  29. package/src/admin/editor/exit.ts +27 -0
  30. package/src/admin/editor/panels/AddPanel.tsx +142 -0
  31. package/src/admin/editor/panels/ClassesSection.tsx +334 -0
  32. package/src/admin/editor/panels/ColorControl.tsx +230 -0
  33. package/src/admin/editor/panels/ConditionsEditor.tsx +201 -0
  34. package/src/admin/editor/panels/ElementPanel.tsx +629 -0
  35. package/src/admin/editor/panels/LayersPanel.tsx +336 -0
  36. package/src/admin/editor/panels/LeftPanel.tsx +77 -0
  37. package/src/admin/editor/panels/PageSettings.tsx +126 -0
  38. package/src/admin/editor/panels/SettingsPanel.tsx +101 -0
  39. package/src/admin/editor/panels/SiteStylesDrawer.tsx +392 -0
  40. package/src/admin/editor/panels/TriggerSettings.tsx +132 -0
  41. package/src/admin/editor/panels/TriggersEditor.tsx +197 -0
  42. package/src/admin/editor/panels/VariableSection.tsx +492 -0
  43. package/src/admin/editor/panels/settings/BackgroundControls.tsx +320 -0
  44. package/src/admin/editor/panels/settings/ClassChip.tsx +167 -0
  45. package/src/admin/editor/panels/settings/ClassChipInput.tsx +349 -0
  46. package/src/admin/editor/panels/settings/DraftTextField.tsx +201 -0
  47. package/src/admin/editor/panels/settings/EffectsControls.tsx +347 -0
  48. package/src/admin/editor/panels/settings/FieldBindControl.tsx +83 -0
  49. package/src/admin/editor/panels/settings/FieldControl.tsx +150 -0
  50. package/src/admin/editor/panels/settings/FormBindControl.tsx +97 -0
  51. package/src/admin/editor/panels/settings/IconPicker.tsx +109 -0
  52. package/src/admin/editor/panels/settings/LengthRow.tsx +181 -0
  53. package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +124 -0
  54. package/src/admin/editor/panels/settings/MediaPicker.tsx +218 -0
  55. package/src/admin/editor/panels/settings/NumberRow.tsx +154 -0
  56. package/src/admin/editor/panels/settings/StateSwitcher.tsx +87 -0
  57. package/src/admin/editor/panels/settings/StyleRow.tsx +480 -0
  58. package/src/admin/editor/panels/settings/VariableBinding.tsx +167 -0
  59. package/src/admin/editor/panels/settings/class-suggest.ts +51 -0
  60. package/src/admin/editor/panels/settings/length-units.ts +83 -0
  61. package/src/admin/editor/panels/settings/node-props.ts +11 -0
  62. package/src/admin/editor/panels/settings/style-sections.ts +291 -0
  63. package/src/admin/editor/panels/site-list.tsx +206 -0
  64. package/src/admin/editor/panels/variable-values.ts +73 -0
  65. package/src/admin/editor/section-templates.ts +50 -0
  66. package/src/admin/editor/shortcuts.ts +20 -0
  67. package/src/admin/editor/store.ts +212 -0
  68. package/src/admin/editor/useClipboardActions.ts +136 -0
  69. package/src/admin/editor/useEditorCommands.ts +142 -0
  70. package/src/admin/editor/useEditorData.ts +167 -0
  71. package/src/admin/editor/useEditorShortcuts.ts +148 -0
  72. package/src/admin/editor/useMediaQuery.ts +20 -0
  73. package/src/admin/editor/useNodeActions.ts +122 -0
  74. package/src/admin/editor/useSave.ts +185 -0
  75. package/src/admin/forms-api.ts +73 -0
  76. package/src/admin/index.tsx +20 -0
  77. package/src/admin/media-api.ts +68 -0
  78. package/src/admin/pages/CreateDialog.tsx +150 -0
  79. package/src/admin/pages/EditorPage.tsx +57 -0
  80. package/src/admin/pages/NewPageDialog.tsx +83 -0
  81. package/src/admin/pages/NewThemePartDialog.tsx +61 -0
  82. package/src/admin/pages/PageList.tsx +71 -0
  83. package/src/admin/pages/PagesPage.tsx +25 -0
  84. package/src/admin/pages/SetupShell.tsx +90 -0
  85. package/src/admin/pages/ThemeBuilderPage.tsx +25 -0
  86. package/src/admin/pages/ThemePartList.tsx +202 -0
  87. package/src/admin/pages/list-kit.tsx +75 -0
  88. package/src/admin/setup/plan.ts +150 -0
  89. package/src/admin/setup/run.ts +61 -0
  90. package/src/admin/setup/spec.ts +100 -0
  91. package/src/admin/setup/useSetupStatus.ts +62 -0
  92. package/src/admin/theme-api.ts +186 -0
  93. package/src/admin/ui.ts +231 -0
  94. package/src/admin/widgets/LayoutField.tsx +67 -0
  95. package/src/astro/EmVBPage.astro +37 -0
  96. package/src/astro/env.d.ts +5 -0
  97. package/src/astro/forms/EmVBFormsRuntime.astro +9 -0
  98. package/src/astro/forms/index.ts +1 -0
  99. package/src/astro/forms-definitions.ts +104 -0
  100. package/src/astro/index.ts +15 -0
  101. package/src/astro/popups/EmVBPopupsRuntime.astro +9 -0
  102. package/src/astro/popups/index.ts +1 -0
  103. package/src/astro/popups/runtime.ts +246 -0
  104. package/src/astro/render.ts +74 -0
  105. package/src/astro/resolve-theme.ts +371 -0
  106. package/src/astro/resolve.ts +65 -0
  107. package/src/astro/tabs/EmVBTabsRuntime.astro +10 -0
  108. package/src/astro/tabs/index.ts +1 -0
  109. package/src/astro/tabs/runtime.ts +111 -0
  110. package/src/astro/theme-context.ts +81 -0
  111. package/src/astro/theme-posts.ts +84 -0
  112. package/src/constants.ts +12 -0
  113. package/src/core/arrange.ts +360 -0
  114. package/src/core/clipboard.ts +422 -0
  115. package/src/core/css/generate.ts +219 -0
  116. package/src/core/css/scope.ts +88 -0
  117. package/src/core/design/cascade.ts +28 -0
  118. package/src/core/design/classes.ts +138 -0
  119. package/src/core/design/devices.ts +56 -0
  120. package/src/core/design/states.ts +49 -0
  121. package/src/core/design/transfer.ts +33 -0
  122. package/src/core/design/variables.ts +319 -0
  123. package/src/core/elements/definition.ts +12 -0
  124. package/src/core/elements/dynamic-elements.ts +173 -0
  125. package/src/core/elements/form-elements.ts +204 -0
  126. package/src/core/elements/index.ts +742 -0
  127. package/src/core/elements/plain-text.ts +32 -0
  128. package/src/core/forms/binding.ts +61 -0
  129. package/src/core/forms/definition.ts +34 -0
  130. package/src/core/forms/success-layout.ts +63 -0
  131. package/src/core/icons/catalog.ts +273 -0
  132. package/src/core/index.ts +316 -0
  133. package/src/core/limits.ts +7 -0
  134. package/src/core/migrate/index.ts +76 -0
  135. package/src/core/render/context.ts +14 -0
  136. package/src/core/render/dynamic-post.ts +147 -0
  137. package/src/core/render/extras.ts +79 -0
  138. package/src/core/render/form.ts +137 -0
  139. package/src/core/render/index.ts +274 -0
  140. package/src/core/render/loop.ts +36 -0
  141. package/src/core/render/section.ts +33 -0
  142. package/src/core/render/tabs.ts +72 -0
  143. package/src/core/render/vnode.ts +87 -0
  144. package/src/core/sanitize/css.ts +591 -0
  145. package/src/core/sanitize/embed-url.ts +103 -0
  146. package/src/core/sanitize/escape.ts +10 -0
  147. package/src/core/sanitize/href.ts +6 -0
  148. package/src/core/sanitize/media-url.ts +7 -0
  149. package/src/core/sanitize/svg.ts +293 -0
  150. package/src/core/sanitize/url.ts +31 -0
  151. package/src/core/schema/descriptors.ts +33 -0
  152. package/src/core/schema/design.ts +88 -0
  153. package/src/core/schema/layout.ts +817 -0
  154. package/src/core/schema/state-names.ts +4 -0
  155. package/src/core/schema/style.ts +257 -0
  156. package/src/core/stats.ts +18 -0
  157. package/src/core/tabs/presence.ts +16 -0
  158. package/src/core/theme/conditions.ts +321 -0
  159. package/src/core/theme/dynamic.ts +133 -0
  160. package/src/core/theme/parse-doc.ts +36 -0
  161. package/src/core/theme/part-types.ts +79 -0
  162. package/src/core/theme/popup-markup.ts +39 -0
  163. package/src/core/theme/popup-rules.ts +61 -0
  164. package/src/core/theme/triggers.ts +104 -0
  165. package/src/core/tree-ops.ts +139 -0
  166. package/src/core/validate.ts +185 -0
  167. package/src/index.ts +18 -0
  168. package/src/server/design-routes.ts +125 -0
  169. package/src/server/hooks.ts +98 -0
  170. package/src/server/plugin.ts +39 -0
@@ -0,0 +1,32 @@
1
+ import { MAX_TEXT_LENGTH } from "../limits.ts";
2
+ import type { LayoutNode } from "../schema/layout.ts";
3
+
4
+ /** Elements whose visible words are one `props.text` string (W-097). */
5
+ const PLAIN_TEXT = ["heading", "text", "label", "link", "button"] as const;
6
+
7
+ export function isPlainTextNode(node: LayoutNode): boolean {
8
+ return (PLAIN_TEXT as readonly string[]).includes(node.type);
9
+ }
10
+
11
+ /** The stored string, or null when this element is not edited on the canvas. */
12
+ export function plainTextOf(node: LayoutNode): string | null {
13
+ if (!isPlainTextNode(node)) return null;
14
+ const text = "text" in node.props ? node.props.text : undefined;
15
+ return typeof text === "string" ? text : null;
16
+ }
17
+
18
+ /** Paragraphs keep line breaks. Headings, labels, links and buttons stay one line. */
19
+ export function isMultilineText(node: LayoutNode): boolean {
20
+ return node.type === "text";
21
+ }
22
+
23
+ /** The string a canvas edit may store. Over-long text is cut to the schema limit. */
24
+ export function commitPlainText(text: string, multiline: boolean): string {
25
+ const flat = multiline ? text : text.replaceAll("\n", "");
26
+ return flat.slice(0, MAX_TEXT_LENGTH);
27
+ }
28
+
29
+ export function withPlainText(node: LayoutNode, text: string): LayoutNode {
30
+ if (!isPlainTextNode(node) || !("text" in node.props)) return node;
31
+ return { ...node, props: { ...node.props, text } };
32
+ }
@@ -0,0 +1,61 @@
1
+ import { isFormNode, type Layout, type LayoutNode } from "../schema/layout.ts";
2
+ import { nodeChildren } from "../tree-ops.ts";
3
+ import { fieldsOf, type FormDefinitions } from "./definition.ts";
4
+
5
+ export type MissingRequiredField = {
6
+ formNodeId: string;
7
+ formId: string;
8
+ field: string;
9
+ };
10
+
11
+ function walk(node: LayoutNode, visit: (node: LayoutNode) => void): void {
12
+ visit(node);
13
+ for (const child of nodeChildren(node)) walk(child, visit);
14
+ }
15
+
16
+ function boundFields(form: LayoutNode): Set<string> {
17
+ const names = new Set<string>();
18
+ walk(form, (node) => {
19
+ if (
20
+ node.type === "text-input" ||
21
+ node.type === "textarea" ||
22
+ node.type === "select" ||
23
+ node.type === "checkbox" ||
24
+ node.type === "radio"
25
+ ) {
26
+ const field = (node.props as { field?: string }).field;
27
+ if (field) names.add(field);
28
+ }
29
+ });
30
+ return names;
31
+ }
32
+
33
+ /**
34
+ * Required fields on the forms-plugin definition that have no EmVB input bound (R-040).
35
+ */
36
+ export function findMissingRequiredFields(
37
+ layout: Layout,
38
+ definitions: FormDefinitions,
39
+ ): MissingRequiredField[] {
40
+ const missing: MissingRequiredField[] = [];
41
+ walk(layout.root, (node) => {
42
+ if (!isFormNode(node) || !node.props.formId) return;
43
+ const definition = definitions.get(node.props.formId);
44
+ if (!definition) return;
45
+ const bound = boundFields(node);
46
+ for (const field of fieldsOf(definition)) {
47
+ if (field.required && !bound.has(field.name)) {
48
+ missing.push({ formNodeId: node.id, formId: node.props.formId, field: field.name });
49
+ }
50
+ }
51
+ });
52
+ return missing;
53
+ }
54
+
55
+ export function layoutHasForm(layout: Layout): boolean {
56
+ let found = false;
57
+ walk(layout.root, (node) => {
58
+ if (isFormNode(node) && node.props.formId.trim()) found = true;
59
+ });
60
+ return found;
61
+ }
@@ -0,0 +1,34 @@
1
+ /** Minimal public form definition (forms-plugin `definition` route). */
2
+ export type PublicFormField = {
3
+ name: string;
4
+ type: string;
5
+ label: string;
6
+ required: boolean;
7
+ options?: ReadonlyArray<{ label: string; value: string }>;
8
+ placeholder?: string;
9
+ };
10
+
11
+ export type PublicFormDefinition = {
12
+ name: string;
13
+ slug: string;
14
+ status: string;
15
+ pages: ReadonlyArray<{ fields: ReadonlyArray<PublicFormField> }>;
16
+ settings: {
17
+ spamProtection?: string;
18
+ submitLabel?: string;
19
+ };
20
+ };
21
+
22
+ export type FormDefinitions = ReadonlyMap<string, PublicFormDefinition>;
23
+
24
+ export function fieldsOf(definition: PublicFormDefinition): PublicFormField[] {
25
+ return definition.pages.flatMap((page) => [...page.fields]);
26
+ }
27
+
28
+ export function fieldByName(
29
+ definition: PublicFormDefinition | undefined,
30
+ name: string,
31
+ ): PublicFormField | undefined {
32
+ if (!definition) return undefined;
33
+ return fieldsOf(definition).find((field) => field.name === name);
34
+ }
@@ -0,0 +1,63 @@
1
+ import { LAYOUT_SCHEMA_VERSION, type Layout } from "../schema/layout.ts";
2
+
3
+ /** Fixture layout for the BRIEF success signal (W-039): container + heading/text/image/button + form. */
4
+ export function successSignalLayout(opts: {
5
+ formId: string;
6
+ colorVar: string;
7
+ classId: string;
8
+ imageSrc: string;
9
+ heading: string;
10
+ }): Layout {
11
+ return {
12
+ schemaVersion: LAYOUT_SCHEMA_VERSION,
13
+ root: {
14
+ id: "root0001",
15
+ type: "container",
16
+ props: {},
17
+ style: { flexDirection: "column", gap: { value: 16, unit: "px" } },
18
+ children: [
19
+ {
20
+ id: "head0001",
21
+ type: "heading",
22
+ props: { text: opts.heading, level: 1 },
23
+ style: { color: { var: opts.colorVar } },
24
+ classes: [opts.classId],
25
+ },
26
+ {
27
+ id: "text0001",
28
+ type: "text",
29
+ props: { text: "Welcome to the EmVB success page." },
30
+ },
31
+ {
32
+ id: "img00001",
33
+ type: "image",
34
+ props: {
35
+ src: opts.imageSrc,
36
+ alt: "Hero",
37
+ decorative: false,
38
+ width: 1,
39
+ height: 1,
40
+ },
41
+ },
42
+ {
43
+ id: "btn00001",
44
+ type: "button",
45
+ props: { text: "Learn more", href: "/about" },
46
+ },
47
+ {
48
+ id: "form0001",
49
+ type: "form",
50
+ props: { formId: opts.formId },
51
+ children: [
52
+ {
53
+ id: "inp00001",
54
+ type: "text-input",
55
+ props: { field: "email", label: "Email", placeholder: "you@example.com" },
56
+ },
57
+ { id: "sub00001", type: "submit", props: { label: "Send" } },
58
+ ],
59
+ },
60
+ ],
61
+ },
62
+ };
63
+ }
@@ -0,0 +1,273 @@
1
+ /** Bundled Lucide icons as path geometry (A-04 / W-025). No remote fetch. */
2
+
3
+ export type IconPrimitive = {
4
+ tag: "path" | "circle" | "line" | "polyline" | "polygon" | "rect";
5
+ attrs: Record<string, string>;
6
+ };
7
+
8
+ export type BundledIcon = {
9
+ id: string;
10
+ label: string;
11
+ /** Inner SVG primitives only — the renderer wraps them in a fixed <svg>. */
12
+ children: readonly IconPrimitive[];
13
+ };
14
+
15
+ export const BUNDLED_ICONS: readonly BundledIcon[] = [
16
+ {
17
+ id: "arrow-left",
18
+ label: "Arrow Left",
19
+ children: [
20
+ { tag: "path", attrs: { d: "m12 19-7-7 7-7" } },
21
+ { tag: "path", attrs: { d: "M19 12H5" } },
22
+ ],
23
+ },
24
+ {
25
+ id: "arrow-right",
26
+ label: "Arrow Right",
27
+ children: [
28
+ { tag: "path", attrs: { d: "M5 12h14" } },
29
+ { tag: "path", attrs: { d: "m12 5 7 7-7 7" } },
30
+ ],
31
+ },
32
+ {
33
+ id: "calendar",
34
+ label: "Calendar",
35
+ children: [
36
+ { tag: "path", attrs: { d: "M8 2v3" } },
37
+ { tag: "path", attrs: { d: "M16 2v3" } },
38
+ { tag: "rect", attrs: { x: "3", y: "3", width: "18", height: "18", rx: "2" } },
39
+ { tag: "path", attrs: { d: "M3 9h18" } },
40
+ ],
41
+ },
42
+ {
43
+ id: "camera",
44
+ label: "Camera",
45
+ children: [
46
+ {
47
+ tag: "path",
48
+ attrs: {
49
+ d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
50
+ },
51
+ },
52
+ { tag: "circle", attrs: { cx: "12", cy: "13", r: "3" } },
53
+ ],
54
+ },
55
+ {
56
+ id: "check",
57
+ label: "Check",
58
+ children: [{ tag: "path", attrs: { d: "M20 6 9 17l-5-5" } }],
59
+ },
60
+ {
61
+ id: "circle-alert",
62
+ label: "Circle Alert",
63
+ children: [
64
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "10" } },
65
+ { tag: "line", attrs: {} },
66
+ { tag: "line", attrs: {} },
67
+ ],
68
+ },
69
+ {
70
+ id: "circle-check",
71
+ label: "Circle Check",
72
+ children: [
73
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "10" } },
74
+ { tag: "path", attrs: { d: "m16 9-5.5 5.5L8 12" } },
75
+ ],
76
+ },
77
+ {
78
+ id: "clock",
79
+ label: "Clock",
80
+ children: [
81
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "10" } },
82
+ { tag: "path", attrs: { d: "M12 6v6l4 2" } },
83
+ ],
84
+ },
85
+ {
86
+ id: "download",
87
+ label: "Download",
88
+ children: [
89
+ { tag: "path", attrs: { d: "M12 15V3" } },
90
+ { tag: "path", attrs: { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" } },
91
+ { tag: "path", attrs: { d: "m7 10 5 5 5-5" } },
92
+ ],
93
+ },
94
+ {
95
+ id: "external-link",
96
+ label: "External Link",
97
+ children: [
98
+ { tag: "path", attrs: { d: "M15 3h6v6" } },
99
+ { tag: "path", attrs: { d: "M10 14 21 3" } },
100
+ { tag: "path", attrs: { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" } },
101
+ ],
102
+ },
103
+ {
104
+ id: "globe",
105
+ label: "Globe",
106
+ children: [
107
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "10" } },
108
+ { tag: "path", attrs: { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" } },
109
+ { tag: "path", attrs: { d: "M2 12h20" } },
110
+ ],
111
+ },
112
+ {
113
+ id: "heart",
114
+ label: "Heart",
115
+ children: [
116
+ {
117
+ tag: "path",
118
+ attrs: {
119
+ d: "M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",
120
+ },
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ id: "house",
126
+ label: "House",
127
+ children: [
128
+ { tag: "path", attrs: { d: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" } },
129
+ {
130
+ tag: "path",
131
+ attrs: {
132
+ d: "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
133
+ },
134
+ },
135
+ ],
136
+ },
137
+ {
138
+ id: "info",
139
+ label: "Info",
140
+ children: [
141
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "10" } },
142
+ { tag: "path", attrs: { d: "M12 16v-4" } },
143
+ { tag: "path", attrs: { d: "M12 8h.01" } },
144
+ ],
145
+ },
146
+ {
147
+ id: "mail",
148
+ label: "Mail",
149
+ children: [
150
+ { tag: "path", attrs: { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" } },
151
+ { tag: "rect", attrs: { x: "2", y: "4", width: "20", height: "16", rx: "2" } },
152
+ ],
153
+ },
154
+ {
155
+ id: "menu",
156
+ label: "Menu",
157
+ children: [
158
+ { tag: "path", attrs: { d: "M4 5h16" } },
159
+ { tag: "path", attrs: { d: "M4 12h16" } },
160
+ { tag: "path", attrs: { d: "M4 19h16" } },
161
+ ],
162
+ },
163
+ {
164
+ id: "minus",
165
+ label: "Minus",
166
+ children: [{ tag: "path", attrs: { d: "M5 12h14" } }],
167
+ },
168
+ {
169
+ id: "phone",
170
+ label: "Phone",
171
+ children: [
172
+ {
173
+ tag: "path",
174
+ attrs: {
175
+ d: "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",
176
+ },
177
+ },
178
+ ],
179
+ },
180
+ {
181
+ id: "play",
182
+ label: "Play",
183
+ children: [
184
+ {
185
+ tag: "path",
186
+ attrs: {
187
+ d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
188
+ },
189
+ },
190
+ ],
191
+ },
192
+ {
193
+ id: "plus",
194
+ label: "Plus",
195
+ children: [
196
+ { tag: "path", attrs: { d: "M5 12h14" } },
197
+ { tag: "path", attrs: { d: "M12 5v14" } },
198
+ ],
199
+ },
200
+ {
201
+ id: "search",
202
+ label: "Search",
203
+ children: [
204
+ { tag: "path", attrs: { d: "m21 21-4.34-4.34" } },
205
+ { tag: "circle", attrs: { cx: "11", cy: "11", r: "8" } },
206
+ ],
207
+ },
208
+ {
209
+ id: "settings",
210
+ label: "Settings",
211
+ children: [
212
+ {
213
+ tag: "path",
214
+ attrs: {
215
+ d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
216
+ },
217
+ },
218
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "3" } },
219
+ ],
220
+ },
221
+ {
222
+ id: "shopping-cart",
223
+ label: "Shopping Cart",
224
+ children: [
225
+ {
226
+ tag: "path",
227
+ attrs: { d: "m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18" },
228
+ },
229
+ {
230
+ tag: "path",
231
+ attrs: { d: "M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25" },
232
+ },
233
+ { tag: "circle", attrs: { cx: "18", cy: "20", r: "2" } },
234
+ { tag: "circle", attrs: { cx: "8", cy: "20", r: "2" } },
235
+ ],
236
+ },
237
+ {
238
+ id: "star",
239
+ label: "Star",
240
+ children: [
241
+ {
242
+ tag: "path",
243
+ attrs: {
244
+ d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
245
+ },
246
+ },
247
+ ],
248
+ },
249
+ {
250
+ id: "user",
251
+ label: "User",
252
+ children: [
253
+ { tag: "path", attrs: { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" } },
254
+ { tag: "circle", attrs: { cx: "12", cy: "7", r: "4" } },
255
+ ],
256
+ },
257
+ {
258
+ id: "x",
259
+ label: "X",
260
+ children: [
261
+ { tag: "path", attrs: { d: "M18 6 6 18" } },
262
+ { tag: "path", attrs: { d: "m6 6 12 12" } },
263
+ ],
264
+ },
265
+ ];
266
+
267
+ export const BUNDLED_ICON_IDS = BUNDLED_ICONS.map((icon) => icon.id);
268
+
269
+ const byId = new Map(BUNDLED_ICONS.map((icon) => [icon.id, icon]));
270
+
271
+ export function getBundledIcon(id: string): BundledIcon | undefined {
272
+ return byId.get(id);
273
+ }