@artkit-ai/react 0.0.0-stage → 0.2.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 +202 -0
- package/README.md +145 -2
- package/dist/cache.d.ts +31 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +95 -0
- package/dist/cache.js.map +1 -0
- package/dist/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +233 -0
- package/dist/client.js.map +1 -0
- package/dist/components/card.d.ts +22 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +16 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/editor.d.ts +41 -0
- package/dist/components/editor.d.ts.map +1 -0
- package/dist/components/editor.js +111 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/icons.d.ts +8 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/icons.js +14 -0
- package/dist/components/icons.js.map +1 -0
- package/dist/components/panel.d.ts +31 -0
- package/dist/components/panel.d.ts.map +1 -0
- package/dist/components/panel.js +132 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/shared.d.ts +67 -0
- package/dist/components/shared.d.ts.map +1 -0
- package/dist/components/shared.js +100 -0
- package/dist/components/shared.js.map +1 -0
- package/dist/components/view.d.ts +39 -0
- package/dist/components/view.d.ts.map +1 -0
- package/dist/components/view.js +76 -0
- package/dist/components/view.js.map +1 -0
- package/dist/context.d.ts +64 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +13 -0
- package/dist/context.js.map +1 -0
- package/dist/controls.d.ts +145 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +188 -0
- package/dist/controls.js.map +1 -0
- package/dist/download.d.ts +4 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +20 -0
- package/dist/download.js.map +1 -0
- package/dist/editor-session.d.ts +96 -0
- package/dist/editor-session.d.ts.map +1 -0
- package/dist/editor-session.js +192 -0
- package/dist/editor-session.js.map +1 -0
- package/dist/hooks.d.ts +64 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +205 -0
- package/dist/hooks.js.map +1 -0
- package/dist/i18n.d.ts +135 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +145 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/kit-css.d.ts +3 -0
- package/dist/kit-css.d.ts.map +1 -0
- package/dist/kit-css.js +5 -0
- package/dist/kit-css.js.map +1 -0
- package/dist/partial-json.d.ts +8 -0
- package/dist/partial-json.d.ts.map +1 -0
- package/dist/partial-json.js +176 -0
- package/dist/partial-json.js.map +1 -0
- package/dist/provider.d.ts +42 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +95 -0
- package/dist/provider.js.map +1 -0
- package/dist/styles.d.ts +25 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +203 -0
- package/dist/styles.js.map +1 -0
- package/dist/toolbar.d.ts +90 -0
- package/dist/toolbar.d.ts.map +1 -0
- package/dist/toolbar.js +233 -0
- package/dist/toolbar.js.map +1 -0
- package/package.json +50 -3
- package/src/cache.ts +109 -0
- package/src/client.ts +342 -0
- package/src/components/card.tsx +86 -0
- package/src/components/editor.tsx +292 -0
- package/src/components/icons.tsx +14 -0
- package/src/components/panel.tsx +334 -0
- package/src/components/shared.tsx +198 -0
- package/src/components/view.tsx +196 -0
- package/src/context.ts +87 -0
- package/src/controls.tsx +587 -0
- package/src/download.ts +23 -0
- package/src/editor-session.ts +260 -0
- package/src/hooks.ts +296 -0
- package/src/i18n.ts +155 -0
- package/src/index.ts +128 -0
- package/src/kit-css.ts +5 -0
- package/src/partial-json.ts +160 -0
- package/src/provider.tsx +176 -0
- package/src/styles.ts +222 -0
- package/src/toolbar.tsx +536 -0
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/** UI strings in pt-BR and en (spec §18.1). Templates use `{name}` placeholders. */
|
|
2
|
+
export const uiMessages = {
|
|
3
|
+
en: {
|
|
4
|
+
loading: 'Loading…',
|
|
5
|
+
generating: 'Generating…',
|
|
6
|
+
provisional: 'Preview — not saved yet',
|
|
7
|
+
noRenderer: 'No renderer is registered for kind "{format}". Showing the raw content.',
|
|
8
|
+
loadFailed: 'Could not load this artifact.',
|
|
9
|
+
retry: 'Retry',
|
|
10
|
+
close: 'Close',
|
|
11
|
+
open: 'Open',
|
|
12
|
+
openTitle: 'Open {title}',
|
|
13
|
+
version: 'Version',
|
|
14
|
+
versionShort: 'v{version}',
|
|
15
|
+
latest: 'latest',
|
|
16
|
+
tabView: 'View',
|
|
17
|
+
tabCode: 'Code',
|
|
18
|
+
tabEdit: 'Edit',
|
|
19
|
+
save: 'Save',
|
|
20
|
+
tabsLabel: 'Artifact sections',
|
|
21
|
+
copy: 'Copy',
|
|
22
|
+
copied: 'Copied',
|
|
23
|
+
export: 'Export',
|
|
24
|
+
exportAs: 'Export as {format}',
|
|
25
|
+
exporting: 'Exporting…',
|
|
26
|
+
exported: 'Exported {filename}',
|
|
27
|
+
exportWarnings: 'Export finished with warnings:',
|
|
28
|
+
noExportFormats: 'No export formats available',
|
|
29
|
+
rejectReason: 'Reason for rejection',
|
|
30
|
+
confirmReject: 'Confirm rejection',
|
|
31
|
+
cancel: 'Cancel',
|
|
32
|
+
loadMore: 'Load more',
|
|
33
|
+
by: 'by {actor}',
|
|
34
|
+
actor_agent: 'agent',
|
|
35
|
+
actor_user: 'user',
|
|
36
|
+
actor_system: 'system',
|
|
37
|
+
changes: 'Changes',
|
|
38
|
+
noChanges: 'No changes.',
|
|
39
|
+
change_added: 'Added',
|
|
40
|
+
change_removed: 'Removed',
|
|
41
|
+
change_changed: 'Changed',
|
|
42
|
+
change_moved: 'Moved',
|
|
43
|
+
diffUnified: 'Highlighted',
|
|
44
|
+
diffSplit: 'Side by side',
|
|
45
|
+
diffViewLabel: 'Diff layout',
|
|
46
|
+
lineAdded: 'added',
|
|
47
|
+
lineRemoved: 'removed',
|
|
48
|
+
undo: 'Undo',
|
|
49
|
+
redo: 'Redo',
|
|
50
|
+
undone: 'Change undone',
|
|
51
|
+
redone: 'Change redone',
|
|
52
|
+
saving: 'Saving…',
|
|
53
|
+
saved: 'Saved',
|
|
54
|
+
unsaved: 'Unsaved changes',
|
|
55
|
+
rolledBack: 'Change rejected: {message}',
|
|
56
|
+
dismiss: 'Dismiss',
|
|
57
|
+
readOnly: 'Read only',
|
|
58
|
+
lockedBy: 'Locked by the {actor} — editing is disabled.',
|
|
59
|
+
lockedUntil: 'Locked until {time} — editing is disabled.',
|
|
60
|
+
reapplyMine: 'Reapply my edit',
|
|
61
|
+
editorLabel: 'Editor for {title}',
|
|
62
|
+
lintWarnings: '{count} lint warnings',
|
|
63
|
+
},
|
|
64
|
+
'pt-BR': {
|
|
65
|
+
loading: 'Carregando…',
|
|
66
|
+
generating: 'Gerando…',
|
|
67
|
+
provisional: 'Prévia — ainda não salva',
|
|
68
|
+
noRenderer: 'Não há renderer registrado para o tipo "{format}". Exibindo o conteúdo bruto.',
|
|
69
|
+
loadFailed: 'Não foi possível carregar este artefato.',
|
|
70
|
+
retry: 'Tentar novamente',
|
|
71
|
+
close: 'Fechar',
|
|
72
|
+
open: 'Abrir',
|
|
73
|
+
openTitle: 'Abrir {title}',
|
|
74
|
+
version: 'Versão',
|
|
75
|
+
versionShort: 'v{version}',
|
|
76
|
+
latest: 'atual',
|
|
77
|
+
tabView: 'Visualização',
|
|
78
|
+
tabCode: 'Código',
|
|
79
|
+
tabEdit: 'Editar',
|
|
80
|
+
save: 'Salvar',
|
|
81
|
+
tabsLabel: 'Seções do artefato',
|
|
82
|
+
copy: 'Copiar',
|
|
83
|
+
copied: 'Copiado',
|
|
84
|
+
export: 'Exportar',
|
|
85
|
+
exportAs: 'Exportar como {format}',
|
|
86
|
+
exporting: 'Exportando…',
|
|
87
|
+
exported: '{filename} exportado',
|
|
88
|
+
exportWarnings: 'Exportação concluída com avisos:',
|
|
89
|
+
noExportFormats: 'Nenhum formato de exportação disponível',
|
|
90
|
+
rejectReason: 'Motivo da rejeição',
|
|
91
|
+
confirmReject: 'Confirmar rejeição',
|
|
92
|
+
cancel: 'Cancelar',
|
|
93
|
+
loadMore: 'Carregar mais',
|
|
94
|
+
by: 'por {actor}',
|
|
95
|
+
actor_agent: 'agente',
|
|
96
|
+
actor_user: 'usuário',
|
|
97
|
+
actor_system: 'sistema',
|
|
98
|
+
changes: 'Alterações',
|
|
99
|
+
noChanges: 'Nenhuma alteração.',
|
|
100
|
+
change_added: 'Inserido',
|
|
101
|
+
change_removed: 'Removido',
|
|
102
|
+
change_changed: 'Alterado',
|
|
103
|
+
change_moved: 'Movido',
|
|
104
|
+
diffUnified: 'Destacado',
|
|
105
|
+
diffSplit: 'Lado a lado',
|
|
106
|
+
diffViewLabel: 'Layout do diff',
|
|
107
|
+
lineAdded: 'inserida',
|
|
108
|
+
lineRemoved: 'removida',
|
|
109
|
+
undo: 'Desfazer',
|
|
110
|
+
redo: 'Refazer',
|
|
111
|
+
undone: 'Alteração desfeita',
|
|
112
|
+
redone: 'Alteração refeita',
|
|
113
|
+
saving: 'Salvando…',
|
|
114
|
+
saved: 'Salvo',
|
|
115
|
+
unsaved: 'Alterações não salvas',
|
|
116
|
+
rolledBack: 'Alteração rejeitada: {message}',
|
|
117
|
+
dismiss: 'Dispensar',
|
|
118
|
+
readOnly: 'Somente leitura',
|
|
119
|
+
lockedBy: 'Bloqueado pelo {actor} — edição desativada.',
|
|
120
|
+
lockedUntil: 'Bloqueado até {time} — edição desativada.',
|
|
121
|
+
reapplyMine: 'Reaplicar minha edição',
|
|
122
|
+
editorLabel: 'Editor de {title}',
|
|
123
|
+
lintWarnings: '{count} avisos de lint',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
function format(template, params = {}) {
|
|
127
|
+
return template.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Resolution order: exact override, language override, built-in catalog (pt* → pt-BR, else en), English.
|
|
131
|
+
*/
|
|
132
|
+
export function createTranslator(locale, overrides = {}) {
|
|
133
|
+
const language = locale.split('-')[0]?.toLowerCase() ?? '';
|
|
134
|
+
const builtIn = language === 'pt' ? uiMessages['pt-BR'] : uiMessages.en;
|
|
135
|
+
const layers = [overrides[locale], overrides[language], builtIn, uiMessages.en];
|
|
136
|
+
return (key, params) => {
|
|
137
|
+
for (const layer of layers) {
|
|
138
|
+
const template = layer?.[key];
|
|
139
|
+
if (template !== undefined)
|
|
140
|
+
return format(template, params);
|
|
141
|
+
}
|
|
142
|
+
return key;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,aAAa;QACzB,WAAW,EAAE,yBAAyB;QACtC,UAAU,EAAE,yEAAyE;QACrF,UAAU,EAAE,+BAA+B;QAC3C,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,cAAc;QACzB,OAAO,EAAE,SAAS;QAClB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;QAChB,QAAQ,E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pClient, createServiceClient, type ExportInput, errorFromResponse, filenameFromDisposition, type HttpClientOptions, type ReadOptions, type RequestOptions, } from './client.js';
|
|
3
|
+
export { ArtifactCard, type ArtifactCardPart, type ArtifactCardProps } from './components/card.js';
|
|
4
|
+
export { ArtifactEditor, type ArtifactEditorPart, type ArtifactEditorProps, type SaveEvent, } from './components/editor.js';
|
|
5
|
+
export { ArtifactPanel, type ArtifactPanelPart, type ArtifactPanelProps, type PanelTab, } from './components/panel.js';
|
|
6
|
+
export type { Slots } from './components/shared.js';
|
|
7
|
+
export { ArtifactView, type ArtifactViewPart, type ArtifactViewProps, FormatRenderer, previewContent, } from './components/view.js';
|
|
8
|
+
export { type ArtifactLoaders, type ArtkitContextValue, type ColorScheme, type EditorModule, type RendererModule, type RendererProps, useArtkit, useOptionalArtkit, } from './context.js';
|
|
9
|
+
export { Button, type ButtonProps, ButtonRow, ColorPicker, type ColorPickerProps, type ControlSize, type ControlVariant, controlsCss, Field, type FieldProps, FieldRow, Hint, IconButton, type IconButtonProps, Inspector, type InspectorProps, InspectorSection, type InspectorSectionProps, NumberField, type NumberFieldProps, Segmented, type SegmentedProps, SelectField, type SelectFieldProps, Switch, type SwitchProps, TextField, type TextFieldProps, Toggle, type ToggleProps, } from './controls.js';
|
|
10
|
+
export { triggerDownload } from './download.js';
|
|
11
|
+
export { DraftSession, type DraftSessionOptions, type DraftSnapshot, type EmitOptions, } from './editor-session.js';
|
|
12
|
+
export { type ApplyConflict, type ApplyOptions, type ExportOptions, type UseApplyOperationsResult, type UseArtifactExportResult, type UseArtifactOptions, type UseArtifactResult, useApplyOperations, useArtifact, useArtifactExport, useLatestVersion, } from './hooks.js';
|
|
13
|
+
export { createTranslator, type Translate, type UiMessageKey, type UiMessageOverrides, type UiMessages, uiMessages, } from './i18n.js';
|
|
14
|
+
export { kitCss } from './kit-css.js';
|
|
15
|
+
export { parsePartialJson } from './partial-json.js';
|
|
16
|
+
export { ArtifactProvider, type ArtifactProviderProps } from './provider.js';
|
|
17
|
+
export { artkitCss, darkTheme, mixColors, themeStyles } from './styles.js';
|
|
18
|
+
export { Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarColor, type ToolbarColorOption, type ToolbarColorProps, ToolbarGroup, ToolbarMenu, type ToolbarMenuItem, type ToolbarMenuProps, type ToolbarOption, type ToolbarProps, ToolbarSelect, type ToolbarSelectProps, ToolbarSpacer, themeSwatches, toolbarCss, } from './toolbar.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,WAAW,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,SAAS,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,GACd,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,cAAc,EACd,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EA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qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EACL,OAAO,EACP,aAAa,EACb,KAAK,kBAAkB,EACvB,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,YAAY,EACZ,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,aAAa,EACb,KAAK,kBAAkB,EACvB,aAAa,EACb,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { ArtifactCache } from './cache.js';
|
|
2
|
+
export { createHttpClient, createServiceClient, errorFromResponse, filenameFromDisposition, } from './client.js';
|
|
3
|
+
export { ArtifactCard } from './components/card.js';
|
|
4
|
+
export { ArtifactEditor, } from './components/editor.js';
|
|
5
|
+
export { ArtifactPanel, } from './components/panel.js';
|
|
6
|
+
export { ArtifactView, FormatRenderer, previewContent, } from './components/view.js';
|
|
7
|
+
export { useArtkit, useOptionalArtkit, } from './context.js';
|
|
8
|
+
export { Button, ButtonRow, ColorPicker, controlsCss, Field, FieldRow, Hint, IconButton, Inspector, InspectorSection, NumberField, Segmented, SelectField, Switch, TextField, Toggle, } from './controls.js';
|
|
9
|
+
export { triggerDownload } from './download.js';
|
|
10
|
+
export { DraftSession, } from './editor-session.js';
|
|
11
|
+
export { useApplyOperations, useArtifact, useArtifactExport, useLatestVersion, } from './hooks.js';
|
|
12
|
+
export { createTranslator, uiMessages, } from './i18n.js';
|
|
13
|
+
export { kitCss } from './kit-css.js';
|
|
14
|
+
export { parsePartialJson } from './partial-json.js';
|
|
15
|
+
export { ArtifactProvider } from './provider.js';
|
|
16
|
+
export { artkitCss, darkTheme, mixColors, themeStyles } from './styles.js';
|
|
17
|
+
export { Toolbar, ToolbarButton, ToolbarColor, ToolbarGroup, ToolbarMenu, ToolbarSelect, ToolbarSpacer, themeSwatches, toolbarCss, } from './toolbar.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAIL,gBAAgB,EAChB,mBAAmB,EAEnB,iBAAiB,EACjB,uBAAuB,GAIxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAiD,MAAM,sBAAsB,CAAC;AACnG,OAAO,EACL,cAAc,GAIf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,aAAa,GAId,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,YAAY,EAGZ,cAAc,EACd,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAOL,SAAS,EACT,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,MAAM,EAEN,SAAS,EACT,WAAW,EAIX,WAAW,EACX,KAAK,EAEL,QAAQ,EACR,IAAI,EACJ,UAAU,EAEV,SAAS,EAET,gBAAgB,EAEhB,WAAW,EAEX,SAAS,EAET,WAAW,EAEX,MAAM,EAEN,SAAS,EAET,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,YAAY,GAIb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAQL,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAKhB,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAA8B,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EACL,OAAO,EACP,aAAa,EAEb,YAAY,EAGZ,YAAY,EACZ,WAAW,EAKX,aAAa,EAEb,aAAa,EACb,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Toolbar and form control styles shared by every kind editor and viewer (include once per kind CSS). */
|
|
2
|
+
export declare const kitCss = "\n.ak-tb{display:flex;flex-wrap:wrap;align-items:center;gap:4px;padding:6px;background:var(--ak-color-background,#fff);color:var(--ak-color-text,#1d2f3c);border:1px solid var(--ak-color-border,#dde0e2);border-radius:var(--ak-radius-md,8px);font-family:var(--ak-font-body,\"Sora\",system-ui,sans-serif);font-size:13px;line-height:1}\n.ak-tb--sticky{position:sticky;top:0;z-index:5}\n.ak-tb-group{display:inline-flex;align-items:center;gap:2px;margin:0;padding:0 0 0 6px;border:0;border-left:1px solid var(--ak-color-border,#dde0e2);min-inline-size:0}\n.ak-tb-group:first-child{padding-left:0;border-left:0}\n.ak-tb-spacer{flex:1}\n.ak-tb-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n.ak-tb-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;height:32px;padding:0 6px;border:1px solid transparent;border-radius:var(--ak-radius-sm,6px);background:none;color:var(--ak-color-muted,#56636d);font:inherit;font-weight:600;cursor:pointer;white-space:nowrap;transition:background-color .15s,color .15s,border-color .15s}\n.ak-tb-button svg{width:16px;height:16px;flex-shrink:0}\n.ak-tb-button--text{padding:0 10px;color:var(--ak-color-text,#1d2f3c)}\n.ak-tb-button:hover:not(:disabled){background:var(--ak-color-hover,#f2f3f4);color:var(--ak-color-text,#1d2f3c)}\n.ak-tb-button:active:not(:disabled){background:var(--ak-color-active,#e8eaec)}\n.ak-tb-button[aria-pressed=\"true\"],.ak-tb-button[aria-expanded=\"true\"]{background:var(--ak-color-fill-accent,#e7f2ef);color:var(--ak-color-accent,#0f7a5a);border-color:var(--ak-color-accent,#0f7a5a)}\n.ak-tb-button[data-variant=\"primary\"]{background:var(--ak-gradient-button);color:var(--ak-color-on-primary,#1d2f3c);border-color:transparent}\n.ak-tb-button[data-variant=\"primary\"]:hover:not(:disabled){background:var(--ak-gradient-button-hover)}\n.ak-tb-button[data-variant=\"danger\"]{color:var(--ak-color-danger,#9f343a)}\n.ak-tb-button[data-variant=\"danger\"]:hover:not(:disabled){background:var(--ak-color-fill-danger,#f5ebeb)}\n.ak-tb-button:disabled,.ak-tb-select:disabled{opacity:.4;cursor:not-allowed}\n.ak-tb-button:focus-visible,.ak-tb-select:focus-visible,.ak-tb-menu-item:focus-visible,.ak-tb-swatch:focus-visible{outline:2px solid var(--ak-color-focus,#0f7a5a);outline-offset:2px}\n.ak-tb-button--menu{padding:0 4px 0 6px;gap:2px}\n.ak-tb-button--menu.ak-tb-button--text{padding:0 6px 0 10px}\n.ak-tb-button .ak-tb-caret{width:12px;height:12px;opacity:.7}\n.ak-tb-color-icon{position:relative;display:inline-flex;flex-direction:column;align-items:center;gap:1px}\n.ak-tb-color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid var(--ak-color-border,#dde0e2)}\n.ak-tb-select{height:32px;max-width:200px;padding:0 8px;font:inherit;font-size:13px;color:var(--ak-color-text,#1d2f3c);background:var(--ak-color-background,#fff);border:1px solid var(--ak-color-border-strong,#8e979d);border-radius:var(--ak-radius-sm,6px);cursor:pointer}\n.ak-tb-anchor{position:relative;display:inline-flex}\n.ak-tb-popover{position:absolute;top:calc(100% + 4px);left:0;z-index:30;display:flex;flex-direction:column;min-width:200px;max-height:360px;overflow:auto;padding:4px;background:var(--ak-color-background,#fff);border:1px solid var(--ak-color-border-strong,#8e979d);border-radius:var(--ak-radius-md,8px)}\n.ak-tb-menu-item{display:flex;align-items:center;gap:8px;width:100%;min-height:32px;padding:0 10px;border:0;border-radius:var(--ak-radius-sm,6px);background:none;color:var(--ak-color-text,#1d2f3c);font:inherit;font-size:13px;text-align:left;cursor:pointer}\n.ak-tb-menu-item svg{width:16px;height:16px;flex-shrink:0;color:var(--ak-color-muted,#56636d)}\n.ak-tb-menu-item:hover:not(:disabled),.ak-tb-menu-item:focus{background:var(--ak-color-hover,#f2f3f4)}\n.ak-tb-menu-item:disabled{opacity:.4;cursor:not-allowed}\n.ak-tb-menu-item[data-danger]{color:var(--ak-color-danger,#9f343a)}\n.ak-tb-menu-item[aria-checked=\"true\"]{color:var(--ak-color-accent,#0f7a5a);font-weight:600}\n.ak-tb-menu-label{flex:1}\n.ak-tb-check{display:inline-flex;width:16px}\n.ak-tb-check svg{color:var(--ak-color-accent,#0f7a5a)}\n.ak-tb-kbd{font-family:var(--ak-font-mono,ui-monospace,monospace);font-size:11px;color:var(--ak-color-muted,#56636d)}\n.ak-tb-separator{width:100%;height:1px;margin:4px 0;border:0;background:var(--ak-color-border,#dde0e2)}\n.ak-tb-palette{display:grid;grid-template-columns:repeat(5,28px);gap:6px;min-width:0;padding:8px}\n.ak-tb-swatch{width:28px;height:28px;padding:0;border:1px solid var(--ak-color-border-strong,#8e979d);border-radius:var(--ak-radius-sm,6px);cursor:pointer}\n.ak-tb-swatch[aria-checked=\"true\"]{box-shadow:inset 0 0 0 2px var(--ak-color-background,#fff);border:2px solid var(--ak-color-accent,#0f7a5a)}\n.ak-tb-palette-none{grid-column:1/-1}\n\n.ak-ctl-button,:where(.ak-ctl-scope) :where(button:not([class])){display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:0 12px;margin:0;font:inherit;font-size:13px;font-weight:600;line-height:1;white-space:nowrap;border:1px solid var(--ak-color-border,#dde0e2);border-radius:var(--ak-radius-sm,6px);background:var(--ak-color-background,#fff);color:var(--ak-color-text,#1d2f3c);cursor:pointer;transition:background-color .15s,border-color .15s,color .15s,box-shadow .15s}\n.ak-ctl-button svg,:where(.ak-ctl-scope) :where(button:not([class])) svg{width:16px;height:16px;flex-shrink:0}\n.ak-ctl-button:hover:not(:disabled),:where(.ak-ctl-scope) :where(button:not([class])):hover:not(:disabled){background:var(--ak-color-hover,#f2f3f4);border-color:var(--ak-color-border-strong,#8e979d)}\n.ak-ctl-button:active:not(:disabled),:where(.ak-ctl-scope) :where(button:not([class])):active:not(:disabled){background:var(--ak-color-active,#e8eaec)}\n.ak-ctl-button[aria-pressed=\"true\"],:where(.ak-ctl-scope) :where(button:not([class]))[aria-pressed=\"true\"]{background:var(--ak-color-fill-accent,#e7f2ef);color:var(--ak-color-accent,#0f7a5a);border-color:var(--ak-color-accent,#0f7a5a)}\n.ak-ctl-button:disabled,:where(.ak-ctl-scope) :where(button:not([class])):disabled{opacity:.4;cursor:not-allowed}\n.ak-ctl-button:focus-visible,:where(.ak-ctl-scope) :where(button:not([class])):focus-visible,.ak-ctl-switch:focus-visible,.ak-ctl-swatch:focus-visible,.ak-ctl-segmented button:focus-visible{outline:2px solid var(--ak-color-focus,#0f7a5a);outline-offset:2px}\n.ak-ctl-button[data-size=\"sm\"]{height:28px;padding:0 10px;font-size:12px}\n.ak-ctl-button[data-size=\"sm\"] svg{width:14px;height:14px}\n.ak-ctl-button[data-icon-only]{width:32px;padding:0}\n.ak-ctl-button[data-icon-only][data-size=\"sm\"]{width:28px}\n.ak-ctl-button[data-variant=\"primary\"]{border-color:transparent;background:var(--ak-gradient-button,#00dd80);color:var(--ak-color-on-primary,#1d2f3c)}\n.ak-ctl-button[data-variant=\"primary\"]:hover:not(:disabled){border-color:transparent;background:var(--ak-gradient-button-hover,#16a683)}\n.ak-ctl-button[data-variant=\"quiet\"]{border-color:transparent;background:transparent;color:var(--ak-color-muted,#56636d)}\n.ak-ctl-button[data-variant=\"quiet\"]:hover:not(:disabled){border-color:transparent;color:var(--ak-color-text,#1d2f3c)}\n.ak-ctl-button[data-variant=\"quiet\"][aria-pressed=\"true\"]{border-color:var(--ak-color-accent,#0f7a5a);color:var(--ak-color-accent,#0f7a5a)}\n.ak-ctl-button[data-variant=\"danger\"]{color:var(--ak-color-danger,#9f343a)}\n.ak-ctl-button[data-variant=\"danger\"]:hover:not(:disabled){background:var(--ak-color-fill-danger,#f5ebeb);border-color:var(--ak-color-danger,#9f343a)}\n.ak-ctl-input,.ak-ctl-select,.ak-ctl-textarea,:where(.ak-ctl-scope) :where(input:not([class]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"color\"]):not([type=\"range\"]):not([type=\"file\"]),select:not([class]),textarea:not([class])){box-sizing:border-box;width:100%;min-width:0;height:32px;margin:0;padding:0 10px;font:inherit;font-size:13px;line-height:1.3;color:var(--ak-color-text,#1d2f3c);background:var(--ak-color-background,#fff);border:1px solid var(--ak-color-border-strong,#8e979d);border-radius:var(--ak-radius-sm,6px);transition:border-color .15s,box-shadow .15s}\n.ak-ctl-input:hover:not(:disabled),.ak-ctl-select:hover:not(:disabled),.ak-ctl-textarea:hover:not(:disabled),:where(.ak-ctl-scope) :where(input:not([class]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"color\"]):not([type=\"range\"]):not([type=\"file\"]),select:not([class]),textarea:not([class])):hover:not(:disabled){border-color:var(--ak-color-muted,#56636d)}\n.ak-ctl-input:focus,.ak-ctl-select:focus,.ak-ctl-textarea:focus,:where(.ak-ctl-scope) :where(input:not([class]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"color\"]):not([type=\"range\"]):not([type=\"file\"]),select:not([class]),textarea:not([class])):focus{outline:none;border-color:var(--ak-color-accent,#0f7a5a);box-shadow:0 0 0 1px var(--ak-color-accent,#0f7a5a)}\n.ak-ctl-input:disabled,.ak-ctl-select:disabled,.ak-ctl-textarea:disabled,:where(.ak-ctl-scope) :where(input:not([class]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"color\"]):not([type=\"range\"]):not([type=\"file\"]),select:not([class]),textarea:not([class])):disabled{opacity:.5;cursor:not-allowed}\n.ak-ctl-input::placeholder,.ak-ctl-textarea::placeholder{color:var(--ak-color-muted,#56636d);opacity:.8}\n.ak-ctl-select,:where(.ak-ctl-scope) :where(select:not([class])){cursor:pointer;padding-right:6px}\n.ak-ctl-textarea,:where(.ak-ctl-scope) :where(textarea:not([class])){height:auto;min-height:72px;padding:8px 10px;line-height:1.5;resize:vertical}\n.ak-ctl-input[data-size=\"sm\"],.ak-ctl-select[data-size=\"sm\"]{height:28px;font-size:12px;padding:0 8px}\n.ak-ctl-field{display:flex;flex-direction:column;gap:4px;min-width:0;margin:0}\n.ak-ctl-label{display:block;padding:0;font-size:12px;font-weight:600;line-height:16px;color:var(--ak-color-muted,#56636d)}\n.ak-ctl-hint{font-size:12px;line-height:16px;color:var(--ak-color-muted,#56636d)}\n.ak-ctl-row{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}\n.ak-ctl-row>.ak-ctl-field{flex:1 1 64px}\n.ak-ctl-buttons{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:0;padding:0;border:0;min-inline-size:0}\n.ak-ctl-affix{position:relative;display:flex;align-items:center;min-width:0}\n.ak-ctl-affix .ak-ctl-input{padding-right:30px}\n.ak-ctl-unit{position:absolute;right:8px;font-size:12px;color:var(--ak-color-muted,#56636d);pointer-events:none}\n.ak-ctl-hex{max-width:160px}\n.ak-ctl-hex .ak-ctl-input{padding-left:30px;padding-right:8px;font-family:var(--ak-font-mono,ui-monospace,monospace)}\n.ak-ctl-hex-preview{position:absolute;left:7px;width:16px;height:16px;border-radius:4px;border:1px solid var(--ak-color-border-strong,#8e979d);background:repeating-conic-gradient(var(--ak-color-border,#dde0e2) 0 25%,transparent 0 50%) 50%/8px 8px}\n.ak-ctl-colors{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;border:0;min-inline-size:0}\n.ak-ctl-colors:disabled{opacity:.5}\n.ak-ctl-swatches{display:flex;flex-wrap:wrap;gap:6px}\n.ak-ctl-swatch{width:24px;height:24px;min-width:0;padding:0;border:1px solid var(--ak-color-border-strong,#8e979d);border-radius:var(--ak-radius-sm,6px);cursor:pointer;transition:transform .1s}\n.ak-ctl-swatch:hover:not(:disabled){transform:scale(1.08)}\n.ak-ctl-swatch[aria-pressed=\"true\"]{border:2px solid var(--ak-color-accent,#0f7a5a);box-shadow:inset 0 0 0 2px var(--ak-color-background,#fff)}\n.ak-ctl-swatch-none{background:linear-gradient(135deg,transparent 44%,var(--ak-color-danger,#9f343a) 44%,var(--ak-color-danger,#9f343a) 56%,transparent 56%),var(--ak-color-background,#fff)}\n.ak-ctl-switch{display:inline-flex;align-items:center;gap:10px;min-height:28px;margin:0;padding:0;border:0;background:none;color:var(--ak-color-text,#1d2f3c);font:inherit;font-size:13px;font-weight:600;text-align:left;cursor:pointer;border-radius:var(--ak-radius-sm,6px)}\n.ak-ctl-switch:disabled{opacity:.4;cursor:not-allowed}\n.ak-ctl-switch-track{position:relative;flex-shrink:0;width:32px;height:18px;border-radius:999px;background:var(--ak-color-border-strong,#8e979d);transition:background-color .15s}\n.ak-ctl-switch-thumb{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:var(--ak-color-background,#fff);transition:transform .15s}\n.ak-ctl-switch[aria-checked=\"true\"] .ak-ctl-switch-track{background:var(--ak-color-primary-deep,#16a683)}\n.ak-ctl-switch[aria-checked=\"true\"] .ak-ctl-switch-thumb{transform:translateX(14px)}\n.ak-ctl-segmented{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--ak-color-border,#dde0e2);border-radius:var(--ak-radius-sm,6px);background:var(--ak-color-surface,#f4f7f7)}\n.ak-ctl-segmented button{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-width:28px;height:26px;padding:0 8px;border:0;border-radius:4px;background:transparent;color:var(--ak-color-muted,#56636d);font:inherit;font-size:12px;font-weight:600;cursor:pointer}\n.ak-ctl-segmented button svg{width:14px;height:14px}\n.ak-ctl-segmented button:hover:not(:disabled){color:var(--ak-color-text,#1d2f3c)}\n.ak-ctl-segmented button[aria-checked=\"true\"]{background:var(--ak-color-background,#fff);color:var(--ak-color-accent,#0f7a5a);box-shadow:0 0 0 1px var(--ak-color-border,#dde0e2)}\n.ak-ctl-inspector{display:flex;flex-direction:column;min-width:0;max-height:80vh;overflow-y:auto;background:var(--ak-color-background,#fff);color:var(--ak-color-text,#1d2f3c);border:1px solid var(--ak-color-border,#dde0e2);border-radius:var(--ak-radius-md,8px);font-size:13px}\n.ak-ctl-section{display:flex;flex-direction:column;gap:12px;margin:0;padding:14px;border:0;border-top:1px solid var(--ak-color-border,#dde0e2)}\n.ak-ctl-section:first-child{border-top:0}\n.ak-ctl-section-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:20px}\n.ak-ctl-section-title{margin:0;font-family:var(--ak-font-heading,\"Sora\",system-ui,sans-serif);font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--ak-color-text,#1d2f3c)}\n.ak-ctl-section-actions{display:flex;gap:4px}\n.ak-ctl-empty{margin:0;font-size:13px;line-height:1.55;color:var(--ak-color-muted,#56636d)}\n.ak-ctl-card{display:flex;flex-direction:column;gap:8px;margin:0;padding:10px;border:1px solid var(--ak-color-border,#dde0e2);border-radius:var(--ak-radius-md,8px);background:var(--ak-color-surface,#f4f7f7);min-inline-size:0}\n.ak-ctl-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}\n.ak-ctl-list-item{display:flex;align-items:center;gap:8px;width:100%;min-height:32px;padding:0 10px;border:1px solid transparent;border-radius:var(--ak-radius-sm,6px);background:none;color:var(--ak-color-text,#1d2f3c);font:inherit;font-size:13px;text-align:left;cursor:pointer}\n.ak-ctl-list-item:hover:not(:disabled){background:var(--ak-color-hover,#f2f3f4)}\n.ak-ctl-list-item[aria-current=\"true\"]{background:var(--ak-color-fill-accent,#e7f2ef);border-color:var(--ak-color-accent,#0f7a5a);color:var(--ak-color-accent,#0f7a5a)}\n";
|
|
3
|
+
//# sourceMappingURL=kit-css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-css.d.ts","sourceRoot":"","sources":["../src/kit-css.ts"],"names":[],"mappings":"AAGA,0GAA0G;AAC1G,eAAO,MAAM,MAAM,i0dAAgC,CAAC"}
|
package/dist/kit-css.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { controlsCss } from './controls.js';
|
|
2
|
+
import { toolbarCss } from './toolbar.js';
|
|
3
|
+
/** Toolbar and form control styles shared by every kind editor and viewer (include once per kind CSS). */
|
|
4
|
+
export const kitCss = `${toolbarCss}${controlsCss}`;
|
|
5
|
+
//# sourceMappingURL=kit-css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-css.js","sourceRoot":"","sources":["../src/kit-css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort parse of a JSON prefix streamed by a model (spec §13.4). Complete values are kept, a string
|
|
3
|
+
* value cut midway keeps the text received so far, and anything else unfinished at the end (a key, a
|
|
4
|
+
* number, a literal) is dropped. Returns undefined for text that is not a JSON prefix. The kind's
|
|
5
|
+
* `parsePartial` then decides which trailing items are complete enough to render.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parsePartialJson(text: string): unknown;
|
|
8
|
+
//# sourceMappingURL=partial-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-json.d.ts","sourceRoot":"","sources":["../src/partial-json.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAoJtD"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const INCOMPLETE = Symbol('incomplete');
|
|
2
|
+
const MAX_DEPTH = 200;
|
|
3
|
+
class PartialJsonSyntaxError extends Error {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Best-effort parse of a JSON prefix streamed by a model (spec §13.4). Complete values are kept, a string
|
|
7
|
+
* value cut midway keeps the text received so far, and anything else unfinished at the end (a key, a
|
|
8
|
+
* number, a literal) is dropped. Returns undefined for text that is not a JSON prefix. The kind's
|
|
9
|
+
* `parsePartial` then decides which trailing items are complete enough to render.
|
|
10
|
+
*/
|
|
11
|
+
export function parsePartialJson(text) {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(text);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Not complete yet: fall through to the tolerant parser.
|
|
17
|
+
}
|
|
18
|
+
let i = 0;
|
|
19
|
+
const length = text.length;
|
|
20
|
+
const skipWhitespace = () => {
|
|
21
|
+
while (i < length && (text[i] === ' ' || text[i] === '\n' || text[i] === '\r' || text[i] === '\t'))
|
|
22
|
+
i++;
|
|
23
|
+
};
|
|
24
|
+
function parseString() {
|
|
25
|
+
i++; // opening quote
|
|
26
|
+
let out = '';
|
|
27
|
+
while (i < length) {
|
|
28
|
+
const char = text[i];
|
|
29
|
+
if (char === '"') {
|
|
30
|
+
i++;
|
|
31
|
+
return { value: out, complete: true };
|
|
32
|
+
}
|
|
33
|
+
if (char === '\\') {
|
|
34
|
+
const next = text[i + 1];
|
|
35
|
+
if (next === undefined)
|
|
36
|
+
break;
|
|
37
|
+
if (next === 'u') {
|
|
38
|
+
const hex = text.slice(i + 2, i + 6);
|
|
39
|
+
if (hex.length < 4)
|
|
40
|
+
break;
|
|
41
|
+
if (!/^[0-9a-fA-F]{4}$/.test(hex))
|
|
42
|
+
throw new PartialJsonSyntaxError('bad escape');
|
|
43
|
+
out += String.fromCharCode(Number.parseInt(hex, 16));
|
|
44
|
+
i += 6;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const escapes = {
|
|
48
|
+
'"': '"',
|
|
49
|
+
'\\': '\\',
|
|
50
|
+
'/': '/',
|
|
51
|
+
b: '\b',
|
|
52
|
+
f: '\f',
|
|
53
|
+
n: '\n',
|
|
54
|
+
r: '\r',
|
|
55
|
+
t: '\t',
|
|
56
|
+
};
|
|
57
|
+
const mapped = escapes[next];
|
|
58
|
+
if (mapped === undefined)
|
|
59
|
+
throw new PartialJsonSyntaxError('bad escape');
|
|
60
|
+
out += mapped;
|
|
61
|
+
i += 2;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
out += char;
|
|
65
|
+
i++;
|
|
66
|
+
}
|
|
67
|
+
i = length;
|
|
68
|
+
return { value: out, complete: false };
|
|
69
|
+
}
|
|
70
|
+
function parseValue(depth) {
|
|
71
|
+
if (depth > MAX_DEPTH)
|
|
72
|
+
throw new PartialJsonSyntaxError('too deep');
|
|
73
|
+
skipWhitespace();
|
|
74
|
+
if (i >= length)
|
|
75
|
+
return INCOMPLETE;
|
|
76
|
+
const char = text[i];
|
|
77
|
+
if (char === '{')
|
|
78
|
+
return parseObject(depth);
|
|
79
|
+
if (char === '[')
|
|
80
|
+
return parseArray(depth);
|
|
81
|
+
if (char === '"')
|
|
82
|
+
return parseString().value;
|
|
83
|
+
for (const [literal, value] of [
|
|
84
|
+
['true', true],
|
|
85
|
+
['false', false],
|
|
86
|
+
['null', null],
|
|
87
|
+
]) {
|
|
88
|
+
if (text.startsWith(literal, i)) {
|
|
89
|
+
i += literal.length;
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
if (literal.startsWith(text.slice(i))) {
|
|
93
|
+
i = length;
|
|
94
|
+
return INCOMPLETE;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const rest = text.slice(i);
|
|
98
|
+
const numeric = /^[-+0-9.eE]*/.exec(rest)?.[0] ?? '';
|
|
99
|
+
if (numeric.length === 0)
|
|
100
|
+
throw new PartialJsonSyntaxError('unexpected token');
|
|
101
|
+
// A number touching the end of the stream may still grow ("12" → "123", "1." → "1.5").
|
|
102
|
+
if (numeric.length === rest.length) {
|
|
103
|
+
i = length;
|
|
104
|
+
return INCOMPLETE;
|
|
105
|
+
}
|
|
106
|
+
if (!/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(numeric))
|
|
107
|
+
throw new PartialJsonSyntaxError('bad number');
|
|
108
|
+
i += numeric.length;
|
|
109
|
+
return Number(numeric);
|
|
110
|
+
}
|
|
111
|
+
function parseObject(depth) {
|
|
112
|
+
i++;
|
|
113
|
+
const result = {};
|
|
114
|
+
for (;;) {
|
|
115
|
+
skipWhitespace();
|
|
116
|
+
if (i >= length)
|
|
117
|
+
return result;
|
|
118
|
+
const char = text[i];
|
|
119
|
+
if (char === '}') {
|
|
120
|
+
i++;
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
if (char === ',') {
|
|
124
|
+
i++;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (char !== '"')
|
|
128
|
+
throw new PartialJsonSyntaxError('expected key');
|
|
129
|
+
const key = parseString();
|
|
130
|
+
if (!key.complete)
|
|
131
|
+
return result;
|
|
132
|
+
skipWhitespace();
|
|
133
|
+
if (i >= length)
|
|
134
|
+
return result;
|
|
135
|
+
if (text[i] !== ':')
|
|
136
|
+
throw new PartialJsonSyntaxError('expected colon');
|
|
137
|
+
i++;
|
|
138
|
+
const value = parseValue(depth + 1);
|
|
139
|
+
if (value === INCOMPLETE)
|
|
140
|
+
return result;
|
|
141
|
+
result[key.value] = value;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function parseArray(depth) {
|
|
145
|
+
i++;
|
|
146
|
+
const result = [];
|
|
147
|
+
for (;;) {
|
|
148
|
+
skipWhitespace();
|
|
149
|
+
if (i >= length)
|
|
150
|
+
return result;
|
|
151
|
+
const char = text[i];
|
|
152
|
+
if (char === ']') {
|
|
153
|
+
i++;
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
if (char === ',') {
|
|
157
|
+
i++;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const value = parseValue(depth + 1);
|
|
161
|
+
if (value === INCOMPLETE)
|
|
162
|
+
return result;
|
|
163
|
+
result.push(value);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const value = parseValue(0);
|
|
168
|
+
return value === INCOMPLETE ? undefined : value;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
if (error instanceof PartialJsonSyntaxError)
|
|
172
|
+
return undefined;
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=partial-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-json.js","sourceRoot":"","sources":["../src/partial-json.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AACxC,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,sBAAuB,SAAQ,KAAK;CAAG;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,yDAAyD;IAC3D,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAE3B,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,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,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,sBAAsB;YAAE,OAAO,SAAS,CAAC;QAC9D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ArtifactRegistry, type AssetResolver, type Theme } from '@artkit-ai/core';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import type { ArtifactClient } from './client.js';
|
|
4
|
+
import { type ArtifactLoaders, type ColorScheme } from './context.js';
|
|
5
|
+
import { type UiMessageOverrides } from './i18n.js';
|
|
6
|
+
export interface ArtifactProviderProps {
|
|
7
|
+
/** Core registry with the kinds the app shows (parsePartial, apply, project, diff, lint). */
|
|
8
|
+
registry: ArtifactRegistry;
|
|
9
|
+
client: ArtifactClient;
|
|
10
|
+
/** Lazy renderers, editors and exporters per format. Read once per format: later changes are ignored. */
|
|
11
|
+
loaders?: ArtifactLoaders;
|
|
12
|
+
/** UI locale (pt-BR or en built in). Artifacts keep their own locale for content formatting. */
|
|
13
|
+
locale?: string;
|
|
14
|
+
/** Extra or overriding UI strings, keyed by locale. */
|
|
15
|
+
messages?: UiMessageOverrides;
|
|
16
|
+
/** Application theme (object or registered id), used by the host chrome and as fallback. */
|
|
17
|
+
theme?: Theme | string;
|
|
18
|
+
/** Extra artifact themes, looked up by `artifact.themeId` before the registry. */
|
|
19
|
+
themes?: Theme[];
|
|
20
|
+
/** Dark variants keyed by theme id; others are derived automatically. */
|
|
21
|
+
darkThemes?: Record<string, Theme>;
|
|
22
|
+
/** `system` follows `prefers-color-scheme`; `data-theme` on an ancestor also works. */
|
|
23
|
+
colorScheme?: ColorScheme;
|
|
24
|
+
/** Synchronous `asset://` lookup for renderers. */
|
|
25
|
+
resolveAssetUrl?: (ref: string) => string | undefined;
|
|
26
|
+
/** Asset access for exports that run in the browser. */
|
|
27
|
+
assets?: AssetResolver;
|
|
28
|
+
/** Formats the server can export, per kind (merged with exporters available in the browser). */
|
|
29
|
+
exportFormats?: Record<string, readonly string[]>;
|
|
30
|
+
/** Set false when the app ships `artkitCss` itself. */
|
|
31
|
+
injectStyles?: boolean;
|
|
32
|
+
/** CSP nonce for the injected `<style>` elements. */
|
|
33
|
+
nonce?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Inject the embedded Sora font (Mouts design system) when a theme uses it. Default true; set false
|
|
36
|
+
* when the app already serves Sora (e.g. through @fontsource).
|
|
37
|
+
*/
|
|
38
|
+
injectFont?: boolean;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export declare function ArtifactProvider(props: ArtifactProviderProps): import("react").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAgB,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGtE,MAAM,WAAW,qBAAqB;IACpC,6FAA6F;IAC7F,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,yGAAyG;IACzG,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,gGAAgG;IAChG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,4FAA4F;IAC5F,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,kFAAkF;IAClF,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,uFAAuF;IACvF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,mDAAmD;IACnD,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACtD,wDAAwD;IACxD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAClD,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAID,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,+BAmH5D"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { defaultTheme } from '@artkit-ai/core';
|
|
3
|
+
import { soraFontFaceCss } from '@artkit-ai/core/fonts';
|
|
4
|
+
import { useMemo, useRef } from 'react';
|
|
5
|
+
import { cacheFor } from './cache.js';
|
|
6
|
+
import { ArtkitContext, } from './context.js';
|
|
7
|
+
import { createTranslator } from './i18n.js';
|
|
8
|
+
import { artkitCss, hashString, themeStyles } from './styles.js';
|
|
9
|
+
export function ArtifactProvider(props) {
|
|
10
|
+
const { registry, client, loaders, locale = 'en', messages, colorScheme = 'system', injectStyles = true, injectFont = true, nonce, } = props;
|
|
11
|
+
const loads = useRef(new Map());
|
|
12
|
+
const loadersRef = useRef(loaders);
|
|
13
|
+
loadersRef.current = loaders;
|
|
14
|
+
const appTheme = useMemo(() => {
|
|
15
|
+
if (typeof props.theme === 'object')
|
|
16
|
+
return props.theme;
|
|
17
|
+
if (typeof props.theme === 'string') {
|
|
18
|
+
const found = props.themes?.find((theme) => theme.id === props.theme);
|
|
19
|
+
if (found)
|
|
20
|
+
return found;
|
|
21
|
+
if (registry.hasTheme(props.theme))
|
|
22
|
+
return registry.theme(props.theme);
|
|
23
|
+
}
|
|
24
|
+
return registry.hasTheme('default') ? registry.theme('default') : defaultTheme;
|
|
25
|
+
}, [props.theme, props.themes, registry]);
|
|
26
|
+
const themeList = useMemo(() => {
|
|
27
|
+
const byId = new Map();
|
|
28
|
+
for (const theme of registry.themes())
|
|
29
|
+
byId.set(theme.id, theme);
|
|
30
|
+
for (const theme of props.themes ?? [])
|
|
31
|
+
byId.set(theme.id, theme);
|
|
32
|
+
return [...byId.values()];
|
|
33
|
+
}, [registry, props.themes]);
|
|
34
|
+
const css = useMemo(() => themeStyles(appTheme, themeList, new Map(Object.entries(props.darkThemes ?? {}))), [appTheme, themeList, props.darkThemes]);
|
|
35
|
+
const value = useMemo(() => {
|
|
36
|
+
const byId = new Map(themeList.map((theme) => [theme.id, theme]));
|
|
37
|
+
function load(type, format) {
|
|
38
|
+
const key = `${type}:${format}`;
|
|
39
|
+
let promise = loads.current.get(key);
|
|
40
|
+
if (!promise) {
|
|
41
|
+
const group = type === 'renderer'
|
|
42
|
+
? loadersRef.current?.renderers
|
|
43
|
+
: type === 'editor'
|
|
44
|
+
? loadersRef.current?.editors
|
|
45
|
+
: loadersRef.current?.exporters;
|
|
46
|
+
const loader = group?.[format];
|
|
47
|
+
promise = loader
|
|
48
|
+
? loader()
|
|
49
|
+
: Promise.reject(new Error(`No ${type} loader registered for kind "${format}".`));
|
|
50
|
+
loads.current.set(key, promise);
|
|
51
|
+
}
|
|
52
|
+
return promise;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
registry,
|
|
56
|
+
client,
|
|
57
|
+
cache: cacheFor(client),
|
|
58
|
+
locale,
|
|
59
|
+
t: createTranslator(locale, messages),
|
|
60
|
+
appTheme,
|
|
61
|
+
colorScheme,
|
|
62
|
+
themeFor: (themeId) => (themeId ? byId.get(themeId) : undefined) ?? appTheme,
|
|
63
|
+
...(props.resolveAssetUrl ? { resolveAssetUrl: props.resolveAssetUrl } : {}),
|
|
64
|
+
...(props.assets ? { assets: props.assets } : {}),
|
|
65
|
+
exportFormats: props.exportFormats ?? {},
|
|
66
|
+
hasRenderer: (format) => Boolean(loadersRef.current?.renderers?.[format]),
|
|
67
|
+
hasEditor: (format) => Boolean(loadersRef.current?.editors?.[format]),
|
|
68
|
+
hasExporters: (format) => Boolean(loadersRef.current?.exporters?.[format]),
|
|
69
|
+
loadRenderer: (format) => load('renderer', format),
|
|
70
|
+
loadEditor: (format) => load('editor', format),
|
|
71
|
+
loadExporters: (format) => load('exporters', format),
|
|
72
|
+
resetLoad: (type, format) => {
|
|
73
|
+
loads.current.delete(`${type}:${format}`);
|
|
74
|
+
},
|
|
75
|
+
...(nonce ? { nonce } : {}),
|
|
76
|
+
};
|
|
77
|
+
}, [
|
|
78
|
+
registry,
|
|
79
|
+
client,
|
|
80
|
+
locale,
|
|
81
|
+
messages,
|
|
82
|
+
appTheme,
|
|
83
|
+
colorScheme,
|
|
84
|
+
themeList,
|
|
85
|
+
props.resolveAssetUrl,
|
|
86
|
+
props.assets,
|
|
87
|
+
props.exportFormats,
|
|
88
|
+
nonce,
|
|
89
|
+
]);
|
|
90
|
+
return (_jsxs(ArtkitContext.Provider, { value: value, children: [injectStyles ? (_jsxs(_Fragment, { children: [injectFont && usesSora(appTheme, themeList) ? (_jsx("style", { href: "artkit-font-sora", precedence: "artkit", nonce: nonce, children: soraFontFaceCss() })) : null, _jsx("style", { href: "artkit-base", precedence: "artkit", nonce: nonce, children: artkitCss }), _jsx("style", { href: `artkit-theme-${hashString(css)}`, precedence: "artkit", nonce: nonce, children: css })] })) : null, props.children] }));
|
|
91
|
+
}
|
|
92
|
+
function usesSora(appTheme, themes) {
|
|
93
|
+
return [appTheme, ...themes].some((theme) => [theme.fonts.heading, theme.fonts.body].some((font) => font.trim().toLowerCase() === 'sora'));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA6C,YAAY,EAAc,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAEL,aAAa,GAKd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAA2B,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwCjE,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,GAAG,IAAI,EACb,QAAQ,EACR,WAAW,GAAG,QAAQ,EACtB,YAAY,GAAG,IAAI,EACnB,UAAU,GAAG,IAAI,EACjB,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,GAAG,EAA6B,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAE7B,MAAM,QAAQ,GAAG,OAAO,CA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