@sutrata/editor 0.4.0 → 0.4.1

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.
@@ -70,12 +70,12 @@ export function TitlePageDialog({ onClose }) {
70
70
  onClose();
71
71
  }
72
72
  return (_jsx("div", { className: "cs-export-overlay", role: "presentation", onClick: e => { if (e.target === e.currentTarget)
73
- onClose(); }, children: _jsxs("div", { className: "cs-export-dialog cs-tp-dialog", role: "dialog", "aria-modal": "true", "aria-labelledby": "cs-tp-title", children: [_jsxs("div", { className: "cs-panel-header", children: [_jsx("span", { id: "cs-tp-title", className: "cs-panel-title", children: t('titlePage.title') }), _jsx("button", { className: "cs-panel-close", onClick: onClose, "aria-label": t('titlePage.cancel'), children: "\u00D7" })] }), _jsxs("div", { className: "cs-tp-body", children: [_jsx("div", { className: "cs-tp-tabs", role: "tablist", "aria-orientation": "vertical", "aria-label": t('titlePage.title'), children: TABS.map(id => (_jsx("button", { ref: el => { tabRefs.current[id] = el; }, type: "button", role: "tab", id: `cs-tp-tab-${id}`, "aria-selected": tab === id, "aria-controls": `cs-tp-panel-${id}`, tabIndex: tab === id ? 0 : -1, className: `cs-tp-tab${tab === id ? ' cs-tp-tab-active' : ''}`, onClick: () => setTab(id), onKeyDown: e => onTabKey(e, id), children: t(`titlePage.section.${id}`) }, id))) }), _jsxs("form", { className: "cs-tp-form", onSubmit: e => { e.preventDefault(); save(); }, children: [_jsxs(Panel, { id: "story", active: tab, children: [_jsx(Field, { label: t('titlePage.field.title'), htmlFor: "cs-tp-f-title", children: _jsx("input", { id: "cs-tp-f-title", ref: firstFieldRef, className: "cs-tp-input", value: form.title, onChange: e => set('title', e.target.value) }) }), form.altTitles.map((alt, i) => (_jsxs("div", { className: "cs-tp-row", children: [_jsxs("select", { "aria-label": t('titlePage.field.titleLanguage'), className: "cs-settings-select cs-tp-lang-select", value: alt.lang, onChange: e => set('altTitles', form.altTitles.map((a, j) => j === i ? { ...a, lang: e.target.value } : a)), children: [_jsx("option", { value: "", children: t('titlePage.chooseLanguage') }), langs.map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] }), _jsx("input", { "aria-label": t('titlePage.field.titleIn'), className: "cs-tp-input", value: alt.text, onChange: e => set('altTitles', form.altTitles.map((a, j) => j === i ? { ...a, text: e.target.value } : a)) }), _jsx("button", { type: "button", className: "cs-tp-remove", "aria-label": t('titlePage.remove'), onClick: () => set('altTitles', form.altTitles.filter((_, j) => j !== i)), children: "\u00D7" })] }, i))), _jsxs("button", { type: "button", className: "cs-tp-add", onClick: () => set('altTitles', [...form.altTitles, { lang: '', text: '' }]), children: ["+ ", t('titlePage.addTitle')] }), _jsx(Field, { label: t('titlePage.field.logline'), htmlFor: "cs-tp-f-logline", hint: _jsx("span", { className: logWords > 50 ? 'cs-tp-count-bad' : logWords > 30 ? 'cs-tp-count-warn' : 'cs-tp-count', children: t('titlePage.words').replace('{n}', String(logWords)) }), children: _jsx("textarea", { id: "cs-tp-f-logline", className: "cs-tp-input", rows: 2, value: form.logline, onChange: e => set('logline', e.target.value) }) })] }), _jsxs(Panel, { id: "credits", active: tab, children: [_jsx(TextField, { id: "author", label: t('titlePage.field.author'), value: form.author, onChange: v => set('author', v) }), _jsx(TextField, { id: "credit", label: t('titlePage.field.credit'), placeholder: "Written by", value: form.credit, onChange: v => set('credit', v) }), _jsx(TextField, { id: "source", label: t('titlePage.field.source'), value: form.source, onChange: v => set('source', v) }), _jsx(TextField, { id: "story", label: t('titlePage.field.story'), value: form.story, onChange: v => set('story', v) }), _jsx(TextField, { id: "screenplay", label: t('titlePage.field.screenplay'), value: form.screenplay, onChange: v => set('screenplay', v) }), _jsx(TextField, { id: "dialogue", label: t('titlePage.field.dialogue'), value: form.dialogue, onChange: v => set('dialogue', v) })] }), _jsxs(Panel, { id: "draft", active: tab, children: [_jsx(TextField, { id: "draft", label: t('titlePage.field.draft'), placeholder: "First Draft", value: form.draft, onChange: v => set('draft', v) }), _jsx(TextField, { id: "revision", label: t('titlePage.field.revision'), value: form.revision, onChange: v => set('revision', v) }), _jsx(Field, { label: t('titlePage.field.date'), htmlFor: "cs-tp-f-date", children: _jsx(DateInput, { id: "cs-tp-f-date", value: form.date, onChange: v => set('date', v), usePickerLabel: t('titlePage.usePicker'), useTextLabel: t('titlePage.useText') }) })] }), _jsxs(Panel, { id: "contact", active: tab, children: [_jsx(Field, { label: t('titlePage.field.contact'), htmlFor: "cs-tp-f-contact", children: _jsx("textarea", { id: "cs-tp-f-contact", className: "cs-tp-input", rows: 3, value: form.contact, onChange: e => set('contact', e.target.value) }) }), _jsx(TextField, { id: "copyright", label: t('titlePage.field.copyright'), placeholder: "\u00A9 2026 \u2026", value: form.copyright, onChange: v => set('copyright', v) })] }), _jsxs(Panel, { id: "document", active: tab, children: [_jsx(Field, { label: t('titlePage.field.lang'), htmlFor: "cs-tp-f-lang", children: _jsxs("select", { id: "cs-tp-f-lang", className: "cs-settings-select", value: form.lang, onChange: e => set('lang', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.notSet') }), langs.map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] }) }), _jsx(Field, { label: t('titlePage.field.langSecondary'), htmlFor: "cs-tp-f-lang2", children: _jsxs("div", { className: "cs-tp-chips", children: [form.langSecondary.map(code => (_jsxs("span", { className: "cs-tp-chip", children: [langLabel(code), _jsx("button", { type: "button", "aria-label": `${t('titlePage.remove')} ${langLabel(code)}`, onClick: () => set('langSecondary', form.langSecondary.filter(c => c !== code)), children: "\u00D7" })] }, code))), _jsxs("select", { id: "cs-tp-f-lang2", className: "cs-settings-select", value: "", onChange: e => {
73
+ onClose(); }, children: _jsxs("div", { className: "cs-export-dialog cs-tp-dialog", role: "dialog", "aria-modal": "true", "aria-labelledby": "cs-tp-title", children: [_jsxs("div", { className: "cs-panel-header", children: [_jsx("span", { id: "cs-tp-title", className: "cs-panel-title", children: t('titlePage.title') }), _jsx("button", { className: "cs-panel-close", onClick: onClose, "aria-label": t('titlePage.cancel'), children: "\u00D7" })] }), _jsxs("div", { className: "cs-tp-body", children: [_jsx("div", { className: "cs-tp-tabs", role: "tablist", "aria-orientation": "vertical", "aria-label": t('titlePage.title'), children: TABS.map(id => (_jsx("button", { ref: el => { tabRefs.current[id] = el; }, type: "button", role: "tab", id: `cs-tp-tab-${id}`, "aria-selected": tab === id, "aria-controls": `cs-tp-panel-${id}`, tabIndex: tab === id ? 0 : -1, className: `cs-tp-tab${tab === id ? ' cs-tp-tab-active' : ''}`, onClick: () => setTab(id), onKeyDown: e => onTabKey(e, id), children: t(`titlePage.section.${id}`) }, id))) }), _jsxs("form", { className: "cs-tp-form", onSubmit: e => { e.preventDefault(); save(); }, children: [_jsxs(Panel, { id: "story", active: tab, children: [_jsx(Field, { label: t('titlePage.field.title'), htmlFor: "cs-tp-f-title", children: _jsx("input", { id: "cs-tp-f-title", ref: firstFieldRef, className: "cs-tp-input", value: form.title, onChange: e => set('title', e.target.value) }) }), form.altTitles.map((alt, i) => (_jsxs("div", { className: "cs-tp-row", children: [_jsxs("select", { "aria-label": t('titlePage.field.titleLanguage'), className: "cs-settings-select cs-tp-lang-select", value: alt.lang, onChange: e => set('altTitles', form.altTitles.map((a, j) => j === i ? { ...a, lang: e.target.value } : a)), children: [_jsx("option", { value: "", children: t('titlePage.chooseLanguage') }), langs.map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] }), _jsx("input", { "aria-label": t('titlePage.field.titleIn'), className: "cs-tp-input", value: alt.text, onChange: e => set('altTitles', form.altTitles.map((a, j) => j === i ? { ...a, text: e.target.value } : a)) }), _jsx("button", { type: "button", className: "cs-tp-remove", "aria-label": t('titlePage.remove'), onClick: () => set('altTitles', form.altTitles.filter((_, j) => j !== i)), children: "\u00D7" })] }, i))), _jsxs("button", { type: "button", className: "cs-tp-add", onClick: () => set('altTitles', [...form.altTitles, { lang: '', text: '' }]), children: ["+ ", t('titlePage.addTitle')] }), _jsx(Field, { label: t('titlePage.field.logline'), htmlFor: "cs-tp-f-logline", hint: _jsx("span", { className: logWords > 50 ? 'cs-tp-count-bad' : logWords > 30 ? 'cs-tp-count-warn' : 'cs-tp-count', children: t('titlePage.words').replace('{n}', String(logWords)) }), children: _jsx("textarea", { id: "cs-tp-f-logline", className: "cs-tp-input", rows: 2, value: form.logline, onChange: e => set('logline', e.target.value) }) })] }), _jsxs(Panel, { id: "credits", active: tab, children: [_jsx(TextField, { id: "author", label: t('titlePage.field.author'), value: form.author, onChange: v => set('author', v) }), _jsx(TextField, { id: "credit", label: t('titlePage.field.credit'), placeholder: t('titlePage.placeholder.credit'), value: form.credit, onChange: v => set('credit', v) }), _jsx(TextField, { id: "source", label: t('titlePage.field.source'), value: form.source, onChange: v => set('source', v) }), _jsx(TextField, { id: "story", label: t('titlePage.field.story'), value: form.story, onChange: v => set('story', v) }), _jsx(TextField, { id: "screenplay", label: t('titlePage.field.screenplay'), value: form.screenplay, onChange: v => set('screenplay', v) }), _jsx(TextField, { id: "dialogue", label: t('titlePage.field.dialogue'), value: form.dialogue, onChange: v => set('dialogue', v) })] }), _jsxs(Panel, { id: "draft", active: tab, children: [_jsx(TextField, { id: "draft", label: t('titlePage.field.draft'), placeholder: t('titlePage.placeholder.draft'), value: form.draft, onChange: v => set('draft', v) }), _jsx(TextField, { id: "revision", label: t('titlePage.field.revision'), value: form.revision, onChange: v => set('revision', v) }), _jsx(Field, { label: t('titlePage.field.date'), htmlFor: "cs-tp-f-date", children: _jsx(DateInput, { id: "cs-tp-f-date", value: form.date, onChange: v => set('date', v), usePickerLabel: t('titlePage.usePicker'), useTextLabel: t('titlePage.useText') }) })] }), _jsxs(Panel, { id: "contact", active: tab, children: [_jsx(Field, { label: t('titlePage.field.contact'), htmlFor: "cs-tp-f-contact", children: _jsx("textarea", { id: "cs-tp-f-contact", className: "cs-tp-input", rows: 3, value: form.contact, onChange: e => set('contact', e.target.value) }) }), _jsx(TextField, { id: "copyright", label: t('titlePage.field.copyright'), placeholder: "\u00A9 2026 \u2026", value: form.copyright, onChange: v => set('copyright', v) })] }), _jsxs(Panel, { id: "document", active: tab, children: [_jsx(Field, { label: t('titlePage.field.lang'), htmlFor: "cs-tp-f-lang", children: _jsxs("select", { id: "cs-tp-f-lang", className: "cs-settings-select", value: form.lang, onChange: e => set('lang', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.notSet') }), langs.map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] }) }), _jsx(Field, { label: t('titlePage.field.langSecondary'), htmlFor: "cs-tp-f-lang2", children: _jsxs("div", { className: "cs-tp-chips", children: [form.langSecondary.map(code => (_jsxs("span", { className: "cs-tp-chip", children: [langLabel(code), _jsx("button", { type: "button", "aria-label": `${t('titlePage.remove')} ${langLabel(code)}`, onClick: () => set('langSecondary', form.langSecondary.filter(c => c !== code)), children: "\u00D7" })] }, code))), _jsxs("select", { id: "cs-tp-f-lang2", className: "cs-settings-select", value: "", onChange: e => {
74
74
  const code = e.target.value;
75
75
  if (code && !form.langSecondary.includes(code))
76
76
  set('langSecondary', [...form.langSecondary, code]);
77
77
  }, children: [_jsx("option", { value: "", children: t('titlePage.addLanguage') }), langs.filter(l => l.code !== form.lang && !form.langSecondary.includes(l.code))
78
- .map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] })] }) }), _jsx(Field, { label: t('titlePage.field.page'), htmlFor: "cs-tp-f-page", children: _jsxs("select", { id: "cs-tp-f-page", className: "cs-settings-select", value: form.page, onChange: e => set('page', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.pageDefault') }), _jsx("option", { value: "A4", children: "A4" }), _jsx("option", { value: "Letter", children: "US Letter" })] }) }), _jsx(Field, { label: t('titlePage.field.style'), htmlFor: "cs-tp-f-style", children: _jsxs("select", { id: "cs-tp-f-style", className: "cs-settings-select", value: form.style, onChange: e => set('style', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.styleDefault').replace('{name}', defaultStyleName) }), styles.map(s => _jsx("option", { value: s.id, children: s.name }, s.id)), form.style && !styles.some(s => s.id === form.style) && (_jsx("option", { value: form.style, children: form.style }))] }) }), _jsx(TextField, { id: "watermark", label: t('titlePage.field.watermark'), placeholder: "CONFIDENTIAL", value: form.watermark, onChange: v => set('watermark', v) })] }), _jsxs(Panel, { id: "other", active: tab, children: [form.custom.map((c, i) => (_jsxs("div", { className: "cs-tp-row", children: [_jsx("input", { "aria-label": t('titlePage.field.key'), className: "cs-tp-input cs-tp-key", value: c.key, placeholder: "key", onChange: e => set('custom', form.custom.map((x, j) => j === i ? { ...x, key: e.target.value } : x)) }), _jsx("input", { "aria-label": t('titlePage.field.value'), className: "cs-tp-input", value: c.value, onChange: e => set('custom', form.custom.map((x, j) => j === i ? { ...x, value: e.target.value } : x)) }), _jsx("button", { type: "button", className: "cs-tp-remove", "aria-label": t('titlePage.remove'), onClick: () => set('custom', form.custom.filter((_, j) => j !== i)), children: "\u00D7" })] }, i))), _jsxs("button", { type: "button", className: "cs-tp-add", onClick: () => set('custom', [...form.custom, { key: '', value: '' }]), children: ["+ ", t('titlePage.addField')] }), preservedCount > 0 && (_jsx("p", { className: "cs-tp-note", children: t('titlePage.preserved').replace('{n}', String(preservedCount)) }))] })] })] }), _jsxs("div", { className: "cs-export-actions cs-tp-actions", children: [_jsx("button", { type: "button", className: "cs-confirm-btn-cancel", onClick: onClose, children: t('titlePage.cancel') }), _jsx("button", { type: "button", className: "cs-confirm-btn-primary", onClick: save, children: t('titlePage.save') })] })] }) }));
78
+ .map(l => _jsx("option", { value: l.code, children: l.label }, l.code))] })] }) }), _jsx(Field, { label: t('titlePage.field.page'), htmlFor: "cs-tp-f-page", children: _jsxs("select", { id: "cs-tp-f-page", className: "cs-settings-select", value: form.page, onChange: e => set('page', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.pageDefault') }), _jsx("option", { value: "A4", children: "A4" }), _jsx("option", { value: "Letter", children: t('titlePage.pageLetter') })] }) }), _jsx(Field, { label: t('titlePage.field.style'), htmlFor: "cs-tp-f-style", children: _jsxs("select", { id: "cs-tp-f-style", className: "cs-settings-select", value: form.style, onChange: e => set('style', e.target.value), children: [_jsx("option", { value: "", children: t('titlePage.styleDefault').replace('{name}', defaultStyleName) }), styles.map(s => _jsx("option", { value: s.id, children: s.name }, s.id)), form.style && !styles.some(s => s.id === form.style) && (_jsx("option", { value: form.style, children: form.style }))] }) }), _jsx(TextField, { id: "watermark", label: t('titlePage.field.watermark'), placeholder: t('titlePage.placeholder.watermark'), value: form.watermark, onChange: v => set('watermark', v) })] }), _jsxs(Panel, { id: "other", active: tab, children: [form.custom.map((c, i) => (_jsxs("div", { className: "cs-tp-row", children: [_jsx("input", { "aria-label": t('titlePage.field.key'), className: "cs-tp-input cs-tp-key", value: c.key, placeholder: t('titlePage.placeholder.key'), onChange: e => set('custom', form.custom.map((x, j) => j === i ? { ...x, key: e.target.value } : x)) }), _jsx("input", { "aria-label": t('titlePage.field.value'), className: "cs-tp-input", value: c.value, onChange: e => set('custom', form.custom.map((x, j) => j === i ? { ...x, value: e.target.value } : x)) }), _jsx("button", { type: "button", className: "cs-tp-remove", "aria-label": t('titlePage.remove'), onClick: () => set('custom', form.custom.filter((_, j) => j !== i)), children: "\u00D7" })] }, i))), _jsxs("button", { type: "button", className: "cs-tp-add", onClick: () => set('custom', [...form.custom, { key: '', value: '' }]), children: ["+ ", t('titlePage.addField')] }), preservedCount > 0 && (_jsx("p", { className: "cs-tp-note", children: t('titlePage.preserved').replace('{n}', String(preservedCount)) }))] })] })] }), _jsxs("div", { className: "cs-export-actions cs-tp-actions", children: [_jsx("button", { type: "button", className: "cs-confirm-btn-cancel", onClick: onClose, children: t('titlePage.cancel') }), _jsx("button", { type: "button", className: "cs-confirm-btn-primary", onClick: save, children: t('titlePage.save') })] })] }) }));
79
79
  }
80
80
  function Panel({ id, active, children }) {
81
81
  return (_jsx("div", { role: "tabpanel", id: `cs-tp-panel-${id}`, "aria-labelledby": `cs-tp-tab-${id}`, className: "cs-tp-panel", hidden: active !== id, children: children }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutrata/editor",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "React + ProseMirror screenplay editor for Sutra, with first-class support for Indic and other complex scripts.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "keywords": [