From a06cc645899595f02c58c46a7859e02d7f212271 Mon Sep 17 00:00:00 2001 From: Marc Lorenz Date: Tue, 24 Mar 2026 11:10:36 +0100 Subject: [PATCH] add image to export adn fix gloabal for filemaker api --- package.json | 6 ++- src/index.ts | 1 - src/utils/filemaker.d.ts | 82 ---------------------------------------- src/utils/webviewer.ts | 15 ++++++++ vite.config.ts | 2 +- 5 files changed, 20 insertions(+), 86 deletions(-) delete mode 100644 src/utils/filemaker.d.ts diff --git a/package.json b/package.json index 66c5586..f7ac716 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dist", "font.css", "theme.css", - "fonts" + "fonts", + "assets" ], "main": "./dist/index.cjs", "module": "./dist/index.js", @@ -18,7 +19,8 @@ "require": "./dist/index.cjs" }, "./style.css": "./dist/index.css", - "./theme.css": "./theme.css" + "./theme.css": "./theme.css", + "./assets/*": "./assets/*" }, "peerDependencies": { "vue": "^3.0.0" diff --git a/src/index.ts b/src/index.ts index 5374fbe..ae144a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,2 @@ export { default as LimelightButton } from './components/LimelightButton.vue' export * from './utils/webviewer' -export type { FileMakerAPI } from './utils/filemaker' diff --git a/src/utils/filemaker.d.ts b/src/utils/filemaker.d.ts deleted file mode 100644 index 76400b1..0000000 --- a/src/utils/filemaker.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * TypeScript definitions for the FileMaker WebViewer JavaScript API - * - * These bindings cover the `FileMaker` global object injected into web viewers - * by Claris FileMaker Pro / WebDirect (FileMaker 19+). - * - * @see https://help.claris.com/en/pro-help/content/scripting-javascript-in-web-viewers.html - */ - -// --------------------------------------------------------------------------- -// Core FileMaker global namespace -// --------------------------------------------------------------------------- - -/** - * The `FileMaker` object is automatically injected into every web viewer's - * JavaScript context by the FileMaker runtime. It is **not** available in - * ordinary browsers. - * - * ### Important notes - * - All `PerformScript*` calls are **asynchronous** – FileMaker does not block - * JavaScript execution while the script runs. - * - The object is only available after the web page has **finished loading**. - * - The web viewer must have *"Allow JavaScript to perform FileMaker scripts"* - * enabled in its object settings. - * - In WebDirect the page source must use the `data:text/html,` MIME prefix - * (not `data:text/html; charset=UTF-8,`) for these calls to work. - */ -export interface FileMakerAPI { - /** - * Calls a FileMaker script by name. - * - * Runs asynchronously – JavaScript does not wait for the script to finish - * and no return value is provided back to JavaScript. - * - * @param script - Name of the FileMaker script to execute (not - * case-sensitive). - * @param parameter - Optional string parameter accessible inside the script - * via `Get(ScriptParameter)`. - * - * @example - * FileMaker.PerformScript("Save Record", JSON.stringify({ id: 42 })); - */ - PerformScript(script: string, parameter?: string): void - - /** - * Calls a FileMaker script by name with an explicit concurrency option. - * - * Behaves identically to `PerformScript` when `option` is `"0"` (pause - * current script). - * - * @param script - Name of the FileMaker script to execute. - * @param parameter - Optional string parameter for the script. - * @param option - How to handle any currently running script. - * See {@link ScriptOption} for the full table. - * - * @example - * // Run concurrently without disturbing existing scripts - * FileMaker.PerformScriptWithOption("Sync Data", "", "3"); - */ - PerformScriptWithOption(script: string, parameter?: string, option?: ScriptOption): void -} - -// --------------------------------------------------------------------------- -// Global augmentation -// --------------------------------------------------------------------------- - -declare global { - /** - * Global `FileMaker` object injected by the FileMaker runtime. - * - * May be `undefined` when the page is loaded outside of a FileMaker web - * viewer (e.g. in a regular browser during development). - * - * Always guard access with a runtime check: - * ```ts - * if (typeof FileMaker !== "undefined") { - * FileMaker.PerformScript("My Script"); - * } - * ``` - */ - const FileMaker: FileMakerAPI | undefined -} diff --git a/src/utils/webviewer.ts b/src/utils/webviewer.ts index ac3396c..7c45d35 100644 --- a/src/utils/webviewer.ts +++ b/src/utils/webviewer.ts @@ -1,3 +1,18 @@ +// --------------------------------------------------------------------------- +// FileMaker global API +// --------------------------------------------------------------------------- + +/** The FileMaker object injected by the runtime into web viewers. */ +export interface FileMakerAPI { + PerformScript(script: string, parameter?: string): void + PerformScriptWithOption(script: string, parameter?: string, option?: ScriptOption): void +} + +declare global { + /** Available only inside a FileMaker web viewer. Always guard with `typeof FileMaker !== 'undefined'`. */ + const FileMaker: FileMakerAPI | undefined +} + // --------------------------------------------------------------------------- // Script execution options // --------------------------------------------------------------------------- diff --git a/vite.config.ts b/vite.config.ts index c0b4cc8..2f36c18 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ plugins: [ tailwindcss(), vue(), - dts({ tsconfigPath: './tsconfig.build.json', insertTypesEntry: true }), + dts({ tsconfigPath: './tsconfig.build.json', insertTypesEntry: true, copyDtsFiles: true }), ], test: { environment: 'jsdom',