@azx-pbc/axiom-react 0.0.0-stage → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +604 -2
- package/dist/FormErrorBoundary.d.ts +37 -0
- package/dist/FormErrorBoundary.d.ts.map +1 -0
- package/dist/FormErrorBoundary.js +54 -0
- package/dist/FormErrorBoundary.js.map +1 -0
- package/dist/FormProvider.d.ts +197 -0
- package/dist/FormProvider.d.ts.map +1 -0
- package/dist/FormProvider.js +149 -0
- package/dist/FormProvider.js.map +1 -0
- package/dist/field-error.d.ts +154 -0
- package/dist/field-error.d.ts.map +1 -0
- package/dist/field-error.js +2 -0
- package/dist/field-error.js.map +1 -0
- package/dist/field-props.d.ts +362 -0
- package/dist/field-props.d.ts.map +1 -0
- package/dist/field-props.js +64 -0
- package/dist/field-props.js.map +1 -0
- package/dist/form-context.d.ts +31 -0
- package/dist/form-context.d.ts.map +1 -0
- package/dist/form-context.js +13 -0
- package/dist/form-context.js.map +1 -0
- package/dist/form-store.d.ts +784 -0
- package/dist/form-store.d.ts.map +1 -0
- package/dist/form-store.js +2179 -0
- package/dist/form-store.js.map +1 -0
- package/dist/hints.d.ts +60 -0
- package/dist/hints.d.ts.map +1 -0
- package/dist/hints.js +158 -0
- package/dist/hints.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/render/field-value.d.ts +92 -0
- package/dist/render/field-value.d.ts.map +1 -0
- package/dist/render/field-value.js +124 -0
- package/dist/render/field-value.js.map +1 -0
- package/dist/render/nodes.d.ts +303 -0
- package/dist/render/nodes.d.ts.map +1 -0
- package/dist/render/nodes.js +325 -0
- package/dist/render/nodes.js.map +1 -0
- package/dist/render/schema.d.ts +30 -0
- package/dist/render/schema.d.ts.map +1 -0
- package/dist/render/schema.js +40 -0
- package/dist/render/schema.js.map +1 -0
- package/dist/render/value-text.d.ts +59 -0
- package/dist/render/value-text.d.ts.map +1 -0
- package/dist/render/value-text.js +104 -0
- package/dist/render/value-text.js.map +1 -0
- package/dist/store/array-bindings.d.ts +110 -0
- package/dist/store/array-bindings.d.ts.map +1 -0
- package/dist/store/array-bindings.js +181 -0
- package/dist/store/array-bindings.js.map +1 -0
- package/dist/store/bindings.d.ts +12 -0
- package/dist/store/bindings.d.ts.map +1 -0
- package/dist/store/bindings.js +16 -0
- package/dist/store/bindings.js.map +1 -0
- package/dist/store/buffer-state.d.ts +42 -0
- package/dist/store/buffer-state.d.ts.map +1 -0
- package/dist/store/buffer-state.js +51 -0
- package/dist/store/buffer-state.js.map +1 -0
- package/dist/store/configure.d.ts +19 -0
- package/dist/store/configure.d.ts.map +1 -0
- package/dist/store/configure.js +28 -0
- package/dist/store/configure.js.map +1 -0
- package/dist/store/derive.d.ts +106 -0
- package/dist/store/derive.d.ts.map +1 -0
- package/dist/store/derive.js +417 -0
- package/dist/store/derive.js.map +1 -0
- package/dist/store/errors.d.ts +20 -0
- package/dist/store/errors.d.ts.map +1 -0
- package/dist/store/errors.js +101 -0
- package/dist/store/errors.js.map +1 -0
- package/dist/store/fields.d.ts +35 -0
- package/dist/store/fields.d.ts.map +1 -0
- package/dist/store/fields.js +81 -0
- package/dist/store/fields.js.map +1 -0
- package/dist/store/form-channel.d.ts +174 -0
- package/dist/store/form-channel.d.ts.map +1 -0
- package/dist/store/form-channel.js +411 -0
- package/dist/store/form-channel.js.map +1 -0
- package/dist/store/gates.d.ts +22 -0
- package/dist/store/gates.d.ts.map +1 -0
- package/dist/store/gates.js +44 -0
- package/dist/store/gates.js.map +1 -0
- package/dist/store/ids.d.ts +20 -0
- package/dist/store/ids.d.ts.map +1 -0
- package/dist/store/ids.js +28 -0
- package/dist/store/ids.js.map +1 -0
- package/dist/store/inputs.d.ts +114 -0
- package/dist/store/inputs.d.ts.map +1 -0
- package/dist/store/inputs.js +202 -0
- package/dist/store/inputs.js.map +1 -0
- package/dist/store/layout.d.ts +81 -0
- package/dist/store/layout.d.ts.map +1 -0
- package/dist/store/layout.js +285 -0
- package/dist/store/layout.js.map +1 -0
- package/dist/store/messages.d.ts +56 -0
- package/dist/store/messages.d.ts.map +1 -0
- package/dist/store/messages.js +157 -0
- package/dist/store/messages.js.map +1 -0
- package/dist/store/option-pages.d.ts +193 -0
- package/dist/store/option-pages.d.ts.map +1 -0
- package/dist/store/option-pages.js +598 -0
- package/dist/store/option-pages.js.map +1 -0
- package/dist/store/parse-print.d.ts +105 -0
- package/dist/store/parse-print.d.ts.map +1 -0
- package/dist/store/parse-print.js +415 -0
- package/dist/store/parse-print.js.map +1 -0
- package/dist/store/proposals.d.ts +114 -0
- package/dist/store/proposals.d.ts.map +1 -0
- package/dist/store/proposals.js +90 -0
- package/dist/store/proposals.js.map +1 -0
- package/dist/store/publish.d.ts +48 -0
- package/dist/store/publish.d.ts.map +1 -0
- package/dist/store/publish.js +96 -0
- package/dist/store/publish.js.map +1 -0
- package/dist/store/snapshots.d.ts +63 -0
- package/dist/store/snapshots.d.ts.map +1 -0
- package/dist/store/snapshots.js +154 -0
- package/dist/store/snapshots.js.map +1 -0
- package/dist/store/steps.d.ts +13 -0
- package/dist/store/steps.d.ts.map +1 -0
- package/dist/store/steps.js +31 -0
- package/dist/store/steps.js.map +1 -0
- package/dist/store/view.d.ts +124 -0
- package/dist/store/view.d.ts.map +1 -0
- package/dist/store/view.js +301 -0
- package/dist/store/view.js.map +1 -0
- package/dist/store/visibility.d.ts +68 -0
- package/dist/store/visibility.d.ts.map +1 -0
- package/dist/store/visibility.js +231 -0
- package/dist/store/visibility.js.map +1 -0
- package/dist/store/wizard-cursor.d.ts +43 -0
- package/dist/store/wizard-cursor.d.ts.map +1 -0
- package/dist/store/wizard-cursor.js +67 -0
- package/dist/store/wizard-cursor.js.map +1 -0
- package/dist/store/writes.d.ts +50 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +91 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/typed.d.ts +134 -0
- package/dist/typed.d.ts.map +1 -0
- package/dist/typed.js +74 -0
- package/dist/typed.js.map +1 -0
- package/dist/useAsyncOptions.d.ts +20 -0
- package/dist/useAsyncOptions.d.ts.map +1 -0
- package/dist/useAsyncOptions.js +70 -0
- package/dist/useAsyncOptions.js.map +1 -0
- package/dist/useBufferedInput.d.ts +69 -0
- package/dist/useBufferedInput.d.ts.map +1 -0
- package/dist/useBufferedInput.js +132 -0
- package/dist/useBufferedInput.js.map +1 -0
- package/dist/useField.d.ts +42 -0
- package/dist/useField.d.ts.map +1 -0
- package/dist/useField.js +63 -0
- package/dist/useField.js.map +1 -0
- package/dist/useFieldArray.d.ts +25 -0
- package/dist/useFieldArray.d.ts.map +1 -0
- package/dist/useFieldArray.js +18 -0
- package/dist/useFieldArray.js.map +1 -0
- package/dist/useForm.d.ts +20 -0
- package/dist/useForm.d.ts.map +1 -0
- package/dist/useForm.js +9 -0
- package/dist/useForm.js.map +1 -0
- package/dist/useFormState.d.ts +23 -0
- package/dist/useFormState.d.ts.map +1 -0
- package/dist/useFormState.js +11 -0
- package/dist/useFormState.js.map +1 -0
- package/dist/useGate.d.ts +15 -0
- package/dist/useGate.d.ts.map +1 -0
- package/dist/useGate.js +21 -0
- package/dist/useGate.js.map +1 -0
- package/dist/useLayout.d.ts +29 -0
- package/dist/useLayout.d.ts.map +1 -0
- package/dist/useLayout.js +59 -0
- package/dist/useLayout.js.map +1 -0
- package/dist/useMessage.d.ts +58 -0
- package/dist/useMessage.d.ts.map +1 -0
- package/dist/useMessage.js +62 -0
- package/dist/useMessage.js.map +1 -0
- package/dist/useWatch.d.ts +19 -0
- package/dist/useWatch.d.ts.map +1 -0
- package/dist/useWatch.js +17 -0
- package/dist/useWatch.js.map +1 -0
- package/dist/useWizard.d.ts +166 -0
- package/dist/useWizard.d.ts.map +1 -0
- package/dist/useWizard.js +554 -0
- package/dist/useWizard.js.map +1 -0
- package/package.json +62 -3
|
@@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;QAAE,OAAO,MAAM,CAAC;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACtC,OAAO,GAAG,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;IAChE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {\n asDecimalString,\n AxiomError,\n DECIMAL_TEXT_PATTERN,\n formatPlainDate,\n isE164PhoneNumber,\n isRecord,\n moneyFromMinor,\n parsePlainDate,\n} from '@azx-pbc/axiom-runtime';\nimport type { CompiledField, MoneyValue, WireValue } from '@azx-pbc/axiom-runtime';\n\n/**\n * The one text↔value contract a buffered input is bound to.\n *\n * A control's text passes through states the wire cannot hold — `12.`, `-`, `+`, `2026-0` —\n * so the text is never the value. A parse answers with one of three states: a wire value the\n * session can take, a partial entry that is still being typed, or an entry the format refuses\n * with a stable reason key the host translates. Only the first is ever written.\n */\nexport type BufferedFormat =\n | { readonly kind: 'decimal' }\n | { readonly kind: 'integer' }\n | { readonly kind: 'money' }\n /**\n * An exact amount and the unit its field is measured in. The unit is the one the control's\n * picker currently shows, so one text entry writes both members of the wire value.\n */\n | { readonly kind: 'quantity'; readonly unit: string }\n | { readonly kind: 'phone' }\n | { readonly kind: 'date' };\n\n/**\n * Why one text entry cannot be a value.\n *\n * These are stable keys, not prose: the layer is headless and has no locale, so a host renders\n * them through its own catalogue (`parseError` plus `parseErrorParams`). A key is also what a\n * test can pin, while an English sentence would change with the wording.\n */\nexport type BufferRefusalReason =\n | 'buffer.decimal.one_point'\n | 'buffer.decimal.digits'\n | 'buffer.decimal.fraction_digits'\n | 'buffer.decimal.not_canonical'\n | 'buffer.integer.digits'\n | 'buffer.integer.no_point'\n | 'buffer.integer.not_safe'\n | 'buffer.money.not_amount'\n | 'buffer.money.scale_exceeded'\n | 'buffer.phone.e164'\n | 'buffer.date.nonexistent_day'\n | 'buffer.date.format';\n\n/** One refusal, with the values its message interpolates. */\nexport interface BufferRefusal {\n readonly reason: BufferRefusalReason;\n readonly params?: Readonly<Record<string, string | number>>;\n}\n\n/** The locale's punctuation for one decimal number, as an input expects to read it. */\nexport interface NumericSeparators {\n /** The mark between the whole part and the fraction (`125,50` in `es`). */\n readonly decimal: string;\n /** The mark between digit groups (`1.234` in `es`). */\n readonly group: string;\n /**\n * CLDR's `minimumGroupingDigits`: how many digits beyond three must appear before a group mark\n * is printed (`1` groups from four digits; `2` leaves four-digit integers ungrouped and starts\n * at five, matching Spanish and Italian). Defaults to `1`.\n */\n readonly minimumGroupingDigits?: 1 | 2;\n}\n\n/** The separators a contract without a locale reads: the canonical `125.50` and `1,234`. */\nconst DEFAULT_SEPARATORS: NumericSeparators = Object.freeze({\n decimal: '.',\n group: ',',\n});\n\n/** One separator table per requested locale, so a keystroke does not re-read a table. */\nconst SEPARATORS = new Map<string, NumericSeparators>();\n\n/**\n * The decimal and grouping marks this layer reads for one language.\n *\n * It is a vendored table, not the host's locale database: the package must render the same entry\n * on Node, in a browser and on a device, exactly as it reads plural rules from its own registry.\n * The marks cover every locale the reference host ships (en, es, fr, de, ru, it, zh, ar, pt);\n * Chinese and Arabic are listed explicitly so neither depends on the canonical fallback. Arabic\n * uses the ASCII decimal and group marks to match the display layer and Western digit policy, so\n * an entry prints and accepts the same spelling the page displays. A language outside this table\n * keeps the canonical `.` decimal and `,` group, and a host with another convention may pass\n * `separators` explicitly. An entry the chosen marks cannot parse is refused rather than guessed\n * at.\n */\nconst LOCALE_SEPARATORS: Readonly<Record<string, NumericSeparators>> = Object.freeze({\n en: DEFAULT_SEPARATORS,\n es: { decimal: ',', group: '.', minimumGroupingDigits: 2 },\n de: { decimal: ',', group: '.' },\n it: { decimal: ',', group: '.', minimumGroupingDigits: 2 },\n pt: { decimal: ',', group: '.' },\n fr: { decimal: ',', group: ' ' },\n ru: { decimal: ',', group: ' ' },\n zh: DEFAULT_SEPARATORS,\n ar: DEFAULT_SEPARATORS,\n});\n\n/** The language subtag of a requested tag, so `es-MX` reads the `es` marks. */\nfunction separatorsOf(locale: string | undefined): NumericSeparators {\n if (locale === undefined || locale === '') return DEFAULT_SEPARATORS;\n const cached = SEPARATORS.get(locale);\n if (cached !== undefined) return cached;\n const language = locale.split(/[-_]/)[0] ?? '';\n const separators = LOCALE_SEPARATORS[language] ?? DEFAULT_SEPARATORS;\n SEPARATORS.set(locale, separators);\n return separators;\n}\n\n/** What one text entry means to the session. */\nexport type ParseOutcome =\n | { readonly kind: 'value'; readonly value: WireValue }\n | { readonly kind: 'partial' }\n | ({ readonly kind: 'invalid' } & BufferRefusal);\n\n/**\n * The resolved format: the kind the control asks for, and the money domain when it is money.\n *\n * `currency` and `scale` are the field declaration's, never the host's: a money field's\n * declaration is mandatory, so two fields with different currencies cannot share a parser and\n * no host needs per-field format configuration.\n */\nexport interface FormatContract {\n readonly format: BufferedFormat;\n readonly currency?: string;\n /**\n * The declared fractional-digit bound. A money amount uses it to place the minor units; a\n * quantity uses it to refuse an amount the declaration cannot hold. A quantity with no stated\n * scale reads `0`, the integer quantity.\n */\n readonly scale?: number;\n /** The marks the entry may use. Absent reads the canonical `.` decimal and `,` group. */\n readonly separators?: NumericSeparators;\n}\n\n/**\n * The contract one field is buffered against.\n *\n * A `money` format with no declared `(currency, scale)` is a programmer error rather than a\n * default: guessing a currency would print an amount the record never held. `locale` is the\n * host's request for that control's punctuation; it changes which marks parse and print, never\n * the value the record holds.\n */\nexport function formatContractOf(\n field: CompiledField,\n format: BufferedFormat,\n locale?: string,\n separators?: NumericSeparators,\n): FormatContract {\n const marks = separators ?? separatorsOf(locale);\n if (format.kind === 'quantity') {\n if (field.units === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `a quantity buffer needs the declared units of ${field.fieldId}; its declaration states none`,\n field.fieldId,\n );\n }\n if (!field.units.includes(format.unit)) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `the unit ${format.unit} is not one ${field.fieldId} declares`,\n field.fieldId,\n );\n }\n return { format, scale: field.scale ?? 0, separators: marks };\n }\n if (format.kind !== 'money') return { format, separators: marks };\n if (field.currency === undefined || field.scale === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `a money buffer needs the declared (currency, scale) of ${field.fieldId}; its declaration states none`,\n field.fieldId,\n );\n }\n return { format, currency: field.currency, scale: field.scale, separators: marks };\n}\n\n/**\n * The identity of a contract's text, compared by value.\n *\n * `formatContractOf` builds a fresh object on every render, so a buffer cannot compare the\n * contract its text was entered under with the object the control now holds. This spelling names\n * every member that changes how text is read or written, so two renders of the same format agree\n * and a locale or declaration change does not.\n */\nexport function contractSignature(contract: FormatContract): string {\n const format = contract.format;\n const unit = format.kind === 'quantity' ? format.unit : '';\n const marks = contract.separators ?? DEFAULT_SEPARATORS;\n return [\n format.kind,\n unit,\n contract.currency ?? '',\n contract.scale === undefined ? '' : String(contract.scale),\n marks.decimal,\n marks.group,\n String(marks.minimumGroupingDigits ?? 1),\n ].join('\\u0000');\n}\n\n/** The text a committed value shows, or empty text for the authored empty value. */\nexport function printEntry(value: WireValue | undefined, contract: FormatContract): string {\n if (value === undefined || value === null) return '';\n switch (contract.format.kind) {\n case 'decimal':\n return typeof value === 'string' || typeof value === 'number'\n ? printDecimalText(String(value), contract)\n : '';\n case 'integer':\n case 'phone':\n case 'date':\n return typeof value === 'string' || typeof value === 'number' ? String(value) : '';\n case 'money':\n return isMoney(value) ? printMoney(value, contract) : '';\n case 'quantity':\n return printQuantity(value, contract);\n }\n}\n\n/** The wire value one text entry names, or why it names none yet. */\nexport function parseEntry(text: string, contract: FormatContract): ParseOutcome {\n if (text.trim() === '') return { kind: 'value', value: null };\n const separators = contract.separators ?? DEFAULT_SEPARATORS;\n switch (contract.format.kind) {\n case 'decimal':\n return parseDecimalText(text.trim(), false, separators);\n case 'integer':\n return parseIntegerText(text.trim(), separators);\n case 'money':\n return parseMoneyText(text.trim(), contract, separators);\n case 'quantity':\n return parseQuantityText(text.trim(), contract, separators);\n case 'phone':\n return parsePhoneText(text.trim());\n case 'date':\n return parseDateText(text.trim());\n }\n}\n\n/** Canonical digit text with no leading zeros; the amount zero loses its sign too. */\nfunction stripLeadingZeros(digits: string): string {\n const without = digits.replace(/^0+(?=[0-9])/, '');\n return without === '0' ? '0' : without;\n}\n\n/**\n * One digit run with the locale's grouping removed, or `undefined` when the groups are malformed.\n *\n * A group mark is accepted only between groups: the first group is one to three digits and every\n * later one is exactly three, so `1,20` is refused rather than read as `120`.\n */\nfunction ungroupDigits(whole: string, group: string): string | undefined {\n const negative = whole.startsWith('-');\n const body = negative ? whole.slice(1) : whole;\n if (body === '') return negative ? '-' : '';\n if (!body.includes(group)) {\n return /^[0-9]*$/.test(body) ? `${negative ? '-' : ''}${body}` : undefined;\n }\n const groups = body.split(group);\n const [first = '', ...rest] = groups;\n if (!/^[0-9]{1,3}$/.test(first)) return undefined;\n if (rest.some((entry) => !/^[0-9]{3}$/.test(entry))) return undefined;\n return `${negative ? '-' : ''}${groups.join('')}`;\n}\n\n/** The spaces a spreadsheet export may carry where a person saw the group mark. */\nconst PASTED_SPACE = /[\\u00A0\\u202F]/g;\n\n/**\n * Pasted grouping spaces as the mark the entry reads.\n *\n * A no-break space and a narrow no-break space become the group mark when the entry reads a\n * space-like group (`fr`, `ru`, or a host override in the same family), and the plain space\n * otherwise. Under any other marks the plain space is still no group mark, so the entry keeps\n * its refusal, and a host override that names a non-breaking group keeps reading it.\n */\nfunction normalizePastedSpaces(body: string, group: string): string {\n const target = group === ' ' || group === '\\u00A0' || group === '\\u202F' ? group : ' ';\n return body.replace(PASTED_SPACE, target);\n}\n\n/**\n * One leading plus as no sign, so a pasted `+12.50` reads as the amount it names.\n *\n * A bare `+` is a half-typed entry, like `-`. A plus followed by another sign (`+-12`) is no\n * sign at all and stays refused.\n */\nfunction withoutLeadingPlus(body: string): string | undefined {\n if (!body.startsWith('+')) return body;\n const rest = body.slice(1);\n if (rest.startsWith('-') || rest.startsWith('+')) return undefined;\n return rest;\n}\n\n/**\n * One decimal entry, in the locale's punctuation, as canonical wire text.\n *\n * The decimal mark is taken before the group mark: `1.234,56` under `de` is a grouped thousand\n * and a fraction, while `1,234.56` under `en` is the same amount. A mark used twice as a decimal\n * is refused (`12,3,4`), and a group mark inside the fraction is refused rather than stripped, so\n * an ambiguous entry never becomes a number the user did not type. Pasted text is normalised\n * first: the two spreadsheet spaces become the group mark where that mark is itself a space,\n * else the plain space, and one leading plus is dropped, while anything else keeps its refusal.\n */\nfunction parseDecimalText(\n body: string,\n integerOnly: boolean,\n separators: NumericSeparators,\n): ParseOutcome {\n const { decimal, group } = usableSeparators(separators);\n const unsigned = withoutLeadingPlus(normalizePastedSpaces(body, group));\n if (unsigned === undefined) {\n return {\n kind: 'invalid',\n reason: integerOnly ? 'buffer.integer.digits' : 'buffer.decimal.digits',\n };\n }\n const parts = unsigned.split(decimal);\n if (parts.length > 2) {\n return { kind: 'invalid', reason: 'buffer.decimal.one_point' };\n }\n const wholeRaw = parts[0] ?? '';\n const fraction = parts[1];\n const plainWhole = ungroupDigits(wholeRaw, group);\n if (plainWhole === undefined) {\n return {\n kind: 'invalid',\n reason: integerOnly ? 'buffer.integer.digits' : 'buffer.decimal.digits',\n };\n }\n if (fraction !== undefined && !/^[0-9]*$/.test(fraction)) {\n // A group mark in the fraction is one of these characters; it is refused with the fraction\n // message rather than silently removed.\n return { kind: 'invalid', reason: 'buffer.decimal.fraction_digits' };\n }\n if (integerOnly && fraction !== undefined) {\n return { kind: 'invalid', reason: 'buffer.integer.no_point' };\n }\n const negative = plainWhole.startsWith('-');\n const digits = stripLeadingZeros(negative ? plainWhole.slice(1) : plainWhole);\n // The integer part alone, or the point with no digit after it, is an entry still being typed.\n if (digits === '' || fraction === '') return { kind: 'partial' };\n const trimmed = fraction === undefined ? '' : fraction.replace(/0+$/, '');\n const text =\n trimmed === ''\n ? `${negative && digits !== '0' ? '-' : ''}${digits}`\n : `${negative ? '-' : ''}${digits}.${trimmed}`;\n if (!DECIMAL_TEXT_PATTERN.test(text)) {\n return { kind: 'invalid', reason: 'buffer.decimal.not_canonical' };\n }\n return { kind: 'value', value: text };\n}\n\n/** The marks a parse may use; a table whose marks collide falls back to the canonical pair. */\nfunction usableSeparators(separators: NumericSeparators): NumericSeparators {\n if (\n separators.decimal === '' ||\n separators.group === '' ||\n separators.decimal === separators.group\n ) {\n return DEFAULT_SEPARATORS;\n }\n return separators;\n}\n\nfunction parseIntegerText(text: string, separators: NumericSeparators): ParseOutcome {\n const parsed = parseDecimalText(text, true, separators);\n if (parsed.kind !== 'value') return parsed;\n const value = Number(parsed.value);\n if (!Number.isSafeInteger(value) || Object.is(value, -0)) {\n return { kind: 'invalid', reason: 'buffer.integer.not_safe' };\n }\n return { kind: 'value', value };\n}\n\n/**\n * A currency symbol at either edge of a pasted amount.\n *\n * The declaration names the currency, so a symbol the text carries is not part of the amount:\n * `$1,234.56` and `1.234,56 €` read as the digits they surround. Only an edge symbol is removed;\n * a space between digits is not a declared group mark, so `1 234,56` is refused rather than\n * guessed at. Pasted spaces are normalised to the plain space before this read, so a no-break\n * space refuses exactly where the plain space refuses. The sign survives a leading symbol, so\n * `-$12.50` is a negative amount.\n */\nconst CURRENCY_SYMBOL_EDGE = /^(\\s*[-+]?\\s*)\\p{Sc}\\s*|\\s*\\p{Sc}\\s*$/gu;\n\nfunction withoutCurrencySymbol(text: string): string {\n return text.replace(CURRENCY_SYMBOL_EDGE, '$1');\n}\n\nfunction parseMoneyText(\n text: string,\n contract: FormatContract,\n separators: NumericSeparators,\n): ParseOutcome {\n const currency = contract.currency;\n const scale = contract.scale;\n if (currency === undefined || scale === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'a money buffer needs a declared (currency, scale)',\n contract.format.kind,\n );\n }\n const decimal = parseDecimalText(withoutCurrencySymbol(text), false, separators);\n if (decimal.kind !== 'value') return decimal;\n if (decimal.value === null || typeof decimal.value !== 'string') {\n return { kind: 'invalid', reason: 'buffer.money.not_amount' };\n }\n const [whole = '', fraction = ''] = decimal.value.split('.');\n if (fraction.length > scale) {\n return {\n kind: 'invalid',\n reason: 'buffer.money.scale_exceeded',\n params: { scale },\n };\n }\n const digits = `${whole.replace('-', '')}${fraction.padEnd(scale, '0')}`;\n const canonical = stripLeadingZeros(digits);\n const minor = canonical === '0' || !decimal.value.startsWith('-') ? canonical : `-${canonical}`;\n return {\n kind: 'value',\n value: moneyFromMinor(asDecimalString(minor), currency, scale, 'half_up'),\n };\n}\n\n/**\n * One quantity entry as the wire record `{ value, unit }`, `MODEL-2.1.21`.\n *\n * The amount is exact decimal text at the declaration's scale; the unit is the one the\n * control's picker holds, so the text and the picker always name one measured value. A scale of\n * zero is an integer quantity and refuses a decimal point, because the declaration cannot hold\n * the fraction the user typed.\n */\nfunction parseQuantityText(\n text: string,\n contract: FormatContract,\n separators: NumericSeparators,\n): ParseOutcome {\n if (contract.format.kind !== 'quantity') {\n throw new AxiomError('ENGINE_ERROR', 'a quantity parse needs a quantity format', text);\n }\n const scale = contract.scale;\n if (scale === undefined || !Number.isInteger(scale) || scale < 0) {\n throw new AxiomError('ENGINE_ERROR', 'a quantity buffer needs a declared scale', text);\n }\n const decimal = parseDecimalText(text, scale === 0, separators);\n if (decimal.kind !== 'value') return decimal;\n if (typeof decimal.value !== 'string') {\n return { kind: 'invalid', reason: 'buffer.decimal.not_canonical' };\n }\n const fraction = decimal.value.split('.')[1] ?? '';\n if (fraction.length > scale) {\n return {\n kind: 'invalid',\n reason: 'buffer.money.scale_exceeded',\n params: { scale },\n };\n }\n return { kind: 'value', value: { value: decimal.value, unit: contract.format.unit } };\n}\n\nfunction parsePhoneText(text: string): ParseOutcome {\n if (isE164PhoneNumber(text)) return { kind: 'value', value: text };\n const digitsOnly = /^\\+?[0-9]*$/.test(text);\n if (digitsOnly && text.length <= 16 && (text.length <= 1 || text[1] !== '0')) {\n return { kind: 'partial' };\n }\n return { kind: 'invalid', reason: 'buffer.phone.e164' };\n}\n\nconst PARTIAL_DATE = /^[0-9]{0,4}(?:-[0-9]{0,2}){0,2}$/;\n\nfunction parseDateText(text: string): ParseOutcome {\n if (PARTIAL_DATE.test(text)) {\n // A spelling shorter than a full date is a half-typed one: no day is refused yet.\n if (text.length < 10) return { kind: 'partial' };\n try {\n return { kind: 'value', value: formatPlainDate(parsePlainDate(text)) };\n } catch (error) {\n if (error instanceof AxiomError) {\n // A complete-looking date that names no civil day is a refusal, not a half-typed entry.\n return { kind: 'invalid', reason: 'buffer.date.nonexistent_day' };\n }\n throw error;\n }\n }\n return { kind: 'invalid', reason: 'buffer.date.format' };\n}\n\nfunction isMoney(value: WireValue): value is MoneyValue {\n return isRecord(value) && typeof value['minor'] === 'string';\n}\n\n/** Canonical decimal text in the contract's grouping and decimal marks. */\nfunction printDecimalText(raw: string, contract: FormatContract): string {\n const negative = raw.startsWith('-');\n const unsigned = negative ? raw.slice(1) : raw;\n const point = unsigned.indexOf('.');\n const whole = point === -1 ? unsigned : unsigned.slice(0, point);\n const fraction = point === -1 ? '' : unsigned.slice(point + 1);\n const marks = contract.separators ?? DEFAULT_SEPARATORS;\n const grouped = groupDigits(whole, marks.group, marks.minimumGroupingDigits ?? 1);\n return `${negative ? '-' : ''}${grouped}${fraction === '' ? '' : `${marks.decimal}${fraction}`}`;\n}\n\n/** The amount member of a committed quantity, in the locale's grouping and decimal punctuation. */\nfunction printQuantity(value: WireValue, contract: FormatContract): string {\n if (!isRecord(value)) return '';\n const amount = value['value'];\n if (typeof amount !== 'string') return '';\n return printDecimalText(amount, contract);\n}\n\n/** `minor` rendered at the field's declared scale: `120000` at scale 2 is `1200.00`. */\nfunction printMoney(value: MoneyValue, contract: FormatContract): string {\n const scale = contract.scale;\n if (scale === undefined || !Number.isInteger(scale) || scale < 0) return '';\n const negative = value.minor.startsWith('-');\n const digits = stripLeadingZeros(negative ? value.minor.slice(1) : value.minor).padStart(\n scale + 1,\n '0',\n );\n const whole = digits.slice(0, digits.length - scale);\n const marks = contract.separators ?? DEFAULT_SEPARATORS;\n const fraction = scale === 0 ? '' : `${marks.decimal}${digits.slice(digits.length - scale)}`;\n return `${negative && digits.replaceAll('0', '') !== '' ? '-' : ''}${groupDigits(whole, marks.group, marks.minimumGroupingDigits ?? 1)}${fraction}`;\n}\n\n/**\n * A digit run grouped from the right once it reaches the locale's minimum grouping width.\n *\n * The scale fixes the fraction; the group mark and minimum grouping threshold are the locale's,\n * and the value the record holds is still canonical text with no separators. Parsing removes the\n * same groups (`ungroupDigits`), so printing and reading one amount are inverses.\n */\nfunction groupDigits(digits: string, group: string, minimumGroupingDigits: 1 | 2 = 1): string {\n if (group === '' || digits.length < 3 + minimumGroupingDigits) return digits;\n let grouped = '';\n for (let end = digits.length; end > 0; end -= 3) {\n const start = Math.max(0, end - 3);\n const part = digits.slice(start, end);\n grouped = grouped === '' ? part : `${part}${group}${grouped}`;\n }\n return grouped;\n}\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { CandidateDelta, EngineCandidate, EngineOperation, EngineOutcome, FieldRef, FormBlocker } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* A change set the session derived but did not apply, `[ENGINE-8.2.1]`.
|
|
4
|
+
*
|
|
5
|
+
* The candidate is the state `Engine.propose` derived, so applying the proposal installs exactly
|
|
6
|
+
* what a host showed: an assigned row's key is minted once, the report is the candidate's, and
|
|
7
|
+
* the apply costs one publish. The delta is what applying would move, stated as data, so a host
|
|
8
|
+
* can confirm a change set before anything is committed. It is built on first read, because the
|
|
9
|
+
* two report digests it carries require sealing both reports; `addedBlockers` is the cheap
|
|
10
|
+
* answer a host reads to decide whether the change set is worth showing at all.
|
|
11
|
+
*
|
|
12
|
+
* The delta closure retains the committed base state it is diffed against until the first read
|
|
13
|
+
* of `delta`, because the digests must name the report that base decided; after that read the
|
|
14
|
+
* memoised delta is all the getter keeps. While a proposal is pending the store holds the same
|
|
15
|
+
* committed state, so declining or applying the proposal releases nothing the session was not
|
|
16
|
+
* already keeping.
|
|
17
|
+
*/
|
|
18
|
+
export interface Proposal {
|
|
19
|
+
readonly outcome: 'proposed';
|
|
20
|
+
readonly operations: readonly EngineOperation[];
|
|
21
|
+
readonly candidate: EngineCandidate;
|
|
22
|
+
readonly addedBlockers: readonly FormBlocker[];
|
|
23
|
+
readonly delta: CandidateDelta;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A user write the session staged instead of committing, which a host confirms or declines.
|
|
27
|
+
*
|
|
28
|
+
* A session holds one pending proposal: staging a newer one replaces the older, and the older is
|
|
29
|
+
* no longer committable. `sequence` is the monotonic number that states which write is latest,
|
|
30
|
+
* because two proposals derived from one basis are otherwise indistinguishable to a commit.
|
|
31
|
+
*/
|
|
32
|
+
export interface WriteProposal extends Proposal {
|
|
33
|
+
/** The session's monotonic order: a larger sequence is the newer staged write. */
|
|
34
|
+
readonly sequence: number;
|
|
35
|
+
/**
|
|
36
|
+
* The binding the write named, so a host can say which control it came from.
|
|
37
|
+
*
|
|
38
|
+
* A control writes one binding; a change set that names several reports the first user write,
|
|
39
|
+
* read from the user-origin field operations alone. A session-input operation (`context`,
|
|
40
|
+
* `env`, `access`) names no binding and never becomes the reported one.
|
|
41
|
+
*/
|
|
42
|
+
readonly binding: FieldRef;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The value-free projection of the pending proposal a form summary states.
|
|
46
|
+
*
|
|
47
|
+
* The summary says that a confirmation waits and which binding it edits; it carries no operation,
|
|
48
|
+
* candidate or report, so a typed value cannot be reached through it and a report cannot go stale
|
|
49
|
+
* behind it. The proposal to apply or discard is the one `onWriteProposed` delivered, or the one
|
|
50
|
+
* `form.propose` returned.
|
|
51
|
+
*/
|
|
52
|
+
export interface PendingProposalSummary {
|
|
53
|
+
/** The session's monotonic order of the staged write that waits. */
|
|
54
|
+
readonly sequence: number;
|
|
55
|
+
/** The binding the staged write named, so a host can say which control it came from. */
|
|
56
|
+
readonly binding: FieldRef;
|
|
57
|
+
}
|
|
58
|
+
/** The codes the store refuses a proposal with before it reaches the engine. */
|
|
59
|
+
export type ProposalRefusalCode = 'PROPOSAL_SUPERSEDED';
|
|
60
|
+
/**
|
|
61
|
+
* A proposal the store refused, stated in the same shape as a session refusal.
|
|
62
|
+
*
|
|
63
|
+
* The engine never sees this proposal: a session holds one pending proposal, and the caller
|
|
64
|
+
* handed in one a newer staged write already replaced, or one whose confirmation the host
|
|
65
|
+
* declined. The code is the store's own, so `STALE_BASIS` keeps meaning exactly what the engine
|
|
66
|
+
* says it means.
|
|
67
|
+
*/
|
|
68
|
+
export interface ProposalRefusal {
|
|
69
|
+
readonly outcome: 'refused';
|
|
70
|
+
readonly code: ProposalRefusalCode;
|
|
71
|
+
/** The sequence the caller's proposal carried, when it carried one. */
|
|
72
|
+
readonly sequence?: number;
|
|
73
|
+
/** The sequence of the proposal the store holds as pending, when it holds one. */
|
|
74
|
+
readonly latest?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What one user write answered: the engine's outcome, and whether the session staged it.
|
|
78
|
+
*
|
|
79
|
+
* A staged write answers `queued` rather than `committed`, because the record has not taken it:
|
|
80
|
+
* applying the proposal is the only thing that writes it. The flag is what keeps a staged write
|
|
81
|
+
* from recording provenance, dirty and touched marks the user has not committed to.
|
|
82
|
+
*/
|
|
83
|
+
export interface UserWriteOutcome {
|
|
84
|
+
readonly outcome: EngineOutcome;
|
|
85
|
+
readonly staged: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Whether a blocker offers a user an alternative that would clear it.
|
|
89
|
+
*
|
|
90
|
+
* Only the two arms authored with `suggests` can: a rule's alternatives and an unavailable
|
|
91
|
+
* option's. The remaining arms are decided facts with a sentence, never a change set, so a
|
|
92
|
+
* change set that adds one of them is reported in the delta and commits as any write does.
|
|
93
|
+
*/
|
|
94
|
+
export declare function offersAlternatives(blocker: FormBlocker): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The binding one user write edits, or `undefined` when no operation is a user's field write.
|
|
97
|
+
*
|
|
98
|
+
* A staged write is a control's edit, so it reports the first user-origin field binding. A
|
|
99
|
+
* session-input operation (`context`, `env`, `access`) carries no binding and is skipped rather
|
|
100
|
+
* than disqualifying the batch: a change set that drives the session beside a control's write is
|
|
101
|
+
* still a write the user confirms, and its session input reaches the record only when the
|
|
102
|
+
* proposal is applied.
|
|
103
|
+
*/
|
|
104
|
+
export declare function editedBinding(operations: readonly EngineOperation[]): FieldRef | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Whether one operation moves rows or replaces a whole array, so a refusal about a row it
|
|
107
|
+
* touched is stale.
|
|
108
|
+
*
|
|
109
|
+
* The kind test is exhaustive over the operation union: a new kind fails typecheck instead of
|
|
110
|
+
* silently reading as a value write. The container replacement is a value write to the array
|
|
111
|
+
* itself, which `isArrayContainer` answers from the declaration.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isStructuralOperation(operation: EngineOperation, isArrayContainer: (fieldId: string) => boolean): boolean;
|
|
114
|
+
//# sourceMappingURL=proposals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../../src/store/proposals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAA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qBAAqB,CACnC,SAAS,EAAE,eAAe,EAC1B,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAC7C,OAAO,CAkBT"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { assertNever } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a blocker offers a user an alternative that would clear it.
|
|
4
|
+
*
|
|
5
|
+
* Only the two arms authored with `suggests` can: a rule's alternatives and an unavailable
|
|
6
|
+
* option's. The remaining arms are decided facts with a sentence, never a change set, so a
|
|
7
|
+
* change set that adds one of them is reported in the delta and commits as any write does.
|
|
8
|
+
*/
|
|
9
|
+
export function offersAlternatives(blocker) {
|
|
10
|
+
switch (blocker.kind) {
|
|
11
|
+
case 'rule':
|
|
12
|
+
case 'unavailableOption':
|
|
13
|
+
return (blocker.suggestions?.length ?? 0) > 0;
|
|
14
|
+
case 'required':
|
|
15
|
+
case 'gate':
|
|
16
|
+
case 'cardinality':
|
|
17
|
+
case 'scale':
|
|
18
|
+
case 'media':
|
|
19
|
+
case 'rowCount':
|
|
20
|
+
case 'invalidOption':
|
|
21
|
+
case 'screen':
|
|
22
|
+
return false;
|
|
23
|
+
default:
|
|
24
|
+
return assertNever(blocker);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The binding one user write edits, or `undefined` when no operation is a user's field write.
|
|
29
|
+
*
|
|
30
|
+
* A staged write is a control's edit, so it reports the first user-origin field binding. A
|
|
31
|
+
* session-input operation (`context`, `env`, `access`) carries no binding and is skipped rather
|
|
32
|
+
* than disqualifying the batch: a change set that drives the session beside a control's write is
|
|
33
|
+
* still a write the user confirms, and its session input reaches the record only when the
|
|
34
|
+
* proposal is applied.
|
|
35
|
+
*/
|
|
36
|
+
export function editedBinding(operations) {
|
|
37
|
+
let binding;
|
|
38
|
+
for (const operation of operations) {
|
|
39
|
+
switch (operation.kind) {
|
|
40
|
+
case 'context':
|
|
41
|
+
case 'env':
|
|
42
|
+
case 'access':
|
|
43
|
+
continue;
|
|
44
|
+
case 'value':
|
|
45
|
+
case 'null':
|
|
46
|
+
case 'remove':
|
|
47
|
+
if (operation.origin === 'user')
|
|
48
|
+
binding ??= operation.ref;
|
|
49
|
+
continue;
|
|
50
|
+
case 'append':
|
|
51
|
+
case 'insert':
|
|
52
|
+
case 'removeRow':
|
|
53
|
+
case 'move':
|
|
54
|
+
if (operation.origin === 'user')
|
|
55
|
+
binding ??= Object.freeze({ fieldId: operation.fieldId });
|
|
56
|
+
continue;
|
|
57
|
+
default:
|
|
58
|
+
return assertNever(operation);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return binding;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether one operation moves rows or replaces a whole array, so a refusal about a row it
|
|
65
|
+
* touched is stale.
|
|
66
|
+
*
|
|
67
|
+
* The kind test is exhaustive over the operation union: a new kind fails typecheck instead of
|
|
68
|
+
* silently reading as a value write. The container replacement is a value write to the array
|
|
69
|
+
* itself, which `isArrayContainer` answers from the declaration.
|
|
70
|
+
*/
|
|
71
|
+
export function isStructuralOperation(operation, isArrayContainer) {
|
|
72
|
+
switch (operation.kind) {
|
|
73
|
+
case 'append':
|
|
74
|
+
case 'insert':
|
|
75
|
+
case 'removeRow':
|
|
76
|
+
case 'move':
|
|
77
|
+
return true;
|
|
78
|
+
case 'value':
|
|
79
|
+
case 'null':
|
|
80
|
+
case 'remove':
|
|
81
|
+
return operation.ref.rowKey === undefined && isArrayContainer(operation.ref.fieldId);
|
|
82
|
+
case 'context':
|
|
83
|
+
case 'env':
|
|
84
|
+
case 'access':
|
|
85
|
+
return false;
|
|
86
|
+
default:
|
|
87
|
+
return assertNever(operation);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=proposals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposals.js","sourceRoot":"","sources":["../../src/store/proposals.ts"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X;gBACE,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAA0B,EAC1B,gBAA8C;IAE9C,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvF,KAAK,SAAS,CAAC;QACf,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf;YACE,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import { assertNever } from '@azx-pbc/axiom-runtime';\nimport type {\n CandidateDelta,\n EngineCandidate,\n EngineOperation,\n EngineOutcome,\n FieldRef,\n FormBlocker,\n} from '@azx-pbc/axiom-runtime';\n\n/**\n * A change set the session derived but did not apply, `[ENGINE-8.2.1]`.\n *\n * The candidate is the state `Engine.propose` derived, so applying the proposal installs exactly\n * what a host showed: an assigned row's key is minted once, the report is the candidate's, and\n * the apply costs one publish. The delta is what applying would move, stated as data, so a host\n * can confirm a change set before anything is committed. It is built on first read, because the\n * two report digests it carries require sealing both reports; `addedBlockers` is the cheap\n * answer a host reads to decide whether the change set is worth showing at all.\n *\n * The delta closure retains the committed base state it is diffed against until the first read\n * of `delta`, because the digests must name the report that base decided; after that read the\n * memoised delta is all the getter keeps. While a proposal is pending the store holds the same\n * committed state, so declining or applying the proposal releases nothing the session was not\n * already keeping.\n */\nexport interface Proposal {\n readonly outcome: 'proposed';\n readonly operations: readonly EngineOperation[];\n readonly candidate: EngineCandidate;\n readonly addedBlockers: readonly FormBlocker[];\n readonly delta: CandidateDelta;\n}\n\n/**\n * A user write the session staged instead of committing, which a host confirms or declines.\n *\n * A session holds one pending proposal: staging a newer one replaces the older, and the older is\n * no longer committable. `sequence` is the monotonic number that states which write is latest,\n * because two proposals derived from one basis are otherwise indistinguishable to a commit.\n */\nexport interface WriteProposal extends Proposal {\n /** The session's monotonic order: a larger sequence is the newer staged write. */\n readonly sequence: number;\n /**\n * The binding the write named, so a host can say which control it came from.\n *\n * A control writes one binding; a change set that names several reports the first user write,\n * read from the user-origin field operations alone. A session-input operation (`context`,\n * `env`, `access`) names no binding and never becomes the reported one.\n */\n readonly binding: FieldRef;\n}\n\n/**\n * The value-free projection of the pending proposal a form summary states.\n *\n * The summary says that a confirmation waits and which binding it edits; it carries no operation,\n * candidate or report, so a typed value cannot be reached through it and a report cannot go stale\n * behind it. The proposal to apply or discard is the one `onWriteProposed` delivered, or the one\n * `form.propose` returned.\n */\nexport interface PendingProposalSummary {\n /** The session's monotonic order of the staged write that waits. */\n readonly sequence: number;\n /** The binding the staged write named, so a host can say which control it came from. */\n readonly binding: FieldRef;\n}\n\n/** The codes the store refuses a proposal with before it reaches the engine. */\nexport type ProposalRefusalCode = 'PROPOSAL_SUPERSEDED';\n\n/**\n * A proposal the store refused, stated in the same shape as a session refusal.\n *\n * The engine never sees this proposal: a session holds one pending proposal, and the caller\n * handed in one a newer staged write already replaced, or one whose confirmation the host\n * declined. The code is the store's own, so `STALE_BASIS` keeps meaning exactly what the engine\n * says it means.\n */\nexport interface ProposalRefusal {\n readonly outcome: 'refused';\n readonly code: ProposalRefusalCode;\n /** The sequence the caller's proposal carried, when it carried one. */\n readonly sequence?: number;\n /** The sequence of the proposal the store holds as pending, when it holds one. */\n readonly latest?: number;\n}\n\n/**\n * What one user write answered: the engine's outcome, and whether the session staged it.\n *\n * A staged write answers `queued` rather than `committed`, because the record has not taken it:\n * applying the proposal is the only thing that writes it. The flag is what keeps a staged write\n * from recording provenance, dirty and touched marks the user has not committed to.\n */\nexport interface UserWriteOutcome {\n readonly outcome: EngineOutcome;\n readonly staged: boolean;\n}\n\n/**\n * Whether a blocker offers a user an alternative that would clear it.\n *\n * Only the two arms authored with `suggests` can: a rule's alternatives and an unavailable\n * option's. The remaining arms are decided facts with a sentence, never a change set, so a\n * change set that adds one of them is reported in the delta and commits as any write does.\n */\nexport function offersAlternatives(blocker: FormBlocker): boolean {\n switch (blocker.kind) {\n case 'rule':\n case 'unavailableOption':\n return (blocker.suggestions?.length ?? 0) > 0;\n case 'required':\n case 'gate':\n case 'cardinality':\n case 'scale':\n case 'media':\n case 'rowCount':\n case 'invalidOption':\n case 'screen':\n return false;\n default:\n return assertNever(blocker);\n }\n}\n\n/**\n * The binding one user write edits, or `undefined` when no operation is a user's field write.\n *\n * A staged write is a control's edit, so it reports the first user-origin field binding. A\n * session-input operation (`context`, `env`, `access`) carries no binding and is skipped rather\n * than disqualifying the batch: a change set that drives the session beside a control's write is\n * still a write the user confirms, and its session input reaches the record only when the\n * proposal is applied.\n */\nexport function editedBinding(operations: readonly EngineOperation[]): FieldRef | undefined {\n let binding: FieldRef | undefined;\n for (const operation of operations) {\n switch (operation.kind) {\n case 'context':\n case 'env':\n case 'access':\n continue;\n case 'value':\n case 'null':\n case 'remove':\n if (operation.origin === 'user') binding ??= operation.ref;\n continue;\n case 'append':\n case 'insert':\n case 'removeRow':\n case 'move':\n if (operation.origin === 'user') binding ??= Object.freeze({ fieldId: operation.fieldId });\n continue;\n default:\n return assertNever(operation);\n }\n }\n return binding;\n}\n\n/**\n * Whether one operation moves rows or replaces a whole array, so a refusal about a row it\n * touched is stale.\n *\n * The kind test is exhaustive over the operation union: a new kind fails typecheck instead of\n * silently reading as a value write. The container replacement is a value write to the array\n * itself, which `isArrayContainer` answers from the declaration.\n */\nexport function isStructuralOperation(\n operation: EngineOperation,\n isArrayContainer: (fieldId: string) => boolean,\n): boolean {\n switch (operation.kind) {\n case 'append':\n case 'insert':\n case 'removeRow':\n case 'move':\n return true;\n case 'value':\n case 'null':\n case 'remove':\n return operation.ref.rowKey === undefined && isArrayContainer(operation.ref.fieldId);\n case 'context':\n case 'env':\n case 'access':\n return false;\n default:\n return assertNever(operation);\n }\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { FieldRef } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* What one publish delivered, and what the pass behind it evaluated.
|
|
4
|
+
*
|
|
5
|
+
* The binding keys are the ones this publish actually notified; the evaluation counts are
|
|
6
|
+
* copied from the engine's own last-pass trace rather than counted here, so a test that reads
|
|
7
|
+
* this seam cannot be satisfied by a store-side counter that disagrees with the pass.
|
|
8
|
+
*/
|
|
9
|
+
export interface PublishTrace {
|
|
10
|
+
readonly bindings: readonly string[];
|
|
11
|
+
/** The array fields whose structure or mutation permissions this publish delivered. */
|
|
12
|
+
readonly arrays: readonly string[];
|
|
13
|
+
readonly ruleEvaluations: Readonly<Record<string, number>>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The form session's field subscriptions. Every listener is registered against one binding and
|
|
17
|
+
* released by the function `subscribe` returns; the release is idempotent, and an empty set is
|
|
18
|
+
* dropped with its key so a form that mounts and unmounts controls keeps no dead entry.
|
|
19
|
+
*/
|
|
20
|
+
export declare class FieldSubscriptions {
|
|
21
|
+
private readonly registrations;
|
|
22
|
+
/** Registers `listener` for one binding; the returned release is idempotent. */
|
|
23
|
+
subscribe(ref: FieldRef, listener: () => void): () => void;
|
|
24
|
+
/** How many listeners one binding currently has, so a leak can be counted rather than assumed. */
|
|
25
|
+
count(ref: FieldRef): number;
|
|
26
|
+
/**
|
|
27
|
+
* Tells every subscribed binding the predicate says changed, and names them.
|
|
28
|
+
*
|
|
29
|
+
* Every listener is collected before any runs, because a listener may release itself — or a
|
|
30
|
+
* sibling's subscription — while being notified.
|
|
31
|
+
*/
|
|
32
|
+
publish(hasChanged: (key: string, ref: FieldRef) => boolean): readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The array-structure channel: one subscriber set per array field, notified only when that
|
|
36
|
+
* container's ordered identity or mutation permissions changed.
|
|
37
|
+
*
|
|
38
|
+
* The field channel cannot serve this: the container's own value changes on every row edit, so
|
|
39
|
+
* a list subscribed there would re-render each row on every keystroke. Rows subscribe to their
|
|
40
|
+
* own binding through `useField`; the list subscribes here.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ArraySubscriptions {
|
|
43
|
+
private readonly listeners;
|
|
44
|
+
subscribe(fieldId: string, listener: () => void): () => void;
|
|
45
|
+
/** Notifies every array whose view changed, naming the fields this publish delivered. */
|
|
46
|
+
publish(hasChanged: (fieldId: string) => boolean): readonly string[];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/store/publish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,uFAAuF;IACvF,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5D;AAOD;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmC;IAEjE,gFAAgF;IAChF,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAgBzD;IAED,kGAAkG;IAClG,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAE3B;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,KAAK,OAAO,GAAG,SAAS,MAAM,EAAE,CAU9E;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAEhE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAa3D;IAED,yFAAyF;IACzF,OAAO,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,MAAM,EAAE,CAUnE;CACF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { bindingKey } from './bindings.js';
|
|
2
|
+
/**
|
|
3
|
+
* The form session's field subscriptions. Every listener is registered against one binding and
|
|
4
|
+
* released by the function `subscribe` returns; the release is idempotent, and an empty set is
|
|
5
|
+
* dropped with its key so a form that mounts and unmounts controls keeps no dead entry.
|
|
6
|
+
*/
|
|
7
|
+
export class FieldSubscriptions {
|
|
8
|
+
registrations = new Map();
|
|
9
|
+
/** Registers `listener` for one binding; the returned release is idempotent. */
|
|
10
|
+
subscribe(ref, listener) {
|
|
11
|
+
const key = bindingKey(ref.fieldId, ref.rowKey);
|
|
12
|
+
let registration = this.registrations.get(key);
|
|
13
|
+
if (registration === undefined) {
|
|
14
|
+
registration = { ref, listeners: new Set() };
|
|
15
|
+
this.registrations.set(key, registration);
|
|
16
|
+
}
|
|
17
|
+
registration.listeners.add(listener);
|
|
18
|
+
return () => {
|
|
19
|
+
const current = this.registrations.get(key);
|
|
20
|
+
if (current === undefined)
|
|
21
|
+
return;
|
|
22
|
+
current.listeners.delete(listener);
|
|
23
|
+
// The map is keyed by binding, so an empty set has to go with it: a form that mounts
|
|
24
|
+
// and unmounts controls would otherwise keep one dead entry per binding, forever.
|
|
25
|
+
if (current.listeners.size === 0)
|
|
26
|
+
this.registrations.delete(key);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** How many listeners one binding currently has, so a leak can be counted rather than assumed. */
|
|
30
|
+
count(ref) {
|
|
31
|
+
return this.registrations.get(bindingKey(ref.fieldId, ref.rowKey))?.listeners.size ?? 0;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Tells every subscribed binding the predicate says changed, and names them.
|
|
35
|
+
*
|
|
36
|
+
* Every listener is collected before any runs, because a listener may release itself — or a
|
|
37
|
+
* sibling's subscription — while being notified.
|
|
38
|
+
*/
|
|
39
|
+
publish(hasChanged) {
|
|
40
|
+
const pending = [];
|
|
41
|
+
const notified = [];
|
|
42
|
+
for (const [key, registration] of this.registrations) {
|
|
43
|
+
if (!hasChanged(key, registration.ref))
|
|
44
|
+
continue;
|
|
45
|
+
notified.push(key);
|
|
46
|
+
for (const listener of registration.listeners)
|
|
47
|
+
pending.push(listener);
|
|
48
|
+
}
|
|
49
|
+
for (const listener of pending)
|
|
50
|
+
listener();
|
|
51
|
+
return notified;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The array-structure channel: one subscriber set per array field, notified only when that
|
|
56
|
+
* container's ordered identity or mutation permissions changed.
|
|
57
|
+
*
|
|
58
|
+
* The field channel cannot serve this: the container's own value changes on every row edit, so
|
|
59
|
+
* a list subscribed there would re-render each row on every keystroke. Rows subscribe to their
|
|
60
|
+
* own binding through `useField`; the list subscribes here.
|
|
61
|
+
*/
|
|
62
|
+
export class ArraySubscriptions {
|
|
63
|
+
listeners = new Map();
|
|
64
|
+
subscribe(fieldId, listener) {
|
|
65
|
+
let set = this.listeners.get(fieldId);
|
|
66
|
+
if (set === undefined) {
|
|
67
|
+
set = new Set();
|
|
68
|
+
this.listeners.set(fieldId, set);
|
|
69
|
+
}
|
|
70
|
+
set.add(listener);
|
|
71
|
+
return () => {
|
|
72
|
+
const current = this.listeners.get(fieldId);
|
|
73
|
+
if (current === undefined)
|
|
74
|
+
return;
|
|
75
|
+
current.delete(listener);
|
|
76
|
+
if (current.size === 0)
|
|
77
|
+
this.listeners.delete(fieldId);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Notifies every array whose view changed, naming the fields this publish delivered. */
|
|
81
|
+
publish(hasChanged) {
|
|
82
|
+
const pending = [];
|
|
83
|
+
const notified = [];
|
|
84
|
+
for (const [fieldId, set] of this.listeners) {
|
|
85
|
+
if (!hasChanged(fieldId))
|
|
86
|
+
continue;
|
|
87
|
+
notified.push(fieldId);
|
|
88
|
+
for (const listener of set)
|
|
89
|
+
pending.push(listener);
|
|
90
|
+
}
|
|
91
|
+
for (const listener of pending)
|
|
92
|
+
listener();
|
|
93
|
+
return notified;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/store/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqB3C;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACZ,aAAa,GAAG,IAAI,GAAG,EAAwB,CAAC;IAEjE,gFAAgF;IAChF,SAAS,CAAC,GAAa,EAAE,QAAoB;QAC3C,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,YAAY,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;YAC7C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC;QACD,YAAY,CAAC,SAAS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c/axiom-runtime';\nimport { bindingKey } from './bindings.js';\n\n/**\n * What one publish delivered, and what the pass behind it evaluated.\n *\n * The binding keys are the ones this publish actually notified; the evaluation counts are\n * copied from the engine's own last-pass trace rather than counted here, so a test that reads\n * this seam cannot be satisfied by a store-side counter that disagrees with the pass.\n */\nexport interface PublishTrace {\n readonly bindings: readonly string[];\n /** The array fields whose structure or mutation permissions this publish delivered. */\n readonly arrays: readonly string[];\n readonly ruleEvaluations: Readonly<Record<string, number>>;\n}\n\ninterface Registration {\n readonly ref: FieldRef;\n readonly listeners: Set<() => void>;\n}\n\n/**\n * The form session's field subscriptions. Every listener is registered against one binding and\n * released by the function `subscribe` returns; the release is idempotent, and an empty set is\n * dropped with its key so a form that mounts and unmounts controls keeps no dead entry.\n */\nexport class FieldSubscriptions {\n private readonly registrations = new Map<string, Registration>();\n\n /** Registers `listener` for one binding; the returned release is idempotent. */\n subscribe(ref: FieldRef, listener: () => void): () => void {\n const key = bindingKey(ref.fieldId, ref.rowKey);\n let registration = this.registrations.get(key);\n if (registration === undefined) {\n registration = { ref, listeners: new Set() };\n this.registrations.set(key, registration);\n }\n registration.listeners.add(listener);\n return (): void => {\n const current = this.registrations.get(key);\n if (current === undefined) return;\n current.listeners.delete(listener);\n // The map is keyed by binding, so an empty set has to go with it: a form that mounts\n // and unmounts controls would otherwise keep one dead entry per binding, forever.\n if (current.listeners.size === 0) this.registrations.delete(key);\n };\n }\n\n /** How many listeners one binding currently has, so a leak can be counted rather than assumed. */\n count(ref: FieldRef): number {\n return this.registrations.get(bindingKey(ref.fieldId, ref.rowKey))?.listeners.size ?? 0;\n }\n\n /**\n * Tells every subscribed binding the predicate says changed, and names them.\n *\n * Every listener is collected before any runs, because a listener may release itself — or a\n * sibling's subscription — while being notified.\n */\n publish(hasChanged: (key: string, ref: FieldRef) => boolean): readonly string[] {\n const pending: (() => void)[] = [];\n const notified: string[] = [];\n for (const [key, registration] of this.registrations) {\n if (!hasChanged(key, registration.ref)) continue;\n notified.push(key);\n for (const listener of registration.listeners) pending.push(listener);\n }\n for (const listener of pending) listener();\n return notified;\n }\n}\n\n/**\n * The array-structure channel: one subscriber set per array field, notified only when that\n * container's ordered identity or mutation permissions changed.\n *\n * The field channel cannot serve this: the container's own value changes on every row edit, so\n * a list subscribed there would re-render each row on every keystroke. Rows subscribe to their\n * own binding through `useField`; the list subscribes here.\n */\nexport class ArraySubscriptions {\n private readonly listeners = new Map<string, Set<() => void>>();\n\n subscribe(fieldId: string, listener: () => void): () => void {\n let set = this.listeners.get(fieldId);\n if (set === undefined) {\n set = new Set();\n this.listeners.set(fieldId, set);\n }\n set.add(listener);\n return (): void => {\n const current = this.listeners.get(fieldId);\n if (current === undefined) return;\n current.delete(listener);\n if (current.size === 0) this.listeners.delete(fieldId);\n };\n }\n\n /** Notifies every array whose view changed, naming the fields this publish delivered. */\n publish(hasChanged: (fieldId: string) => boolean): readonly string[] {\n const pending: (() => void)[] = [];\n const notified: string[] = [];\n for (const [fieldId, set] of this.listeners) {\n if (!hasChanged(fieldId)) continue;\n notified.push(fieldId);\n for (const listener of set) pending.push(listener);\n }\n for (const listener of pending) listener();\n return notified;\n }\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { EngineFieldState, ValueState } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { FieldProps } from '../field-props.js';
|
|
3
|
+
import type { BindingView, DeriveContext, DisplayOptions } from './derive.js';
|
|
4
|
+
import type { BindingVisibility } from './visibility.js';
|
|
5
|
+
/**
|
|
6
|
+
* The per-binding `FieldProps` cache.
|
|
7
|
+
*
|
|
8
|
+
* It holds no facts of its own: the engine's per-binding state is the record, and this adds the
|
|
9
|
+
* session view and the host's display rules to it. An entry is replaced only when the engine's
|
|
10
|
+
* state object, the view or the display options change, and then only if the derivation states
|
|
11
|
+
* something different — which is what keeps a candidate session's fresh state objects from
|
|
12
|
+
* re-rendering every control after an access change.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FieldSnapshots {
|
|
15
|
+
private readonly committed;
|
|
16
|
+
private candidate;
|
|
17
|
+
private signatures;
|
|
18
|
+
/** The props of one binding, derived only when one of its three inputs changed. */
|
|
19
|
+
read(owner: object, committed: boolean, key: string, state: EngineFieldState, view: BindingView, display: DisplayOptions, visibility: BindingVisibility, describe: () => Omit<DeriveContext, 'state' | 'view' | 'display' | 'visibility' | 'signature'>): FieldProps;
|
|
20
|
+
/** Adopts the candidate entries a commit rendered; unread bindings keep their committed entry. */
|
|
21
|
+
commit(owner: object): void;
|
|
22
|
+
/** The props committed state last read, or `undefined` before its first read. */
|
|
23
|
+
current(key: string): FieldProps | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Drops one binding's entry. A row the record no longer addresses is not re-read, and the
|
|
26
|
+
* props it cached hold its value; a row that returns re-derives a fresh object.
|
|
27
|
+
*/
|
|
28
|
+
retire(key: string): void;
|
|
29
|
+
/** How many entries the committed cache retains, so a churned list can be counted. */
|
|
30
|
+
retained(): number;
|
|
31
|
+
/** Drops every entry, including one a render that will never commit left behind. */
|
|
32
|
+
clear(): void;
|
|
33
|
+
private candidateValues;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The per-binding value-only cache `useWatch` reads.
|
|
37
|
+
*
|
|
38
|
+
* A watched value changes identity only when the value itself changes: a pass that moves a
|
|
39
|
+
* message or a sibling's fact re-derives the binding's state object, so the value is compared
|
|
40
|
+
* and the previous object returned. That is what makes a message-only change render nothing.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ValueSnapshots {
|
|
43
|
+
private readonly committed;
|
|
44
|
+
private candidate;
|
|
45
|
+
read(owner: object, committed: boolean, key: string, next: ValueState): ValueState;
|
|
46
|
+
/** Keeps the value identities a committed render read, without adopting an aborted one. */
|
|
47
|
+
commit(owner: object): void;
|
|
48
|
+
/** Drops one binding's value identity; a binding that returns re-derives it. */
|
|
49
|
+
retire(key: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Gives a value-only subscriber a new snapshot without changing the value it states.
|
|
52
|
+
*
|
|
53
|
+
* Declining a write is a repaint, not a record change. Cloning both live wrappers preserves
|
|
54
|
+
* their tagged value while letting `useSyncExternalStore` observe the deliberate repaint.
|
|
55
|
+
*/
|
|
56
|
+
repaint(key: string): void;
|
|
57
|
+
/** How many entries the committed cache retains, so a churned list can be counted. */
|
|
58
|
+
retained(): number;
|
|
59
|
+
/** Drops every entry, including one a render that will never commit left behind. */
|
|
60
|
+
clear(): void;
|
|
61
|
+
private candidateValues;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=snapshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/store/snapshots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAUzD;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IACzD,OAAO,CAAC,SAAS,CAAiF;IAClG,OAAO,CAAC,UAAU,CAAK;IAEvB,mFAAmF;IACnF,IAAI,CACF,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC,GAC7F,UAAU,CA8BZ;IAED,kGAAkG;IAClG,MA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