@fusion.dev/helix-sandbox 0.0.0-dev

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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/api.json +1 -0
  4. package/custom-elements.json +1182 -0
  5. package/dist/code-block/code-block-highlight.d.ts +16 -0
  6. package/dist/code-block/code-block-highlight.d.ts.map +1 -0
  7. package/dist/code-block/code-block-highlight.js +10 -0
  8. package/dist/code-block/code-block-highlight.js.map +1 -0
  9. package/dist/code-block/index.d.ts +2 -0
  10. package/dist/code-block/index.d.ts.map +1 -0
  11. package/dist/code-block/index.js +5 -0
  12. package/dist/code-block/index.js.map +1 -0
  13. package/dist/editor/index.d.ts +2 -0
  14. package/dist/editor/index.d.ts.map +1 -0
  15. package/dist/editor/index.js +2 -0
  16. package/dist/editor/index.js.map +1 -0
  17. package/dist/editor/root/editor-root.css.d.ts +2 -0
  18. package/dist/editor/root/editor-root.css.d.ts.map +1 -0
  19. package/dist/editor/root/editor-root.css.js +3 -0
  20. package/dist/editor/root/editor-root.css.js.map +1 -0
  21. package/dist/editor/root/editor-root.d.ts +146 -0
  22. package/dist/editor/root/editor-root.d.ts.map +1 -0
  23. package/dist/editor/root/editor-root.js +199 -0
  24. package/dist/editor/root/editor-root.js.map +1 -0
  25. package/dist/highlight/highlight.d.ts +25 -0
  26. package/dist/highlight/highlight.d.ts.map +1 -0
  27. package/dist/highlight/highlight.js +97 -0
  28. package/dist/highlight/highlight.js.map +1 -0
  29. package/dist/highlight/index.d.ts +4 -0
  30. package/dist/highlight/index.d.ts.map +1 -0
  31. package/dist/highlight/index.js +4 -0
  32. package/dist/highlight/index.js.map +1 -0
  33. package/dist/highlight/language.d.ts +26 -0
  34. package/dist/highlight/language.d.ts.map +1 -0
  35. package/dist/highlight/language.js +21 -0
  36. package/dist/highlight/language.js.map +1 -0
  37. package/dist/highlight/shell.d.ts +10 -0
  38. package/dist/highlight/shell.d.ts.map +1 -0
  39. package/dist/highlight/shell.js +31 -0
  40. package/dist/highlight/shell.js.map +1 -0
  41. package/dist/highlight/stream.d.ts +10 -0
  42. package/dist/highlight/stream.d.ts.map +1 -0
  43. package/dist/highlight/stream.js +178 -0
  44. package/dist/highlight/stream.js.map +1 -0
  45. package/dist/highlight/syntax.d.ts +10 -0
  46. package/dist/highlight/syntax.d.ts.map +1 -0
  47. package/dist/highlight/syntax.js +100 -0
  48. package/dist/highlight/syntax.js.map +1 -0
  49. package/dist/index.d.ts +20 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +2 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/sandbox/editor/sandbox-editor.css.d.ts +2 -0
  54. package/dist/sandbox/editor/sandbox-editor.css.d.ts.map +1 -0
  55. package/dist/sandbox/editor/sandbox-editor.css.js +3 -0
  56. package/dist/sandbox/editor/sandbox-editor.css.js.map +1 -0
  57. package/dist/sandbox/editor/sandbox-editor.d.ts +147 -0
  58. package/dist/sandbox/editor/sandbox-editor.d.ts.map +1 -0
  59. package/dist/sandbox/editor/sandbox-editor.js +199 -0
  60. package/dist/sandbox/editor/sandbox-editor.js.map +1 -0
  61. package/examples.json +1 -0
  62. package/lint.json +1 -0
  63. package/package.json +116 -0
  64. package/types/jsx.d.ts +638 -0
  65. package/types/svelte.d.ts +36 -0
  66. package/types/vue.d.ts +134 -0
  67. package/types/words.d.ts +22 -0
