brumate 0.3.0 → 0.4.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/README.md +2 -2
- package/check.d.ts +49 -0
- package/dist/{boot-C25Sa6vq.d.ts → boot-DLlRmD9z.d.ts} +8 -10
- package/dist/cli.js +275 -15
- package/dist/cli.js.map +1 -1
- package/dist/client-BvDsC6Qr.js +3463 -0
- package/dist/client-BvDsC6Qr.js.map +1 -0
- package/dist/{client-D0CqSxoO.d.ts → client-DBwL2wKQ.d.ts} +390 -181
- package/dist/{client-routes-JTbGtukf.js → client-routes-BtGpYCef.js} +60 -30
- package/dist/client-routes-BtGpYCef.js.map +1 -0
- package/dist/{cookies-BzllthiF.js → cookies-Cnbf4w-S.js} +14 -7
- package/dist/cookies-Cnbf4w-S.js.map +1 -0
- package/dist/{defer-BbD7JQhj.js → defer-CKWZLv2K.js} +4 -4
- package/dist/defer-CKWZLv2K.js.map +1 -0
- package/dist/{devtools-CQgD7NPB.js → devtools-4uTPwR_v.js} +56 -82
- package/dist/devtools-4uTPwR_v.js.map +1 -0
- package/dist/{devtools-panel-BVB-W5q4.js → devtools-panel-Be9pxYgv.js} +397 -333
- package/dist/devtools-panel-Be9pxYgv.js.map +1 -0
- package/dist/{events-CSs7OwIC.js → events-LgLdp1R7.js} +34 -5
- package/dist/events-LgLdp1R7.js.map +1 -0
- package/dist/features-CHY5Ekku.js +30 -0
- package/dist/features-CHY5Ekku.js.map +1 -0
- package/dist/files-WW4RlajL.js +506 -0
- package/dist/files-WW4RlajL.js.map +1 -0
- package/dist/{forms-Cl21hkHt.d.ts → forms-j1xPAR14.d.ts} +3 -3
- package/dist/{forms-Bg-CwGqX.js → forms-nXK7-Lv_.js} +78 -44
- package/dist/forms-nXK7-Lv_.js.map +1 -0
- package/dist/highlight.js +31 -22
- package/dist/highlight.js.map +1 -1
- package/dist/{html-mNTKzaDD.js → html-BtKRyi7g.js} +86 -22
- package/dist/html-BtKRyi7g.js.map +1 -0
- package/dist/{html-Bq1rFxX_.d.ts → html-Bw9Qwu6F.d.ts} +20 -5
- package/dist/index.d.ts +96 -10
- package/dist/index.js +639 -104
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BHpOw1LF.js → inspect-Y6y4uNZp.js} +3751 -676
- package/dist/inspect-Y6y4uNZp.js.map +1 -0
- package/dist/{loader-Dos_3NP0.js → loader-BjKGJzLN.js} +20 -14
- package/dist/loader-BjKGJzLN.js.map +1 -0
- package/dist/logo-DQ_OYhBi.js +10 -0
- package/dist/logo-DQ_OYhBi.js.map +1 -0
- package/dist/{navigate-O78d_zGN.js → navigate-CfOr-TRF.js} +94 -31
- package/dist/navigate-CfOr-TRF.js.map +1 -0
- package/dist/nesting-DA5vJw9X.js +265 -0
- package/dist/nesting-DA5vJw9X.js.map +1 -0
- package/dist/{produce-Doc91GkX.js → produce-B7X9ori9.js} +137 -9
- package/dist/produce-B7X9ori9.js.map +1 -0
- package/dist/{produce-D0V0ICkz.d.ts → produce-DIgHBVwL.d.ts} +39 -5
- package/dist/{rpc-ygMRPmN4.js → rpc-Q-XkLwFh.js} +11 -6
- package/dist/rpc-Q-XkLwFh.js.map +1 -0
- package/dist/runtime/batch.js +9 -7
- package/dist/runtime/batch.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -4
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/devtools.d.ts +11 -29
- package/dist/runtime/devtools.js +3 -1
- package/dist/runtime/env.js +14 -2
- package/dist/runtime/env.js.map +1 -1
- package/dist/runtime/events.d.ts +23 -1
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/forms.d.ts +2 -2
- package/dist/runtime/forms.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/hot.js +5 -2
- package/dist/runtime/hot.js.map +1 -1
- package/dist/runtime/html.d.ts +2 -2
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/routes.js +4 -1
- package/dist/runtime/routes.js.map +1 -1
- package/dist/runtime/server.d.ts +5 -5
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +38 -1
- package/dist/runtime/signals.js +33 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +18 -3
- package/dist/runtime/testing.js +150 -33
- package/dist/runtime/testing.js.map +1 -1
- package/dist/{server-DuFYRXrd.d.ts → server-BvPIg9pT.d.ts} +84 -22
- package/dist/{server-CxVDYE_V.js → server-DjyOVJtJ.js} +598 -164
- package/dist/server-DjyOVJtJ.js.map +1 -0
- package/dist/{static-loader-Drpr0AzI.d.ts → static-loader-BGgdp_Y5.d.ts} +2 -2
- package/dist/{static-loader-nZssh66R.js → static-loader-BZR17hSw.js} +78 -99
- package/dist/static-loader-BZR17hSw.js.map +1 -0
- package/dist/{stream-DCYZO4IF.js → stream-BP5AVmg5.js} +102 -16
- package/dist/stream-BP5AVmg5.js.map +1 -0
- package/dist/vite.d.ts +13 -20
- package/dist/vite.js +1890 -548
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +951 -0
- package/forms/forms.brm.ts +3 -3
- package/package.json +12 -3
- package/skills/brumate/SKILL.md +58 -0
- package/skills/brumate/references/errors.md +2078 -0
- package/skills/brumate/references/events.md +117 -0
- package/skills/brumate/references/signals.md +61 -0
- package/skills/brumate/references/state.md +235 -0
- package/skills/brumate/references/syntax.md +250 -0
- package/types.d.ts +4 -4
- package/dist/client-BD6XT-s5.js +0 -1968
- package/dist/client-BD6XT-s5.js.map +0 -1
- package/dist/client-routes-JTbGtukf.js.map +0 -1
- package/dist/cookies-BzllthiF.js.map +0 -1
- package/dist/defer-BbD7JQhj.js.map +0 -1
- package/dist/devtools-CQgD7NPB.js.map +0 -1
- package/dist/devtools-panel-BVB-W5q4.js.map +0 -1
- package/dist/events-CSs7OwIC.js.map +0 -1
- package/dist/files-BXSSrQgc.js +0 -205
- package/dist/files-BXSSrQgc.js.map +0 -1
- package/dist/forms-Bg-CwGqX.js.map +0 -1
- package/dist/html-mNTKzaDD.js.map +0 -1
- package/dist/inspect-BHpOw1LF.js.map +0 -1
- package/dist/loader-Dos_3NP0.js.map +0 -1
- package/dist/navigate-O78d_zGN.js.map +0 -1
- package/dist/produce-Doc91GkX.js.map +0 -1
- package/dist/rpc-ygMRPmN4.js.map +0 -1
- package/dist/server-CxVDYE_V.js.map +0 -1
- package/dist/static-loader-nZssh66R.js.map +0 -1
- package/dist/stream-DCYZO4IF.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-BtKRyi7g.js","names":[],"sources":["../src/runtime/html.ts"],"sourcesContent":["// HTML string helpers that the server and the client both use.\n\nconst RAW: unique symbol = Symbol.for('brumate.raw');\n\n/** HTML that is inserted as it is, such as the output of a template. */\nexport interface Raw {\n [RAW]: string;\n}\n\n// A class, not an object literal, so serializers can skip their test for raw HTML on plain objects.\nclass RawHTML implements Raw {\n readonly [RAW]: string;\n\n constructor(html: string) {\n this[RAW] = html;\n }\n}\n\nexport function raw(html: string): Raw {\n return new RawHTML(html);\n}\n\nexport function isRaw(value: unknown): value is Raw {\n return typeof value === 'object' && value !== null && RAW in value;\n}\n\nexport function rawHTML(value: Raw): string {\n return value[RAW];\n}\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"' };\n\nfunction toEscape(char: string): string {\n return ESCAPES[char]!;\n}\n\n// Most text has nothing to escape, so a test without the global flag skips the replace.\nexport function escape(value: string): string {\n return /[&<>]/.test(value) ? value.replace(/[&<>]/g, toEscape) : value;\n}\n\nexport function escapeAttribute(value: string): string {\n return /[&<\"]/.test(value) ? value.replace(/[&<\"]/g, toEscape) : value;\n}\n\n/** True for a promise, or any object with a `then` function, as the server awaits it. */\nfunction isThenable(value: unknown): boolean {\n return (\n value !== null &&\n (typeof value === 'object' || typeof value === 'function') &&\n typeof (value as PromiseLike<unknown>).then === 'function'\n );\n}\n\n/** Renders a value inserted in markup. A promise is not awaited: it renders empty. */\nexport function insertValue(value: unknown): string {\n if (isRaw(value)) {\n return value[RAW];\n }\n // A memo of a promise that is still loading: empty until its value lands.\n if (value === null || value === undefined || typeof value === 'boolean' || isThenable(value)) {\n return '';\n }\n if (Array.isArray(value)) {\n let result = '';\n for (const item of value) {\n result += insertValue(item);\n }\n return result;\n }\n return escape(String(value));\n}\n\n/**\n * Renders a value as the text of an element whose content is text, such as\n * a `<textarea>`, as `insertValue` does but without escaping.\n */\nexport function textValue(value: unknown): string {\n if (isRaw(value)) {\n return value[RAW];\n }\n if (value === null || value === undefined || typeof value === 'boolean' || isThenable(value)) {\n return '';\n }\n if (Array.isArray(value)) {\n let result = '';\n for (const item of value) {\n result += textValue(item);\n }\n return result;\n }\n return String(value);\n}\n\nfunction toKebabCase(name: string): string {\n return name.startsWith('--') ? name : name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n}\n\nexport function classValue(value: unknown): string {\n if (typeof value !== 'object' || value === null) {\n return value ? String(value) : '';\n }\n let text = '';\n if (Array.isArray(value)) {\n for (const item of value) {\n const part = classValue(item);\n if (part !== '') {\n text = text === '' ? part : `${text} ${part}`;\n }\n }\n return text;\n }\n // An empty name still adds a space between its neighbours, as in a join.\n let first = true;\n for (const name in value) {\n if (Object.hasOwn(value, name) && (value as Record<string, unknown>)[name]) {\n text = first ? name : `${text} ${name}`;\n first = false;\n }\n }\n return text;\n}\n\n/**\n * Renders a `class` attribute from classes that each have a space before\n * them, which the compiler builds from a literal class value. The classes\n * are escaped already. No class renders nothing.\n */\nexport function classAttribute(classes: string): string {\n return classes === '' ? '' : ` class=\"${classes.slice(1)}\"`;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === 'object' && value !== null) {\n const declarations: string[] = [];\n for (const [name, item] of Object.entries(value)) {\n if (item !== null && item !== undefined && item !== false) {\n declarations.push(`${toKebabCase(name)}:${String(item)}`);\n }\n }\n return declarations.join(';');\n }\n return String(value);\n}\n\n/** The brand of a binding of `$bind`, under the key of the registry. See `Binding`. */\nconst BOUND = Symbol.for('brumate.binding');\n\n/** The words of an attribute that says `true` or `false` in its value. */\nconst TRUE_FALSE = ['true', 'false'] as const;\n\n/**\n * Attributes whose two states are words in the value, not whether the\n * attribute is there, by their words for `true` and `false`. A missing\n * attribute means a third state, such as the default of the element, so\n * `false` must not remove it. `aria-*` and `data-*` are such attributes too.\n */\nconst SWITCHES = new Map<string, readonly [string, string]>([\n ['contenteditable', TRUE_FALSE],\n ['draggable', TRUE_FALSE],\n ['spellcheck', TRUE_FALSE],\n ['writingsuggestions', TRUE_FALSE],\n // SVG.\n ['focusable', TRUE_FALSE],\n ['translate', ['yes', 'no']],\n ['autocomplete', ['on', 'off']],\n ['autocorrect', ['on', 'off']],\n]);\n\n/** The words of `true` and `false` for an attribute that says them in its value, or undefined. */\nfunction switchWords(name: string): readonly [string, string] | undefined {\n const lower = name.toLowerCase();\n if (lower.startsWith('aria-') || lower.startsWith('data-')) {\n return TRUE_FALSE;\n }\n return SWITCHES.get(lower);\n}\n\n/**\n * Returns the text of an attribute, or undefined if the attribute is not\n * rendered.\n *\n * - `null` and `undefined` leave the attribute out.\n * - For an attribute whose value says its state, such as `aria-expanded`,\n * `draggable` or `translate`, `true` and `false` render as its words:\n * `\"true\"` and `\"false\"`, or `\"yes\"` and `\"no\"`, or `\"on\"` and `\"off\"`.\n * - For other attributes, such as `disabled`, `true` renders the attribute\n * without a value, and `false` leaves it out.\n */\nexport function attributeText(name: string, value: unknown): string | undefined {\n // `value=$bind(name)` on an element renders the value of the name.\n if (typeof value === 'object' && value !== null && BOUND in value) {\n // A `ref` is no attribute: the element goes to its signal.\n if (name === 'ref') {\n return undefined;\n }\n value = (value as unknown as { value: unknown }).value;\n }\n // A promise is a memo that is still loading: the attribute is absent until its value lands.\n if (value === null || value === undefined || typeof value === 'function' || isThenable(value)) {\n return undefined;\n }\n if (typeof value === 'boolean') {\n const words = switchWords(name);\n if (words) {\n return value ? words[0] : words[1];\n }\n return value ? '' : undefined;\n }\n if (name === 'class') {\n const text = classValue(value);\n return text === '' ? undefined : text;\n }\n return name === 'style' ? styleValue(value) : String(value);\n}\n\n/**\n * A name that HTML reads as one attribute. A spread takes its names from\n * data, so a name with a space, a quote, `>`, `/` or `=` could write other\n * attributes or markup.\n */\n// oxlint-disable-next-line no-control-regex -- HTML reads no control character in a name.\nconst ATTRIBUTE_NAME = /^[^\\s\"'>/=\\x00-\\x1f\\x7f]+$/;\n\n/** Renders one attribute, with a leading space. A name that is not one attribute renders nothing. */\nexport function attribute(name: string, value: unknown): string {\n const text = attributeText(name, value);\n if (text === undefined || !ATTRIBUTE_NAME.test(name)) {\n return '';\n }\n return value === true && text === '' ? ` ${name}` : ` ${name}=\"${escapeAttribute(text)}\"`;\n}\n\n/**\n * Returns the value of a style variable with text around it, such as `12px`\n * for `${size}px`. A value that sets no variable stays as it is.\n */\nexport function affix(prefix: string, value: unknown, suffix: string): unknown {\n return value === null || value === undefined || value === false\n ? value\n : `${prefix}${String(value)}${suffix}`;\n}\n\n/** Returns a style with custom properties before an element's own style. */\nexport function vars(variables: Record<string, unknown>, own: unknown): string {\n const parts: string[] = [];\n for (const [name, value] of Object.entries(variables)) {\n if (value !== null && value !== undefined && value !== false) {\n parts.push(`${name}:${String(value)}`);\n }\n }\n const rest = own === null || own === undefined || own === false ? '' : styleValue(own);\n if (rest) {\n parts.push(rest);\n }\n return parts.join(';');\n}\n\n/** Returns a `<style>` element for a component's stylesheet. */\nexport function styleElement(id: string, css: string): string {\n return `<style b-style=\"${escapeAttribute(id)}\">${css.replace(/<\\/style/gi, '<\\\\/style')}</style>`;\n}\n\n/**\n * Merges the attributes of an element that has spreads, in their order: a\n * later value wins, except `class`, whose values all apply.\n */\n/**\n * A value of an attribute that brumate writes, such as the `b-on` of a dynamic tag, which the\n * compiler wraps. An object of attributes, such as a spread, writes a `b-` attribute only with\n * one, so data from outside the app cannot name handlers or scopes.\n */\nexport class Internal {\n readonly value: unknown;\n\n constructor(value: unknown) {\n this.value = value;\n }\n}\n\n/** Wraps the value of an attribute that brumate writes. See `Internal`. */\nexport function internal(value: unknown): Internal {\n return new Internal(value);\n}\n\n/** The value of an attribute of an object, or undefined for a `b-` attribute from outside. */\nexport function ownValue(name: string, value: unknown): unknown {\n if (value instanceof Internal) {\n return value.value;\n }\n return name.startsWith('b-') ? undefined : value;\n}\n\nexport function mergeAttributes(\n parts: Record<string, unknown>[],\n variables?: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const part of parts) {\n for (const [name, value] of Object.entries(part ?? {})) {\n // A `b-` attribute from outside the app does not take the place of brumate's own.\n if (name.startsWith('b-') && !(value instanceof Internal)) {\n continue;\n }\n result[name] =\n name === 'class' && result.class !== undefined && value !== undefined\n ? [result.class, value]\n : value;\n }\n }\n // The style variables of the component come before the style that won, whoever gave it.\n if (variables) {\n result.style = vars(variables, result.style);\n }\n return result;\n}\n\n/**\n * The `b-on` entry of a handler that a spread passes on, such as\n * `click:prevent=Parent#h1@3`: its event, the modifiers of its wrappers, its\n * client function and the scope it runs in. A handler that `$handler` made\n * has its arguments after another `@`, encoded so that they hold no space.\n */\nexport function handlerEntry(\n name: string,\n ref: string,\n scope: number | string,\n modifiers: readonly string[] = [],\n args?: unknown[],\n): string {\n const bound = args === undefined ? '' : `@${encodeURIComponent(JSON.stringify(args))}`;\n return `${[name.slice(2).toLowerCase(), ...modifiers].join(':')}=${ref}@${scope}${bound}`;\n}\n\n/**\n * The `b-on` entry of a binding that a spread puts on `value` or `checked`\n * of an element. It names the scope of the slot, or of the setter of\n * `$bind(name, fn)`, after `@`. A box writes on `change`.\n */\nexport function bindEntry(\n name: string,\n ref: { scope: number | string; slot: number },\n setter?: { ref: string; scope: number | string },\n): string {\n const event = name === 'checked' ? 'change' : 'input';\n return setter\n ? `${event}=$set:${setter.ref}@${setter.scope}`\n : `${event}=$bind#0.${ref.slot}@${ref.scope}`;\n}\n\n/**\n * The `b-on` attribute of an element with spreads: the bindings of its\n * spreads, so its handlers read the new value, then its own handlers, then\n * those of its spreads.\n */\nexport function onAttribute(on: string[], own: string): string {\n const value = onValue(on, own);\n return value ? ` b-on=\"${escapeAttribute(value)}\"` : '';\n}\n\n/** The value of `b-on`, in the order of `onAttribute`. */\nexport function onValue(on: string[], own: string): string {\n const bindings: string[] = [];\n const rest: string[] = [];\n for (const entry of on) {\n if (/=\\$(bind#|set:)/.test(entry)) {\n bindings.push(entry);\n } else {\n rest.push(entry);\n }\n }\n const parts: string[] = [];\n for (const part of [...bindings, own, ...rest]) {\n if (part) {\n parts.push(part);\n }\n }\n return parts.join(' ');\n}\n\n/** Renders an object of attributes. */\nexport function spread(attributes: Record<string, unknown>, names = false): string {\n let result = '';\n const written: string[] = [];\n for (const [name, value] of Object.entries(attributes)) {\n if (name !== 'children' && !/^on[A-Z]/.test(name)) {\n const text = attribute(name, ownValue(name, value));\n if (text) {\n result += text;\n written.push(name);\n }\n }\n }\n // `b-s` names the attributes of a spread that changes in the browser. Its first update there\n // removes only those, so a spread that wrote none still writes it, empty.\n return names ? `${result} b-s=\"${written.join(' ')}\"` : result;\n}\n\nexport const VOID_ELEMENTS: Set<string> = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'source',\n 'track',\n 'wbr',\n]);\n\n/**\n * Renders the attributes of a form that posts to a server function, such as\n * ` action=\"/_brumate/App_1abc%23save\" method=\"post\"`. `method` is the name of\n * the method attribute to add, if the element has none. `build` is the ID\n * of the build of the page, which the URL carries as `__build`, so the\n * server can tell a post from before a deploy without scripts.\n */\nexport function actionAttributes(\n prefix: string,\n name: string,\n id: string,\n method?: string,\n result?: string,\n build?: string,\n key?: string,\n): string {\n const methodText = method ? ` ${method}=\"post\"` : '';\n // The key of a form of a function that `idempotent` made, so a second post gets the first result.\n const params: string[] = [];\n if (build !== undefined) {\n params.push(`__build=${encodeURIComponent(build)}`);\n }\n if (key !== undefined) {\n params.push(`__key=${key}`);\n }\n const query = params.join('&');\n if (result !== undefined) {\n // The form posts to its page, which renders with the result. With the\n // loader, the result is written into the `$action` at `result` instead.\n const url = `?__action=${encodeURIComponent(id)}${query ? `&${query}` : ''}`;\n return ` ${name}=\"${escapeAttribute(url)}\"${methodText} b-action=\"${escapeAttribute(id)}\" b-result=\"${escapeAttribute(result)}\"`;\n }\n const url = `${prefix}/${encodeURIComponent(id)}${query ? `?${query}` : ''}`;\n return ` ${name}=\"${escapeAttribute(url)}\"${methodText}`;\n}\n"],"mappings":";AAEA,MAAM,MAAqB,OAAO,IAAI,aAAa;AAQnD,IAAM,UAAN,MAA6B;CAC3B,CAAU;CAEV,YAAY,MAAc;EACxB,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,IAAI,MAAmB;CACrC,OAAO,IAAI,QAAQ,IAAI;AACzB;AAEA,SAAgB,MAAM,OAA8B;CAClD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO;AAC/D;AAEA,SAAgB,QAAQ,OAAoB;CAC1C,OAAO,MAAM;AACf;AAEA,MAAM,UAAkC;CAAE,KAAK;CAAS,KAAK;CAAQ,KAAK;CAAQ,MAAK;AAAS;AAEhG,SAAS,SAAS,MAAsB;CACtC,OAAO,QAAQ;AACjB;AAGA,SAAgB,OAAO,OAAuB;CAC5C,OAAO,QAAQ,KAAK,KAAK,IAAI,MAAM,QAAQ,UAAU,QAAQ,IAAI;AACnE;AAEA,SAAgB,gBAAgB,OAAuB;CACrD,OAAO,QAAQ,KAAK,KAAK,IAAI,MAAM,QAAQ,UAAU,QAAQ,IAAI;AACnE;;AAGA,SAAS,WAAW,OAAyB;CAC3C,OACE,UAAU,SACT,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,OAAQ,MAA+B,SAAS;AAEpD;;AAGA,SAAgB,YAAY,OAAwB;CAClD,IAAI,MAAM,KAAK,GACb,OAAO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AW,aAAa,gBAAgB,EAAE,EAAE,cAAc,gBAAgB,MAAM,EAAE;CAGhI,OAAO,IAAI,KAAK,IAAI,gBAAgB,GADrB,OAAO,GAAG,mBAAmB,EAAE,IAAI,QAAQ,IAAI,UAAU,IACjC,EAAE,GAAG;AAC9C"}
|
|
@@ -9,7 +9,7 @@ declare function isRaw(value: unknown): value is Raw;
|
|
|
9
9
|
declare function rawHTML(value: Raw): string;
|
|
10
10
|
declare function escape(value: string): string;
|
|
11
11
|
declare function escapeAttribute(value: string): string;
|
|
12
|
-
/** Renders a value inserted in markup.
|
|
12
|
+
/** Renders a value inserted in markup. A promise is not awaited: it renders empty. */
|
|
13
13
|
declare function insertValue(value: unknown): string;
|
|
14
14
|
/**
|
|
15
15
|
* Renders a value as the text of an element whose content is text, such as
|
|
@@ -50,7 +50,20 @@ declare function styleElement(id: string, css: string): string;
|
|
|
50
50
|
* Merges the attributes of an element that has spreads, in their order: a
|
|
51
51
|
* later value wins, except `class`, whose values all apply.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* A value of an attribute that brumate writes, such as the `b-on` of a dynamic tag, which the
|
|
55
|
+
* compiler wraps. An object of attributes, such as a spread, writes a `b-` attribute only with
|
|
56
|
+
* one, so data from outside the app cannot name handlers or scopes.
|
|
57
|
+
*/
|
|
58
|
+
declare class Internal {
|
|
59
|
+
readonly value: unknown;
|
|
60
|
+
constructor(value: unknown);
|
|
61
|
+
}
|
|
62
|
+
/** Wraps the value of an attribute that brumate writes. See `Internal`. */
|
|
63
|
+
declare function internal(value: unknown): Internal;
|
|
64
|
+
/** The value of an attribute of an object, or undefined for a `b-` attribute from outside. */
|
|
65
|
+
declare function ownValue(name: string, value: unknown): unknown;
|
|
66
|
+
declare function mergeAttributes(parts: Record<string, unknown>[], variables?: Record<string, unknown>): Record<string, unknown>;
|
|
54
67
|
/**
|
|
55
68
|
* The `b-on` entry of a handler that a spread passes on, such as
|
|
56
69
|
* `click:prevent=Parent#h1@3`: its event, the modifiers of its wrappers, its
|
|
@@ -76,8 +89,10 @@ declare function bindEntry(name: string, ref: {
|
|
|
76
89
|
* those of its spreads.
|
|
77
90
|
*/
|
|
78
91
|
declare function onAttribute(on: string[], own: string): string;
|
|
92
|
+
/** The value of `b-on`, in the order of `onAttribute`. */
|
|
93
|
+
declare function onValue(on: string[], own: string): string;
|
|
79
94
|
/** Renders an object of attributes. */
|
|
80
|
-
declare function spread(attributes: Record<string, unknown
|
|
95
|
+
declare function spread(attributes: Record<string, unknown>, names?: boolean): string;
|
|
81
96
|
declare const VOID_ELEMENTS: Set<string>;
|
|
82
97
|
/**
|
|
83
98
|
* Renders the attributes of a form that posts to a server function, such as
|
|
@@ -88,5 +103,5 @@ declare const VOID_ELEMENTS: Set<string>;
|
|
|
88
103
|
*/
|
|
89
104
|
declare function actionAttributes(prefix: string, name: string, id: string, method?: string, result?: string, build?: string, key?: string): string;
|
|
90
105
|
//#endregion
|
|
91
|
-
export { vars as S,
|
|
92
|
-
//# sourceMappingURL=html-
|
|
106
|
+
export { spread as C, vars as E, rawHTML as S, textValue as T, mergeAttributes as _, affix as a, ownValue as b, bindEntry as c, escape as d, escapeAttribute as f, isRaw as g, internal as h, actionAttributes as i, classAttribute as l, insertValue as m, Raw as n, attribute as o, handlerEntry as p, VOID_ELEMENTS as r, attributeText as s, Internal as t, classValue as u, onAttribute as v, styleElement as w, raw as x, onValue as y };
|
|
107
|
+
//# sourceMappingURL=html-Bw9Qwu6F.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1399,7 +1399,6 @@ interface InsertNode extends Range {
|
|
|
1399
1399
|
expression: Expression;
|
|
1400
1400
|
}
|
|
1401
1401
|
type Modifier = "prevent" | "stop" | "passive" | "once" | "capture";
|
|
1402
|
-
type PrefetchStrategy = "hover" | "visible" | "idle" | "none";
|
|
1403
1402
|
interface StaticAttribute extends Range {
|
|
1404
1403
|
kind: "static";
|
|
1405
1404
|
name: string;
|
|
@@ -1421,15 +1420,11 @@ interface EventAttribute extends Range {
|
|
|
1421
1420
|
}
|
|
1422
1421
|
interface RefAttribute extends Range {
|
|
1423
1422
|
kind: "ref";
|
|
1424
|
-
/** The name
|
|
1423
|
+
/** The name in `ref=$bind(name)`: a signal, or a prop that the component writes. */
|
|
1425
1424
|
target: string;
|
|
1426
1425
|
/** The range of the name. */
|
|
1427
1426
|
targetRange: Range;
|
|
1428
1427
|
}
|
|
1429
|
-
interface PrefetchAttribute extends Range {
|
|
1430
|
-
kind: "prefetch";
|
|
1431
|
-
strategy: PrefetchStrategy;
|
|
1432
|
-
}
|
|
1433
1428
|
interface SpreadAttribute extends Range {
|
|
1434
1429
|
kind: "spread";
|
|
1435
1430
|
value: Expression;
|
|
@@ -1439,7 +1434,7 @@ interface ComputedAttribute extends Range {
|
|
|
1439
1434
|
name: Expression;
|
|
1440
1435
|
value: Expression | true;
|
|
1441
1436
|
}
|
|
1442
|
-
type Attribute = StaticAttribute | ValueAttribute | EventAttribute | RefAttribute |
|
|
1437
|
+
type Attribute = StaticAttribute | ValueAttribute | EventAttribute | RefAttribute | SpreadAttribute | ComputedAttribute;
|
|
1443
1438
|
interface Body extends Range {
|
|
1444
1439
|
script?: Script;
|
|
1445
1440
|
templates: TemplateDecl[];
|
|
@@ -1461,6 +1456,14 @@ interface ForBlock extends Range {
|
|
|
1461
1456
|
list: Expression;
|
|
1462
1457
|
/** `'index'` keys items by position. */
|
|
1463
1458
|
key?: Expression | "index";
|
|
1459
|
+
/**
|
|
1460
|
+
* `window(height, count)`: the browser renders only the items in view, which are about
|
|
1461
|
+
* `height` pixels tall, and the server renders the first `count`.
|
|
1462
|
+
*/
|
|
1463
|
+
window?: {
|
|
1464
|
+
height: Expression;
|
|
1465
|
+
count?: Expression;
|
|
1466
|
+
};
|
|
1464
1467
|
body: Body;
|
|
1465
1468
|
fallback?: Body;
|
|
1466
1469
|
}
|
|
@@ -1573,6 +1576,10 @@ interface Declaration {
|
|
|
1573
1576
|
* `const { user: { name } } = $props()`. Undefined for the props object.
|
|
1574
1577
|
*/
|
|
1575
1578
|
propKey?: string;
|
|
1579
|
+
/** True for a prop whose `$props<T>` type is written as `Promise<...>`, or a union with one. */
|
|
1580
|
+
promise?: boolean;
|
|
1581
|
+
/** True for the props object (`const props = $props()`) and the rest of `$props()`. */
|
|
1582
|
+
whole?: boolean;
|
|
1576
1583
|
/** For `const result = $action(fn)`, the name of the server function. */
|
|
1577
1584
|
action?: string;
|
|
1578
1585
|
/** True for a server function that a server function refreshes with `refresh(fn)`. */
|
|
@@ -1606,14 +1613,21 @@ interface Declaration {
|
|
|
1606
1613
|
writable?: boolean;
|
|
1607
1614
|
/** True for a signal or a writable prop that `$bind` passes to a child, which needs a slot. */
|
|
1608
1615
|
bound?: boolean;
|
|
1616
|
+
/**
|
|
1617
|
+
* The props of components that the binding passes the declaration to, and `value` or `checked`
|
|
1618
|
+
* of an input. A signal that only `ref` binds holds an element that the browser fills.
|
|
1619
|
+
*/
|
|
1620
|
+
boundAs?: Set<string>;
|
|
1609
1621
|
/** True for `const name = await $memo(value)`: the render waits for the memo where it is declared. */
|
|
1610
1622
|
awaited?: boolean;
|
|
1611
1623
|
/** For `const name = $id()`, the position of the call among the `$id` calls of its scope. */
|
|
1612
1624
|
idIndex?: number;
|
|
1625
|
+
/** For `const name = $isPassed(prop)`, the key of the prop. */
|
|
1626
|
+
passedKey?: string;
|
|
1613
1627
|
/** Elements whose `ref` targets this declaration. */
|
|
1614
1628
|
refs: {
|
|
1615
1629
|
attribute: RefAttribute;
|
|
1616
|
-
element: ElementNode;
|
|
1630
|
+
element: ElementNode | DynamicTagNode;
|
|
1617
1631
|
scope: Scope;
|
|
1618
1632
|
}[];
|
|
1619
1633
|
}
|
|
@@ -1661,6 +1675,8 @@ interface Site {
|
|
|
1661
1675
|
* the modifiers that `b-on` holds, such as `prevent(Enter)`.
|
|
1662
1676
|
*/
|
|
1663
1677
|
modifiers?: string[];
|
|
1678
|
+
/** True for the handler prop of a component, such as `onPick=(…)`, which the child calls. */
|
|
1679
|
+
handlerProp?: boolean;
|
|
1664
1680
|
/** The block whose header this site is. */
|
|
1665
1681
|
block?: Block;
|
|
1666
1682
|
/** The trigger of a `$client` site. */
|
|
@@ -1697,6 +1713,11 @@ interface SemanticModel {
|
|
|
1697
1713
|
setter?: Site;
|
|
1698
1714
|
}[];
|
|
1699
1715
|
diagnostics: Diagnostic[];
|
|
1716
|
+
/** The `$isPending(memo)` and `$resolve(memo)` calls, with the read of their memo. */
|
|
1717
|
+
pendingCalls: {
|
|
1718
|
+
reference: Reference;
|
|
1719
|
+
at: Range;
|
|
1720
|
+
}[];
|
|
1700
1721
|
}
|
|
1701
1722
|
/** Returns true if `scope` is `ancestor` or inside it. */
|
|
1702
1723
|
export declare function isWithin(scope: Scope, ancestor: Scope): boolean;
|
|
@@ -1712,6 +1733,28 @@ export declare function lookup(scope: Scope, name: string): Declaration | undefi
|
|
|
1712
1733
|
//#region src/analyze.d.ts
|
|
1713
1734
|
export declare function analyze(file: SFCFile): SemanticModel;
|
|
1714
1735
|
//#endregion
|
|
1736
|
+
//#region src/error-catalog.d.ts
|
|
1737
|
+
/** One compile error of a `.brm` file. */
|
|
1738
|
+
interface ErrorEntry {
|
|
1739
|
+
/** The message the compiler reports, with `{name}` for the parts that vary. */
|
|
1740
|
+
message: string;
|
|
1741
|
+
/** What causes it, in one sentence. */
|
|
1742
|
+
cause: string;
|
|
1743
|
+
/** The form to write instead, as a short `brm` example. */
|
|
1744
|
+
fix: string;
|
|
1745
|
+
/** A code such as BRM012. It never changes and is never reused. */
|
|
1746
|
+
code?: string;
|
|
1747
|
+
/** The docs page that explains the code. */
|
|
1748
|
+
link?: string;
|
|
1749
|
+
}
|
|
1750
|
+
/** The link to the explanation of a code. */
|
|
1751
|
+
export declare function errorLink(code: string): string;
|
|
1752
|
+
/**
|
|
1753
|
+
* The entry for a message that the compiler reported. The place of the
|
|
1754
|
+
* error, as in `(File.brm:3:7)`, can follow the message.
|
|
1755
|
+
*/
|
|
1756
|
+
export declare function findError(message: string): ErrorEntry | undefined;
|
|
1757
|
+
//#endregion
|
|
1715
1758
|
//#region src/graph.d.ts
|
|
1716
1759
|
type GraphNode = {
|
|
1717
1760
|
kind: "source";
|
|
@@ -1763,6 +1806,18 @@ interface ComponentUsage {
|
|
|
1763
1806
|
source: string;
|
|
1764
1807
|
/** The props whose values can change on the client. `*` means every prop. */
|
|
1765
1808
|
liveProps: Set<string>;
|
|
1809
|
+
/** True for a dynamic tag, which can name the component. Only a component that declares the prop takes it. */
|
|
1810
|
+
dynamic?: boolean;
|
|
1811
|
+
/**
|
|
1812
|
+
* The props whose value names `.brm` imports, such as `as=Target` or `as=(flag ? A : B)`: the
|
|
1813
|
+
* prop name and the import specifiers.
|
|
1814
|
+
*/
|
|
1815
|
+
components?: Map<string, string[]>;
|
|
1816
|
+
/**
|
|
1817
|
+
* The props whose value is a prop of this file, such as `{as}`: the prop name and the names of
|
|
1818
|
+
* this file's props. `*` means the whole props object.
|
|
1819
|
+
*/
|
|
1820
|
+
passed?: Map<string, string[]>;
|
|
1766
1821
|
}
|
|
1767
1822
|
/** Lists the components that a file renders, and the props it passes that can change. */
|
|
1768
1823
|
export declare function summarize(file: SFCFile, graph: Graph): ComponentUsage[];
|
|
@@ -1802,7 +1857,7 @@ export declare function printGraph(source: string, graph: Graph): string;
|
|
|
1802
1857
|
interface StyleOutput {
|
|
1803
1858
|
/** The scoped CSS of every `<style>` block, or an empty string. */
|
|
1804
1859
|
css: string;
|
|
1805
|
-
/** The attribute that marks the component's elements, such as `
|
|
1860
|
+
/** The attribute that marks the component's elements, such as `b-c-1abc`. */
|
|
1806
1861
|
attribute: string;
|
|
1807
1862
|
/**
|
|
1808
1863
|
* The custom property for each `${…}` interpolation, in source order. Text
|
|
@@ -1875,6 +1930,22 @@ interface Plan {
|
|
|
1875
1930
|
elementItems: Set<Block>;
|
|
1876
1931
|
/** The export name of each client root, such as `h3`. */
|
|
1877
1932
|
symbols: Map<Site, string>;
|
|
1933
|
+
/**
|
|
1934
|
+
* The children of each component and dynamic tag, which the browser renders each time the
|
|
1935
|
+
* component inserts them: the export of their render, such as `n0`, and their scope.
|
|
1936
|
+
*/
|
|
1937
|
+
childrenRenders: Map<ComponentNode | DynamicTagNode, {
|
|
1938
|
+
symbol: string;
|
|
1939
|
+
scope: Scope;
|
|
1940
|
+
}>;
|
|
1941
|
+
/**
|
|
1942
|
+
* The component whose children hold a block, for the blocks in children. The browser renders
|
|
1943
|
+
* the new bodies of such a block with the contexts of that component, as the server does.
|
|
1944
|
+
*/
|
|
1945
|
+
blockHolders: Map<Block, {
|
|
1946
|
+
node: ComponentNode;
|
|
1947
|
+
scope: Scope;
|
|
1948
|
+
}>;
|
|
1878
1949
|
/** Sites whose code runs on the client, including update code for live nodes. */
|
|
1879
1950
|
clientSites: Set<Site>;
|
|
1880
1951
|
/** The compiled `<style>` blocks. */
|
|
@@ -2037,6 +2108,16 @@ export declare class CompileError extends Error {
|
|
|
2037
2108
|
}
|
|
2038
2109
|
export declare function compile(source: string, options?: CompileOptions): CompileResult;
|
|
2039
2110
|
//#endregion
|
|
2111
|
+
//#region src/codegen/markup.d.ts
|
|
2112
|
+
/** The render functions that fill a nested block of a clone. */
|
|
2113
|
+
type Fill = {
|
|
2114
|
+
kind: "if";
|
|
2115
|
+
renders: string[];
|
|
2116
|
+
} | {
|
|
2117
|
+
kind: "for";
|
|
2118
|
+
render: string;
|
|
2119
|
+
};
|
|
2120
|
+
//#endregion
|
|
2040
2121
|
//#region src/shared-module.d.ts
|
|
2041
2122
|
/** The query of the shared module of a module of reactive logic. */
|
|
2042
2123
|
export declare const SHARED_QUERY = "?brumate-shared";
|
|
@@ -2093,6 +2174,11 @@ interface ClientOutput {
|
|
|
2093
2174
|
loaders: Record<string, string[]>;
|
|
2094
2175
|
/** False when nothing of the component runs in the browser. */
|
|
2095
2176
|
clientCode: boolean;
|
|
2177
|
+
/**
|
|
2178
|
+
* The render functions of the client entry that fill a nested `#if` or `#for` of a clone,
|
|
2179
|
+
* for the render module, which imports them.
|
|
2180
|
+
*/
|
|
2181
|
+
fillOf: (block: Block) => Fill | undefined;
|
|
2096
2182
|
diagnostics: Diagnostic[];
|
|
2097
2183
|
}
|
|
2098
2184
|
/**
|
|
@@ -2179,5 +2265,5 @@ export declare function inspect(source: string, options?: InspectOptions): {
|
|
|
2179
2265
|
text: string;
|
|
2180
2266
|
};
|
|
2181
2267
|
//#endregion
|
|
2182
|
-
export type { AnchorTarget, Attribute, Block, Body, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, DeferBlock, Diagnostic, DynamicTagNode, Edge, ElementNode, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, Modifier, OffscreenBlock, ParseOptions, Plan, PortalBlock,
|
|
2268
|
+
export type { AnchorTarget, Attribute, Block, Body, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, DeferBlock, Diagnostic, DynamicTagNode, Edge, ElementNode, ErrorEntry, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, Modifier, OffscreenBlock, ParseOptions, Plan, PortalBlock, ProjectProps, Range, ReactiveModule, RefAttribute, Reference, RepeatBlock, Resolve, ResolveModule, Reveal, RevealOrder, SFCFile, Scope, ScopeKind, ScopePlan, Script, SemanticModel, Severity, SharedSite, Site, SiteKind, SourceMap, SpreadAttribute, StaticAttribute, Style, SwitchBlock, TemplateDecl, TextNode, TryBlock, ValueAttribute, upstreamMemos };
|
|
2183
2269
|
//# sourceMappingURL=index.d.ts.map
|