package/types/vue.d.ts ADDED
@@ -0,0 +1,134 @@
1
+ import type {
2
+ HelixSandboxEditor,
3
+ HelixBeforeEditEvent,
4
+ HelixCaretEvent,
5
+ HelixEditEvent,
6
+ } from "@fusion.dev/helix-sandbox";
7
+ import type { HTMLAttributes, PublicProps, EmitFn, EmitsToProps } from "vue";
8
+
9
+ /** This file was autogenerated by @wc-toolkit/vuejs-types */
10
+ /**
11
+ * A generic type for strongly typing custom events with their targets
12
+ * @template T - The type of the event target (extends EventTarget)
13
+ * @template D - The type of the detail payload for the custom event
14
+ */
15
+ type TypedEvent<T extends EventTarget, E = Event> = E & {
16
+ target: T;
17
+ };
18
+
19
+ export type EventMap = {
20
+ [event: string]: Event;
21
+ };
22
+
23
+ // Vue's template type-checking reads props from $props and events from $emit.
24
+ // See: https://vuejs.org/guide/extras/web-components.html#non-vue-web-components-and-typescript
25
+ export type VueEmitsOptions<T extends EventMap> = {
26
+ [K in keyof T]: (event: T[K]) => void;
27
+ };
28
+
29
+ export type VueEmit<T extends EventMap> = EmitFn<VueEmitsOptions<T>>;
30
+
31
+ // Helps Volar autocomplete "@event" by providing "onXxx" props.
32
+ export type VueOnProps<T extends EventMap> = EmitsToProps<VueEmitsOptions<T>>;
33
+
34
+ export type DefineCustomElement<
35
+ ElementType extends HTMLElement,
36
+ Props = {},
37
+ Events extends EventMap = {},
38
+ > = new () => ElementType & {
39
+ /** @deprecated Do not use the $props property on a Custom Element ref; this is for template prop types only. */
40
+ $props: HTMLAttributes & Props & PublicProps & VueOnProps<Events>;
41
+
42
+ /** @deprecated Do not use the $emit property on a Custom Element ref; this is for template event types only. */
43
+ $emit: VueEmit<Events>;
44
+ };
45
+
46
+ /** `HelixSandboxEditor` component event */
47
+ export type HelixSandboxEditorElementEvent<E = Event> = TypedEvent<
48
+ HelixSandboxEditor,
49
+ E
50
+ >;
51
+ /** `helix-before-edit` event type */
52
+ export type HelixSandboxEditorHelixBeforeEditElementEvent =
53
+ HelixSandboxEditorElementEvent<HelixBeforeEditEvent>;
54
+ /** `helix-caret` event type */
55
+ export type HelixSandboxEditorHelixCaretElementEvent =
56
+ HelixSandboxEditorElementEvent<HelixCaretEvent>;
57
+ /** `helix-edit` event type */
58
+ export type HelixSandboxEditorHelixEditElementEvent =
59
+ HelixSandboxEditorElementEvent<HelixEditEvent>;
60
+
61
+ export type HelixSandboxEditorVueProps = {
62
+ /** Accessible name for the editable region. */
63
+ "field-label"?: (HelixSandboxEditor["fieldLabel"]) | undefined;
64
+ /** Accessible name for the editable region. */
65
+ fieldLabel?: (HelixSandboxEditor["fieldLabel"]) | undefined;
66
+ /** The language of the source, which decides how it is highlighted. A name
67
+ the editor does not read draws the source plain. */
68
+ language?: (HelixSandboxEditor["language"]) | undefined;
69
+ /** Which source this pane holds, echoed in every change. */
70
+ name?: (HelixSandboxEditor["name"]) | undefined;
71
+ /** Whether the text can be changed.
72
+
73
+ `EditorState.readOnly` rather than removing the editor's focus or its
74
+ keymap: a reader still needs to select the text, scroll it, and put a
75
+ cursor in it to read a long line. What it stops is the typing. */
76
+ readonly?: (HelixSandboxEditor["readOnly"]) | undefined;
77
+ /** Whether the text can be changed.
78
+
79
+ `EditorState.readOnly` rather than removing the editor's focus or its
80
+ keymap: a reader still needs to select the text, scroll it, and put a
81
+ cursor in it to read a long line. What it stops is the typing. */
82
+ readOnly?: (HelixSandboxEditor["readOnly"]) | undefined;
83
+ /** The source being edited. */
84
+ value?: (HelixSandboxEditor["value"]) | undefined;
85
+ };
86
+
87
+ export type HelixSandboxEditorVueEvents = {
88
+ /** Fired before the source is edited. Cancelable: refusing it takes the decision and nothing moves. */
89
+ "helix-before-edit": HelixSandboxEditorHelixBeforeEditElementEvent;
90
+ /** Fired when the cursor moves, with its line and column. */
91
+ "helix-caret": HelixSandboxEditorHelixCaretElementEvent;
92
+ /** Fired after the source was edited, with the new source. */
93
+ "helix-edit": HelixSandboxEditorHelixEditElementEvent;
94
+ };
95
+
96
+ export type CustomCssProperties = {};
97
+
98
+ // Vue SFC template type-checking (GlobalComponents) for non-Vue custom elements.
99
+ // Note: Some tooling expects this augmentation under "@vue/runtime-core", while
100
+ // other docs/examples use "vue". We emit both for compatibility.
101
+ export interface WcToolkitVueGlobalComponents {
102
+ /** CodeMirror, not a '<textarea>'. A textarea cannot highlight what it holds, number its lines, or say where the cursor is, and a status bar reading line and column has to ask something. **On its own path.** This is '@fusion.dev/helix-sandbox/editor', and the package's root exports its class as a type only, because CodeMirror is most of what the package weighs over the wire. A sandbox with no editable pane pays for none, and neither does a site that registers its elements once. 'language' names the grammar by the name a file or a sandbox pane carries: 'css', 'html', 'js', 'jsx', 'mjs', 'sh', 'ts' or 'tsx'. A name the editor does not read draws the source plain, and the console says so once. Each edit a reader makes is 'helix-before-edit' first, which you can cancel to refuse the edit, and 'helix-edit' once the source holds it, as 'helix-sandbox-source' sends them. A 'value' set from outside is the source the editor is given, and sends neither. **The editor is ':state(modified)' while its source differs from the source it was given**, the first 'value' or the last one set from outside, and 'reset()' puts that source back as an edit. The view is built once and reconfigured, not rebuilt. Replacing it on every change would throw away the undo history, the scroll position, and the selection, which is most of what an editor is. */
103
+ "helix-sandbox-editor": DefineCustomElement<
104
+ HelixSandboxEditor,
105
+ HelixSandboxEditorVueProps,
106
+ HelixSandboxEditorVueEvents
107
+ >;
108
+ }
109
+
110
+ declare module "@vue/runtime-core" {
111
+ interface GlobalComponents extends WcToolkitVueGlobalComponents {}
112
+ }
113
+
114
+ declare module "@vue/runtime-dom" {
115
+ interface GlobalComponents extends WcToolkitVueGlobalComponents {}
116
+
117
+ // Needed for named slots on native elements when using Web Components.
118
+ // Vue templates otherwise reject: <span slot="icon" />
119
+ interface HTMLAttributes {
120
+ slot?: (string) | undefined;
121
+ }
122
+ }
123
+
124
+ declare module "vue" {
125
+ interface GlobalComponents extends WcToolkitVueGlobalComponents {}
126
+
127
+ // Some package managers (notably pnpm) may not make "@vue/runtime-dom" directly
128
+ // resolvable from the consuming project, so we also augment via "vue".
129
+ interface HTMLAttributes {
130
+ slot?: (string) | undefined;
131
+ }
132
+
133
+ interface CSSProperties extends CustomCssProperties {}
134
+ }
@@ -0,0 +1,22 @@
1
+ // Generated by `helix-words-types` from this package manifest. Do not edit.
2
+ //
3
+ // `registerWords`, and the words each family lets you register with it, keyed
4
+ // by the family tag. Import it from here, which types your calls:
5
+ // `import { registerWords } from '@fusion.dev/helix-sandbox/words'`. With it imported
6
+ // from elsewhere, `import type {} from '@fusion.dev/helix-sandbox/words'` types them.
7
+ import type { Message, MessageTable } from '@fusion.dev/helix-core'
8
+
9
+ export * from '@fusion.dev/helix-core/words'
10
+
11
+ declare module '@fusion.dev/helix-core' {
12
+ interface HelixWords {
13
+ 'helix-sandbox-editor': {
14
+ /**
15
+ * Accessible name for the editable region.
16
+ *
17
+ * English: `Example source`
18
+ */
19
+ fieldLabel: Message
20
+ }
21
+ }
22
+ }